diff --git a/.hgtags b/.hgtags index 843dc9ea972..d063220672f 100644 --- a/.hgtags +++ b/.hgtags @@ -222,3 +222,6 @@ ea73f01b9053e7165e7ba80f242bafecbc6af712 jdk8-b96 711eb4aa87de68de78250e0549980936bab53d54 jdk8-b98 2d3875b0d18b3ad1c2bebf385a697e309e4005a4 jdk8-b99 3d34036aae4ea90b2ca59712d5a69db3221f0875 jdk8-b100 +edb01c460d4cab21ff0ff13512df7b746efaa0e7 jdk8-b101 +bbe43d712fe08e650808d774861b256ccb34e500 jdk8-b102 +30a1d677a20c6a95f98043d8f20ce570304e3818 jdk8-b103 diff --git a/.hgtags-top-repo b/.hgtags-top-repo index a19c8745350..456aa0fa60e 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -222,3 +222,6 @@ a1c1e8bf71f354f3aec0214cf13d6668811e021d jdk8-b97 0d0c983a817bbe8518a5ff201306334a8de267f2 jdk8-b98 59dc9da813794c924a0383c2a6241af94defdfed jdk8-b99 d2dcb110e9dbaf9903c05b211df800e78e4b394e jdk8-b100 +9f74a220677dc265a724515d8e2617548cef62f1 jdk8-b101 +5eb3c1dc348f72a7f84f7d9d07834e8bbe09a799 jdk8-b102 +b7e64be81c8a7690703df5711f4fc2375da8a9cb jdk8-b103 diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 1f084da68c9..0e4c4d9194c 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.68 for OpenJDK jdk8. +# Generated by GNU Autoconf 2.67 for OpenJDK jdk8. # # Report bugs to . # @@ -91,7 +91,6 @@ 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 @@ -217,18 +216,11 @@ 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 - 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+"$@"} + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -689,6 +681,7 @@ STATIC_LIBRARY SHARED_LIBRARY OBJ_SUFFIX COMPILER_NAME +TARGET_BITS_FLAG JT_HOME JTREGEXE LIPO @@ -1469,7 +1462,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 @@ -1905,7 +1898,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF OpenJDK configure jdk8 -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1951,7 +1944,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1989,7 +1982,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile @@ -2027,7 +2020,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_objc_try_compile @@ -2064,7 +2057,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -2101,7 +2094,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp @@ -2114,10 +2107,10 @@ fi ac_fn_cxx_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -2184,7 +2177,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 \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -2193,7 +2186,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; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_cxx_check_header_mongrel @@ -2234,7 +2227,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_try_run @@ -2248,7 +2241,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 \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2266,7 +2259,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; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_cxx_check_header_compile @@ -2443,7 +2436,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f conftest.val fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_compute_int @@ -2489,7 +2482,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; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_try_link @@ -2502,7 +2495,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 \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2557,7 +2550,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; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_cxx_check_func @@ -2570,7 +2563,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 \${$3+:} false; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2588,7 +2581,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; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile cat >config.log <<_ACEOF @@ -2596,7 +2589,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.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2854,7 +2847,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 @@ -3794,7 +3787,7 @@ fi #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1373384053 +DATE_WHEN_GENERATED=1376579640 ############################################################################### # @@ -3832,7 +3825,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 ${ac_cv_path_BASENAME+:} false; then : +if test "${ac_cv_path_BASENAME+set}" = set; then : $as_echo_n "(cached) " >&6 else case $BASENAME in @@ -3891,7 +3884,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 ${ac_cv_path_BASH+:} false; then : +if test "${ac_cv_path_BASH+set}" = set; then : $as_echo_n "(cached) " >&6 else case $BASH in @@ -3950,7 +3943,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 ${ac_cv_path_CAT+:} false; then : +if test "${ac_cv_path_CAT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CAT in @@ -4009,7 +4002,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 ${ac_cv_path_CHMOD+:} false; then : +if test "${ac_cv_path_CHMOD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CHMOD in @@ -4068,7 +4061,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 ${ac_cv_path_CMP+:} false; then : +if test "${ac_cv_path_CMP+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CMP in @@ -4127,7 +4120,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 ${ac_cv_path_COMM+:} false; then : +if test "${ac_cv_path_COMM+set}" = set; then : $as_echo_n "(cached) " >&6 else case $COMM in @@ -4186,7 +4179,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 ${ac_cv_path_CP+:} false; then : +if test "${ac_cv_path_CP+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CP in @@ -4245,7 +4238,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 ${ac_cv_path_CPIO+:} false; then : +if test "${ac_cv_path_CPIO+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CPIO in @@ -4304,7 +4297,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 ${ac_cv_path_CUT+:} false; then : +if test "${ac_cv_path_CUT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CUT in @@ -4363,7 +4356,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 ${ac_cv_path_DATE+:} false; then : +if test "${ac_cv_path_DATE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $DATE in @@ -4422,7 +4415,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 ${ac_cv_path_DIFF+:} false; then : +if test "${ac_cv_path_DIFF+set}" = set; then : $as_echo_n "(cached) " >&6 else case $DIFF in @@ -4481,7 +4474,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 ${ac_cv_path_DIRNAME+:} false; then : +if test "${ac_cv_path_DIRNAME+set}" = set; then : $as_echo_n "(cached) " >&6 else case $DIRNAME in @@ -4540,7 +4533,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 ${ac_cv_path_ECHO+:} false; then : +if test "${ac_cv_path_ECHO+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ECHO in @@ -4599,7 +4592,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 ${ac_cv_path_EXPR+:} false; then : +if test "${ac_cv_path_EXPR+set}" = set; then : $as_echo_n "(cached) " >&6 else case $EXPR in @@ -4658,7 +4651,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 ${ac_cv_path_FILE+:} false; then : +if test "${ac_cv_path_FILE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $FILE in @@ -4717,7 +4710,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 ${ac_cv_path_FIND+:} false; then : +if test "${ac_cv_path_FIND+set}" = set; then : $as_echo_n "(cached) " >&6 else case $FIND in @@ -4776,7 +4769,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 ${ac_cv_path_HEAD+:} false; then : +if test "${ac_cv_path_HEAD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $HEAD in @@ -4835,7 +4828,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 ${ac_cv_path_LN+:} false; then : +if test "${ac_cv_path_LN+set}" = set; then : $as_echo_n "(cached) " >&6 else case $LN in @@ -4894,7 +4887,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 ${ac_cv_path_LS+:} false; then : +if test "${ac_cv_path_LS+set}" = set; then : $as_echo_n "(cached) " >&6 else case $LS in @@ -4953,7 +4946,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 ${ac_cv_path_MKDIR+:} false; then : +if test "${ac_cv_path_MKDIR+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MKDIR in @@ -5012,7 +5005,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 ${ac_cv_path_MKTEMP+:} false; then : +if test "${ac_cv_path_MKTEMP+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MKTEMP in @@ -5071,7 +5064,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 ${ac_cv_path_MV+:} false; then : +if test "${ac_cv_path_MV+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MV in @@ -5130,7 +5123,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 ${ac_cv_path_PRINTF+:} false; then : +if test "${ac_cv_path_PRINTF+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PRINTF in @@ -5189,7 +5182,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 ${ac_cv_path_RM+:} false; then : +if test "${ac_cv_path_RM+set}" = set; then : $as_echo_n "(cached) " >&6 else case $RM in @@ -5248,7 +5241,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 ${ac_cv_path_SH+:} false; then : +if test "${ac_cv_path_SH+set}" = set; then : $as_echo_n "(cached) " >&6 else case $SH in @@ -5307,7 +5300,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 ${ac_cv_path_SORT+:} false; then : +if test "${ac_cv_path_SORT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $SORT in @@ -5366,7 +5359,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 ${ac_cv_path_TAIL+:} false; then : +if test "${ac_cv_path_TAIL+set}" = set; then : $as_echo_n "(cached) " >&6 else case $TAIL in @@ -5425,7 +5418,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 ${ac_cv_path_TAR+:} false; then : +if test "${ac_cv_path_TAR+set}" = set; then : $as_echo_n "(cached) " >&6 else case $TAR in @@ -5484,7 +5477,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 ${ac_cv_path_TEE+:} false; then : +if test "${ac_cv_path_TEE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $TEE in @@ -5543,7 +5536,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 ${ac_cv_path_TOUCH+:} false; then : +if test "${ac_cv_path_TOUCH+set}" = set; then : $as_echo_n "(cached) " >&6 else case $TOUCH in @@ -5602,7 +5595,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 ${ac_cv_path_TR+:} false; then : +if test "${ac_cv_path_TR+set}" = set; then : $as_echo_n "(cached) " >&6 else case $TR in @@ -5661,7 +5654,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 ${ac_cv_path_UNAME+:} false; then : +if test "${ac_cv_path_UNAME+set}" = set; then : $as_echo_n "(cached) " >&6 else case $UNAME in @@ -5720,7 +5713,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 ${ac_cv_path_UNIQ+:} false; then : +if test "${ac_cv_path_UNIQ+set}" = set; then : $as_echo_n "(cached) " >&6 else case $UNIQ in @@ -5779,7 +5772,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 ${ac_cv_path_WC+:} false; then : +if test "${ac_cv_path_WC+set}" = set; then : $as_echo_n "(cached) " >&6 else case $WC in @@ -5838,7 +5831,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 ${ac_cv_path_WHICH+:} false; then : +if test "${ac_cv_path_WHICH+set}" = set; then : $as_echo_n "(cached) " >&6 else case $WHICH in @@ -5897,7 +5890,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 ${ac_cv_path_XARGS+:} false; then : +if test "${ac_cv_path_XARGS+set}" = set; then : $as_echo_n "(cached) " >&6 else case $XARGS in @@ -5957,7 +5950,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 ${ac_cv_prog_AWK+:} false; then : +if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -6007,7 +6000,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 ${ac_cv_path_GREP+:} false; then : +if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -6082,7 +6075,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 ${ac_cv_path_EGREP+:} false; then : +if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -6161,7 +6154,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 ${ac_cv_path_FGREP+:} false; then : +if test "${ac_cv_path_FGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 @@ -6240,7 +6233,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 ${ac_cv_path_SED+:} false; then : +if test "${ac_cv_path_SED+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ @@ -6326,7 +6319,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 ${ac_cv_path_NAWK+:} false; then : +if test "${ac_cv_path_NAWK+set}" = set; then : $as_echo_n "(cached) " >&6 else case $NAWK in @@ -6390,7 +6383,7 @@ THEPWDCMD=pwd 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 ${ac_cv_path_CYGPATH+:} false; then : +if test "${ac_cv_path_CYGPATH+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CYGPATH in @@ -6430,7 +6423,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 ${ac_cv_path_READLINK+:} false; then : +if test "${ac_cv_path_READLINK+set}" = set; then : $as_echo_n "(cached) " >&6 else case $READLINK in @@ -6470,7 +6463,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 ${ac_cv_path_DF+:} false; then : +if test "${ac_cv_path_DF+set}" = set; then : $as_echo_n "(cached) " >&6 else case $DF in @@ -6510,7 +6503,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 ${ac_cv_path_SETFILE+:} false; then : +if test "${ac_cv_path_SETFILE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $SETFILE in @@ -6556,7 +6549,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 ${ac_cv_build+:} false; then : +if test "${ac_cv_build+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias @@ -6572,7 +6565,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='-' @@ -6590,7 +6583,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 ${ac_cv_host+:} false; then : +if test "${ac_cv_host+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then @@ -6605,7 +6598,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='-' @@ -6623,7 +6616,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 ${ac_cv_target+:} false; then : +if test "${ac_cv_target+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then @@ -6638,7 +6631,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='-' @@ -8164,7 +8157,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 ${ac_cv_prog_PKGHANDLER+:} false; then : +if test "${ac_cv_prog_PKGHANDLER+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$PKGHANDLER"; then @@ -8529,7 +8522,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 ${ac_cv_path_CHECK_GMAKE+:} false; then : +if test "${ac_cv_path_CHECK_GMAKE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CHECK_GMAKE in @@ -8883,7 +8876,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 ${ac_cv_path_CHECK_MAKE+:} false; then : +if test "${ac_cv_path_CHECK_MAKE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CHECK_MAKE in @@ -9242,7 +9235,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 ${ac_cv_path_CHECK_TOOLSDIR_GMAKE+:} false; then : +if test "${ac_cv_path_CHECK_TOOLSDIR_GMAKE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CHECK_TOOLSDIR_GMAKE in @@ -9595,7 +9588,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 ${ac_cv_path_CHECK_TOOLSDIR_MAKE+:} false; then : +if test "${ac_cv_path_CHECK_TOOLSDIR_MAKE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CHECK_TOOLSDIR_MAKE in @@ -9991,7 +9984,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 ${ac_cv_path_UNZIP+:} false; then : +if test "${ac_cv_path_UNZIP+set}" = set; then : $as_echo_n "(cached) " >&6 else case $UNZIP in @@ -10050,7 +10043,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 ${ac_cv_path_ZIP+:} false; then : +if test "${ac_cv_path_ZIP+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ZIP in @@ -10109,7 +10102,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 ${ac_cv_path_LDD+:} false; then : +if test "${ac_cv_path_LDD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $LDD in @@ -10155,7 +10148,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 ${ac_cv_path_OTOOL+:} false; then : +if test "${ac_cv_path_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else case $OTOOL in @@ -10200,7 +10193,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 ${ac_cv_path_READELF+:} false; then : +if test "${ac_cv_path_READELF+set}" = set; then : $as_echo_n "(cached) " >&6 else case $READELF in @@ -10243,7 +10236,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 ${ac_cv_path_HG+:} false; then : +if test "${ac_cv_path_HG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $HG in @@ -10283,7 +10276,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 ${ac_cv_path_STAT+:} false; then : +if test "${ac_cv_path_STAT+set}" = set; then : $as_echo_n "(cached) " >&6 else case $STAT in @@ -10323,7 +10316,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 ${ac_cv_path_TIME+:} false; then : +if test "${ac_cv_path_TIME+set}" = set; then : $as_echo_n "(cached) " >&6 else case $TIME in @@ -10376,7 +10369,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 ${ac_cv_path_COMM+:} false; then : +if test "${ac_cv_path_COMM+set}" = set; then : $as_echo_n "(cached) " >&6 else case $COMM in @@ -10438,7 +10431,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 ${ac_cv_path_XATTR+:} false; then : +if test "${ac_cv_path_XATTR+set}" = set; then : $as_echo_n "(cached) " >&6 else case $XATTR in @@ -10494,7 +10487,7 @@ $as_echo "$as_me: Could not find $PROG_NAME!" >&6;} set dummy codesign; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CODESIGN+:} false; then : +if test "${ac_cv_path_CODESIGN+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CODESIGN in @@ -10558,7 +10551,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 ${ac_cv_path_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -10601,7 +10594,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 ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in @@ -10774,7 +10767,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 ${ac_cv_prog_BDEPS_UNZIP+:} false; then : +if test "${ac_cv_prog_BDEPS_UNZIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$BDEPS_UNZIP"; then @@ -10820,7 +10813,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 ${ac_cv_prog_BDEPS_FTP+:} false; then : +if test "${ac_cv_prog_BDEPS_FTP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$BDEPS_FTP"; then @@ -12116,7 +12109,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 ${ac_cv_path_JAVAC_CHECK+:} false; then : +if test "${ac_cv_path_JAVAC_CHECK+set}" = set; then : $as_echo_n "(cached) " >&6 else case $JAVAC_CHECK in @@ -12156,7 +12149,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 ${ac_cv_path_JAVA_CHECK+:} false; then : +if test "${ac_cv_path_JAVA_CHECK+set}" = set; then : $as_echo_n "(cached) " >&6 else case $JAVA_CHECK in @@ -16485,7 +16478,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 ${ac_cv_path_JTREGEXE+:} false; then : +if test "${ac_cv_path_JTREGEXE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $JTREGEXE in @@ -16553,7 +16546,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 ${ac_cv_path_CYGWIN_LINK+:} false; then : +if test "${ac_cv_path_CYGWIN_LINK+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CYGWIN_LINK in @@ -17996,7 +17989,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 ${ac_cv_path_BUILD_CC+:} false; then : +if test "${ac_cv_path_BUILD_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else case $BUILD_CC in @@ -18307,7 +18300,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 ${ac_cv_path_BUILD_CXX+:} false; then : +if test "${ac_cv_path_BUILD_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $BUILD_CXX in @@ -18616,7 +18609,7 @@ $as_echo "$as_me: Rewriting BUILD_CXX to \"$new_complete\"" >&6;} 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 ${ac_cv_path_BUILD_LD+:} false; then : +if test "${ac_cv_path_BUILD_LD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $BUILD_LD in @@ -19123,7 +19116,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 ${ac_cv_path_TOOLS_DIR_CC+:} false; then : +if test "${ac_cv_path_TOOLS_DIR_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else case $TOOLS_DIR_CC in @@ -19175,7 +19168,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 ${ac_cv_path_POTENTIAL_CC+:} false; then : +if test "${ac_cv_path_POTENTIAL_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else case $POTENTIAL_CC in @@ -19588,7 +19581,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 ${ac_cv_prog_PROPER_COMPILER_CC+:} false; then : +if test "${ac_cv_prog_PROPER_COMPILER_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$PROPER_COMPILER_CC"; then @@ -19632,7 +19625,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 ${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_PROPER_COMPILER_CC"; then @@ -20082,7 +20075,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 ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -20126,7 +20119,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 ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -20179,7 +20172,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 @@ -20294,7 +20287,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; } @@ -20337,7 +20330,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 @@ -20396,7 +20389,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 @@ -20407,7 +20400,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 ${ac_cv_objext+:} false; then : +if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20448,7 +20441,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 @@ -20458,7 +20451,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 ${ac_cv_c_compiler_gnu+:} false; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20495,7 +20488,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 ${ac_cv_prog_cc_g+:} false; then : +if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -20573,7 +20566,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 ${ac_cv_prog_cc_c89+:} false; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -20696,7 +20689,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 ${ac_cv_path_TOOLS_DIR_CXX+:} false; then : +if test "${ac_cv_path_TOOLS_DIR_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $TOOLS_DIR_CXX in @@ -20748,7 +20741,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 ${ac_cv_path_POTENTIAL_CXX+:} false; then : +if test "${ac_cv_path_POTENTIAL_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else case $POTENTIAL_CXX in @@ -21161,7 +21154,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 ${ac_cv_prog_PROPER_COMPILER_CXX+:} false; then : +if test "${ac_cv_prog_PROPER_COMPILER_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$PROPER_COMPILER_CXX"; then @@ -21205,7 +21198,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 ${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+:} false; then : +if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_PROPER_COMPILER_CXX"; then @@ -21659,7 +21652,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 ${ac_cv_prog_CXX+:} false; then : +if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -21703,7 +21696,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 ${ac_cv_prog_ac_ct_CXX+:} false; then : +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -21781,7 +21774,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 ${ac_cv_cxx_compiler_gnu+:} false; then : +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21818,7 +21811,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 ${ac_cv_prog_cxx_g+:} false; then : +if test "${ac_cv_prog_cxx_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -21916,7 +21909,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 ${ac_cv_prog_OBJC+:} false; then : +if test "${ac_cv_prog_OBJC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJC"; then @@ -21960,7 +21953,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 ${ac_cv_prog_ac_ct_OBJC+:} false; then : +if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJC"; then @@ -22036,7 +22029,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 ${ac_cv_objc_compiler_gnu+:} false; then : +if test "${ac_cv_objc_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -22073,7 +22066,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 ${ac_cv_prog_objc_g+:} false; then : +if test "${ac_cv_prog_objc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_objc_werror_flag=$ac_objc_werror_flag @@ -22449,7 +22442,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 ${ac_cv_prog_AR+:} false; then : +if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -22489,7 +22482,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 ${ac_cv_prog_ac_ct_AR+:} false; then : +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then @@ -22831,7 +22824,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 ${ac_cv_prog_WINLD+:} false; then : +if test "${ac_cv_prog_WINLD+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$WINLD"; then @@ -23170,7 +23163,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 ${ac_cv_prog_MT+:} false; then : +if test "${ac_cv_prog_MT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$MT"; then @@ -23491,7 +23484,7 @@ $as_echo "$as_me: Rewriting MT to \"$new_complete\"" >&6;} 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 ${ac_cv_prog_RC+:} false; then : +if test "${ac_cv_prog_RC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RC"; then @@ -23883,7 +23876,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 ${ac_cv_prog_WINAR+:} false; then : +if test "${ac_cv_prog_WINAR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$WINAR"; then @@ -24189,7 +24182,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 ${ac_cv_prog_DUMPBIN+:} false; then : +if test "${ac_cv_prog_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then @@ -24508,7 +24501,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : + if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -24624,7 +24617,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 @@ -24908,7 +24901,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 ${ac_cv_prog_CXXCPP+:} false; then : + if test "${ac_cv_prog_CXXCPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded @@ -25024,7 +25017,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 @@ -25326,7 +25319,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 ${ac_cv_path_AS+:} false; then : +if test "${ac_cv_path_AS+set}" = set; then : $as_echo_n "(cached) " >&6 else case $AS in @@ -25638,7 +25631,7 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris; 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 ${ac_cv_path_NM+:} false; then : +if test "${ac_cv_path_NM+set}" = set; then : $as_echo_n "(cached) " >&6 else case $NM in @@ -25944,7 +25937,7 @@ $as_echo "$as_me: Rewriting NM to \"$new_complete\"" >&6;} set dummy gnm; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_GNM+:} false; then : +if test "${ac_cv_path_GNM+set}" = set; then : $as_echo_n "(cached) " >&6 else case $GNM in @@ -26250,7 +26243,7 @@ $as_echo "$as_me: Rewriting GNM to \"$new_complete\"" >&6;} 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 ${ac_cv_path_STRIP+:} false; then : +if test "${ac_cv_path_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else case $STRIP in @@ -26556,7 +26549,7 @@ $as_echo "$as_me: Rewriting STRIP to \"$new_complete\"" >&6;} 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 ${ac_cv_path_MCS+:} false; then : +if test "${ac_cv_path_MCS+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MCS in @@ -26864,7 +26857,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 ${ac_cv_prog_NM+:} false; then : +if test "${ac_cv_prog_NM+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -26904,7 +26897,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 ${ac_cv_prog_ac_ct_NM+:} false; then : +if test "${ac_cv_prog_ac_ct_NM+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NM"; then @@ -27224,7 +27217,7 @@ $as_echo "$as_me: Rewriting NM to \"$new_complete\"" >&6;} 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 ${ac_cv_prog_STRIP+:} false; then : +if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -27264,7 +27257,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 ${ac_cv_prog_ac_ct_STRIP+:} false; then : +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -27589,7 +27582,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 ${ac_cv_prog_OBJCOPY+:} false; then : +if test "${ac_cv_prog_OBJCOPY+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJCOPY"; then @@ -27633,7 +27626,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 ${ac_cv_prog_ac_ct_OBJCOPY+:} false; then : +if test "${ac_cv_prog_ac_ct_OBJCOPY+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJCOPY"; then @@ -27960,7 +27953,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 ${ac_cv_prog_OBJDUMP+:} false; then : +if test "${ac_cv_prog_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then @@ -28004,7 +27997,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 ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then @@ -28328,7 +28321,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 ${ac_cv_path_LIPO+:} false; then : +if test "${ac_cv_path_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else case $LIPO in @@ -28645,7 +28638,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 ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -28785,17 +28778,16 @@ if test "x$OPENJDK_TARGET_OS" = xsolaris; then # keep track of c/cxx flags that we added outselves... # to prevent emitting warning... - ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" - ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" - ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" + TARGET_BITS_FLAG="-m${OPENJDK_TARGET_CPU_BITS}" - CFLAGS="${CFLAGS}${ADDED_CFLAGS}" - CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" - LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" - CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" - CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" - LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" + CFLAGS="${CFLAGS} ${TARGET_BITS_FLAG}" + CXXFLAGS="${CXXFLAGS} ${TARGET_BITS_FLAG}" + LDFLAGS="${LDFLAGS} ${TARGET_BITS_FLAG}" + + CFLAGS_JDK="${CFLAGS_JDK} ${TARGET_BITS_FLAG}" + CXXFLAGS_JDK="${CXXFLAGS_JDK} ${TARGET_BITS_FLAG}" + LDFLAGS_JDK="${LDFLAGS_JDK} ${TARGET_BITS_FLAG}" elif test "x$COMPILE_TYPE" = xreduced; then if test "x$OPENJDK_TARGET_OS" != xwindows; then @@ -28803,17 +28795,16 @@ elif test "x$COMPILE_TYPE" = xreduced; then # keep track of c/cxx flags that we added outselves... # to prevent emitting warning... - ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" - ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" - ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" + TARGET_BITS_FLAG="-m${OPENJDK_TARGET_CPU_BITS}" - CFLAGS="${CFLAGS}${ADDED_CFLAGS}" - CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" - LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" - CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" - CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" - LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" + CFLAGS="${CFLAGS} ${TARGET_BITS_FLAG}" + CXXFLAGS="${CXXFLAGS} ${TARGET_BITS_FLAG}" + LDFLAGS="${LDFLAGS} ${TARGET_BITS_FLAG}" + + CFLAGS_JDK="${CFLAGS_JDK} ${TARGET_BITS_FLAG}" + CXXFLAGS_JDK="${CXXFLAGS_JDK} ${TARGET_BITS_FLAG}" + LDFLAGS_JDK="${LDFLAGS_JDK} ${TARGET_BITS_FLAG}" fi fi @@ -28822,7 +28813,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" = xyes; then : +if test "x$ac_cv_header_stdio_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDIO_H 1 _ACEOF @@ -28851,7 +28842,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 ${ac_cv_sizeof_int_p+:} false; then : +if test "${ac_cv_sizeof_int_p+set}" = set; 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 : @@ -28861,7 +28852,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 @@ -28908,7 +28899,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 ${ac_cv_c_bigendian+:} false; then : +if test "${ac_cv_c_bigendian+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -30084,8 +30075,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 ${ac_cv_have_x+:} false; then : + *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #( + *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then : $as_echo_n "(cached) " >&6 else # One or both of the vars are not set, and there is no cached value. @@ -30362,7 +30353,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 ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : +if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30396,14 +30387,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" = xyes; then : +if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; 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 ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : +if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30437,7 +30428,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" = xyes; then : +if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = x""yes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi @@ -30456,14 +30447,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" = xyes; then : +if test "x$ac_cv_func_gethostbyname" = x""yes; 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 ${ac_cv_lib_nsl_gethostbyname+:} false; then : +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30497,14 +30488,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" = xyes; then : +if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; 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 ${ac_cv_lib_bsd_gethostbyname+:} false; then : +if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30538,7 +30529,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" = xyes; then : +if test "x$ac_cv_lib_bsd_gethostbyname" = x""yes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi @@ -30553,14 +30544,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" = xyes; then : +if test "x$ac_cv_func_connect" = x""yes; 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 ${ac_cv_lib_socket_connect+:} false; then : +if test "${ac_cv_lib_socket_connect+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30594,7 +30585,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" = xyes; then : +if test "x$ac_cv_lib_socket_connect" = x""yes; then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi @@ -30602,14 +30593,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" = xyes; then : +if test "x$ac_cv_func_remove" = x""yes; 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 ${ac_cv_lib_posix_remove+:} false; then : +if test "${ac_cv_lib_posix_remove+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30643,7 +30634,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" = xyes; then : +if test "x$ac_cv_lib_posix_remove" = x""yes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi @@ -30651,14 +30642,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" = xyes; then : +if test "x$ac_cv_func_shmat" = x""yes; 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 ${ac_cv_lib_ipc_shmat+:} false; then : +if test "${ac_cv_lib_ipc_shmat+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30692,7 +30683,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" = xyes; then : +if test "x$ac_cv_lib_ipc_shmat" = x""yes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi @@ -30710,7 +30701,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 ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : +if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -30744,7 +30735,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" = xyes; then : +if test "x$ac_cv_lib_ICE_IceConnectionNumber" = x""yes; then : X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi @@ -31762,7 +31753,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 ${ac_cv_lib_freetype_FT_Init_FreeType+:} false; then : +if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -31796,7 +31787,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" = xyes; then : +if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = x""yes; then : FREETYPE2_FOUND=true else as_fn_error $? "Could not find freetype2! $HELP_MSG " "$LINENO" 5 @@ -32084,7 +32075,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" = xyes; then : +if test "x$ac_cv_header_alsa_asoundlib_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ALSA_ASOUNDLIB_H 1 _ACEOF @@ -32143,7 +32134,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 ${ac_cv_lib_jpeg_main+:} false; then : +if test "${ac_cv_lib_jpeg_main+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -32171,7 +32162,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" = xyes; then : +if test "x$ac_cv_lib_jpeg_main" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBJPEG 1 _ACEOF @@ -32220,7 +32211,7 @@ if test "x${with_giflib}" = "xbundled"; then USE_EXTERNAL_LIBGIF=false elif test "x${with_giflib}" = "xsystem"; then ac_fn_cxx_check_header_mongrel "$LINENO" "gif_lib.h" "ac_cv_header_gif_lib_h" "$ac_includes_default" -if test "x$ac_cv_header_gif_lib_h" = xyes; then : +if test "x$ac_cv_header_gif_lib_h" = x""yes; then : else as_fn_error $? "--with-giflib=system specified, but gif_lib.h not found!" "$LINENO" 5 @@ -32229,7 +32220,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DGifGetCode in -lgif" >&5 $as_echo_n "checking for DGifGetCode in -lgif... " >&6; } -if ${ac_cv_lib_gif_DGifGetCode+:} false; then : +if test "${ac_cv_lib_gif_DGifGetCode+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -32263,7 +32254,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_DGifGetCode" >&5 $as_echo "$ac_cv_lib_gif_DGifGetCode" >&6; } -if test "x$ac_cv_lib_gif_DGifGetCode" = xyes; then : +if test "x$ac_cv_lib_gif_DGifGetCode" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGIF 1 _ACEOF @@ -32295,7 +32286,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 ${ac_cv_lib_z_compress+:} false; then : +if test "${ac_cv_lib_z_compress+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -32329,7 +32320,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" = xyes; then : +if test "x$ac_cv_lib_z_compress" = x""yes; then : ZLIB_FOUND=yes else ZLIB_FOUND=no @@ -32422,7 +32413,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 ${ac_cv_lib_m_cos+:} false; then : +if test "${ac_cv_lib_m_cos+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -32456,7 +32447,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" = xyes; then : +if test "x$ac_cv_lib_m_cos" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF @@ -32480,7 +32471,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 ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -32514,7 +32505,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" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -32744,7 +32735,7 @@ and LIBFFI_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else LIBFFI_CFLAGS=$pkg_cv_LIBFFI_CFLAGS LIBFFI_LIBS=$pkg_cv_LIBFFI_LIBS @@ -32760,7 +32751,7 @@ if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then set dummy llvm-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 ${ac_cv_prog_LLVM_CONFIG+:} false; then : +if test "${ac_cv_prog_LLVM_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$LLVM_CONFIG"; then @@ -33376,7 +33367,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 ${ac_cv_path_CCACHE+:} false; then : +if test "${ac_cv_path_CCACHE+set}" = set; then : $as_echo_n "(cached) " >&6 else case $CCACHE in @@ -33638,21 +33629,10 @@ $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 - if test "x$cache_file" != "x/dev/null"; then + test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - 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 + cat confcache >$cache_file 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;} @@ -33684,7 +33664,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" @@ -33785,7 +33765,6 @@ 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 @@ -34093,7 +34072,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.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -34156,7 +34135,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.68, +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -34285,7 +34264,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 @@ -34307,10 +34286,9 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= ac_tmp= + tmp= trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -34318,13 +34296,12 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + test -n "$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. @@ -34346,7 +34323,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF @@ -34374,7 +34351,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -34422,7 +34399,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && +cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -34454,7 +34431,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 < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -34488,7 +34465,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 >"$ac_tmp/defines.awk" <<\_ACAWK || +cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -34500,8 +34477,8 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -34602,7 +34579,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 @@ -34621,7 +34598,7 @@ do for ac_f do case $ac_f in - -) ac_f="$ac_tmp/stdin";; + -) ac_f="$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 `:'. @@ -34630,7 +34607,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'" @@ -34656,8 +34633,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -34782,22 +34759,21 @@ 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 "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +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 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { 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"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$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 "$ac_tmp/stdin" + rm -f "$tmp/stdin" case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -34808,20 +34784,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 "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$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 "$ac_tmp/config.h" "$ac_file" \ + mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 index 889b99ed727..ed2581c1005 100644 --- a/common/autoconf/platform.m4 +++ b/common/autoconf/platform.m4 @@ -412,17 +412,16 @@ AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], [ # keep track of c/cxx flags that we added outselves... # to prevent emitting warning... - ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" - ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" - ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" + TARGET_BITS_FLAG="-m${OPENJDK_TARGET_CPU_BITS}" + AC_SUBST(TARGET_BITS_FLAG) - CFLAGS="${CFLAGS}${ADDED_CFLAGS}" - CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" - LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" + CFLAGS="${CFLAGS} ${TARGET_BITS_FLAG}" + CXXFLAGS="${CXXFLAGS} ${TARGET_BITS_FLAG}" + LDFLAGS="${LDFLAGS} ${TARGET_BITS_FLAG}" - CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" - CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" - LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" + CFLAGS_JDK="${CFLAGS_JDK} ${TARGET_BITS_FLAG}" + CXXFLAGS_JDK="${CXXFLAGS_JDK} ${TARGET_BITS_FLAG}" + LDFLAGS_JDK="${LDFLAGS_JDK} ${TARGET_BITS_FLAG}" ]) AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index c30fd35dc18..d2ffb614bcc 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -304,6 +304,7 @@ MACOSX_VERSION_MIN=@MACOSX_VERSION_MIN@ COMPILER_TYPE:=@COMPILER_TYPE@ COMPILER_NAME:=@COMPILER_NAME@ +TARGET_BITS_FLAG=@TARGET_BITS_FLAG@ COMPILER_SUPPORTS_TARGET_BITS_FLAG=@COMPILER_SUPPORTS_TARGET_BITS_FLAG@ CC_OUT_OPTION:=@CC_OUT_OPTION@ diff --git a/common/makefiles/IdlCompilation.gmk b/common/makefiles/IdlCompilation.gmk index b03ea43a9e5..94cc15476ad 100644 --- a/common/makefiles/IdlCompilation.gmk +++ b/common/makefiles/IdlCompilation.gmk @@ -83,9 +83,6 @@ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NE $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk)) -# Remove any relative addressing in the paths. -$1_SRC := $$(abspath $$($1_SRC)) -$1_BIN := $$(abspath $$($1_BIN)) # Find all existing java files and existing class files. $$(eval $$(call MakeDir,$$($1_BIN))) $1_SRCS := $$(shell find $$($1_SRC) -name "*.idl") diff --git a/common/makefiles/Main.gmk b/common/makefiles/Main.gmk index 1214ce56427..dd99df2d526 100644 --- a/common/makefiles/Main.gmk +++ b/common/makefiles/Main.gmk @@ -204,7 +204,7 @@ clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jd # If the output directory was created by configure and now becomes empty, remove it as well. # FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh! dist-clean: clean - @($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp) + @($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers) @$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ;\ diff --git a/corba/.hgtags b/corba/.hgtags index 9acbd27447b..6aa967721af 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -222,3 +222,6 @@ c8286839d0df04aba819ec4bef12b86babccf30e jdk8-b90 3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98 3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99 8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100 +a013024b07475782f1fa8e196e950b34b4077663 jdk8-b101 +528c7e76eaeee022817ee085668459bc97cf5665 jdk8-b102 +49c4a777fdfd648d4c3fffc940fdb97a23108ca8 jdk8-b103 diff --git a/corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaInputStream.sjava b/corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaInputStream.sjava deleted file mode 100644 index 648ff3f4fb7..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaInputStream.sjava +++ /dev/null @@ -1,528 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.corba.se.impl.encoding; - -import java.io.IOException; -import java.io.Serializable; -import java.math.BigDecimal; -import java.nio.ByteBuffer; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; - -/** - * This is delegates to the real implementation. - * - * NOTE: - * - * Before using the stream for valuetype unmarshaling, one must call - * performORBVersionSpecificInit(). - */ -public abstract class CDRInputStream - extends org.omg.CORBA_2_3.portable.InputStream - implements com.sun.corba.se.impl.encoding.MarshalInputStream, - org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream -{ - protected CorbaMessageMediator messageMediator; - private CDRInputStreamBase impl; - - // We can move this out somewhere later. For now, it serves its purpose - // to create a concrete CDR delegate based on the GIOP version. - private static class InputStreamFactory { - - public static CDRInputStreamBase newInputStream(ORB orb, GIOPVersion version) - { - switch(version.intValue()) { - case GIOPVersion.VERSION_1_0: - return new CDRInputStream_1_0(); - case GIOPVersion.VERSION_1_1: - return new CDRInputStream_1_1(); - case GIOPVersion.VERSION_1_2: - return new CDRInputStream_1_2(); - default: - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_ENCODING ) ; - throw wrapper.unsupportedGiopVersion( version ) ; - } - } - } - - // Required for the case when a ClientResponseImpl is - // created with a SystemException due to a dead server/closed - // connection with no warning. Note that the stream will - // not be initialized in this case. - // - // Probably also required by ServerRequestImpl. - // - // REVISIT. - public CDRInputStream() { - } - - public CDRInputStream(CDRInputStream is) { - impl = is.impl.dup(); - impl.setParent(this); - } - - public CDRInputStream(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int size, - boolean littleEndian, - GIOPVersion version, - BufferManagerRead bufMgr) - { - impl = InputStreamFactory.newInputStream( (ORB)orb, version); - - impl.init(orb, byteBuffer, size, littleEndian, bufMgr); - - impl.setParent(this); - } - - // org.omg.CORBA.portable.InputStream - public final boolean read_boolean() { - return impl.read_boolean(); - } - - public final char read_char() { - return impl.read_char(); - } - - public final char read_wchar() { - return impl.read_wchar(); - } - - public final byte read_octet() { - return impl.read_octet(); - } - - public final short read_short() { - return impl.read_short(); - } - - public final short read_ushort() { - return impl.read_ushort(); - } - - public final int read_long() { - return impl.read_long(); - } - - public final int read_ulong() { - return impl.read_ulong(); - } - - public final long read_longlong() { - return impl.read_longlong(); - } - - public final long read_ulonglong() { - return impl.read_ulonglong(); - } - - public final float read_float() { - return impl.read_float(); - } - - public final double read_double() { - return impl.read_double(); - } - - public final String read_string() { - return impl.read_string(); - } - - public final String read_wstring() { - return impl.read_wstring(); - } - - public final void read_boolean_array(boolean[] value, int offset, int length) { - impl.read_boolean_array(value, offset, length); - } - - public final void read_char_array(char[] value, int offset, int length) { - impl.read_char_array(value, offset, length); - } - - public final void read_wchar_array(char[] value, int offset, int length) { - impl.read_wchar_array(value, offset, length); - } - - public final void read_octet_array(byte[] value, int offset, int length) { - impl.read_octet_array(value, offset, length); - } - - public final void read_short_array(short[] value, int offset, int length) { - impl.read_short_array(value, offset, length); - } - - public final void read_ushort_array(short[] value, int offset, int length) { - impl.read_ushort_array(value, offset, length); - } - - public final void read_long_array(int[] value, int offset, int length) { - impl.read_long_array(value, offset, length); - } - - public final void read_ulong_array(int[] value, int offset, int length) { - impl.read_ulong_array(value, offset, length); - } - - public final void read_longlong_array(long[] value, int offset, int length) { - impl.read_longlong_array(value, offset, length); - } - - public final void read_ulonglong_array(long[] value, int offset, int length) { - impl.read_ulonglong_array(value, offset, length); - } - - public final void read_float_array(float[] value, int offset, int length) { - impl.read_float_array(value, offset, length); - } - - public final void read_double_array(double[] value, int offset, int length) { - impl.read_double_array(value, offset, length); - } - - public final org.omg.CORBA.Object read_Object() { - return impl.read_Object(); - } - - public final TypeCode read_TypeCode() { - return impl.read_TypeCode(); - } - public final Any read_any() { - return impl.read_any(); - } - - public final Principal read_Principal() { - return impl.read_Principal(); - } - - public final int read() throws java.io.IOException { - return impl.read(); - } - - public final java.math.BigDecimal read_fixed() { - return impl.read_fixed(); - } - - public final org.omg.CORBA.Context read_Context() { - return impl.read_Context(); - } - - public final org.omg.CORBA.Object read_Object(java.lang.Class clz) { - return impl.read_Object(clz); - } - - public final org.omg.CORBA.ORB orb() { - return impl.orb(); - } - - // org.omg.CORBA_2_3.portable.InputStream - public final java.io.Serializable read_value() { - return impl.read_value(); - } - - public final java.io.Serializable read_value(java.lang.Class clz) { - return impl.read_value(clz); - } - - public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) { - return impl.read_value(factory); - } - - public final java.io.Serializable read_value(java.lang.String rep_id) { - return impl.read_value(rep_id); - } - - public final java.io.Serializable read_value(java.io.Serializable value) { - return impl.read_value(value); - } - - public final java.lang.Object read_abstract_interface() { - return impl.read_abstract_interface(); - } - - public final java.lang.Object read_abstract_interface(java.lang.Class clz) { - return impl.read_abstract_interface(clz); - } - // com.sun.corba.se.impl.encoding.MarshalInputStream - - public final void consumeEndian() { - impl.consumeEndian(); - } - - public final int getPosition() { - return impl.getPosition(); - } - - // org.omg.CORBA.DataInputStream - - public final java.lang.Object read_Abstract () { - return impl.read_Abstract(); - } - - public final java.io.Serializable read_Value () { - return impl.read_Value(); - } - - public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) { - impl.read_any_array(seq, offset, length); - } - - public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { - impl.read_boolean_array(seq, offset, length); - } - - public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) { - impl.read_char_array(seq, offset, length); - } - - public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { - impl.read_wchar_array(seq, offset, length); - } - - public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { - impl.read_octet_array(seq, offset, length); - } - - public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { - impl.read_short_array(seq, offset, length); - } - - public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { - impl.read_ushort_array(seq, offset, length); - } - - public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) { - impl.read_long_array(seq, offset, length); - } - - public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { - impl.read_ulong_array(seq, offset, length); - } - - public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { - impl.read_ulonglong_array(seq, offset, length); - } - - public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { - impl.read_longlong_array(seq, offset, length); - } - - public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { - impl.read_float_array(seq, offset, length); - } - - public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { - impl.read_double_array(seq, offset, length); - } - - // org.omg.CORBA.portable.ValueBase - public final String[] _truncatable_ids() { - return impl._truncatable_ids(); - } - - // java.io.InputStream - public final int read(byte b[]) throws IOException { - return impl.read(b); - } - - public final int read(byte b[], int off, int len) throws IOException { - return impl.read(b, off, len); - } - - public final long skip(long n) throws IOException { - return impl.skip(n); - } - - public final int available() throws IOException { - return impl.available(); - } - - public final void close() throws IOException { - impl.close(); - } - - public final void mark(int readlimit) { - impl.mark(readlimit); - } - - public final void reset() { - impl.reset(); - } - - public final boolean markSupported() { - return impl.markSupported(); - } - - public abstract CDRInputStream dup(); - - // Needed by TCUtility - public final java.math.BigDecimal read_fixed(short digits, short scale) { - return impl.read_fixed(digits, scale); - } - - public final boolean isLittleEndian() { - return impl.isLittleEndian(); - } - - protected final ByteBuffer getByteBuffer() { - return impl.getByteBuffer(); - } - - protected final void setByteBuffer(ByteBuffer byteBuffer) { - impl.setByteBuffer(byteBuffer); - } - - protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { - impl.setByteBufferWithInfo(bbwi); - } - - public final int getBufferLength() { - return impl.getBufferLength(); - } - - protected final void setBufferLength(int value) { - impl.setBufferLength(value); - } - - protected final int getIndex() { - return impl.getIndex(); - } - - protected final void setIndex(int value) { - impl.setIndex(value); - } - - public final void orb(org.omg.CORBA.ORB orb) { - impl.orb(orb); - } - - public final GIOPVersion getGIOPVersion() { - return impl.getGIOPVersion(); - } - - public final BufferManagerRead getBufferManager() { - return impl.getBufferManager(); - } - - // This should be overridden by any stream (ex: IIOPInputStream) - // which wants to read values. Thus, TypeCodeInputStream doesn't - // have to do this. - public CodeBase getCodeBase() { - return null; - } - - // Use Latin-1 for GIOP 1.0 or when code set negotiation was not - // performed. - protected CodeSetConversion.BTCConverter createCharBTCConverter() { - return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1, - impl.isLittleEndian()); - } - - // Subclasses must decide what to do here. It's inconvenient to - // make the class and this method abstract because of dup(). - protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter(); - - // Prints the current buffer in a human readable form - void printBuffer() { - impl.printBuffer(); - } - - /** - * Aligns the current position on the given octet boundary - * if there are enough bytes available to do so. Otherwise, - * it just returns. This is used for some (but not all) - * GIOP 1.2 message headers. - */ - public void alignOnBoundary(int octetBoundary) { - impl.alignOnBoundary(octetBoundary); - } - - // Needed by request and reply messages for GIOP versions >= 1.2 only. - public void setHeaderPadding(boolean headerPadding) { - impl.setHeaderPadding(headerPadding); - } - - /** - * This must be called after determining the proper ORB version, - * and setting it on the stream's ORB instance. It can be called - * after reading the service contexts, since that is the only place - * we can get the ORB version info. - * - * Trying to unmarshal things requiring repository IDs before calling - * this will result in NullPtrExceptions. - */ - public void performORBVersionSpecificInit() { - // In the case of SystemExceptions, a stream is created - // with its default constructor (and thus no impl is set). - if (impl != null) - impl.performORBVersionSpecificInit(); - } - - /** - * Resets any internal references to code set converters. - * This is useful for forcing the CDR stream to reacquire - * converters (probably from its subclasses) when state - * has changed. - */ - public void resetCodeSetConverters() { - impl.resetCodeSetConverters(); - } - - public void setMessageMediator(MessageMediator messageMediator) - { - this.messageMediator = (CorbaMessageMediator) messageMediator; - } - - public MessageMediator getMessageMediator() - { - return messageMediator; - } - - // ValueInputStream ----------------------------- - - public void start_value() { - impl.start_value(); - } - - public void end_value() { - impl.end_value(); - } -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaOutputStream.sjava b/corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaOutputStream.sjava deleted file mode 100644 index 240a28067da..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaOutputStream.sjava +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.corba.se.impl.encoding; - -import java.io.IOException; -import java.io.Serializable; -import java.math.BigDecimal; -import java.nio.ByteBuffer; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -/** - * This is delegates to the real implementation. - */ -public abstract class CDROutputStream - extends org.omg.CORBA_2_3.portable.OutputStream - implements com.sun.corba.se.impl.encoding.MarshalOutputStream, - org.omg.CORBA.DataOutputStream, org.omg.CORBA.portable.ValueOutputStream -{ -/* - private CDROutputStreamBase impl; - protected ORB orb ; - protected ORBUtilSystemException wrapper ; - protected CorbaMessageMediator corbaMessageMediator; - - - // We can move this out somewhere later. For now, it serves its purpose - // to create a concrete CDR delegate based on the GIOP version. - private static class OutputStreamFactory { - - public static CDROutputStreamBase newOutputStream(ORB orb, GIOPVersion version) - { - switch(version.intValue()) { - case GIOPVersion.VERSION_1_0: - return new CDROutputStream_1_0(); - case GIOPVersion.VERSION_1_1: - return new CDROutputStream_1_1(); - case GIOPVersion.VERSION_1_2: - return new CDROutputStream_1_2(); - default: - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_ENCODING ) ; - // REVISIT - what is appropriate? INTERNAL exceptions - // are really hard to track later. - throw wrapper.unsupportedGiopVersion( version ) ; - } - } - } - - // REVISIT - These two constructors should be re-factored to better hide - // the fact that someone extending this class 'can' construct a CDROutputStream - // that does not use pooled ByteBuffers. Right now, only EncapsOutputStream - // does _not_ use pooled ByteBuffers, see EncapsOutputStream. - - // NOTE: When a stream is constructed for non-channel-backed sockets - // it notifies the constructor not to use pooled (i.e, direct) - // ByteBuffers. - - public CDROutputStream(ORB orb, - GIOPVersion version, - boolean littleEndian, - BufferManagerWrite bufferManager, - byte streamFormatVersion, - boolean usePooledByteBuffers) - { - impl = OutputStreamFactory.newOutputStream(orb, version); - impl.init(orb, littleEndian, bufferManager, streamFormatVersion, usePooledByteBuffers); - - impl.setParent(this); - this.orb = orb ; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_ENCODING ) ; - } - - public CDROutputStream(ORB orb, - GIOPVersion version, - boolean littleEndian, - BufferManagerWrite bufferManager, - byte streamFormatVersion) - { - this(orb, version, littleEndian, bufferManager, streamFormatVersion, true); - } -*/ - - private ByteArrayOutputStream bos ; - private ObjectOutputStream oos ; - - public JavaOutputStream() - { - bos = new ByteArrayOutputStream() ; - oos = new ObjectOutputStream( bos ) ; - } - - // Provided by IIOPOutputStream and EncapsOutputStream - public org.omg.CORBA.portable.InputStream create_input_stream() - { - ObjectInputStream ois = new ByteArrayInputStream( bos.toByteArray() ) ; - - return new JavaInputStream( ois ) ; - } - - public final void write_boolean(boolean value) { - impl.write_boolean(value); - } - public final void write_char(char value) { - impl.write_char(value); - } - public final void write_wchar(char value) { - impl.write_wchar(value); - } - public final void write_octet(byte value) { - impl.write_octet(value); - } - public final void write_short(short value) { - impl.write_short(value); - } - public final void write_ushort(short value) { - impl.write_ushort(value); - } - public final void write_long(int value) { - impl.write_long(value); - } - public final void write_ulong(int value) { - impl.write_ulong(value); - } - public final void write_longlong(long value) { - impl.write_longlong(value); - } - public final void write_ulonglong(long value) { - impl.write_ulonglong(value); - } - public final void write_float(float value) { - impl.write_float(value); - } - public final void write_double(double value) { - impl.write_double(value); - } - public final void write_string(String value) { - impl.write_string(value); - } - public final void write_wstring(String value) { - impl.write_wstring(value); - } - - public final void write_boolean_array(boolean[] value, int offset, int length) { - impl.write_boolean_array(value, offset, length); - } - public final void write_char_array(char[] value, int offset, int length) { - impl.write_char_array(value, offset, length); - } - public final void write_wchar_array(char[] value, int offset, int length) { - impl.write_wchar_array(value, offset, length); - } - public final void write_octet_array(byte[] value, int offset, int length) { - impl.write_octet_array(value, offset, length); - } - public final void write_short_array(short[] value, int offset, int length) { - impl.write_short_array(value, offset, length); - } - public final void write_ushort_array(short[] value, int offset, int length){ - impl.write_ushort_array(value, offset, length); - } - public final void write_long_array(int[] value, int offset, int length) { - impl.write_long_array(value, offset, length); - } - public final void write_ulong_array(int[] value, int offset, int length) { - impl.write_ulong_array(value, offset, length); - } - public final void write_longlong_array(long[] value, int offset, int length) { - impl.write_longlong_array(value, offset, length); - } - public final void write_ulonglong_array(long[] value, int offset,int length) { - impl.write_ulonglong_array(value, offset, length); - } - public final void write_float_array(float[] value, int offset, int length) { - impl.write_float_array(value, offset, length); - } - public final void write_double_array(double[] value, int offset, int length) { - impl.write_double_array(value, offset, length); - } - public final void write_Object(org.omg.CORBA.Object value) { - impl.write_Object(value); - } - public final void write_TypeCode(TypeCode value) { - impl.write_TypeCode(value); - } - public final void write_any(Any value) { - impl.write_any(value); - } - - public final void write_Principal(Principal value) { - impl.write_Principal(value); - } - - public final void write(int b) throws java.io.IOException { - impl.write(b); - } - - public final void write_fixed(java.math.BigDecimal value) { - impl.write_fixed(value); - } - - public final void write_Context(org.omg.CORBA.Context ctx, - org.omg.CORBA.ContextList contexts) { - impl.write_Context(ctx, contexts); - } - - public final org.omg.CORBA.ORB orb() { - return impl.orb(); - } - - // org.omg.CORBA_2_3.portable.OutputStream - public final void write_value(java.io.Serializable value) { - impl.write_value(value); - } - - public final void write_value(java.io.Serializable value, java.lang.Class clz) { - impl.write_value(value, clz); - } - - public final void write_value(java.io.Serializable value, String repository_id) { - impl.write_value(value, repository_id); - } - - public final void write_value(java.io.Serializable value, - org.omg.CORBA.portable.BoxedValueHelper factory) { - impl.write_value(value, factory); - } - - public final void write_abstract_interface(java.lang.Object obj) { - impl.write_abstract_interface(obj); - } - - // java.io.OutputStream - public final void write(byte b[]) throws IOException { - impl.write(b); - } - - public final void write(byte b[], int off, int len) throws IOException { - impl.write(b, off, len); - } - - public final void flush() throws IOException { - impl.flush(); - } - - public final void close() throws IOException { - impl.close(); - } - - // com.sun.corba.se.impl.encoding.MarshalOutputStream - public final void start_block() { - impl.start_block(); - } - - public final void end_block() { - impl.end_block(); - } - - public final void putEndian() { - impl.putEndian(); - } - - public void writeTo(java.io.OutputStream s) - throws IOException - { - impl.writeTo(s); - } - - public final byte[] toByteArray() { - return impl.toByteArray(); - } - - // org.omg.CORBA.DataOutputStream - public final void write_Abstract (java.lang.Object value) { - impl.write_Abstract(value); - } - - public final void write_Value (java.io.Serializable value) { - impl.write_Value(value); - } - - public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) { - impl.write_any_array(seq, offset, length); - } - - public void setMessageMediator(MessageMediator messageMediator) - { - this.corbaMessageMediator = (CorbaMessageMediator) messageMediator; - } - - public MessageMediator getMessageMediator() - { - return corbaMessageMediator; - } - - // org.omg.CORBA.portable.ValueBase - public final String[] _truncatable_ids() { - return impl._truncatable_ids(); - } - - // Other - protected final int getSize() { - return impl.getSize(); - } - - protected final int getIndex() { - return impl.getIndex(); - } - - protected int getRealIndex(int index) { - // Used in indirections. Overridden by TypeCodeOutputStream. - return index; - } - - protected final void setIndex(int value) { - impl.setIndex(value); - } - - protected final ByteBuffer getByteBuffer() { - return impl.getByteBuffer(); - } - - protected final void setByteBuffer(ByteBuffer byteBuffer) { - impl.setByteBuffer(byteBuffer); - } - - public final boolean isLittleEndian() { - return impl.isLittleEndian(); - } - - // XREVISIT - return to final if possible - // REVISIT - was protected - need access from msgtypes test. - public ByteBufferWithInfo getByteBufferWithInfo() { - return impl.getByteBufferWithInfo(); - } - - protected void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { - impl.setByteBufferWithInfo(bbwi); - } - - // REVISIT: was protected - but need to access from xgiop. - public final BufferManagerWrite getBufferManager() { - return impl.getBufferManager(); - } - - public final void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) { - impl.write_fixed(bigDecimal, digits, scale); - } - - public final void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) { - impl.writeOctetSequenceTo(s); - } - - public final GIOPVersion getGIOPVersion() { - return impl.getGIOPVersion(); - } - - public final void writeIndirection(int tag, int posIndirectedTo) { - impl.writeIndirection(tag, posIndirectedTo); - } - - // Use Latin-1 for GIOP 1.0 or when code set negotiation was not - // performed. - protected CodeSetConversion.CTBConverter createCharCTBConverter() { - return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1); - } - - // Subclasses must decide what to do here. It's inconvenient to - // make the class and this method abstract because of dup(). - protected abstract CodeSetConversion.CTBConverter createWCharCTBConverter(); - - protected final void freeInternalCaches() { - impl.freeInternalCaches(); - } - - void printBuffer() { - impl.printBuffer(); - } - - public void alignOnBoundary(int octetBoundary) { - impl.alignOnBoundary(octetBoundary); - } - - // Needed by request and reply messages for GIOP versions >= 1.2 only. - public void setHeaderPadding(boolean headerPadding) { - impl.setHeaderPadding(headerPadding); - } - - // ValueOutputStream ----------------------------- - - public void start_value(String rep_id) { - impl.start_value(rep_id); - } - - public void end_value() { - impl.end_value(); - } -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ThreadCurrentStack.sjava b/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ThreadCurrentStack.sjava deleted file mode 100644 index 016a902825a..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ThreadCurrentStack.sjava +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. - * 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.corba.se.impl.interceptors; - -import com.sun.corba.se.impl.corba.AnyImpl; -import org.omg.PortableInterceptor.Current; -import org.omg.PortableInterceptor.InvalidSlot; - -import com.sun.corba.se.impl.util.MinorCodes; -import com.sun.corba.se.impl.core.ORB; - -/** - * ThreadCurrentStack is the container of PICurrent instances for each thread - */ -public class ThreadCurrentStack -{ - // PICurrentPool is the container for reusable PICurrents - private class PICurrentPool { - - // Contains a list of reusable PICurrents - private java.util.ArrayList pool; - - // High water mark for the pool - // If the pool size reaches this limit then putPICurrent will - // not put PICurrent to the pool. - private static final int HIGH_WATER_MARK = 5; - - // currentIndex points to the last PICurrent in the list - private int currentIndex; - - PICurrentPool( ) { - pool = new java.util.ArrayList( HIGH_WATER_MARK ); - currentIndex = 0; - } - - /** - * Puts PICurrent to the re-usable pool. - */ - void putPICurrent( PICurrent current ) { - // If there are enough PICurrents in the pool, then don't add - // this current to the pool. - if( currentIndex >= HIGH_WATER_MARK ) { - return; - } - pool.add(currentIndex , current); - currentIndex++; - } - - /** - * Gets PICurrent from the re-usable pool. - */ - PICurrent getPICurrent( ) { - // If there are no entries in the pool then return null - if( currentIndex == 0 ) { - return null; - } - // Works like a stack, Gets the last one added first - currentIndex--; - return (PICurrent) pool.get(currentIndex); - } - } - - // Contains all the active PICurrents for each thread. - // The ArrayList is made to behave like a stack. - private java.util.ArrayList currentContainer; - - // Keeps track of number of PICurrents in the stack. - private int currentIndex; - - // For Every Thread there will be a pool of re-usable ThreadCurrent's - // stored in PICurrentPool - private PICurrentPool currentPool; - - // The orb associated with this ThreadCurrentStack - private ORB piOrb; - - /** - * Constructs the stack and and PICurrentPool - */ - ThreadCurrentStack( ORB piOrb, PICurrent current ) { - this.piOrb = piOrb; - currentIndex = 0; - currentContainer = new java.util.ArrayList( ); - currentPool = new PICurrentPool( ); - currentContainer.add( currentIndex, current ); - currentIndex++; - } - - - /** - * pushPICurrent goes through the following steps - * 1: Checks to see if there is any PICurrent in PICurrentPool - * If present then use that instance to push into the ThreadCurrentStack - * - * 2:If there is no PICurrent in the pool, then creates a new one and pushes - * that into the ThreadCurrentStack - */ - void pushPICurrent( ) { - PICurrent current = currentPool.getPICurrent( ); - if( current == null ) { - // get an existing PICurrent to get the slotSize - PICurrent currentTemp = peekPICurrent(); - current = new PICurrent( piOrb, currentTemp.getSlotSize( )); - } - currentContainer.add( currentIndex, current ); - currentIndex++; - } - - /** - * popPICurrent does the following - * 1: pops the top PICurrent in the ThreadCurrentStack - * - * 2: resets the slots in the PICurrent which resets the slotvalues to - * null if there are any previous sets. - * - * 3: pushes the reset PICurrent into the PICurrentPool to reuse - */ - void popPICurrent( ) { - // Do not pop the PICurrent, If there is only one. - // This should not happen, But an extra check for safety. - if( currentIndex <= 1 ) { - throw new org.omg.CORBA.INTERNAL( - "Cannot pop the only PICurrent in the stack", - MinorCodes.CANT_POP_ONLY_CURRENT_2, - CompletionStatus.COMPLETED_NO ); - } - currentIndex--; - PICurrent current = (PICurrent)currentContainer.get( currentIndex ); - current.resetSlots( ); - currentPool.putPICurrent( current ); - } - - /** - * peekPICurrent gets the top PICurrent in the ThreadCurrentStack without - * popping. - */ - PICurrent peekPICurrent( ) { - return (PICurrent) currentContainer.get( currentIndex - 1); - } - -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/DefineWrapper.sjava b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/DefineWrapper.sjava deleted file mode 100644 index 0179dfa0bd1..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/DefineWrapper.sjava +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. 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.corba.se.impl.orbutil ; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -/** This class provides just a main method. Its purpose is to allow -D arguments to -* set up the system properties when starting programs with tools like OptimizeIt that -* make this difficult or impossible. -* -* Invocation: {java launcher of some kind} DefineClass -Dxxx=yyy -Dxxx=yyy ... {class name} arg0, arg1, ... -* Result: updates system properties with -D args, then uses reflection to invoke {class name}.main with the args -*/ - -class DefineWrapper { - public static void main( String[] args ) - { - int numberDefines = args.length ; - String className = null ; - - for (int ctr=0; ctr and get methods. - - - // - // Perform case sensitivity test first. This applies to all - // method names AND attributes. Compare each method name and - // attribute to all other method names and attributes. If names - // differ only in case, apply mangling as defined in section 1.3.2.7 - // of Java2IDL spec. Note that we compare using the original names. - // - for(Iterator outerIter=allMethodInfo.values().iterator(); - outerIter.hasNext();) { - IDLMethodInfo outer = (IDLMethodInfo) outerIter.next(); - for(Iterator innerIter = allMethodInfo.values().iterator(); - innerIter.hasNext();) { - IDLMethodInfo inner = (IDLMethodInfo) innerIter.next(); - - if( (outer != inner) && - (!outer.originalName.equals(inner.originalName)) && - outer.originalName.equalsIgnoreCase(inner.originalName) ) { - outer.mangledName = - mangleCaseSensitiveCollision(outer.originalName); - break; - } - - } - } - - for(Iterator iter = allMethodInfo.values().iterator(); - iter.hasNext();) { - IDLMethodInfo next = (IDLMethodcurrentInfo) iter.next(); - next.mangledName = - mangleIdentifier(next.mangledName, - next.propertyType != null); - } - - // - // Now check for overloaded method names and apply 1.3.2.6. - // - for(Iterator outerIter=allMethodInfo.values().iterator(); - outerIter.hasNext();) { - IDLMethodInfo outer = (IDLMethodInfo) outerIter.next(); - if (outer.propertyType != null) { - continue; - } - for(Iterator innerIter = allMethodInfo.values().iterator(); - innerIter.hasNext();) { - IDLMethodInfo inner = (IDLMethodInfo) innerIter.next(); - - if( (outer != inner) && - (inner.propertyType == null) && - outer.originalName.equals(inner.originalName) ) { - outer.mangledName = mangleOverloadedMethod - (outer.mangledName, outer.method); - break; - } - } - } - - // - // Now mangle any properties that clash with method names. - // - for(Iterator outerIter=allMethodInfo.values().iterator(); - outerIter.hasNext();) { - IDLMethodInfo outer = (IDLMethodInfo) outerIter.next(); - if(outer.propertyType == null) { - continue; - } - for(Iterator innerIter = allMethodInfo.values().iterator(); - innerIter.hasNext();) { - IDLMethodInfo inner = (IDLMethodInfo) innerIter.next(); - if( (outer != inner) && - (inner.propertyType == null) && - outer.mangledName.equals(inner.mangledName) ) { - outer.mangledName = outer.mangledName + - ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS; - break; - } - } - } - - // - // Ensure that no mapped method names clash with mapped name - // of container(1.3.2.9). This is a case insensitive comparison. - // - for (int ctr=0; ctr and get, - // map only is to an attribute, and leave the - // get method alone. - if( IDLNameToMethodMap_.containsKey(idlName) ) { - // @@@ I18N - Method clash = (Method) IDLNameToMethodMap_.get(idlName); - MethodInfo clashMethodInfo = - (MethodInfo)allMethodInfo.get( clash ) ; - if (clashMethodInfo.isBooleanProperty() && - next.isReadProperty()) { - // fix idlName - } else if (clashMethodInfo.isReadProperty() && - next.isBooleanProperty()) { - // Remove entry under idlName - // put entry into table under correct name - } else { - throw new IllegalStateException("Error : methods " + - clash + " and " + next.method + - " both result in IDL name '" + idlName + "'"); - } - } - - IDLNameToMethodMap_.put(idlName, next.method); - } - - return; - - } - - - /** - * Perform all necessary stand-alone identifier mangling operations - * on a java identifier that is being transformed into an IDL name. - * That is, mangling operations that don't require looking at anything - * else but the identifier itself. This covers sections 1.3.2.2, 1.3.2.3, - * and 1.3.2.4 of the Java2IDL spec. Method overloading and - * case-sensitivity checks are handled elsewhere. - */ - - private static String mangleIdentifier(String identifier) { - return mangleIdentifier(identifier, false); - } - - private static String mangleIdentifier(String identifier, boolean attribute) { - - String mangledName = identifier; - - // - // Apply leading underscore test (1.3.2.3) - // This should be done before IDL Keyword clash test, since clashing - // IDL keywords are mangled by adding a leading underscore. - // - if( hasLeadingUnderscore(mangledName) ) { - mangledName = mangleLeadingUnderscore(mangledName); - } - - // - // Apply IDL keyword clash test (1.3.2.2). - // This is not needed for attributes since when the full property - // name is composed it cannot clash with an IDL keyword. - // (Also, rmic doesn't do it.) - // - - if( !attribute && isIDLKeyword(mangledName) ) { - mangledName = mangleIDLKeywordClash(mangledName); - } - - // - // Replace illegal IDL identifier characters (1.3.2.4) - // for all method names and attributes. - // - if( !isIDLIdentifier(mangledName) ) { - mangledName = mangleUnicodeChars(mangledName); - } - - return mangledName; - } - - /** - * Checks whether a java identifier clashes with an - * IDL keyword. Note that this is a case-insensitive - * comparison. - * - * Used to implement section 1.3.2.2 of Java2IDL spec. - */ - private static boolean isIDLKeyword(String identifier) { - - String identifierAllCaps = identifier.toUpperCase(); - - return idlKeywords_.contains(identifierAllCaps); - } - - private static String mangleIDLKeywordClash(String identifier) { - return UNDERSCORE + identifier; - } - - private static String mangleLeadingUnderscore(String identifier) { - return LEADING_UNDERSCORE_CHAR + identifier; - } - - /** - * Checks whether a java identifier starts with an underscore. - * Used to implement section 1.3.2.3 of Java2IDL spec. - */ - private static boolean hasLeadingUnderscore(String identifier) { - return identifier.startsWith(UNDERSCORE); - } - - /** - * Implements Section 1.3.2.4 of Java2IDL Mapping. - * All non-IDL identifier characters must be replaced - * with their Unicode representation. - */ - static String mangleUnicodeChars(String identifier) { - StringBuffer mangledIdentifier = new StringBuffer(); - - for(int i = 0; i < identifier.length(); i++) { - char nextChar = identifier.charAt(i); - if( isIDLIdentifierChar(nextChar) ) { - mangledIdentifier.append(nextChar); - } else { - String unicode = charToUnicodeRepresentation(nextChar); - mangledIdentifier.append(unicode); - } - } - - return mangledIdentifier.toString(); - } - - /** - * Implements mangling portion of Section 1.3.2.7 of Java2IDL spec. - * This method only deals with the actual mangling. Decision about - * whether case-sensitive collision mangling is required is made - * elsewhere. - * - * - * "...a mangled name is generated consisting of the original name - * followed by an underscore separated list of decimal indices - * into the string, where the indices identify all the upper case - * characters in the original string. Indices are zero based." - * - */ - String mangleCaseSensitiveCollision(String identifier) { - - StringBuffer mangledIdentifier = new StringBuffer(identifier); - - // There is always at least one trailing underscore, whether or - // not the identifier has uppercase letters. - mangledIdentifier.append(UNDERSCORE); - - boolean needUnderscore = false; - for(int i = 0; i < identifier.length(); i++) { - char next = identifier.charAt(i); - if( Character.isUpperCase(next) ) { - // This bit of logic is needed to ensure that we have - // an underscore separated list of indices but no - // trailing underscores. Basically, after we have at least - // one uppercase letter, we always put an undercore before - // printing the next one. - if( needUnderscore ) { - mangledIdentifier.append(UNDERSCORE); - } - mangledIdentifier.append(i); - needUnderscore = true; - } - } - - return mangledIdentifier.toString(); - } - - private static String mangleContainerClash(String identifier) { - return identifier + ID_CONTAINER_CLASH_CHAR; - } - - /** - * Implements Section 1.3.2.9 of Java2IDL Mapping. Container in this - * context means the name of the java Class(excluding package) in which - * the identifier is defined. Comparison is case-insensitive. - */ - private static boolean identifierClashesWithContainer - (String mappedContainerName, String identifier) { - - return identifier.equalsIgnoreCase(mappedContainerName); - } - - /** - * Returns Unicode mangling as defined in Section 1.3.2.4 of - * Java2IDL spec. - * - * "For Java identifiers that contain illegal OMG IDL identifier - * characters such as '$' or Unicode characters outside of ISO Latin 1, - * any such illegal characters are replaced by "U" followed by the - * 4 hexadecimal characters(in upper case) representing the Unicode - * value. So, the Java name a$b is mapped to aU0024b and - * x\u03bCy is mapped to xU03BCy." - */ - public static String charToUnicodeRepresentation(char c) { - - int orig = (int) c; - StringBuffer hexString = new StringBuffer(); - - int value = orig; - - while( value > 0 ) { - int div = value / 16; - int mod = value % 16; - hexString.insert(0, HEX_DIGITS[mod]); - value = div; - } - - int numZerosToAdd = 4 - hexString.length(); - for(int i = 0; i < numZerosToAdd; i++) { - hexString.insert(0, "0"); - } - - hexString.insert(0, "U"); - return hexString.toString(); - } - - private static boolean isIDLIdentifier(String identifier) { - - boolean isIdentifier = true; - - for(int i = 0; i < identifier.length(); i++) { - char nextChar = identifier.charAt(i); - // 1st char must be alphbetic. - isIdentifier = (i == 0) ? - isIDLAlphabeticChar(nextChar) : - isIDLIdentifierChar(nextChar); - if( !isIdentifier ) { - break; - } - } - - return isIdentifier; - - } - - private static boolean isIDLIdentifierChar(char c) { - return (isIDLAlphabeticChar(c) || - isIDLDecimalDigit(c) || - isUnderscore(c)); - } - - /** - * True if character is one of 114 Alphabetic characters as - * specified in Table 2 of Chapter 3 in CORBA spec. - */ - private static boolean isIDLAlphabeticChar(char c) { - - // NOTE that we can't use the java.lang.Character - // isUpperCase, isLowerCase, etc. methods since they - // include many characters other than the Alphabetic list in - // the CORBA spec. Instead, we test for inclusion in the - // Unicode value ranges for the corresponding legal characters. - - boolean alphaChar = - ( - // A - Z - ((c >= 0x0041) && (c <= 0x005A)) - - || - - // a - z - ((c >= 0x0061) && (c <= 0x007A)) - - || - - // other letter uppercase, other letter lowercase, which is - // the entire upper half of C1 Controls except X and / - ((c >= 0x00C0) && (c <= 0x00FF) - && (c != 0x00D7) && (c != 0x00F7))); - - return alphaChar; - } - - /** - * True if character is one of 10 Decimal Digits - * specified in Table 3 of Chapter 3 in CORBA spec. - */ - private static boolean isIDLDecimalDigit(char c) { - return ( (c >= 0x0030) && (c <= 0x0039) ); - } - - private static boolean isUnderscore(char c) { - return ( c == 0x005F ); - } - - /** - * Mangle an overloaded method name as defined in Section 1.3.2.6 of - * Java2IDL spec. Current value of method name is passed in as argument. - * We can't start from original method name since the name might have - * been partially mangled as a result of the other rules. - */ - private static String mangleOverloadedMethod(String mangledName, Method m) { - - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); - - // Start by appending the separator string - String newMangledName = mangledName + OVERLOADED_TYPE_SEPARATOR; - - Class[] parameterTypes = m.getParameterTypes(); - - for(int i = 0; i < parameterTypes.length; i++) { - Class nextParamType = parameterTypes[i]; - - if( i > 0 ) { - newMangledName = newMangledName + OVERLOADED_TYPE_SEPARATOR; - } - IDLType idlType = classToIDLType(nextParamType); - - String moduleName = idlType.getModuleName(); - String memberName = idlType.getMemberName(); - - String typeName = (moduleName.length() > 0) ? - moduleName + UNDERSCORE + memberName : memberName; - - if( !idlTypesUtil.isPrimitive(nextParamType) && - (idlTypesUtil.getSpecialCaseIDLTypeMapping(nextParamType) - == null) && - isIDLKeyword(typeName) ) { - typeName = mangleIDLKeywordClash(typeName); - } - - typeName = mangleUnicodeChars(typeName); - - newMangledName = newMangledName + typeName; - } - - return newMangledName; - } - - - private static IDLType classToIDLType(Class c) { - - IDLType idlType = null; - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); - - if( idlTypesUtil.isPrimitive(c) ) { - - idlType = idlTypesUtil.getPrimitiveIDLTypeMapping(c); - - } else if( c.isArray() ) { - - // Calculate array depth, as well as base element type. - Class componentType = c.getComponentType(); - int numArrayDimensions = 1; - while(componentType.isArray()) { - componentType = componentType.getComponentType(); - numArrayDimensions++; - } - IDLType componentIdlType = classToIDLType(componentType); - - String[] modules = BASE_IDL_ARRAY_MODULE_TYPE; - if( componentIdlType.hasModule() ) { - modules = (String[])ObjectUtility.concatenateArrays( modules, - componentIdlType.getModules() ) ; - } - - String memberName = BASE_IDL_ARRAY_ELEMENT_TYPE + - numArrayDimensions + UNDERSCORE + - componentIdlType.getMemberName(); - - idlType = new IDLType(c, modules, memberName); - - } else { - idlType = idlTypesUtil.getSpecialCaseIDLTypeMapping(c); - - if (idlType == null) { - // Section 1.3.2.5 of Java2IDL spec defines mangling rules for - // inner classes. - String memberName = getUnmappedContainerName(c); - - // replace inner class separator with double underscore - memberName = memberName.replaceAll("\\$", - INNER_CLASS_SEPARATOR); - - if( hasLeadingUnderscore(memberName) ) { - memberName = mangleLeadingUnderscore(memberName); - } - - // Get raw package name. If there is a package, it - // will still have the "." separators and none of the - // mangling rules will have been applied. - String packageName = getPackageName(c); - - if (packageName == null) { - idlType = new IDLType( c, memberName ) ; - } else { - // If this is a generated IDL Entity Type we need to - // prepend org_omg_boxedIDL per sections 1.3.5 and 1.3.9 - if (idlTypesUtil.isEntity(c)) { - packageName = "org.omg.boxedIDL." + packageName ; - } - - // Section 1.3.2.1 and 1.3.2.6 of Java2IDL spec defines - // rules for mapping java packages to IDL modules and for - // mangling module name portion of type name. NOTE that - // of the individual identifier mangling rules, - // only the leading underscore test is done here. - // The other two(IDL Keyword, Illegal Unicode chars) are - // done in mangleOverloadedMethodName. - StringTokenizer tokenizer = - new StringTokenizer(packageName, "."); - - String[] modules = new String[ tokenizer.countTokens() ] ; - int index = 0 ; - while (tokenizer.hasMoreElements()) { - String next = tokenizer.nextToken(); - String nextMangled = hasLeadingUnderscore(next) ? - mangleLeadingUnderscore(next) : next; - - modules[index++] = nextMangled ; - } - - idlType = new IDLType(c, modules, memberName); - } - } - } - - return idlType; - } - - /** - * Return Class' package name or null if there is no package. - */ - private static String getPackageName(Class c) { - Package thePackage = c.getPackage(); - String packageName = null; - - // Try to get package name by introspection. Some classloaders might - // not provide this information, so check for null. - if( thePackage != null ) { - packageName = thePackage.getName(); - } else { - // brute force method - String fullyQualifiedClassName = c.getName(); - int lastDot = fullyQualifiedClassName.indexOf('.'); - packageName = (lastDot == -1) ? null : - fullyQualifiedClassName.substring(0, lastDot); - } - return packageName; - } - - private static String getMappedContainerName(Class c) { - String unmappedName = getUnmappedContainerName(c); - - return mangleIdentifier(unmappedName); - } - - /** - * Return portion of class name excluding package name. - */ - private static String getUnmappedContainerName(Class c) { - - String memberName = null; - String packageName = getPackageName(c); - - String fullyQualifiedClassName = c.getName(); - - if( packageName != null ) { - int packageLength = packageName.length(); - memberName = fullyQualifiedClassName.substring(packageLength + 1); - } else { - memberName = fullyQualifiedClassName; - - } - - return memberName; - } - - /** - * Internal helper class for tracking information related to each - * interface method while we're building the name translation table. - */ - private static class IDLMethodInfo - { - public Method method; - public String propertyType; - - // If this is a property, originalName holds the original - // attribute name. Otherwise, it holds the original method name. - public String originalName; - - // If this is a property, mangledName holds the mangled attribute - // name. Otherwise, it holds the mangled method name. - public String mangledName; - - } - - public String toString() { - - StringBuffer contents = new StringBuffer(); - contents.append("IDLNameTranslator[" ); - for( int ctr=0; ctr 0 ) { - String className = args[0]; - try { - remoteInterface = Class.forName(className); - } catch(Exception e) { - e.printStackTrace(); - System.exit(-1); - } - } - - System.out.println("Building name translation for " + remoteInterface); - try { - IDLNameTranslator nameTranslator = - IDLNameTranslatorImpl.get(remoteInterface); - System.out.println(nameTranslator); - } catch(IllegalStateException ise) { - ise.printStackTrace(); - } - } -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil_save.sjava b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil_save.sjava deleted file mode 100644 index 66bf284375e..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil_save.sjava +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.presentation.rmi ; - -import java.lang.reflect.Method; -import java.lang.reflect.Field; -import java.util.Set; -import java.util.HashSet; -import java.util.Iterator; - -/** - * Utility class for testing RMI/IDL Types as defined in - * Section 1.2 of The Java Language to IDL Mapping. Note that - * these are static checks only. Runtime checks, such as those - * described in Section 1.2.3, #3, are not covered. - */ -public class IDLTypesUtil { - - public static final String JAVA_GET_PROPERTY_PREFIX = "get"; - public static final String JAVA_SET_PROPERTY_PREFIX = "set"; - public static final String JAVA_IS_PROPERTY_PREFIX = "is"; - - public static final int VALID_TYPE = 0; - public static final int INVALID_TYPE = 1; - - /** - * Validate a class to ensure it conforms to the rules for a - * Java RMI/IIOP interface. - * - * @throws IDLTypeException if not a valid RMI/IIOP interface. - */ - public void validateRemoteInterface(Class c) throws IDLTypeException - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - if( !c.isInterface() ) { - String msg = "Class " + c + " must be a java interface."; - throw new IDLTypeException(msg); - } - - if( !java.rmi.Remote.class.isAssignableFrom(c) ) { - String msg = "Class " + c + " must extend java.rmi.Remote, " + - "either directly or indirectly."; - throw new IDLTypeException(msg); - } - - // Get all methods, including super-interface methods. - Method[] methods = c.getMethods(); - - for(int i = 0; i < methods.length; i++) { - Method next = methods[i]; - validateExceptions(next); - } - - // Removed because of bug 4989053 - // validateDirectInterfaces(c); - validateConstants(c); - - return; - } - - public boolean isRemoteInterface(Class c) - { - boolean remoteInterface = true; - try { - validateRemoteInterface(c); - } catch(IDLTypeException ite) { - remoteInterface = false; - } - - return remoteInterface; - } - - /** - * Section 1.2.2 Primitive Types - */ - public boolean isPrimitive(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return c.isPrimitive(); - } - - /** - * Section 1.2.4 - */ - public boolean isValue(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return - (!c.isInterface() && - java.io.Serializable.class.isAssignableFrom(c) && - !java.rmi.Remote.class.isAssignableFrom(c)); - } - - /** - * Section 1.2.5 - */ - public boolean isArray(Class c) - { - boolean arrayType = false; - - if( c == null ) { - throw new IllegalArgumentException(); - } - - if( c.isArray() ) { - Class componentType = c.getComponentType(); - arrayType = - (isPrimitive(componentType) || isRemoteInterface(componentType) || - isEntity(componentType) || isException(componentType) || - isValue(componentType) || isObjectReference(componentType) ); - } - - return arrayType; - } - - /** - * Section 1.2.6 - */ - public boolean isException(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - // Must be a checked exception, not including RemoteException or - // its subclasses. - return isCheckedException(c) && !isRemoteException(c) && isValue(c); - } - - public boolean isRemoteException(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return java.rmi.RemoteException.class.isAssignableFrom(c) ; - } - - public boolean isCheckedException(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return Throwable.class.isAssignableFrom(c) && - !RuntimeException.class.isAssignableFrom(c) && - !Error.class.isAssignableFrom(c) ; - } - - /** - * Section 1.2.7 - */ - public boolean isObjectReference(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return (c.isInterface() && - org.omg.CORBA.Object.class.isAssignableFrom(c)); - } - - /** - * Section 1.2.8 - */ - public boolean isEntity(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - Class superClass = c.getSuperclass(); - return (!c.isInterface() && - (superClass != null) && - (org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(c))); - } - - public String javaPropertyPrefixToIDL( String javaPrefix ) - { - return "_" + javaPrefix + "_" ; - } - - /** - * Return the property type if given method is legal property accessor as defined in - * Section 1.3.4.3 of Java2IDL spec. Result is one of: JAVA_GET_PROPERTY_PREFIX, - * JAVA_SET_PROPERTY_PREFIX, JAVA_IS_PROPERTY_PREFIX. - */ - public String propertyAccessorMethodType(Method m, Class c) { - - String methodName = m.getName(); - Class returnType = m.getReturnType(); - Class[] parameters = m.getParameterTypes(); - Class[] exceptionTypes = m.getExceptionTypes(); - String propertyType = null; - - if( methodName.startsWith(JAVA_GET_PROPERTY_PREFIX) ) { - - if((parameters.length == 0) && (returnType != Void.TYPE) && - !hasCorrespondingReadProperty(m, c, JAVA_IS_PROPERTY_PREFIX) { - propertyType = JAVA_GET_PROPERTY_PREFIX; - } - - } else if( methodName.startsWith(JAVA_SET_PROPERTY_PREFIX) ) { - - if((returnType == Void.TYPE) && (parameters.length == 1)) { - if (hasCorrespondingReadProperty(m, c, JAVA_GET_PROPERTY_PREFIX) || - hasCorrespondingReadProperty(m, c, JAVA_IS_PROPERTY_PREFIX)) { - propertyType = JAVA_SET_PROPERTY_PREFIX; - } - } - - } else if( methodName.startsWith(JAVA_IS_PROPERTY_PREFIX) ) { - if((parameters.length == 0) && (returnType == Boolean.TYPE)) { - propertyType = JAVA_IS_PROPERTY_PREFIX; - } - } - - // Some final checks that apply to all properties. - if( propertyType != null ) { - if(!validPropertyExceptions(m) || - (methodName.length() <= propertyType.length())) { - propertyType = null; - } - } - - return propertyType ; - } - - private boolean hasCorrespondingReadProperty - (Method writeProperty, Class c, String readPropertyPrefix) { - - String writePropertyMethodName = writeProperty.getName(); - Class[] writePropertyParameters = writeProperty.getParameterTypes(); - boolean foundReadProperty = false; - - try { - // Look for a valid corresponding Read property - String readPropertyMethodName = - writePropertyMethodName.replaceFirst - (JAVA_SET_PROPERTY_PREFIX, readPropertyPrefix); - Method readPropertyMethod = c.getMethod(readPropertyMethodName, - new Class[] {}); - foundReadProperty = - ((propertyAccessorMethodType(readPropertyMethod, c) != null) && - (readPropertyMethod.getReturnType() == - writePropertyParameters[0])); - } catch(Exception e) { - // ignore. this means we didn't find a corresponding get property. - } - - return foundReadProperty; - } - - public String getAttributeNameForProperty(String propertyName) { - String attributeName = null; - String prefix = null; - - if( propertyName.startsWith(JAVA_GET_PROPERTY_PREFIX) ) { - prefix = JAVA_GET_PROPERTY_PREFIX; - } else if( propertyName.startsWith(JAVA_SET_PROPERTY_PREFIX) ) { - prefix = JAVA_SET_PROPERTY_PREFIX; - } else if( propertyName.startsWith(JAVA_IS_PROPERTY_PREFIX) ) { - prefix = JAVA_IS_PROPERTY_PREFIX; - } - - if( (prefix != null) && (prefix.length() < propertyName.length()) ) { - String remainder = propertyName.substring(prefix.length()); - if( (remainder.length() >= 2) && - Character.isUpperCase(remainder.charAt(0)) && - Character.isUpperCase(remainder.charAt(1)) ) { - // don't set the first letter to lower-case if the - // first two are upper-case - attributeName = remainder; - } else { - attributeName = Character.toLowerCase(remainder.charAt(0)) + - remainder.substring(1); - } - } - - return attributeName; - } - - /** - * Return IDL Type name for primitive types as defined in - * Section 1.3.3 of Java2IDL spec or null if not a primitive type. - */ - public IDLType getPrimitiveIDLTypeMapping(Class c) { - - if( c == null ) { - throw new IllegalArgumentException(); - } - - if( c.isPrimitive() ) { - if( c == Void.TYPE ) { - return new IDLType( c, "void" ) ; - } else if( c == Boolean.TYPE ) { - return new IDLType( c, "boolean" ) ; - } else if( c == Character.TYPE ) { - return new IDLType( c, "wchar" ) ; - } else if( c == Byte.TYPE ) { - return new IDLType( c, "octet" ) ; - } else if( c == Short.TYPE ) { - return new IDLType( c, "short" ) ; - } else if( c == Integer.TYPE ) { - return new IDLType( c, "long" ) ; - } else if( c == Long.TYPE ) { - return new IDLType( c, "long_long" ) ; - } else if( c == Float.TYPE ) { - return new IDLType( c, "float" ) ; - } else if( c == Double.TYPE ) { - return new IDLType( c, "double" ) ; - } - } - - return null; - } - - /** - * Return IDL Type name for special case type mappings as defined in - * Table 1-1 of Java2IDL spec or null if given class is not a special - * type. - */ - public IDLType getSpecialCaseIDLTypeMapping(Class c) { - - if( c == null ) { - throw new IllegalArgumentException(); - } - - if( c == java.lang.Object.class ) { - return new IDLType( c, new String[] { "java", "lang" }, - "Object" ) ; - } else if( c == java.lang.String.class ) { - return new IDLType( c, new String[] { "CORBA" }, - "WStringValue" ) ; - } else if( c == java.lang.Class.class ) { - return new IDLType( c, new String[] { "javax", "rmi", "CORBA" }, - "ClassDesc" ) ; - } else if( c == java.io.Serializable.class ) { - return new IDLType( c, new String[] { "java", "io" }, - "Serializable" ) ; - } else if( c == java.io.Externalizable.class ) { - return new IDLType( c, new String[] { "java", "io" }, - "Externalizable" ) ; - } else if( c == java.rmi.Remote.class ) { - return new IDLType( c, new String[] { "java", "rmi" }, - "Remote" ) ; - } else if( c == org.omg.CORBA.Object.class ) { - return new IDLType( c, "Object" ) ; - } else { - return null; - } - } - - /** - * Implements 1.2.3 #2 and #4 - */ - private void validateExceptions(Method method) throws IDLTypeException { - - Class[] exceptions = method.getExceptionTypes(); - - boolean declaresRemoteExceptionOrSuperClass = false; - - // Section 1.2.3, #2 - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { - Class exception = exceptions[eIndex]; - if( isRemoteExceptionOrSuperClass(exception) ) { - declaresRemoteExceptionOrSuperClass = true; - break; - } - } - - if( !declaresRemoteExceptionOrSuperClass ) { - String msg = "Method '" + method + "' must throw at least one " + - "exception of type java.rmi.RemoteException or one of its " + - "super-classes"; - throw new IDLTypeException(msg); - } - - // Section 1.2.3, #4 - // See also bug 4972402 - // For all exceptions E in exceptions, - // (isCheckedException(E) => (isValue(E) || RemoteException.isAssignableFrom( E ) ) - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { - Class exception = exceptions[eIndex]; - - if (isCheckedException(exception) && !isValue(exception) && - !isRemoteException(exception)) - { - String msg = "Exception '" + exception + "' on method '" + - method + "' is not a allowed RMI/IIOP exception type"; - throw new IDLTypeException(msg); - } - } - - return; - } - - /** - * Returns true if the method's throw clause conforms to the exception - * restrictions for properties as defined in Section 1.3.4.3 of - * Java2IDL spec. This means that for all exceptions E declared on the - * method, E isChecked => RemoteException.isAssignableFrom( E ). - */ - private boolean validPropertyExceptions(Method method) - { - Class[] exceptions = method.getExceptionTypes(); - - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { - Class exception = exceptions[eIndex]; - - if (isCheckedException(exception) && !isRemoteException(exception)) - return false ; - } - - return true; - } - - /** - * Implements Section 1.2.3, #2. - */ - private boolean isRemoteExceptionOrSuperClass(Class c) { - return - ((c == java.rmi.RemoteException.class) || - (c == java.io.IOException.class) || - (c == java.lang.Exception.class) || - (c == java.lang.Throwable.class)); - } - - /** - * Implements Section 1.2.3, #5. - */ - private void validateDirectInterfaces(Class c) throws IDLTypeException { - - Class[] directInterfaces = c.getInterfaces(); - - if( directInterfaces.length < 2 ) { - return; - } - - Set allMethodNames = new HashSet(); - Set currentMethodNames = new HashSet(); - - for(int i = 0; i < directInterfaces.length; i++) { - Class next = directInterfaces[i]; - Method[] methods = next.getMethods(); - - // Comparison is based on method names only. First collect - // all methods from current interface, eliminating duplicate - // names. - currentMethodNames.clear(); - for(int m = 0; m < methods.length; m++) { - currentMethodNames.add(methods[m].getName()); - } - - // Now check each method against list of all unique method - // names processed so far. - for(Iterator iter=currentMethodNames.iterator(); iter.hasNext();) { - String methodName = (String) iter.next(); - if( allMethodNames.contains(methodName) ) { - String msg = "Class " + c + " inherits method " + - methodName + " from multiple direct interfaces."; - throw new IDLTypeException(msg); - } else { - allMethodNames.add(methodName); - } - } - } - - return; - } - - /** - * Implements 1.2.3 #6 - */ - private void validateConstants(final Class c) - throws IDLTypeException { - - Field[] fields = null; - - try { - fields = (Field[]) - java.security.AccessController.doPrivileged - (new java.security.PrivilegedExceptionAction() { - public java.lang.Object run() throws Exception { - return c.getFields(); - } - }); - } catch(java.security.PrivilegedActionException pae) { - IDLTypeException ite = new IDLTypeException(); - ite.initCause(pae); - throw ite; - } - - for(int i = 0; i < fields.length; i++) { - Field next = fields[i]; - Class fieldType = next.getType(); - if( (fieldType != java.lang.String.class) && - !isPrimitive(fieldType) ) { - String msg = "Constant field '" + next.getName() + - "' in class '" + next.getDeclaringClass().getName() + - "' has invalid type' " + next.getType() + "'. Constants" + - " in RMI/IIOP interfaces can only have primitive" + - " types and java.lang.String types."; - throw new IDLTypeException(msg); - } - } - - - return; - } - -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientRequestImpl.sjava b/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientRequestImpl.sjava deleted file mode 100644 index 6279ff6acb6..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientRequestImpl.sjava +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.iiop; - -import com.sun.corba.se.impl.protocol.Request; -import com.sun.corba.se.impl.core.ClientRequest; -import com.sun.corba.se.impl.core.ServiceContext; -import com.sun.corba.se.impl.core.ServiceContexts; -import com.sun.corba.se.impl.core.ClientResponse; -import com.sun.corba.se.impl.core.ServerRequest; -import com.sun.corba.se.impl.core.ServerResponse; -import com.sun.corba.se.impl.corba.IOR; -import com.sun.corba.se.impl.corba.GIOPVersion; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.core.ORBVersion; -import com.sun.corba.se.impl.core.ORB; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.ior.ObjectKeyFactory ; -import com.sun.corba.se.impl.ior.ObjectKey ; -import com.sun.corba.se.impl.ior.ObjectKeyTemplate ; -import com.sun.corba.se.impl.ior.IIOPProfile; - -public class LocalClientRequestImpl extends IIOPOutputStream - implements ClientRequest -{ - public LocalClientRequestImpl( GIOPVersion gv, - ORB orb, IOR ior, short addrDisposition, - String operationName, boolean oneway, ServiceContexts svc, - int requestId, byte streamFormatVersion) - { - super(gv, - orb, - null, - BufferManagerFactory.newBufferManagerWrite(BufferManagerFactory.GROW), - streamFormatVersion); - - this.isOneway = oneway; - boolean responseExpected = !isOneway; - - IIOPProfile iop = ior.getProfile(); - ObjectKey okey = iop.getObjectKey(); - ObjectKeyTemplate oktemp = okey.getTemplate() ; - ORBVersion version = oktemp.getORBVersion() ; - orb.setORBVersion( version ) ; - - this.request = MessageBase.createRequest(orb, gv, requestId, - responseExpected, ior, addrDisposition, operationName, svc, null); - setMessage(request); - request.write(this); - - // mark beginning of msg body for possible later use - bodyBegin = getSize(); - } - - public int getRequestId() { - return request.getRequestId(); - } - - public boolean isOneWay() { - return isOneway; - } - - public ServiceContexts getServiceContexts() { - return request.getServiceContexts(); - } - - public String getOperationName() { - return request.getOperation(); - } - - public ObjectKey getObjectKey() { - return request.getObjectKey(); - } - - public ServerRequest getServerRequest() - { - // Set the size of the marshalled data in the message header. - getMessage().setSize( getByteBuffer(), getSize() ) ; - - // Construct a new ServerRequest out of the buffer in this ClientRequest - LocalServerRequestImpl serverRequest = new LocalServerRequestImpl( - (ORB)orb(), toByteArray(), request ) ; - - // Skip over all of the GIOP header information. This positions - // the offset in the buffer so that the skeleton can correctly read - // the marshalled arguments. - serverRequest.setIndex( bodyBegin ) ; - - return serverRequest ; - } - - public ClientResponse invoke() - { - ORB myORB = (ORB)orb() ; - - ServerResponse serverResponse = myORB.process( getServerRequest() ) ; - - LocalServerResponseImpl lsr = (LocalServerResponseImpl)serverResponse ; - - return lsr.getClientResponse() ; - } - - /** - * Check to see if the request is local. - */ - public boolean isLocal(){ - return true; - } - - private RequestMessage request; - private int bodyBegin; - private boolean isOneway; -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientResponseImpl.sjava b/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientResponseImpl.sjava deleted file mode 100644 index 24f40e7249f..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientResponseImpl.sjava +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.iiop; - -import java.io.IOException; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.impl.core.Response; -import com.sun.corba.se.impl.core.ClientResponse; -import com.sun.corba.se.impl.corba.IOR; -import com.sun.corba.se.impl.core.ORB; -import com.sun.corba.se.impl.core.ServiceContext; -import com.sun.corba.se.impl.core.ServiceContexts; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; -import com.sun.corba.se.impl.orbutil.MinorCodes; - -class LocalClientResponseImpl extends IIOPInputStream implements ClientResponse -{ - LocalClientResponseImpl(ORB orb, byte[] buf, ReplyMessage header) - { - super(orb, buf, header.getSize(), header.isLittleEndian(), header, null); - - this.reply = header; - - // NOTE (Ram J) (06/02/2000) if we set result.setIndex(bodyBegin) - // in LocalServerResponse.getClientResponse(), then we do not need - // to read the headers (done below) anymore. - // This will be an optimisation which is can be done to speed up the - // local invocation by avoiding reading the headers in the local cases. - - // BUGFIX(Ram Jeyaraman) This has been moved from - // LocalServerResponse.getClientResponse() - // Skip over all of the GIOP header information. This positions - // the offset in the buffer so that the skeleton can correctly read - // the marshalled arguments. - this.setIndex(Message.GIOPMessageHeaderLength); - - // BUGFIX(Ram Jeyaraman) For local invocations, the reply mesg fields - // needs to be set, by reading the response buffer contents - // to correctly set the exception type and other info. - this.reply.read(this); - } - - LocalClientResponseImpl(SystemException ex) - { - this.systemException = ex; - } - - public boolean isSystemException() { - if ( reply != null ) - return reply.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION; - else - return (systemException != null); - } - - public boolean isUserException() { - if ( reply != null ) - return reply.getReplyStatus() == ReplyMessage.USER_EXCEPTION; - else - return false; - } - - public boolean isLocationForward() { - if ( reply != null ) { - return ( (reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD) || - (reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD_PERM) ); - //return reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD; - } else { - return false; - } - } - - public boolean isDifferentAddrDispositionRequested() { - if (reply != null) { - return reply.getReplyStatus() == ReplyMessage.NEEDS_ADDRESSING_MODE; - } - - return false; - } - - public short getAddrDisposition() { - if (reply != null) { - return reply.getAddrDisposition(); - } - - throw new org.omg.CORBA.INTERNAL( - "Null reply in getAddrDisposition", - MinorCodes.NULL_REPLY_IN_GET_ADDR_DISPOSITION, - CompletionStatus.COMPLETED_MAYBE); - } - - public IOR getForwardedIOR() { - if ( reply != null ) - return reply.getIOR(); - else - return null; - } - - public int getRequestId() { - if ( reply != null ) - return reply.getRequestId(); - else - throw new org.omg.CORBA.INTERNAL("Error in getRequestId"); - } - - public ServiceContexts getServiceContexts() { - if ( reply != null ) - return reply.getServiceContexts(); - else - return null; - } - - public SystemException getSystemException() { - if ( reply != null ) - return reply.getSystemException(); - else - return systemException; - } - - public java.lang.String peekUserExceptionId() { - mark(Integer.MAX_VALUE); - String result = read_string(); - reset(); - return result; - } - - /** - * Check to see if the response is local. - */ - public boolean isLocal(){ - return true; - } - - private ReplyMessage reply; - private SystemException systemException; -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerRequestImpl.sjava b/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerRequestImpl.sjava deleted file mode 100644 index ecafbee3947..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerRequestImpl.sjava +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.iiop; - -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.impl.core.ServerRequest; -import com.sun.corba.se.impl.core.ServiceContext; -import com.sun.corba.se.impl.core.DuplicateServiceContext; -import com.sun.corba.se.impl.core.UEInfoServiceContext; -import com.sun.corba.se.impl.core.ServiceContexts; -import com.sun.corba.se.impl.core.ServerResponse; -import com.sun.corba.se.impl.corba.IOR; -import com.sun.corba.se.impl.core.ORB; -import com.sun.corba.se.impl.orbutil.ORBUtility; //d11638 -import org.omg.CORBA.portable.UnknownException; -import org.omg.CORBA.UNKNOWN; -import org.omg.CORBA.CompletionStatus; -import com.sun.corba.se.impl.ior.ObjectKey; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage; - -class LocalServerRequestImpl extends IIOPInputStream implements ServerRequest { - org.omg.CORBA.portable.OutputStream replyStream; - org.omg.CORBA.portable.OutputStream exceptionReplyStream; - - LocalServerRequestImpl(ORB orb, byte[] buf, RequestMessage header) - { - super(orb, buf, header.getSize(), header.isLittleEndian(), header, null ); - - this.request = header; - } - - public int getRequestId() { - return request.getRequestId(); - } - - public boolean isOneWay() { - return !request.isResponseExpected(); - } - - public ServiceContexts getServiceContexts() { - return request.getServiceContexts(); - } - - public String getOperationName() { - return request.getOperation(); - } - - public ObjectKey getObjectKey() { - return request.getObjectKey(); - } - - public ServerResponse createResponse(ServiceContexts svc) - { - return new LocalServerResponseImpl(this, svc); - } - - public org.omg.CORBA.portable.OutputStream createReply() { - if (replyStream == null) { - replyStream = (org.omg.CORBA.portable.OutputStream) - createResponse(null); - } - return replyStream; - } - - public org.omg.CORBA.portable.OutputStream createExceptionReply() { - if (exceptionReplyStream == null) { - exceptionReplyStream = (org.omg.CORBA.portable.OutputStream) - createUserExceptionResponse(null); - } - return exceptionReplyStream; - } - - public ServerResponse createUserExceptionResponse( - ServiceContexts svc) - { - return new LocalServerResponseImpl(this, svc, true); - } - - public ServerResponse createUnknownExceptionResponse( - UnknownException ex) { - ServiceContexts contexts = null; - SystemException sys = new UNKNOWN( 0, - CompletionStatus.COMPLETED_MAYBE); - - try { - contexts = new ServiceContexts( (ORB)orb() ); - UEInfoServiceContext uei = new UEInfoServiceContext(sys); - contexts.put(uei) ; - } catch (DuplicateServiceContext d) { - // can't happen - } - - return createSystemExceptionResponse(sys,contexts); - } - - public ServerResponse createSystemExceptionResponse( - SystemException ex, ServiceContexts svc) { - - // Only do this if interceptors have been initialized on this request - // and have not completed their lifecycle (otherwise the info stack - // may be empty or have a different request's entry on top). - if (executePIInResponseConstructor()) { - // Inform Portable Interceptors of the SystemException. This is - // required to be done here because the ending interception point - // is called in the ServerResponseImpl constructor called below - // but we do not currently write the SystemException into the - // response until after the ending point is called. - ORB orb = (ORB)orb(); - orb.getPIHandler().setServerPIInfo( ex ); - } - - if (orb() != null && ((ORB)orb()).subcontractDebugFlag && ex != null) - ORBUtility.dprint(this, "Sending SystemException:", ex); - - LocalServerResponseImpl response = - new LocalServerResponseImpl(this, svc, false); - ORBUtility.writeSystemException(ex, response); - return response; - } - - public ServerResponse createLocationForward( - IOR ior, ServiceContexts svc) { - ReplyMessage reply = MessageBase.createReply( (ORB)orb(), - request.getGIOPVersion(), request.getRequestId(), - ReplyMessage.LOCATION_FORWARD, svc, ior); - LocalServerResponseImpl response = - new LocalServerResponseImpl(this, reply, ior); - - return response; - } - - private RequestMessage request; - - /** - * Check to see if the request is local. - */ - public boolean isLocal(){ - return true; - } - - private boolean _executeReturnServantInResponseConstructor = false; - - public boolean executeReturnServantInResponseConstructor() - { - return _executeReturnServantInResponseConstructor; - } - - public void setExecuteReturnServantInResponseConstructor(boolean b) - { - _executeReturnServantInResponseConstructor = b; - } - - - private boolean _executeRemoveThreadInfoInResponseConstructor = false; - - public boolean executeRemoveThreadInfoInResponseConstructor() - { - return _executeRemoveThreadInfoInResponseConstructor; - } - - public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b) - { - _executeRemoveThreadInfoInResponseConstructor = b; - } - - - private boolean _executePIInResponseConstructor = false; - - public boolean executePIInResponseConstructor() { - return _executePIInResponseConstructor; - } - - public void setExecutePIInResponseConstructor( boolean b ) { - _executePIInResponseConstructor = b; - } - - // We know that we're talking to the same ValueHandler, so - // use the maximum version it supports. - public byte getStreamFormatVersionForReply() { - return ORBUtility.getMaxStreamFormatVersion(); - } -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerResponseImpl.sjava b/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerResponseImpl.sjava deleted file mode 100644 index 8574ccfadf1..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerResponseImpl.sjava +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.iiop; - -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.impl.core.ServerResponse; -import com.sun.corba.se.impl.core.ORB; -import com.sun.corba.se.impl.corba.IOR; -import com.sun.corba.se.impl.core.ServiceContext; -import com.sun.corba.se.impl.core.ServiceContexts; -import com.sun.corba.se.impl.core.ClientResponse; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; - -class LocalServerResponseImpl - extends IIOPOutputStream - implements ServerResponse -{ - LocalServerResponseImpl(LocalServerRequestImpl request, ServiceContexts svc) - { - this(request, - MessageBase.createReply( - (ORB)request.orb(), - request.getGIOPVersion(), - request.getRequestId(), ReplyMessage.NO_EXCEPTION, - svc, null), - null); - } - - LocalServerResponseImpl(LocalServerRequestImpl request, ServiceContexts svc, - boolean user) - { - this(request, - MessageBase.createReply( - (ORB)request.orb(), - request.getGIOPVersion(), request.getRequestId(), - user ? ReplyMessage.USER_EXCEPTION : - ReplyMessage.SYSTEM_EXCEPTION, - svc, null), - null); - } - - LocalServerResponseImpl( LocalServerRequestImpl request, ReplyMessage reply, - IOR ior) - { - super(request.getGIOPVersion(), - (ORB)request.orb(), - null, - BufferManagerFactory.newBufferManagerWrite(BufferManagerFactory.GROW), - request.getStreamFormatVersionForReply()); - - setMessage(reply); - - ORB orb = (ORB)request.orb(); - - ServerResponseImpl.runServantPostInvoke(orb, request); - - if( request.executePIInResponseConstructor() ) { - // Invoke server request ending interception points (send_*): - // Note: this may end up with a SystemException or an internal - // Runtime ForwardRequest. - orb.getPIHandler().invokeServerPIEndingPoint( reply ); - - // Note this will be executed even if a ForwardRequest or - // SystemException is thrown by a Portable Interceptors ending - // point since we end up in this constructor again anyway. - orb.getPIHandler().cleanupServerPIRequest(); - - // See (Local)ServerRequestImpl.createSystemExceptionResponse - // for why this is necesary. - request.setExecutePIInResponseConstructor(false); - } - - // Once you get here then the final reply is available (i.e., - // postinvoke and interceptors have completed. - if (request.executeRemoveThreadInfoInResponseConstructor()) { - ServerResponseImpl.removeThreadInfo(orb, request); - } - - reply.write(this); - if (reply.getIOR() != null) - reply.getIOR().write(this); - - this.reply = reply; - this.ior = reply.getIOR(); - } - - public boolean isSystemException() { - if (reply != null) - return reply.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION; - return false; - } - - public boolean isUserException() { - if (reply != null) - return reply.getReplyStatus() == ReplyMessage.USER_EXCEPTION; - return false; - } - - public boolean isLocationForward() { - if (ior != null) - return true; - return false; - } - - public IOR getForwardedIOR() { - return ior; - } - - public int getRequestId() { - if (reply != null) - return reply.getRequestId(); - return -1; - } - - public ServiceContexts getServiceContexts() { - if (reply != null) - return reply.getServiceContexts(); - return null; - } - - public SystemException getSystemException() { - if (reply != null) - return reply.getSystemException(); - return null; - } - - public ReplyMessage getReply() - { - return reply ; - } - - public ClientResponse getClientResponse() - { - // set the size of the marshalled data in the message header - getMessage().setSize(getByteBuffer(), getSize()); - - // Construct a new ClientResponse out of the buffer in this ClientRequest - LocalClientResponseImpl result = - new LocalClientResponseImpl( (ORB)orb(), toByteArray(), reply); - - // NOTE (Ram J) (06/02/2000) if we set result.setIndex(bodyBegin) here - // then the LocalClientResponse does not need to read the headers anymore. - // This will be an optimisation which is can be done to speed up the - // local invocation by avoiding reading the headers in the local cases. - - // BUGFIX(Ram Jeyaraman) result.setOffset is now done in - // LocalClientResponseImpl constructor. - /* - // Skip over all of the GIOP header information. This positions - // the offset in the buffer so that the skeleton can correctly read - // the marshalled arguments. - result.setOffset( bodyBegin ) ; - */ - - return result ; - } - - /** - * Check to see if the response is local. - */ - public boolean isLocal(){ - return true; - } - - private ReplyMessage reply; - private IOR ior; // forwarded IOR -} diff --git a/corba/src/share/classes/com/sun/corba/se/impl/transport/BufferConnectionImpl.sjava b/corba/src/share/classes/com/sun/corba/se/impl/transport/BufferConnectionImpl.sjava deleted file mode 100644 index c54ee9434f1..00000000000 --- a/corba/src/share/classes/com/sun/corba/se/impl/transport/BufferConnectionImpl.sjava +++ /dev/null @@ -1,710 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.transport; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.nio.channels.SelectableChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.SocketChannel; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Collections; -import java.util.Hashtable; -import java.util.HashMap; -import java.util.Map; - -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.DATA_CONVERSION; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.OBJECT_NOT_EXIST; -import org.omg.CORBA.SystemException; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ConnectionCache; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.EventHandler; -import com.sun.corba.se.pept.transport.InboundConnectionCache; -import com.sun.corba.se.pept.transport.OutboundConnectionCache; -import com.sun.corba.se.pept.transport.ResponseWaitingRoom; -import com.sun.corba.se.pept.transport.Selector; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orbutil.threadpool.Work; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.transport.CorbaContactInfo; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom; - -import com.sun.corba.se.impl.encoding.CachedCodeBase; -import com.sun.corba.se.impl.encoding.CDRInputStream_1_0; -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.encoding.CDROutputStream_1_0; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.transport.CorbaResponseWaitingRoomImpl; - -/** - * @author Ken Cavanaugh - */ -public class BufferConnectionImpl - extends - EventHandlerBase - implements - CorbaConnection, - Work -{ - // - // New transport. - // - - protected long enqueueTime; - - public SocketChannel getSocketChannel() - { - return null; - } - - // REVISIT: - // protected for test: genericRPCMSGFramework.IIOPConnection constructor. - - // - // From iiop.Connection.java - // - - protected long timeStamp = 0; - protected boolean isServer = false; - - // Start at some value other than zero since this is a magic - // value in some protocols. - protected int requestId = 5; - protected CorbaResponseWaitingRoom responseWaitingRoom; - protected int state; - protected java.lang.Object stateEvent = new java.lang.Object(); - protected java.lang.Object writeEvent = new java.lang.Object(); - protected boolean writeLocked; - protected int serverRequestCount = 0; - - // Server request map: used on the server side of Connection - // Maps request ID to IIOPInputStream. - Map serverRequestMap = new HashMap() ; - - // This is a flag associated per connection telling us if the - // initial set of sending contexts were sent to the receiver - // already... - protected boolean postInitialContexts = false; - - // Remote reference to CodeBase server (supplies - // FullValueDescription, among other things) - protected IOR codeBaseServerIOR; - - // CodeBase cache for this connection. This will cache remote operations, - // handle connecting, and ensure we don't do any remote operations until - // necessary. - protected CachedCodeBase cachedCodeBase = new CachedCodeBase(this); - - protected ORBUtilSystemException wrapper ; - - List buffers ; - - public BufferConnectionImpl(ORB orb, byte[][] data ) - { - this.orb = orb; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_TRANSPORT ) ; - buffers = new ArrayList() ; - } - - //////////////////////////////////////////////////// - // - // framework.transport.Connection - // - - public boolean shouldRegisterReadEvent() - { - return false; - } - - public boolean shouldRegisterServerReadEvent() - { - return false; - } - - public boolean read() - { - return true ; - } - - protected CorbaMessageMediator readBits() - { - return null ; - } - - protected boolean dispatch(CorbaMessageMediator messageMediator) - { - } - - public boolean shouldUseDirectByteBuffers() - { - return false ; - } - - // Only called from readGIOPMessage with (12, 0, 12) as arguments - // size is size of buffer to create - // offset is offset from start of message in buffer - // length is length to read - public ByteBuffer read(int size, int offset, int length) - throws IOException - { - byte[] buf = new byte[size]; - readFully( buf, offset, length); - ByteBuffer byteBuffer = ByteBuffer.wrap(buf); - byteBuffer.limit(size); - return byteBuffer; - } - - // Only called as read( buf, 12, msgsize-12 ) in readGIOPMessage - // We can ignore the byteBuffer parameter - // offset is the starting position to place data in the result - // length is the length of the data to read - public ByteBuffer read(ByteBuffer byteBuffer, int offset, int length) - throws IOException - { - int size = offset + length; - byte[] buf = new byte[size]; - readFully(buf, offset, length); - return ByteBuffer.wrap(buf); - } - - // Read size bytes from buffer list and place the data - // starting at offset in buf. - public void readFully(byte[] buf, int offset, int size) - throws IOException - { - int remaining = size ; - int position = offset ; - while (remaining > 0) { - ByteBuffer buff = (ByteBuffer)buffers.get(0) ; - int dataSize = buff.remaining() ; - int xferSize = dataSize ; - if (dataSize >= remaining) : - xferSize = remaining ; - buffers.remove(0) ; - } - - buff.get( buf, offset, xferSize ) ; - - offset += xferSize ; - remaining -= xferSize ; - } - } - - public void write(ByteBuffer byteBuffer) - throws IOException - { - buffers.add( byteBuffer ) ; - } - - /** - * Note:it is possible for this to be called more than once - */ - public synchronized void close() - { - } - - public Acceptor getAcceptor() - { - return null; - } - - public ContactInfo getContactInfo() - { - return null; - } - - public EventHandler getEventHandler() - { - return this; - } - - public OutputObject createOutputObject(MessageMediator messageMediator) - { - // REVISIT - remove this method from Connection and all it subclasses. - throw new RuntimeException("*****SocketOrChannelConnectionImpl.createOutputObject - should not be called."); - } - - // This is used by the GIOPOutputObject in order to - // throw the correct error when handling code sets. - // Can we determine if we are on the server side by - // other means? XREVISIT - public boolean isServer() - { - return isServer; - } - - public boolean isBusy() - { - return false ; - } - - public long getTimeStamp() - { - return timeStamp; - } - - public void setTimeStamp(long time) - { - timeStamp = time; - } - - public void setState(String stateString) - { - synchronized (stateEvent) { - if (stateString.equals("ESTABLISHED")) { - state = ESTABLISHED; - stateEvent.notifyAll(); - } else { - // REVISIT: ASSERT - } - } - } - - public void writeLock() - { - } - - public void writeUnlock() - { - } - - public void sendWithoutLock(OutputObject outputObject) - { - } - - public void registerWaiter(MessageMediator messageMediator) - { - } - - public void unregisterWaiter(MessageMediator messageMediator) - { - } - - public InputObject waitForResponse(MessageMediator messageMediator) - { - return null ; - } - - public void setConnectionCache(ConnectionCache connectionCache) - { - } - - public ConnectionCache getConnectionCache() - { - return null; - } - - //////////////////////////////////////////////////// - // - // EventHandler methods - // - - public SelectableChannel getChannel() - { - return null; - } - - public int getInterestOps() - { - return null; - } - - // public Acceptor getAcceptor() - already defined above. - - public Connection getConnection() - { - return this; - } - - //////////////////////////////////////////////////// - // - // Work methods. - // - - public String getName() - { - return this.toString(); - } - - public void doWork() - { - } - - public void setEnqueueTime(long timeInMillis) - { - enqueueTime = timeInMillis; - } - - public long getEnqueueTime() - { - return enqueueTime; - } - - //////////////////////////////////////////////////// - // - // spi.transport.CorbaConnection. - // - - public ResponseWaitingRoom getResponseWaitingRoom() - { - return null ; - } - - // REVISIT - inteface defines isServer but already defined in - // higher interface. - - - public void serverRequestMapPut(int requestId, - CorbaMessageMediator messageMediator) - { - serverRequestMap.put(new Integer(requestId), messageMediator); - } - - public CorbaMessageMediator serverRequestMapGet(int requestId) - { - return (CorbaMessageMediator) - serverRequestMap.get(new Integer(requestId)); - } - - public void serverRequestMapRemove(int requestId) - { - serverRequestMap.remove(new Integer(requestId)); - } - - - // REVISIT: this is also defined in: - // com.sun.corba.se.spi.legacy.connection.Connection - public java.net.Socket getSocket() - { - return null; - } - - /** It is possible for a Close Connection to have been - ** sent here, but we will not check for this. A "lazy" - ** Exception will be thrown in the Worker thread after the - ** incoming request has been processed even though the connection - ** is closed before the request is processed. This is o.k because - ** it is a boundary condition. To prevent it we would have to add - ** more locks which would reduce performance in the normal case. - **/ - public synchronized void serverRequestProcessingBegins() - { - serverRequestCount++; - } - - public synchronized void serverRequestProcessingEnds() - { - serverRequestCount--; - } - - // - // - // - - public synchronized int getNextRequestId() - { - return requestId++; - } - - // Negotiated code sets for char and wchar data - protected CodeSetComponentInfo.CodeSetContext codeSetContext = null; - - public ORB getBroker() - { - return orb; - } - - public CodeSetComponentInfo.CodeSetContext getCodeSetContext() - { - // Needs to be synchronized for the following case when the client - // doesn't send the code set context twice, and we have two threads - // in ServerRequestDispatcher processCodeSetContext. - // - // Thread A checks to see if there is a context, there is none, so - // it calls setCodeSetContext, getting the synch lock. - // Thread B checks to see if there is a context. If we didn't synch, - // it might decide to outlaw wchar/wstring. - if (codeSetContext == null) { - synchronized(this) { - return codeSetContext; - } - } - - return codeSetContext; - } - - public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) { - // Double check whether or not we need to do this - if (codeSetContext == null) { - - if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null || - OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) { - // If the client says it's negotiated a code set that - // isn't a fallback and we never said we support, then - // it has a bug. - throw wrapper.badCodesetsFromClient() ; - } - - codeSetContext = csc; - } - } - - // - // from iiop.IIOPConnection.java - // - - // Map request ID to an InputObject. - // This is so the client thread can start unmarshaling - // the reply and remove it from the out_calls map while the - // ReaderThread can still obtain the input stream to give - // new fragments. Only the ReaderThread touches the clientReplyMap, - // so it doesn't incur synchronization overhead. - - public MessageMediator clientRequestMapGet(int requestId) - { - return null ; - } - - protected MessageMediator clientReply_1_1; - - public void clientReply_1_1_Put(MessageMediator x) - { - clientReply_1_1 = x; - } - - public MessageMediator clientReply_1_1_Get() - { - return clientReply_1_1; - } - - public void clientReply_1_1_Remove() - { - clientReply_1_1 = null; - } - - protected MessageMediator serverRequest_1_1; - - public void serverRequest_1_1_Put(MessageMediator x) - { - serverRequest_1_1 = x; - } - - public MessageMediator serverRequest_1_1_Get() - { - return serverRequest_1_1; - } - - public void serverRequest_1_1_Remove() - { - serverRequest_1_1 = null; - } - - protected String getStateString( int state ) - { - synchronized ( stateEvent ){ - switch (state) { - case OPENING : return "OPENING" ; - case ESTABLISHED : return "ESTABLISHED" ; - case CLOSE_SENT : return "CLOSE_SENT" ; - case CLOSE_RECVD : return "CLOSE_RECVD" ; - case ABORT : return "ABORT" ; - default : return "???" ; - } - } - } - - public synchronized boolean isPostInitialContexts() { - return postInitialContexts; - } - - // Can never be unset... - public synchronized void setPostInitialContexts(){ - postInitialContexts = true; - } - - /** - * Wake up the outstanding requests on the connection, and hand them - * COMM_FAILURE exception with a given minor code. - * - * Also, delete connection from connection table and - * stop the reader thread. - - * Note that this should only ever be called by the Reader thread for - * this connection. - * - * @param minor_code The minor code for the COMM_FAILURE major code. - * @param die Kill the reader thread (this thread) before exiting. - */ - public void purgeCalls(SystemException systemException, - boolean die, boolean lockHeld) - { - } - - /************************************************************************* - * The following methods are for dealing with Connection cleaning for - * better scalability of servers in high network load conditions. - **************************************************************************/ - - public void sendCloseConnection(GIOPVersion giopVersion) - throws IOException - { - Message msg = MessageBase.createCloseConnection(giopVersion); - sendHelper(giopVersion, msg); - } - - public void sendMessageError(GIOPVersion giopVersion) - throws IOException - { - Message msg = MessageBase.createMessageError(giopVersion); - sendHelper(giopVersion, msg); - } - - /** - * Send a CancelRequest message. This does not lock the connection, so the - * caller needs to ensure this method is called appropriately. - * @exception IOException - could be due to abortive connection closure. - */ - public void sendCancelRequest(GIOPVersion giopVersion, int requestId) - throws IOException - { - - Message msg = MessageBase.createCancelRequest(giopVersion, requestId); - sendHelper(giopVersion, msg); - } - - protected void sendHelper(GIOPVersion giopVersion, Message msg) - throws IOException - { - // REVISIT: See comments in CDROutputObject constructor. - CDROutputObject outputObject = - new CDROutputObject((ORB)orb, null, giopVersion, this, msg, - ORBConstants.STREAM_FORMAT_VERSION_1); - msg.write(outputObject); - - outputObject.writeTo(this); - } - - public void sendCancelRequestWithLock(GIOPVersion giopVersion, - int requestId) - throws IOException - { - writeLock(); - try { - sendCancelRequest(giopVersion, requestId); - } finally { - writeUnlock(); - } - } - - // Begin Code Base methods --------------------------------------- - // - // Set this connection's code base IOR. The IOR comes from the - // SendingContext. This is an optional service context, but all - // JavaSoft ORBs send it. - // - // The set and get methods don't need to be synchronized since the - // first possible get would occur during reading a valuetype, and - // that would be after the set. - - // Sets this connection's code base IOR. This is done after - // getting the IOR out of the SendingContext service context. - // Our ORBs always send this, but it's optional in CORBA. - - public final void setCodeBaseIOR(IOR ior) { - codeBaseServerIOR = ior; - } - - public final IOR getCodeBaseIOR() { - return codeBaseServerIOR; - } - - // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase - // won't connect to the remote codebase unless it's necessary. - public final CodeBase getCodeBase() { - return cachedCodeBase; - } - - // End Code Base methods ----------------------------------------- - - // Can be overridden in subclass for different options. - protected void setSocketOptions(Socket socket) - { - } - - public String toString() - { - synchronized ( stateEvent ){ - return - "BufferConnectionImpl[" + " " - + getStateString( state ) + " " - + shouldUseSelectThreadToWait() + " " - + shouldUseWorkerThreadForEvent() - + "]" ; - } - } - - // Must be public - used in encoding. - public void dprint(String msg) - { - ORBUtility.dprint("SocketOrChannelConnectionImpl", msg); - } - - protected void dprint(String msg, Throwable t) - { - dprint(msg); - t.printStackTrace(System.out); - } -} - -// End of file. diff --git a/hotspot/.hgtags b/hotspot/.hgtags index c802f848b65..b58c3218710 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -363,3 +363,9 @@ c9dd82da51ed34a28f7c6b3245163ee962e94572 hs25-b40 9f71e36a471ae4a668e08827d33035963ed10c08 hs25-b42 5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100 46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43 +f6921c876db192bba389cec062855a66372da01c jdk8-b101 +530fe88b3b2c710f42810b3580d86a0d83ad6c1c hs25-b44 +c4697c1c448416108743b59118b4a2498b339d0c jdk8-b102 +7f55137d6aa81efc6eb0035813709f2cb6a26b8b hs25-b45 +6f9be7f87b9653e94fd8fb3070891a0cc91b15bf jdk8-b103 +580430d131ccd475e2f2ad4006531b8c4813d102 hs25-b46 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java index dd800a49bc4..dbf09b29119 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java @@ -29,11 +29,10 @@ public interface JVMTIThreadState { public static final int JVMTI_THREAD_STATE_ALIVE = 0x0001; public static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002; public static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004; - public static final int JVMTI_THREAD_STATE_WAITING = 0x0008; + public static final int JVMTI_THREAD_STATE_WAITING = 0x0080; public static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010; public static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020; public static final int JVMTI_THREAD_STATE_SLEEPING = 0x0040; - public static final int JVMTI_THREAD_STATE_WAITING_FOR_NOTIFICATION = 0x0080; public static final int JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100; public static final int JVMTI_THREAD_STATE_PARKED = 0x0200; public static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400; 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 2530f1af7a7..66344b553f6 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 @@ -44,7 +44,7 @@ public class PhaseCFG extends Phase { Type type = db.lookupType("PhaseCFG"); numBlocksField = new CIntField(type.getCIntegerField("_num_blocks"), 0); blocksField = type.getAddressField("_blocks"); - bbsField = type.getAddressField("_bbs"); + bbsField = type.getAddressField("_node_to_block_mapping"); brootField = type.getAddressField("_broot"); } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java index fb17c53d329..226a1762570 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java @@ -32,7 +32,7 @@ import sun.jvm.hotspot.types.*; // to the sys_thread_t structure of the classic JVM implementation. public class OSThread extends VMObject { private static JIntField interruptedField; - private static JIntField threadIdField; + private static Field threadIdField; static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { @@ -44,7 +44,7 @@ public class OSThread extends VMObject { private static synchronized void initialize(TypeDataBase db) { Type type = db.lookupType("OSThread"); interruptedField = type.getJIntField("_interrupted"); - threadIdField = type.getJIntField("_thread_id"); + threadIdField = type.getField("_thread_id"); } public OSThread(Address addr) { @@ -56,7 +56,7 @@ public class OSThread extends VMObject { } public int threadId() { - return (int)threadIdField.getValue(addr); + return threadIdField.getJInt(addr); } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java index 96817b26226..418bef9a086 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,23 +74,24 @@ public class ClassDump extends Tool { public void run() { // Ready to go with the database... try { - // The name of the filter always comes from a System property. - // If we have a pkgList, pass it, otherwise let the filter read - // its own System property for the list of classes. - String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter", - "sun.jvm.hotspot.tools.jcore.PackageNameFilter"); - try { - Class filterClass = Class.forName(filterClassName); - if (pkgList == null) { - classFilter = (ClassFilter) filterClass.newInstance(); - } else { - Constructor con = filterClass.getConstructor(String.class); - classFilter = (ClassFilter) con.newInstance(pkgList); + if (classFilter == null) { + // If not already set, the name of the filter comes from a System property. + // If we have a pkgList, pass it, otherwise let the filter read + // its own System property for the list of classes. + String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter", + "sun.jvm.hotspot.tools.jcore.PackageNameFilter"); + try { + Class filterClass = Class.forName(filterClassName); + if (pkgList == null) { + classFilter = (ClassFilter) filterClass.newInstance(); + } else { + Constructor con = filterClass.getConstructor(String.class); + classFilter = (ClassFilter) con.newInstance(pkgList); + } + } catch(Exception exp) { + System.err.println("Warning: Can not create class filter!"); } - } catch(Exception exp) { - System.err.println("Warning: Can not create class filter!"); } - String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", "."); setOutputDirectory(outputDirectory); diff --git a/hotspot/make/bsd/makefiles/adlc.make b/hotspot/make/bsd/makefiles/adlc.make index 826d256b9eb..cf5c05e2ac7 100644 --- a/hotspot/make/bsd/makefiles/adlc.make +++ b/hotspot/make/bsd/makefiles/adlc.make @@ -41,13 +41,11 @@ SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad ifeq ("${Platform_arch_model}", "${Platform_arch}") SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad) + $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) else SOURCES.AD = \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad) + $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) endif EXEC = $(OUTDIR)/adlc diff --git a/hotspot/make/bsd/makefiles/minimal1.make b/hotspot/make/bsd/makefiles/minimal1.make index 42d794ab747..d045db79099 100644 --- a/hotspot/make/bsd/makefiles/minimal1.make +++ b/hotspot/make/bsd/makefiles/minimal1.make @@ -24,16 +24,20 @@ TYPE=MINIMAL1 -INCLUDE_JVMTI ?= false -INCLUDE_FPROF ?= false -INCLUDE_VM_STRUCTS ?= false -INCLUDE_JNI_CHECK ?= false -INCLUDE_SERVICES ?= false -INCLUDE_MANAGEMENT ?= false -INCLUDE_ALL_GCS ?= false -INCLUDE_NMT ?= false -INCLUDE_TRACE ?= false -INCLUDE_CDS ?= false +# Force all variables to false, overriding any other +# setting that may have occurred in the makefiles. These +# can still be overridden by passing the variable as an +# argument to 'make' +INCLUDE_JVMTI := false +INCLUDE_FPROF := false +INCLUDE_VM_STRUCTS := false +INCLUDE_JNI_CHECK := false +INCLUDE_SERVICES := false +INCLUDE_MANAGEMENT := false +INCLUDE_ALL_GCS := false +INCLUDE_NMT := false +INCLUDE_TRACE := false +INCLUDE_CDS := false CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index b373e5fb0f6..2ec3b0aaf52 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013 HS_MAJOR_VER=25 HS_MINOR_VER=0 -HS_BUILD_NUMBER=43 +HS_BUILD_NUMBER=46 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make index 25ace2f5f76..7b808d9b2ae 100644 --- a/hotspot/make/linux/makefiles/adlc.make +++ b/hotspot/make/linux/makefiles/adlc.make @@ -41,13 +41,11 @@ SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad ifeq ("${Platform_arch_model}", "${Platform_arch}") SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad) + $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) else SOURCES.AD = \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad) + $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) endif EXEC = $(OUTDIR)/adlc diff --git a/hotspot/make/linux/makefiles/minimal1.make b/hotspot/make/linux/makefiles/minimal1.make index 42d794ab747..d045db79099 100644 --- a/hotspot/make/linux/makefiles/minimal1.make +++ b/hotspot/make/linux/makefiles/minimal1.make @@ -24,16 +24,20 @@ TYPE=MINIMAL1 -INCLUDE_JVMTI ?= false -INCLUDE_FPROF ?= false -INCLUDE_VM_STRUCTS ?= false -INCLUDE_JNI_CHECK ?= false -INCLUDE_SERVICES ?= false -INCLUDE_MANAGEMENT ?= false -INCLUDE_ALL_GCS ?= false -INCLUDE_NMT ?= false -INCLUDE_TRACE ?= false -INCLUDE_CDS ?= false +# Force all variables to false, overriding any other +# setting that may have occurred in the makefiles. These +# can still be overridden by passing the variable as an +# argument to 'make' +INCLUDE_JVMTI := false +INCLUDE_FPROF := false +INCLUDE_VM_STRUCTS := false +INCLUDE_JNI_CHECK := false +INCLUDE_SERVICES := false +INCLUDE_MANAGEMENT := false +INCLUDE_ALL_GCS := false +INCLUDE_NMT := false +INCLUDE_TRACE := false +INCLUDE_CDS := false CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" diff --git a/hotspot/make/solaris/makefiles/adlc.make b/hotspot/make/solaris/makefiles/adlc.make index 750bd8319bf..642a7ca6136 100644 --- a/hotspot/make/solaris/makefiles/adlc.make +++ b/hotspot/make/solaris/makefiles/adlc.make @@ -42,13 +42,11 @@ SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad ifeq ("${Platform_arch_model}", "${Platform_arch}") SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad) + $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) else SOURCES.AD = \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad) + $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) endif EXEC = $(OUTDIR)/adlc diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make index b57365b93dc..48f9b295b73 100644 --- a/hotspot/make/solaris/makefiles/dtrace.make +++ b/hotspot/make/solaris/makefiles/dtrace.make @@ -283,9 +283,9 @@ $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files) $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \ $(DTraced_Files) ||\ STATUS=$$?;\ - if [ x"$$STATUS" = x"1" -a \ - x`uname -r` = x"5.10" -a \ - x`uname -p` = x"sparc" ]; then\ + if [ x"$$STATUS" = x"1" ]; then \ + if [ x`uname -r` = x"5.10" -a \ + x`uname -p` = x"sparc" ]; then\ echo "*****************************************************************";\ echo "* If you are building server compiler, and the error message is ";\ echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\ @@ -294,6 +294,20 @@ $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files) echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ echo "* dtrace probes for this build.";\ echo "*****************************************************************";\ + elif [ x`uname -r` = x"5.10" ]; then\ + echo "*****************************************************************";\ + echo "* If you are seeing 'syntax error near \"umpiconninfo_t\"' on Solaris";\ + echo "* 10, try doing 'cd /usr/lib/dtrace && gzip mpi.d' as root, ";\ + echo "* or set the environment variable HOTSPOT_DISABLE_DTRACE_PROBES";\ + echo "* to disable dtrace probes for this build.";\ + echo "*****************************************************************";\ + else \ + echo "*****************************************************************";\ + echo "* If you cannot fix dtrace build issues, try to ";\ + echo "* set the environment variable HOTSPOT_DISABLE_DTRACE_PROBES";\ + echo "* to disable dtrace probes for this build.";\ + echo "*****************************************************************";\ + fi; \ fi;\ exit $$STATUS # Since some DTraced_Files are in LIBJVM.o and they are touched by this diff --git a/hotspot/make/windows/create.bat b/hotspot/make/windows/create.bat index 16602c8ea90..6e72fa9c9e9 100644 --- a/hotspot/make/windows/create.bat +++ b/hotspot/make/windows/create.bat @@ -1,6 +1,6 @@ @echo off REM -REM Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. +REM Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. REM REM This code is free software; you can redistribute it and/or modify it @@ -148,7 +148,7 @@ echo HotSpotJDKDist=%HotSpotJDKDist% REM This is now safe to do. :copyfiles -for /D %%i in (compiler1, compiler2, tiered, core) do ( +for /D %%i in (compiler1, compiler2, tiered ) do ( if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL ) @@ -156,7 +156,7 @@ copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\ REM force regneration of ProjectFile if exist %ProjectFile% del %ProjectFile% -for /D %%i in (compiler1, compiler2, tiered, core) do ( +for /D %%i in (compiler1, compiler2, tiered ) do ( echo -- %%i -- echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make diff --git a/hotspot/make/windows/create_obj_files.sh b/hotspot/make/windows/create_obj_files.sh index b162bd07b60..c17b0690e17 100644 --- a/hotspot/make/windows/create_obj_files.sh +++ b/hotspot/make/windows/create_obj_files.sh @@ -73,19 +73,17 @@ done BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles ${GENERATED}/tracefiles" -if [ -d "${ALTSRC}/share/vm/jfr" ]; then - BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr" +if [ -d "${ALTSRC}/share/vm/jfr/buffers" ]; then BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/buffers" fi BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/share/vm/prims/wbtestmethods" -CORE_PATHS="${BASE_PATHS}" # shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS. if [ -d "${ALTSRC}/share/vm/gc_implementation" ]; then - CORE_PATHS="${CORE_PATHS} `$FIND ${ALTSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" + BASE_PATHS="${BASE_PATHS} `$FIND ${ALTSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" fi -CORE_PATHS="${CORE_PATHS} `$FIND ${COMMONSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" +BASE_PATHS="${BASE_PATHS} `$FIND ${COMMONSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" if [ -d "${ALTSRC}/share/vm/c1" ]; then COMPILER1_PATHS="${ALTSRC}/share/vm/c1" @@ -104,12 +102,11 @@ COMPILER2_PATHS="${COMPILER2_PATHS} ${GENERATED}/adfiles" # Include dirs per type. case "${TYPE}" in - "core") Src_Dirs="${CORE_PATHS}" ;; - "compiler1") Src_Dirs="${CORE_PATHS} ${COMPILER1_PATHS}" ;; - "compiler2") Src_Dirs="${CORE_PATHS} ${COMPILER2_PATHS}" ;; - "tiered") Src_Dirs="${CORE_PATHS} ${COMPILER1_PATHS} ${COMPILER2_PATHS}" ;; - "zero") Src_Dirs="${CORE_PATHS}" ;; - "shark") Src_Dirs="${CORE_PATHS}" ;; + "compiler1") Src_Dirs="${BASE_PATHS} ${COMPILER1_PATHS}" ;; + "compiler2") Src_Dirs="${BASE_PATHS} ${COMPILER2_PATHS}" ;; + "tiered") Src_Dirs="${BASE_PATHS} ${COMPILER1_PATHS} ${COMPILER2_PATHS}" ;; + "zero") Src_Dirs="${BASE_PATHS}" ;; + "shark") Src_Dirs="${BASE_PATHS}" ;; esac COMPILER2_SPECIFIC_FILES="opto libadt bcEscapeAnalyzer.cpp c2_* runtime_*" @@ -122,7 +119,6 @@ Src_Files_EXCLUDE="jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp" # Exclude per type. case "${TYPE}" in - "core") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${COMPILER2_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;; "compiler1") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER2_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;; "compiler2") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;; "tiered") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;; @@ -149,9 +145,17 @@ for e in ${Src_Dirs}; do Src_Files="${Src_Files}`findsrc ${e}` " done -Obj_Files= +Obj_Files=" " for e in ${Src_Files}; do - Obj_Files="${Obj_Files}${e%\.[!.]*}.obj " + o="${e%\.[!.]*}.obj" + set +e + chk=`expr "${Obj_Files}" : ".* $o"` + set -e + if [ "$chk" != 0 ]; then + echo "# INFO: skipping duplicate $o" + continue + fi + Obj_Files="${Obj_Files}$o " done echo Obj_Files=${Obj_Files} diff --git a/hotspot/make/windows/makefiles/adlc.make b/hotspot/make/windows/makefiles/adlc.make index f320d4e932d..7bcaef718fd 100644 --- a/hotspot/make/windows/makefiles/adlc.make +++ b/hotspot/make/windows/makefiles/adlc.make @@ -55,13 +55,11 @@ CXX_INCLUDE_DIRS=\ !if "$(Platform_arch_model)" == "$(Platform_arch)" SOURCES_AD=\ - $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad \ - $(WorkSpace)/src/os_cpu/windows_$(Platform_arch)/vm/windows_$(Platform_arch_model).ad + $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad !else SOURCES_AD=\ $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad \ - $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch).ad \ - $(WorkSpace)/src/os_cpu/windows_$(Platform_arch)/vm/windows_$(Platform_arch_model).ad + $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch).ad !endif # NOTE! If you add any files here, you must also update GENERATED_NAMES_IN_DIR diff --git a/hotspot/make/windows/makefiles/projectcreator.make b/hotspot/make/windows/makefiles/projectcreator.make index 7aa3ef65cad..a5336c6bf51 100644 --- a/hotspot/make/windows/makefiles/projectcreator.make +++ b/hotspot/make/windows/makefiles/projectcreator.make @@ -44,10 +44,11 @@ ProjectCreatorSources=\ # This is only used internally ProjectCreatorIncludesPRIVATE=\ - -relativeInclude src\closed\share\vm \ - -relativeInclude src\closed\os\windows\vm \ - -relativeInclude src\closed\os_cpu\windows_$(Platform_arch)\vm \ - -relativeInclude src\closed\cpu\$(Platform_arch)\vm \ + -relativeAltSrcInclude src\closed \ + -altRelativeInclude share\vm \ + -altRelativeInclude os\windows\vm \ + -altRelativeInclude os_cpu\windows_$(Platform_arch)\vm \ + -altRelativeInclude cpu\$(Platform_arch)\vm \ -relativeInclude src\share\vm \ -relativeInclude src\share\vm\precompiled \ -relativeInclude src\share\vm\prims\wbtestmethods \ @@ -91,7 +92,7 @@ ProjectCreatorIDEOptions = \ -disablePch getThread_windows_$(Platform_arch).cpp \ -disablePch_compiler2 opcodes.cpp -# Common options for the IDE builds for core, c1, and c2 +# Common options for the IDE builds for c1, and c2 ProjectCreatorIDEOptions=\ $(ProjectCreatorIDEOptions) \ -sourceBase $(HOTSPOTWORKSPACE) \ @@ -157,19 +158,11 @@ ProjectCreatorIDEOptionsIgnoreCompiler2=\ -ignoreFile_TARGET ciTypeFlow.hpp \ -ignoreFile_TARGET $(Platform_arch_model).ad -################################################## -# Without compiler(core) specific options -################################################## -ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ -$(ProjectCreatorIDEOptionsIgnoreCompiler1:TARGET=core) \ -$(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=core) - ################################################## # Client(C1) compiler specific options ################################################## ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ -define_compiler1 COMPILER1 \ - -ignorePath_compiler1 core \ $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1) ################################################## @@ -178,7 +171,6 @@ $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1) #NOTE! This list must be kept in sync with GENERATED_NAMES in adlc.make. ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ -define_compiler2 COMPILER2 \ - -ignorePath_compiler2 core \ -additionalFile_compiler2 $(Platform_arch_model).ad \ -additionalFile_compiler2 ad_$(Platform_arch_model).cpp \ -additionalFile_compiler2 ad_$(Platform_arch_model).hpp \ diff --git a/hotspot/make/windows/makefiles/trace.make b/hotspot/make/windows/makefiles/trace.make index 82422b173cf..02948c0a8d0 100644 --- a/hotspot/make/windows/makefiles/trace.make +++ b/hotspot/make/windows/makefiles/trace.make @@ -90,25 +90,25 @@ $(TraceOutDir)/traceTypes.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceType !if "$(OPENJDK)" == "true" $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS) - @echo Generating $@ + @echo Generating OpenJDK $@ @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp !else $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS) - @echo Generating $@ + @echo Generating AltSrc $@ @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp $(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS) - @echo Generating $@ + @echo Generating AltSrc $@ @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceProducer.xsl -OUT $(TraceOutDir)/traceProducer.cpp $(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS) - @echo Generating $@ + @echo Generating AltSrc $@ @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceRequestables.xsl -OUT $(TraceOutDir)/traceRequestables.hpp $(TraceOutDir)/traceEventControl.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS) - @echo Generating $@ + @echo Generating AltSrc $@ @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventControl.xsl -OUT $(TraceOutDir)/traceEventControl.hpp !endif diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make index b76443774de..8b5e23d4a28 100644 --- a/hotspot/make/windows/makefiles/vm.make +++ b/hotspot/make/windows/makefiles/vm.make @@ -36,10 +36,6 @@ CXX_FLAGS=$(CXX_FLAGS) /D "PRODUCT" CXX_FLAGS=$(CXX_FLAGS) /D "ASSERT" !endif -!if "$(Variant)" == "core" -# No need to define anything, CORE is defined as !COMPILER1 && !COMPILER2 -!endif - !if "$(Variant)" == "compiler1" CXX_FLAGS=$(CXX_FLAGS) /D "COMPILER1" !endif diff --git a/hotspot/make/windows/projectfiles/common/Makefile b/hotspot/make/windows/projectfiles/common/Makefile index 8ae363be7d5..0bc4fb182ec 100644 --- a/hotspot/make/windows/projectfiles/common/Makefile +++ b/hotspot/make/windows/projectfiles/common/Makefile @@ -112,6 +112,7 @@ ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -def ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions) $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class + @if "$(MSC_VER)"=="1500" echo Make sure you have VS2008 SP1 or later, or you may see 'expanded command line too long' @$(RUN_JAVA) -Djava.class.path="$(HOTSPOTBUILDSPACE)/classes" ProjectCreator WinGammaPlatform$(VcVersion) $(ProjectCreatorIDEOptions) clean: diff --git a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp index e32094deb06..093be806072 100644 --- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp @@ -42,7 +42,7 @@ define_pd_global(bool, ProfileInterpreter, false); #else define_pd_global(bool, ProfileInterpreter, true); #endif // CC_INTERP -define_pd_global(bool, TieredCompilation, false); +define_pd_global(bool, TieredCompilation, trueInTiered); define_pd_global(intx, CompileThreshold, 10000); define_pd_global(intx, BackEdgeThreshold, 140000); diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp index 7b9a494dff0..b6f8a5a5d1a 100644 --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp @@ -1887,6 +1887,27 @@ void TemplateInterpreterGenerator::generate_throw_exception() { if (ProfileInterpreter) { __ set_method_data_pointer_for_bcp(); } + +#if INCLUDE_JVMTI + if (EnableInvokeDynamic) { + Label L_done; + + __ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode + __ cmp_and_br_short(G1_scratch, Bytecodes::_invokestatic, Assembler::notEqual, Assembler::pn, L_done); + + // The member name argument must be restored if _invokestatic is re-executed after a PopFrame call. + // Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL. + + __ call_VM(G1_scratch, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), I0, Lmethod, Lbcp); + + __ br_null(G1_scratch, false, Assembler::pn, L_done); + __ delayed()->nop(); + + __ st_ptr(G1_scratch, Lesp, wordSize); + __ bind(L_done); + } +#endif // INCLUDE_JVMTI + // Resume bytecode interpretation at the current bcp __ dispatch_next(vtos); // end of JVMTI PopFrame support diff --git a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp index ce92123e818..d49bec21fe7 100644 --- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp @@ -44,7 +44,7 @@ define_pd_global(bool, ProfileInterpreter, false); #else define_pd_global(bool, ProfileInterpreter, true); #endif // CC_INTERP -define_pd_global(bool, TieredCompilation, false); +define_pd_global(bool, TieredCompilation, trueInTiered); define_pd_global(intx, CompileThreshold, 10000); define_pd_global(intx, BackEdgeThreshold, 100000); diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp index 2efa59f8b33..52e459900c7 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp @@ -1920,6 +1920,29 @@ void TemplateInterpreterGenerator::generate_throw_exception() { __ get_thread(thread); __ movl(Address(thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive); +#if INCLUDE_JVMTI + if (EnableInvokeDynamic) { + Label L_done; + const Register local0 = rdi; + + __ cmpb(Address(rsi, 0), Bytecodes::_invokestatic); + __ jcc(Assembler::notEqual, L_done); + + // The member name argument must be restored if _invokestatic is re-executed after a PopFrame call. + // Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL. + + __ get_method(rdx); + __ movptr(rax, Address(local0, 0)); + __ call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), rax, rdx, rsi); + + __ testptr(rax, rax); + __ jcc(Assembler::zero, L_done); + + __ movptr(Address(rbx, 0), rax); + __ bind(L_done); + } +#endif // INCLUDE_JVMTI + __ dispatch_next(vtos); // end of PopFrame support diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp index f0a2258a70e..4ac85c49578 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp @@ -1929,6 +1929,29 @@ void TemplateInterpreterGenerator::generate_throw_exception() { __ movl(Address(r15_thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive); +#if INCLUDE_JVMTI + if (EnableInvokeDynamic) { + Label L_done; + const Register local0 = r14; + + __ cmpb(Address(r13, 0), Bytecodes::_invokestatic); + __ jcc(Assembler::notEqual, L_done); + + // The member name argument must be restored if _invokestatic is re-executed after a PopFrame call. + // Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL. + + __ get_method(rdx); + __ movptr(rax, Address(local0, 0)); + __ call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), rax, rdx, r13); + + __ testptr(rax, rax); + __ jcc(Assembler::zero, L_done); + + __ movptr(Address(rbx, 0), rax); + __ bind(L_done); + } +#endif // INCLUDE_JVMTI + __ dispatch_next(vtos); // end of PopFrame support diff --git a/hotspot/src/cpu/zero/vm/entryFrame_zero.hpp b/hotspot/src/cpu/zero/vm/entryFrame_zero.hpp index 434b11adf1f..97b185c3aab 100644 --- a/hotspot/src/cpu/zero/vm/entryFrame_zero.hpp +++ b/hotspot/src/cpu/zero/vm/entryFrame_zero.hpp @@ -58,8 +58,8 @@ class EntryFrame : public ZeroFrame { JavaCallWrapper* call_wrapper, TRAPS); public: - JavaCallWrapper *call_wrapper() const { - return (JavaCallWrapper *) value_of_word(call_wrapper_off); + JavaCallWrapper **call_wrapper() const { + return (JavaCallWrapper **) addr_of_word(call_wrapper_off); } public: diff --git a/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp b/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp index f6bd6d3c6be..971560cd0d8 100644 --- a/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp +++ b/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp @@ -141,7 +141,7 @@ inline intptr_t* frame::id() const { return fp(); } -inline JavaCallWrapper* frame::entry_frame_call_wrapper() const { +inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const { return zero_entryframe()->call_wrapper(); } diff --git a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp index f1a280bb4b4..1203c315879 100644 --- a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp +++ b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp @@ -176,6 +176,19 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_oop_arraycopy; } + static int SafeFetch32(int *adr, int errValue) { + int value = errValue; + value = *adr; + return value; + } + + static intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) { + intptr_t value = errValue; + value = *adr; + return value; + } + + void generate_initial() { // Generates all stubs and initializes the entry points @@ -225,6 +238,15 @@ class StubGenerator: public StubCodeGenerator { // arraycopy stubs used by compilers generate_arraycopy_stubs(); + + // Safefetch stubs. + StubRoutines::_safefetch32_entry = CAST_FROM_FN_PTR(address, StubGenerator::SafeFetch32); + StubRoutines::_safefetch32_fault_pc = NULL; + StubRoutines::_safefetch32_continuation_pc = NULL; + + StubRoutines::_safefetchN_entry = CAST_FROM_FN_PTR(address, StubGenerator::SafeFetchN); + StubRoutines::_safefetchN_fault_pc = NULL; + StubRoutines::_safefetchN_continuation_pc = NULL; } public: diff --git a/hotspot/src/os/bsd/vm/attachListener_bsd.cpp b/hotspot/src/os/bsd/vm/attachListener_bsd.cpp index 6f128f2543b..4a580b486fc 100644 --- a/hotspot/src/os/bsd/vm/attachListener_bsd.cpp +++ b/hotspot/src/os/bsd/vm/attachListener_bsd.cpp @@ -445,14 +445,14 @@ AttachOperation* AttachListener::dequeue() { void AttachListener::vm_start() { char fn[UNIX_PATH_MAX]; - struct stat64 st; + struct stat st; int ret; int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d", os::get_temp_directory(), os::current_process_id()); assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow"); - RESTARTABLE(::stat64(fn, &st), ret); + RESTARTABLE(::stat(fn, &st), ret); if (ret == 0) { ret = ::unlink(fn); if (ret == -1) { diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 3b44d9a220f..0674e6f3c83 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -1642,6 +1642,8 @@ void os::print_os_info(outputStream* st) { void os::win32::print_windows_version(outputStream* st) { OSVERSIONINFOEX osvi; + SYSTEM_INFO si; + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); @@ -1651,6 +1653,18 @@ void os::win32::print_windows_version(outputStream* st) { } int os_vers = osvi.dwMajorVersion * 1000 + osvi.dwMinorVersion; + + ZeroMemory(&si, sizeof(SYSTEM_INFO)); + if (os_vers >= 5002) { + // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could + // find out whether we are running on 64 bit processor or not. + if (os::Kernel32Dll::GetNativeSystemInfoAvailable()) { + os::Kernel32Dll::GetNativeSystemInfo(&si); + } else { + GetSystemInfo(&si); + } + } + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { switch (os_vers) { case 3051: st->print(" Windows NT 3.51"); break; @@ -1658,57 +1672,48 @@ void os::win32::print_windows_version(outputStream* st) { case 5000: st->print(" Windows 2000"); break; case 5001: st->print(" Windows XP"); break; case 5002: - case 6000: - case 6001: - case 6002: { - // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could - // find out whether we are running on 64 bit processor or not. - SYSTEM_INFO si; - ZeroMemory(&si, sizeof(SYSTEM_INFO)); - if (!os::Kernel32Dll::GetNativeSystemInfoAvailable()){ - GetSystemInfo(&si); + if (osvi.wProductType == VER_NT_WORKSTATION && + si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + st->print(" Windows XP x64 Edition"); } else { - os::Kernel32Dll::GetNativeSystemInfo(&si); - } - if (os_vers == 5002) { - if (osvi.wProductType == VER_NT_WORKSTATION && - si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - st->print(" Windows XP x64 Edition"); - else - st->print(" Windows Server 2003 family"); - } else if (os_vers == 6000) { - if (osvi.wProductType == VER_NT_WORKSTATION) - st->print(" Windows Vista"); - else - st->print(" Windows Server 2008"); - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - st->print(" , 64 bit"); - } else if (os_vers == 6001) { - if (osvi.wProductType == VER_NT_WORKSTATION) { - st->print(" Windows 7"); - } else { - // Unrecognized windows, print out its major and minor versions - st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); - } - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - st->print(" , 64 bit"); - } else if (os_vers == 6002) { - if (osvi.wProductType == VER_NT_WORKSTATION) { - st->print(" Windows 8"); - } else { - st->print(" Windows Server 2012"); - } - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - st->print(" , 64 bit"); - } else { // future os - // Unrecognized windows, print out its major and minor versions - st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); - if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - st->print(" , 64 bit"); + st->print(" Windows Server 2003 family"); } break; - } - default: // future windows, print out its major and minor versions + + case 6000: + if (osvi.wProductType == VER_NT_WORKSTATION) { + st->print(" Windows Vista"); + } else { + st->print(" Windows Server 2008"); + } + break; + + case 6001: + if (osvi.wProductType == VER_NT_WORKSTATION) { + st->print(" Windows 7"); + } else { + st->print(" Windows Server 2008 R2"); + } + break; + + case 6002: + if (osvi.wProductType == VER_NT_WORKSTATION) { + st->print(" Windows 8"); + } else { + st->print(" Windows Server 2012"); + } + break; + + case 6003: + if (osvi.wProductType == VER_NT_WORKSTATION) { + st->print(" Windows 8.1"); + } else { + st->print(" Windows Server 2012 R2"); + } + break; + + default: // future os + // Unrecognized windows, print out its major and minor versions st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); } } else { @@ -1720,6 +1725,11 @@ void os::win32::print_windows_version(outputStream* st) { st->print(" Windows %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); } } + + if (os_vers >= 6000 && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + st->print(" , 64 bit"); + } + st->print(" Build %d", osvi.dwBuildNumber); st->print(" %s", osvi.szCSDVersion); // service pack st->cr(); diff --git a/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.ad b/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.ad deleted file mode 100644 index f58244ea48f..00000000000 --- a/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.ad +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -// -// This code is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License version 2 only, as -// published by the Free Software Foundation. -// -// This code is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// version 2 for more details (a copy is included in the LICENSE file that -// accompanied this code). -// -// You should have received a copy of the GNU General Public License version -// 2 along with this work; if not, write to the Free Software Foundation, -// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -// -// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -// or visit www.oracle.com if you need additional information or have any -// questions. -// -// - -// X86 Bsd Architecture Description File - diff --git a/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.ad b/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.ad deleted file mode 100644 index 254328e0971..00000000000 --- a/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.ad +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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 -// 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. -// -// - -// AMD64 Bsd Architecture Description File - -//----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- -// This block specifies the encoding classes used by the compiler to -// output byte streams. Encoding classes generate functions which are -// called by Machine Instruction Nodes in order to generate the bit -// encoding of the instruction. Operands specify their base encoding -// interface with the interface keyword. There are currently -// supported four interfaces, REG_INTER, CONST_INTER, MEMORY_INTER, & -// COND_INTER. REG_INTER causes an operand to generate a function -// which returns its register number when queried. CONST_INTER causes -// an operand to generate a function which returns the value of the -// constant when queried. MEMORY_INTER causes an operand to generate -// four functions which return the Base Register, the Index Register, -// the Scale Value, and the Offset Value of the operand when queried. -// COND_INTER causes an operand to generate six functions which return -// the encoding code (ie - encoding bits for the instruction) -// associated with each basic boolean condition for a conditional -// instruction. Instructions specify two basic values for encoding. -// They use the ins_encode keyword to specify their encoding class -// (which must be one of the class names specified in the encoding -// block), and they use the opcode keyword to specify, in order, their -// primary, secondary, and tertiary opcode. Only the opcode sections -// which a particular instruction needs for encoding need to be -// specified. -encode %{ - // Build emit functions for each basic byte or larger field in the intel - // encoding scheme (opcode, rm, sib, immediate), and call them from C++ - // code in the enc_class source block. Emit functions will live in the - // main source block for now. In future, we can generalize this by - // adding a syntax that specifies the sizes of fields in an order, - // so that the adlc can build the emit functions automagically - -%} - - -// Platform dependent source - -source %{ - -%} diff --git a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad deleted file mode 100644 index 5e234deaa4f..00000000000 --- a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -// -// This code is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License version 2 only, as -// published by the Free Software Foundation. -// -// This code is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// version 2 for more details (a copy is included in the LICENSE file that -// accompanied this code). -// -// You should have received a copy of the GNU General Public License version -// 2 along with this work; if not, write to the Free Software Foundation, -// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -// -// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -// or visit www.oracle.com if you need additional information or have any -// questions. -// -// - -// X86 Linux Architecture Description File - diff --git a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_64.ad b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_64.ad deleted file mode 100644 index 3b3ac007cd1..00000000000 --- a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_64.ad +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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 -// 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. -// -// - -// AMD64 Linux Architecture Description File - -//----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- -// This block specifies the encoding classes used by the compiler to -// output byte streams. Encoding classes generate functions which are -// called by Machine Instruction Nodes in order to generate the bit -// encoding of the instruction. Operands specify their base encoding -// interface with the interface keyword. There are currently -// supported four interfaces, REG_INTER, CONST_INTER, MEMORY_INTER, & -// COND_INTER. REG_INTER causes an operand to generate a function -// which returns its register number when queried. CONST_INTER causes -// an operand to generate a function which returns the value of the -// constant when queried. MEMORY_INTER causes an operand to generate -// four functions which return the Base Register, the Index Register, -// the Scale Value, and the Offset Value of the operand when queried. -// COND_INTER causes an operand to generate six functions which return -// the encoding code (ie - encoding bits for the instruction) -// associated with each basic boolean condition for a conditional -// instruction. Instructions specify two basic values for encoding. -// They use the ins_encode keyword to specify their encoding class -// (which must be one of the class names specified in the encoding -// block), and they use the opcode keyword to specify, in order, their -// primary, secondary, and tertiary opcode. Only the opcode sections -// which a particular instruction needs for encoding need to be -// specified. -encode %{ - // Build emit functions for each basic byte or larger field in the intel - // encoding scheme (opcode, rm, sib, immediate), and call them from C++ - // code in the enc_class source block. Emit functions will live in the - // main source block for now. In future, we can generalize this by - // adding a syntax that specifies the sizes of fields in an order, - // so that the adlc can build the emit functions automagically - -%} - - -// Platform dependent source - -source %{ - -%} diff --git a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp index de0ba9a6ad5..2618519e2a4 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -410,16 +410,6 @@ extern "C" { int SpinPause() { } - int SafeFetch32(int *adr, int errValue) { - int value = errValue; - value = *adr; - return value; - } - intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) { - intptr_t value = errValue; - value = *adr; - return value; - } void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { if (from > to) { diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.ad b/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.ad deleted file mode 100644 index 7f27d4591b3..00000000000 --- a/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.ad +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. -// 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. -// - -// -// - -// SPARC Solaris Architecture Description File diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad deleted file mode 100644 index 9b95823b844..00000000000 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -// -// This code is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License version 2 only, as -// published by the Free Software Foundation. -// -// This code is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// version 2 for more details (a copy is included in the LICENSE file that -// accompanied this code). -// -// You should have received a copy of the GNU General Public License version -// 2 along with this work; if not, write to the Free Software Foundation, -// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -// -// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -// or visit www.oracle.com if you need additional information or have any -// questions. -// -// - -// X86 Solaris Architecture Description File - diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.ad b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.ad deleted file mode 100644 index f3334952f62..00000000000 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.ad +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) 2004, 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. -// -// - -// AMD64 Solaris Architecture Description File - -//----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- -// This block specifies the encoding classes used by the compiler to -// output byte streams. Encoding classes generate functions which are -// called by Machine Instruction Nodes in order to generate the bit -// encoding of the instruction. Operands specify their base encoding -// interface with the interface keyword. There are currently -// supported four interfaces, REG_INTER, CONST_INTER, MEMORY_INTER, & -// COND_INTER. REG_INTER causes an operand to generate a function -// which returns its register number when queried. CONST_INTER causes -// an operand to generate a function which returns the value of the -// constant when queried. MEMORY_INTER causes an operand to generate -// four functions which return the Base Register, the Index Register, -// the Scale Value, and the Offset Value of the operand when queried. -// COND_INTER causes an operand to generate six functions which return -// the encoding code (ie - encoding bits for the instruction) -// associated with each basic boolean condition for a conditional -// instruction. Instructions specify two basic values for encoding. -// They use the ins_encode keyword to specify their encoding class -// (which must be one of the class names specified in the encoding -// block), and they use the opcode keyword to specify, in order, their -// primary, secondary, and tertiary opcode. Only the opcode sections -// which a particular instruction needs for encoding need to be -// specified. -encode %{ - // Build emit functions for each basic byte or larger field in the intel - // encoding scheme (opcode, rm, sib, immediate), and call them from C++ - // code in the enc_class source block. Emit functions will live in the - // main source block for now. In future, we can generalize this by - // adding a syntax that specifies the sizes of fields in an order, - // so that the adlc can build the emit functions automagically -%} - - -// Platform dependent source - -source %{ -%} diff --git a/hotspot/src/os_cpu/windows_x86/vm/windows_x86_32.ad b/hotspot/src/os_cpu/windows_x86/vm/windows_x86_32.ad deleted file mode 100644 index 27fedf269c5..00000000000 --- a/hotspot/src/os_cpu/windows_x86/vm/windows_x86_32.ad +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -// -// This code is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License version 2 only, as -// published by the Free Software Foundation. -// -// This code is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// version 2 for more details (a copy is included in the LICENSE file that -// accompanied this code). -// -// You should have received a copy of the GNU General Public License version -// 2 along with this work; if not, write to the Free Software Foundation, -// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -// -// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -// or visit www.oracle.com if you need additional information or have any -// questions. -// -// - -// X86 Win32 Architecture Description File - diff --git a/hotspot/src/os_cpu/windows_x86/vm/windows_x86_64.ad b/hotspot/src/os_cpu/windows_x86/vm/windows_x86_64.ad deleted file mode 100644 index 54e183a0bc5..00000000000 --- a/hotspot/src/os_cpu/windows_x86/vm/windows_x86_64.ad +++ /dev/null @@ -1,63 +0,0 @@ -// -// 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 -// 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. -// -// - -// AMD64 Win32 Architecture Description File - -//----------OS-DEPENDENT ENCODING BLOCK----------------------------------------------------- -// This block specifies the encoding classes used by the compiler to output -// byte streams. Encoding classes generate functions which are called by -// Machine Instruction Nodes in order to generate the bit encoding of the -// instruction. Operands specify their base encoding interface with the -// interface keyword. There are currently supported four interfaces, -// REG_INTER, CONST_INTER, MEMORY_INTER, & COND_INTER. REG_INTER causes an -// operand to generate a function which returns its register number when -// queried. CONST_INTER causes an operand to generate a function which -// returns the value of the constant when queried. MEMORY_INTER causes an -// operand to generate four functions which return the Base Register, the -// Index Register, the Scale Value, and the Offset Value of the operand when -// queried. COND_INTER causes an operand to generate six functions which -// return the encoding code (ie - encoding bits for the instruction) -// associated with each basic boolean condition for a conditional instruction. -// Instructions specify two basic values for encoding. They use the -// ins_encode keyword to specify their encoding class (which must be one of -// the class names specified in the encoding block), and they use the -// opcode keyword to specify, in order, their primary, secondary, and -// tertiary opcode. Only the opcode sections which a particular instruction -// needs for encoding need to be specified. -encode %{ - // Build emit functions for each basic byte or larger field in the intel - // encoding scheme (opcode, rm, sib, immediate), and call them from C++ - // code in the enc_class source block. Emit functions will live in the - // main source block for now. In future, we can generalize this by - // adding a syntax that specifies the sizes of fields in an order, - // so that the adlc can build the emit functions automagically - -%} - - -// Platform dependent source - -source %{ - -%} diff --git a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java b/hotspot/src/share/tools/ProjectCreator/BuildConfig.java index a9b07e03e62..7c95db62f0c 100644 --- a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java +++ b/hotspot/src/share/tools/ProjectCreator/BuildConfig.java @@ -142,6 +142,69 @@ class BuildConfig { return rv; } + // Returns true if the specified path refers to a relative alternate + // source file. RelativeAltSrcInclude is usually "src\closed". + public static boolean matchesRelativeAltSrcInclude(String path) { + String relativeAltSrcInclude = + getFieldString(null, "RelativeAltSrcInclude"); + Vector v = getFieldVector(null, "AltRelativeInclude"); + for (String pathPart : v) { + if (path.contains(relativeAltSrcInclude + Util.sep + pathPart)) { + return true; + } + } + return false; + } + + // Returns the relative alternate source file for the specified path. + // Null is returned if the specified path does not have a matching + // alternate source file. + public static String getMatchingRelativeAltSrcFile(String path) { + Vector v = getFieldVector(null, "RelativeAltSrcFileList"); + if (v == null) { + return null; + } + for (String pathPart : v) { + if (path.endsWith(pathPart)) { + String relativeAltSrcInclude = + getFieldString(null, "RelativeAltSrcInclude"); + return relativeAltSrcInclude + Util.sep + pathPart; + } + } + return null; + } + + // Returns true if the specified path has a matching alternate + // source file. + public static boolean matchesRelativeAltSrcFile(String path) { + return getMatchingRelativeAltSrcFile(path) != null; + } + + // Track the specified alternate source file. The source file is + // tracked without the leading .* + // part to make matching regular source files easier. + public static void trackRelativeAltSrcFile(String path) { + String pattern = getFieldString(null, "RelativeAltSrcInclude") + + Util.sep; + int altSrcInd = path.indexOf(pattern); + if (altSrcInd == -1) { + // not an AltSrc path + return; + } + + altSrcInd += pattern.length(); + if (altSrcInd >= path.length()) { + // not a valid AltSrc path + return; + } + + String altSrcFile = path.substring(altSrcInd); + Vector v = getFieldVector(null, "RelativeAltSrcFileList"); + if (v == null || !v.contains(altSrcFile)) { + addFieldVector(null, "RelativeAltSrcFileList", altSrcFile); + } + } + void addTo(Hashtable ht, String key, String value) { ht.put(expandFormat(key), expandFormat(value)); } @@ -272,8 +335,19 @@ class BuildConfig { private Vector getSourceIncludes() { Vector rv = new Vector(); - Vector ri = new Vector(); String sourceBase = getFieldString(null, "SourceBase"); + + // add relative alternate source include values: + String relativeAltSrcInclude = + getFieldString(null, "RelativeAltSrcInclude"); + Vector asri = new Vector(); + collectRelevantVectors(asri, "AltRelativeInclude"); + for (String f : asri) { + rv.add(sourceBase + Util.sep + relativeAltSrcInclude + + Util.sep + f); + } + + Vector ri = new Vector(); collectRelevantVectors(ri, "RelativeInclude"); for (String f : ri) { rv.add(sourceBase + Util.sep + f); @@ -541,35 +615,6 @@ class TieredProductConfig extends ProductConfig { } } -class CoreDebugConfig extends GenericDebugNonKernelConfig { - String getOptFlag() { - return getCI().getNoOptFlag(); - } - - CoreDebugConfig() { - initNames("core", "debug", "jvm.dll"); - init(getIncludes(), getDefines()); - } -} - -class CoreFastDebugConfig extends GenericDebugNonKernelConfig { - String getOptFlag() { - return getCI().getOptFlag(); - } - - CoreFastDebugConfig() { - initNames("core", "fastdebug", "jvm.dll"); - init(getIncludes(), getDefines()); - } -} - -class CoreProductConfig extends ProductConfig { - CoreProductConfig() { - initNames("core", "product", "jvm.dll"); - init(getIncludes(), getDefines()); - } -} - abstract class CompilerInterface { abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); diff --git a/hotspot/src/share/tools/ProjectCreator/FileTreeCreator.java b/hotspot/src/share/tools/ProjectCreator/FileTreeCreator.java index 3643c572e99..a81132c7029 100644 --- a/hotspot/src/share/tools/ProjectCreator/FileTreeCreator.java +++ b/hotspot/src/share/tools/ProjectCreator/FileTreeCreator.java @@ -12,11 +12,15 @@ public class FileTreeCreator extends SimpleFileVisitor final int startDirLength; Stack attributes = new Stack(); Vector allConfigs; - WinGammaPlatformVC10 wg; + WinGammaPlatform wg; + WinGammaPlatformVC10 wg10; - public FileTreeCreator(Path startDir, Vector allConfigs, WinGammaPlatformVC10 wg) { + public FileTreeCreator(Path startDir, Vector allConfigs, WinGammaPlatform wg) { super(); this.wg = wg; + if (wg instanceof WinGammaPlatformVC10) { + wg10 = (WinGammaPlatformVC10)wg; + } this.allConfigs = allConfigs; this.startDir = startDir; startDirLength = startDir.toAbsolutePath().toString().length(); diff --git a/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java b/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java index 837eef1a566..cb0fe33577e 100644 --- a/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java +++ b/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java @@ -1,3 +1,27 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + import static java.nio.file.FileVisitResult.CONTINUE; import java.io.IOException; @@ -21,6 +45,8 @@ public class FileTreeCreatorVC10 extends FileTreeCreator { boolean usePch = false; boolean disablePch = false; boolean useIgnore = false; + boolean isAltSrc = false; // only needed as a debugging crumb + boolean isReplacedByAltSrc = false; String fileName = file.getFileName().toString(); // TODO hideFile @@ -30,6 +56,26 @@ public class FileTreeCreatorVC10 extends FileTreeCreator { usePch = true; } + String fileLoc = vcProjLocation.relativize(file).toString(); + + // isAltSrc and isReplacedByAltSrc applies to all configs for a file + if (BuildConfig.matchesRelativeAltSrcInclude( + file.toAbsolutePath().toString())) { + // current file is an alternate source file so track it + isAltSrc = true; + BuildConfig.trackRelativeAltSrcFile( + file.toAbsolutePath().toString()); + } else if (BuildConfig.matchesRelativeAltSrcFile( + file.toAbsolutePath().toString())) { + // current file is a regular file that matches an alternate + // source file so yack about replacing the regular file + isReplacedByAltSrc = true; + System.out.println("INFO: alternate source file '" + + BuildConfig.getMatchingRelativeAltSrcFile( + file.toAbsolutePath().toString()) + + "' replaces '" + fileLoc + "'"); + } + for (BuildConfig cfg : allConfigs) { if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) { useIgnore = true; @@ -57,10 +103,9 @@ public class FileTreeCreatorVC10 extends FileTreeCreator { } } - String tagName = wg.getFileTagFromSuffix(fileName); - String fileLoc = vcProjLocation.relativize(file).toString(); + String tagName = wg10.getFileTagFromSuffix(fileName); - if (!useIgnore && !disablePch && !usePch) { + if (!useIgnore && !disablePch && !usePch && !isReplacedByAltSrc) { wg.tag(tagName, new String[] { "Include", fileLoc}); } else { wg.startTag( @@ -78,12 +123,17 @@ public class FileTreeCreatorVC10 extends FileTreeCreator { if (disablePch) { wg.tag("PrecompiledHeader", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); } + if (isReplacedByAltSrc) { + wg.tagData("ExcludedFromBuild", "true", "Condition", + "'$(Configuration)|$(Platform)'=='" + + cfg.get("Name") + "'"); + } } wg.endTag(); } String filter = startDir.relativize(file.getParent().toAbsolutePath()).toString(); - wg.addFilterDependency(fileLoc, filter); + wg10.addFilterDependency(fileLoc, filter); return CONTINUE; } @@ -112,7 +162,7 @@ public class FileTreeCreatorVC10 extends FileTreeCreator { if (!hide) { String name = startDir.relativize(path.toAbsolutePath()).toString(); if (!"".equals(name)) { - wg.addFilter(name); + wg10.addFilter(name); } attributes.push(newAttr); @@ -137,6 +187,4 @@ public class FileTreeCreatorVC10 extends FileTreeCreator { public void writeFileTree() throws IOException { Files.walkFileTree(this.startDir, this); } - - - } \ No newline at end of file +} diff --git a/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java b/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java index b36e0121f8a..9a431845719 100644 --- a/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java +++ b/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java @@ -12,7 +12,7 @@ import java.util.Vector; public class FileTreeCreatorVC7 extends FileTreeCreator { public FileTreeCreatorVC7(Path startDir, Vector allConfigs, WinGammaPlatform wg) { - super(startDir, allConfigs, null); + super(startDir, allConfigs, wg); } @Override diff --git a/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java b/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java index a3065e51273..f1e16ea8a45 100644 --- a/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java +++ b/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,10 +39,15 @@ public class ProjectCreator { + "jvm.dll; no trailing slash>"); System.err.println(" If any of the above are specified, " + "they must all be."); + System.err.println(" Note: if '-altRelativeInclude' option below is " + + "used, then the '-relativeAltSrcInclude' option must be used " + + "to specify the alternate source dir, e.g., 'src\\closed'"); System.err.println(" Additional, optional arguments, which can be " + "specified multiple times:"); System.err.println(" -absoluteInclude "); + System.err.println(" -altRelativeInclude "); System.err.println(" -relativeInclude "); System.err.println(" -define "); System.err.println(" If any of the above are specified, "+ "they must all be."); + System.err.println(" Note: if '-altRelativeInclude' option below " + + "is used, then the '-relativeAltSrcInclude' " + + "option must be used to specify the alternate " + + "source dir, e.g., 'src\\closed'"); System.err.println(" Additional, optional arguments, which can be " + "specified multiple times:"); System.err.println(" -absoluteInclude "); + System.err.println(" -altRelativeInclude "); System.err.println(" -relativeInclude "); System.err.println(" -define allConfigs) throws IOException { System.out.println(); - System.out.print(" Writing .vcxproj file: " + projectFileName); + System.out.println(" Writing .vcxproj file: " + projectFileName); String projDir = Util.normalize(new File(projectFileName).getParent()); @@ -114,7 +138,7 @@ public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 { endTag(); printWriter.close(); - System.out.println(" Done."); + System.out.println(" Done writing .vcxproj file."); writeFilterFile(projectFileName, projectName, allConfigs, projDir); writeUserFile(projectFileName, allConfigs); diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java index 09e961cbfa0..b7a99a652db 100644 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java +++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java @@ -139,19 +139,22 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform { tagV("Tool", cfg.getV("LinkerFlags")); - tag("Tool", - new String[] { - "Name", - "VCPostBuildEventTool", - "Description", - BuildConfig - .getFieldString(null, "PostbuildDescription"), - // Caution: String.replace(String,String) is available - // from JDK5 onwards only - "CommandLine", - cfg.expandFormat(BuildConfig.getFieldString(null, - "PostbuildCommand").replace("\t", - " ")) }); + String postBuildCmd = BuildConfig.getFieldString(null, + "PostbuildCommand"); + if (postBuildCmd != null) { + tag("Tool", + new String[] { + "Name", + "VCPostBuildEventTool", + "Description", + BuildConfig + .getFieldString(null, "PostbuildDescription"), + // Caution: String.replace(String,String) is available + // from JDK5 onwards only + "CommandLine", + cfg.expandFormat(postBuildCmd.replace("\t", + " ")) }); + } tag("Tool", new String[] { "Name", "VCPreBuildEventTool" }); diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index 3af2d23b7d6..dbe3476aad9 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2295,7 +2295,7 @@ void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) { if (gen_type_check) { // We have determined that offset == referent_offset && src != null. // if (src->_klass->_reference_type == REF_NONE) -> continue - __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), UseCompressedKlassPointers ? T_OBJECT : T_ADDRESS), src_klass); + __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass); LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE); LIR_Opr reference_type = new_register(T_INT); __ move(reference_type_addr, reference_type); diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp index 71813b8f338..837d529ca13 100644 --- a/hotspot/src/share/vm/ci/ciReplay.cpp +++ b/hotspot/src/share/vm/ci/ciReplay.cpp @@ -299,7 +299,7 @@ class CompileReplay : public StackObj { Symbol* method_signature = parse_symbol(CHECK_NULL); Method* m = k->find_method(method_name, method_signature); if (m == NULL) { - report_error("can't find method"); + report_error("Can't find method"); } return m; } @@ -398,8 +398,8 @@ class CompileReplay : public StackObj { // compile void process_compile(TRAPS) { - // methodHandle method; Method* method = parse_method(CHECK); + if (had_error()) return; int entry_bci = parse_int("entry_bci"); const char* comp_level_label = "comp_level"; int comp_level = parse_int(comp_level_label); @@ -440,6 +440,7 @@ class CompileReplay : public StackObj { // void process_ciMethod(TRAPS) { Method* method = parse_method(CHECK); + if (had_error()) return; ciMethodRecord* rec = new_ciMethod(method); rec->invocation_counter = parse_int("invocation_counter"); rec->backedge_counter = parse_int("backedge_counter"); @@ -451,6 +452,7 @@ class CompileReplay : public StackObj { // ciMethodData orig # # ... data # # ... oops void process_ciMethodData(TRAPS) { Method* method = parse_method(CHECK); + if (had_error()) return; /* jsut copied from Method, to build interpret data*/ if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) { return; diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index 650a299f346..32a4da05bb5 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -878,7 +878,7 @@ objArrayOop ClassLoader::get_system_packages(TRAPS) { instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) { ResourceMark rm(THREAD); - EventMark m("loading class " INTPTR_FORMAT, (address)h_name); + EventMark m("loading class %s", h_name->as_C_string()); ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion); stringStream st; diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 678cb2dcd13..8e94d834ad9 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -2557,6 +2557,26 @@ void java_lang_ref_SoftReference::set_clock(jlong value) { *offset = value; } +// Support for java_lang_invoke_DirectMethodHandle + +int java_lang_invoke_DirectMethodHandle::_member_offset; + +oop java_lang_invoke_DirectMethodHandle::member(oop dmh) { + oop member_name = NULL; + bool is_dmh = dmh->is_oop() && java_lang_invoke_DirectMethodHandle::is_instance(dmh); + assert(is_dmh, "a DirectMethodHandle oop is expected"); + if (is_dmh) { + member_name = dmh->obj_field(member_offset_in_bytes()); + } + return member_name; +} + +void java_lang_invoke_DirectMethodHandle::compute_offsets() { + Klass* klass_oop = SystemDictionary::DirectMethodHandle_klass(); + if (klass_oop != NULL && EnableInvokeDynamic) { + compute_offset(_member_offset, klass_oop, vmSymbols::member_name(), vmSymbols::java_lang_invoke_MemberName_signature()); + } +} // Support for java_lang_invoke_MethodHandle @@ -3205,6 +3225,7 @@ void JavaClasses::compute_offsets() { java_lang_ThreadGroup::compute_offsets(); if (EnableInvokeDynamic) { java_lang_invoke_MethodHandle::compute_offsets(); + java_lang_invoke_DirectMethodHandle::compute_offsets(); java_lang_invoke_MemberName::compute_offsets(); java_lang_invoke_LambdaForm::compute_offsets(); java_lang_invoke_MethodType::compute_offsets(); diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index 899d3ba48a3..8a8e801f387 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -976,6 +976,32 @@ class java_lang_invoke_MethodHandle: AllStatic { static int form_offset_in_bytes() { return _form_offset; } }; +// Interface to java.lang.invoke.DirectMethodHandle objects + +class java_lang_invoke_DirectMethodHandle: AllStatic { + friend class JavaClasses; + + private: + static int _member_offset; // the MemberName of this DMH + + static void compute_offsets(); + + public: + // Accessors + static oop member(oop mh); + + // Testers + static bool is_subclass(Klass* klass) { + return klass->is_subclass_of(SystemDictionary::DirectMethodHandle_klass()); + } + static bool is_instance(oop obj) { + return obj != NULL && is_subclass(obj->klass()); + } + + // Accessors for code generation: + static int member_offset_in_bytes() { return _member_offset; } +}; + // Interface to java.lang.invoke.LambdaForm objects // (These are a private interface for managing adapter code generation.) diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp index a2a1a857517..85735a732fa 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp @@ -151,6 +151,7 @@ class SymbolPropertyTable; do_klass(reflect_CallerSensitive_klass, sun_reflect_CallerSensitive, Opt ) \ \ /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \ + do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Opt ) \ do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292 ) \ do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292 ) \ do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292 ) \ diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index df370237167..067cf503305 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -255,6 +255,7 @@ /* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */ \ template(java_lang_invoke_CallSite, "java/lang/invoke/CallSite") \ template(java_lang_invoke_ConstantCallSite, "java/lang/invoke/ConstantCallSite") \ + template(java_lang_invoke_DirectMethodHandle, "java/lang/invoke/DirectMethodHandle") \ template(java_lang_invoke_MutableCallSite, "java/lang/invoke/MutableCallSite") \ template(java_lang_invoke_VolatileCallSite, "java/lang/invoke/VolatileCallSite") \ template(java_lang_invoke_MethodHandle, "java/lang/invoke/MethodHandle") \ @@ -352,6 +353,7 @@ template(thread_id_name, "tid") \ template(newInstance0_name, "newInstance0") \ template(limit_name, "limit") \ + template(member_name, "member") \ template(forName_name, "forName") \ template(forName0_name, "forName0") \ template(isJavaIdentifierStart_name, "isJavaIdentifierStart") \ diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp index 1c7a28c6bd0..f7730287b94 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp @@ -122,6 +122,22 @@ class MarkRefsIntoClosure: public CMSOopsInGenClosure { } }; +class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure { + private: + const MemRegion _span; + CMSBitMap* _bitMap; + protected: + DO_OOP_WORK_DEFN + public: + Par_MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap); + virtual void do_oop(oop* p); + virtual void do_oop(narrowOop* p); + + Prefetch::style prefetch_style() { + return Prefetch::do_read; + } +}; + // A variant of the above used in certain kinds of CMS // marking verification. class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index ced79cbcf69..54ade2db111 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -50,6 +50,7 @@ #include "memory/genMarkSweep.hpp" #include "memory/genOopClosures.inline.hpp" #include "memory/iterator.hpp" +#include "memory/padded.hpp" #include "memory/referencePolicy.hpp" #include "memory/resourceArea.hpp" #include "memory/tenuredGeneration.hpp" @@ -569,6 +570,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, _restart_addr(NULL), _overflow_list(NULL), _stats(cmsGen), + _eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true)), _eden_chunk_array(NULL), // may be set in ctor body _eden_chunk_capacity(0), // -- ditto -- _eden_chunk_index(0), // -- ditto -- @@ -732,7 +734,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, assert(_eden_chunk_array != NULL || _eden_chunk_capacity == 0, "Error"); // Support for parallelizing survivor space rescan - if (CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) { + if ((CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) || CMSParallelInitialMarkEnabled) { const size_t max_plab_samples = ((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize; @@ -2137,6 +2139,39 @@ void CMSCollector::do_mark_sweep_work(bool clear_all_soft_refs, } +void CMSCollector::print_eden_and_survivor_chunk_arrays() { + DefNewGeneration* dng = _young_gen->as_DefNewGeneration(); + EdenSpace* eden_space = dng->eden(); + ContiguousSpace* from_space = dng->from(); + ContiguousSpace* to_space = dng->to(); + // Eden + if (_eden_chunk_array != NULL) { + gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")", + eden_space->bottom(), eden_space->top(), + eden_space->end(), eden_space->capacity()); + gclog_or_tty->print_cr("_eden_chunk_index=" SIZE_FORMAT ", " + "_eden_chunk_capacity=" SIZE_FORMAT, + _eden_chunk_index, _eden_chunk_capacity); + for (size_t i = 0; i < _eden_chunk_index; i++) { + gclog_or_tty->print_cr("_eden_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT, + i, _eden_chunk_array[i]); + } + } + // Survivor + if (_survivor_chunk_array != NULL) { + gclog_or_tty->print_cr("survivor " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")", + from_space->bottom(), from_space->top(), + from_space->end(), from_space->capacity()); + gclog_or_tty->print_cr("_survivor_chunk_index=" SIZE_FORMAT ", " + "_survivor_chunk_capacity=" SIZE_FORMAT, + _survivor_chunk_index, _survivor_chunk_capacity); + for (size_t i = 0; i < _survivor_chunk_index; i++) { + gclog_or_tty->print_cr("_survivor_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT, + i, _survivor_chunk_array[i]); + } + } +} + void CMSCollector::getFreelistLocks() const { // Get locks for all free lists in all generations that this // collector is responsible for @@ -3549,6 +3584,31 @@ CMSPhaseAccounting::~CMSPhaseAccounting() { // CMS work +// The common parts of CMSParInitialMarkTask and CMSParRemarkTask. +class CMSParMarkTask : public AbstractGangTask { + protected: + CMSCollector* _collector; + int _n_workers; + CMSParMarkTask(const char* name, CMSCollector* collector, int n_workers) : + AbstractGangTask(name), + _collector(collector), + _n_workers(n_workers) {} + // Work method in support of parallel rescan ... of young gen spaces + void do_young_space_rescan(uint worker_id, OopsInGenClosure* cl, + ContiguousSpace* space, + HeapWord** chunk_array, size_t chunk_top); + void work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl); +}; + +// Parallel initial mark task +class CMSParInitialMarkTask: public CMSParMarkTask { + public: + CMSParInitialMarkTask(CMSCollector* collector, int n_workers) : + CMSParMarkTask("Scan roots and young gen for initial mark in parallel", + collector, n_workers) {} + void work(uint worker_id); +}; + // Checkpoint the roots into this generation from outside // this generation. [Note this initial checkpoint need only // be approximate -- we'll do a catch up phase subsequently.] @@ -3646,19 +3706,42 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) { // the klasses. The claimed marks need to be cleared before marking starts. ClassLoaderDataGraph::clear_claimed_marks(); - CMKlassClosure klass_closure(¬Older); + if (CMSPrintEdenSurvivorChunks) { + print_eden_and_survivor_chunk_arrays(); + } + { COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;) - gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. - gch->gen_process_strong_roots(_cmsGen->level(), - true, // younger gens are roots - true, // activate StrongRootsScope - false, // not scavenging - SharedHeap::ScanningOption(roots_scanning_options()), - ¬Older, - true, // walk all of code cache if (so & SO_CodeCache) - NULL, - &klass_closure); + if (CMSParallelInitialMarkEnabled && CollectedHeap::use_parallel_gc_threads()) { + // The parallel version. + FlexibleWorkGang* workers = gch->workers(); + assert(workers != NULL, "Need parallel worker threads."); + int n_workers = workers->active_workers(); + CMSParInitialMarkTask tsk(this, n_workers); + gch->set_par_threads(n_workers); + initialize_sequential_subtasks_for_young_gen_rescan(n_workers); + if (n_workers > 1) { + GenCollectedHeap::StrongRootsScope srs(gch); + workers->run_task(&tsk); + } else { + GenCollectedHeap::StrongRootsScope srs(gch); + tsk.work(0); + } + gch->set_par_threads(0); + } else { + // The serial version. + CMKlassClosure klass_closure(¬Older); + gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. + gch->gen_process_strong_roots(_cmsGen->level(), + true, // younger gens are roots + true, // activate StrongRootsScope + false, // not scavenging + SharedHeap::ScanningOption(roots_scanning_options()), + ¬Older, + true, // walk all of code cache if (so & SO_CodeCache) + NULL, + &klass_closure); + } } // Clear mod-union table; it will be dirtied in the prologue of @@ -4417,7 +4500,9 @@ void CMSCollector::preclean() { verify_overflow_empty(); _abort_preclean = false; if (CMSPrecleaningEnabled) { - _eden_chunk_index = 0; + if (!CMSEdenChunksRecordAlways) { + _eden_chunk_index = 0; + } size_t used = get_eden_used(); size_t capacity = get_eden_capacity(); // Don't start sampling unless we will get sufficiently @@ -4526,7 +4611,9 @@ void CMSCollector::sample_eden() { if (!_start_sampling) { return; } - if (_eden_chunk_array) { + // When CMSEdenChunksRecordAlways is true, the eden chunk array + // is populated by the young generation. + if (_eden_chunk_array != NULL && !CMSEdenChunksRecordAlways) { if (_eden_chunk_index < _eden_chunk_capacity) { _eden_chunk_array[_eden_chunk_index] = *_top_addr; // take sample assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr, @@ -5010,6 +5097,10 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch, // Update the saved marks which may affect the root scans. gch->save_marks(); + if (CMSPrintEdenSurvivorChunks) { + print_eden_and_survivor_chunk_arrays(); + } + { COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;) @@ -5116,10 +5207,53 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch, } } +void CMSParInitialMarkTask::work(uint worker_id) { + elapsedTimer _timer; + ResourceMark rm; + HandleMark hm; + + // ---------- scan from roots -------------- + _timer.start(); + GenCollectedHeap* gch = GenCollectedHeap::heap(); + Par_MarkRefsIntoClosure par_mri_cl(_collector->_span, &(_collector->_markBitMap)); + CMKlassClosure klass_closure(&par_mri_cl); + + // ---------- young gen roots -------------- + { + work_on_young_gen_roots(worker_id, &par_mri_cl); + _timer.stop(); + if (PrintCMSStatistics != 0) { + gclog_or_tty->print_cr( + "Finished young gen initial mark scan work in %dth thread: %3.3f sec", + worker_id, _timer.seconds()); + } + } + + // ---------- remaining roots -------------- + _timer.reset(); + _timer.start(); + gch->gen_process_strong_roots(_collector->_cmsGen->level(), + false, // yg was scanned above + false, // this is parallel code + false, // not scavenging + SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), + &par_mri_cl, + true, // walk all of code cache if (so & SO_CodeCache) + NULL, + &klass_closure); + assert(_collector->should_unload_classes() + || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_CodeCache), + "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops"); + _timer.stop(); + if (PrintCMSStatistics != 0) { + gclog_or_tty->print_cr( + "Finished remaining root initial mark scan work in %dth thread: %3.3f sec", + worker_id, _timer.seconds()); + } +} + // Parallel remark task -class CMSParRemarkTask: public AbstractGangTask { - CMSCollector* _collector; - int _n_workers; +class CMSParRemarkTask: public CMSParMarkTask { CompactibleFreeListSpace* _cms_space; // The per-thread work queues, available here for stealing. @@ -5133,10 +5267,9 @@ class CMSParRemarkTask: public AbstractGangTask { CompactibleFreeListSpace* cms_space, int n_workers, FlexibleWorkGang* workers, OopTaskQueueSet* task_queues): - AbstractGangTask("Rescan roots and grey objects in parallel"), - _collector(collector), + CMSParMarkTask("Rescan roots and grey objects in parallel", + collector, n_workers), _cms_space(cms_space), - _n_workers(n_workers), _task_queues(task_queues), _term(n_workers, task_queues) { } @@ -5150,11 +5283,6 @@ class CMSParRemarkTask: public AbstractGangTask { void work(uint worker_id); private: - // Work method in support of parallel rescan ... of young gen spaces - void do_young_space_rescan(int i, Par_MarkRefsIntoAndScanClosure* cl, - ContiguousSpace* space, - HeapWord** chunk_array, size_t chunk_top); - // ... of dirty cards in old space void do_dirty_card_rescan_tasks(CompactibleFreeListSpace* sp, int i, Par_MarkRefsIntoAndScanClosure* cl); @@ -5186,6 +5314,25 @@ class RemarkKlassClosure : public KlassClosure { } }; +void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) { + DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration(); + EdenSpace* eden_space = dng->eden(); + ContiguousSpace* from_space = dng->from(); + ContiguousSpace* to_space = dng->to(); + + HeapWord** eca = _collector->_eden_chunk_array; + size_t ect = _collector->_eden_chunk_index; + HeapWord** sca = _collector->_survivor_chunk_array; + size_t sct = _collector->_survivor_chunk_index; + + assert(ect <= _collector->_eden_chunk_capacity, "out of bounds"); + assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds"); + + do_young_space_rescan(worker_id, cl, to_space, NULL, 0); + do_young_space_rescan(worker_id, cl, from_space, sca, sct); + do_young_space_rescan(worker_id, cl, eden_space, eca, ect); +} + // work_queue(i) is passed to the closure // Par_MarkRefsIntoAndScanClosure. The "i" parameter // also is passed to do_dirty_card_rescan_tasks() and to @@ -5210,23 +5357,7 @@ void CMSParRemarkTask::work(uint worker_id) { // work first. // ---------- young gen roots -------------- { - DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration(); - EdenSpace* eden_space = dng->eden(); - ContiguousSpace* from_space = dng->from(); - ContiguousSpace* to_space = dng->to(); - - HeapWord** eca = _collector->_eden_chunk_array; - size_t ect = _collector->_eden_chunk_index; - HeapWord** sca = _collector->_survivor_chunk_array; - size_t sct = _collector->_survivor_chunk_index; - - assert(ect <= _collector->_eden_chunk_capacity, "out of bounds"); - assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds"); - - do_young_space_rescan(worker_id, &par_mrias_cl, to_space, NULL, 0); - do_young_space_rescan(worker_id, &par_mrias_cl, from_space, sca, sct); - do_young_space_rescan(worker_id, &par_mrias_cl, eden_space, eca, ect); - + work_on_young_gen_roots(worker_id, &par_mrias_cl); _timer.stop(); if (PrintCMSStatistics != 0) { gclog_or_tty->print_cr( @@ -5334,8 +5465,8 @@ void CMSParRemarkTask::work(uint worker_id) { // Note that parameter "i" is not used. void -CMSParRemarkTask::do_young_space_rescan(int i, - Par_MarkRefsIntoAndScanClosure* cl, ContiguousSpace* space, +CMSParMarkTask::do_young_space_rescan(uint worker_id, + OopsInGenClosure* cl, ContiguousSpace* space, HeapWord** chunk_array, size_t chunk_top) { // Until all tasks completed: // . claim an unclaimed task @@ -5530,6 +5661,32 @@ CMSParRemarkTask::do_work_steal(int i, Par_MarkRefsIntoAndScanClosure* cl, "Else our work is not yet done"); } +// Record object boundaries in _eden_chunk_array by sampling the eden +// top in the slow-path eden object allocation code path and record +// the boundaries, if CMSEdenChunksRecordAlways is true. If +// CMSEdenChunksRecordAlways is false, we use the other asynchronous +// sampling in sample_eden() that activates during the part of the +// preclean phase. +void CMSCollector::sample_eden_chunk() { + if (CMSEdenChunksRecordAlways && _eden_chunk_array != NULL) { + if (_eden_chunk_lock->try_lock()) { + // Record a sample. This is the critical section. The contents + // of the _eden_chunk_array have to be non-decreasing in the + // address order. + _eden_chunk_array[_eden_chunk_index] = *_top_addr; + assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr, + "Unexpected state of Eden"); + if (_eden_chunk_index == 0 || + ((_eden_chunk_array[_eden_chunk_index] > _eden_chunk_array[_eden_chunk_index-1]) && + (pointer_delta(_eden_chunk_array[_eden_chunk_index], + _eden_chunk_array[_eden_chunk_index-1]) >= CMSSamplingGrain))) { + _eden_chunk_index++; // commit sample + } + _eden_chunk_lock->unlock(); + } + } +} + // Return a thread-local PLAB recording array, as appropriate. void* CMSCollector::get_data_recorder(int thr_num) { if (_survivor_plab_array != NULL && @@ -5553,12 +5710,13 @@ void CMSCollector::reset_survivor_plab_arrays() { // Merge the per-thread plab arrays into the global survivor chunk // array which will provide the partitioning of the survivor space -// for CMS rescan. +// for CMS initial scan and rescan. void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv, int no_of_gc_threads) { assert(_survivor_plab_array != NULL, "Error"); assert(_survivor_chunk_array != NULL, "Error"); - assert(_collectorState == FinalMarking, "Error"); + assert(_collectorState == FinalMarking || + (CMSParallelInitialMarkEnabled && _collectorState == InitialMarking), "Error"); for (int j = 0; j < no_of_gc_threads; j++) { _cursor[j] = 0; } @@ -5621,7 +5779,7 @@ void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv, } // Set up the space's par_seq_tasks structure for work claiming -// for parallel rescan of young gen. +// for parallel initial scan and rescan of young gen. // See ParRescanTask where this is currently used. void CMSCollector:: @@ -6748,6 +6906,28 @@ void MarkRefsIntoClosure::do_oop(oop obj) { void MarkRefsIntoClosure::do_oop(oop* p) { MarkRefsIntoClosure::do_oop_work(p); } void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); } +Par_MarkRefsIntoClosure::Par_MarkRefsIntoClosure( + MemRegion span, CMSBitMap* bitMap): + _span(span), + _bitMap(bitMap) +{ + assert(_ref_processor == NULL, "deliberately left NULL"); + assert(_bitMap->covers(_span), "_bitMap/_span mismatch"); +} + +void Par_MarkRefsIntoClosure::do_oop(oop obj) { + // if p points into _span, then mark corresponding bit in _markBitMap + assert(obj->is_oop(), "expected an oop"); + HeapWord* addr = (HeapWord*)obj; + if (_span.contains(addr)) { + // this should be made more efficient + _bitMap->par_mark(addr); + } +} + +void Par_MarkRefsIntoClosure::do_oop(oop* p) { Par_MarkRefsIntoClosure::do_oop_work(p); } +void Par_MarkRefsIntoClosure::do_oop(narrowOop* p) { Par_MarkRefsIntoClosure::do_oop_work(p); } + // A variant of the above, used for CMS marking verification. MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure( MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm): @@ -9305,7 +9485,6 @@ void ASConcurrentMarkSweepGeneration::shrink_by(size_t desired_bytes) { return; } } - // Transfer some number of overflown objects to usual marking // stack. Return true if some objects were transferred. bool MarkRefsIntoAndScanClosure::take_from_overflow_list() { @@ -9377,4 +9556,3 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt ShouldNotReachHere(); } } - diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index 3806b896d26..2c87671dfe2 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -515,6 +515,8 @@ class CMSCollector: public CHeapObj { friend class ConcurrentMarkSweepThread; friend class ConcurrentMarkSweepGeneration; friend class CompactibleFreeListSpace; + friend class CMSParMarkTask; + friend class CMSParInitialMarkTask; friend class CMSParRemarkTask; friend class CMSConcMarkingTask; friend class CMSRefProcTaskProxy; @@ -749,6 +751,7 @@ class CMSCollector: public CHeapObj { Generation* _young_gen; // the younger gen HeapWord** _top_addr; // ... Top of Eden HeapWord** _end_addr; // ... End of Eden + Mutex* _eden_chunk_lock; HeapWord** _eden_chunk_array; // ... Eden partitioning array size_t _eden_chunk_index; // ... top (exclusive) of array size_t _eden_chunk_capacity; // ... max entries in array @@ -950,6 +953,7 @@ class CMSCollector: public CHeapObj { // Support for parallel remark of survivor space void* get_data_recorder(int thr_num); + void sample_eden_chunk(); CMSBitMap* markBitMap() { return &_markBitMap; } void directAllocated(HeapWord* start, size_t size); @@ -1027,6 +1031,8 @@ class CMSCollector: public CHeapObj { // Initialization errors bool completed_initialization() { return _completed_initialization; } + + void print_eden_and_survivor_chunk_arrays(); }; class CMSExpansionCause : public AllStatic { @@ -1317,6 +1323,10 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { //Delegate to collector return collector()->get_data_recorder(thr_num); } + void sample_eden_chunk() { + //Delegate to collector + return collector()->sample_eden_chunk(); + } // Printing const char* name() const; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp index 36dfdce6d25..3387dc44f0a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -96,11 +96,6 @@ "the buffer will be enqueued for processing. A value of 0 " \ "specifies that mutator threads should not do such filtering.") \ \ - develop(intx, G1ExtraRegionSurvRate, 33, \ - "If the young survival rate is S, and there's room left in " \ - "to-space, we will allow regions whose survival rate is up to " \ - "S + (1 - S)*X, where X is this parameter (as a fraction.)") \ - \ develop(bool, G1SATBPrintStubs, false, \ "If true, print generated stubs for the SATB barrier") \ \ @@ -110,9 +105,6 @@ develop(bool, G1RSBarrierRegionFilter, true, \ "If true, generate region filtering code in RS barrier") \ \ - develop(bool, G1RSBarrierNullFilter, true, \ - "If true, generate null-pointer filtering code in RS barrier") \ - \ develop(bool, G1DeferredRSUpdate, true, \ "If true, use deferred RS updates") \ \ @@ -120,9 +112,6 @@ "If true, verify that no dirty cards remain after RS log " \ "processing.") \ \ - develop(bool, G1RSCountHisto, false, \ - "If true, print a histogram of RS occupancies after each pause") \ - \ diagnostic(bool, G1PrintRegionLivenessInfo, false, \ "Prints the liveness information for all regions in the heap " \ "at the end of a marking cycle.") \ @@ -169,9 +158,6 @@ product(uintx, G1ConcRSHotCardLimit, 4, \ "The threshold that defines (>=) a hot card.") \ \ - develop(bool, G1PrintOopAppls, false, \ - "When true, print applications of closures to external locs.") \ - \ develop(intx, G1RSetRegionEntriesBase, 256, \ "Max number of regions in a fine-grain table per MB.") \ \ diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 22c84ec81ee..9486d208dc9 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -314,6 +314,11 @@ void HeapRegion::setup_heap_region_size(uintx min_heap_size) { region_size = MAX_REGION_SIZE; } + if (region_size != G1HeapRegionSize) { + // Update the flag to make sure that PrintFlagsFinal logs the correct value + FLAG_SET_ERGO(uintx, G1HeapRegionSize, region_size); + } + // And recalculate the log. region_size_log = log2_long((jlong) region_size); diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index c104533a47b..a1eb3130bc6 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -927,11 +927,9 @@ void ParNewGeneration::collect(bool full, workers->active_workers(), Threads::number_of_non_daemon_threads()); workers->set_active_workers(active_workers); - _next_gen = gch->next_gen(this); - assert(_next_gen != NULL, - "This must be the youngest gen, and not the only gen"); assert(gch->n_gens() == 2, "Par collection currently only works with single older gen."); + _next_gen = gch->next_gen(this); // Do we have to avoid promotion_undo? if (gch->collector_policy()->is_concurrent_mark_sweep_policy()) { set_avoid_promotion_undo(true); diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp index 987767b1640..6d3b25d9545 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ #include "gc_implementation/shared/parGCAllocBuffer.hpp" #include "gc_implementation/shared/copyFailedInfo.hpp" #include "memory/defNewGeneration.hpp" +#include "memory/padded.hpp" #include "utilities/taskqueue.hpp" class ChunkArray; diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.hpp index 0d9d7761c74..00b865f2a35 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.hpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_HPP #include "memory/genOopClosures.hpp" +#include "memory/padded.hpp" // Closures for ParNewGeneration diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp index 32929e7a55c..dd3933b0009 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @@ -29,14 +29,16 @@ #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" #include "gc_implementation/shared/gcTrace.hpp" #include "gc_implementation/shared/mutableSpace.hpp" +#include "memory/allocation.inline.hpp" #include "memory/memRegion.hpp" +#include "memory/padded.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/oop.psgc.inline.hpp" -PSPromotionManager** PSPromotionManager::_manager_array = NULL; -OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; -PSOldGen* PSPromotionManager::_old_gen = NULL; -MutableSpace* PSPromotionManager::_young_space = NULL; +PaddedEnd* PSPromotionManager::_manager_array = NULL; +OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; +PSOldGen* PSPromotionManager::_old_gen = NULL; +MutableSpace* PSPromotionManager::_young_space = NULL; void PSPromotionManager::initialize() { ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); @@ -45,8 +47,10 @@ void PSPromotionManager::initialize() { _old_gen = heap->old_gen(); _young_space = heap->young_gen()->to_space(); + // To prevent false sharing, we pad the PSPromotionManagers + // and make sure that the first instance starts at a cache line. assert(_manager_array == NULL, "Attempt to initialize twice"); - _manager_array = NEW_C_HEAP_ARRAY(PSPromotionManager*, ParallelGCThreads+1, mtGC); + _manager_array = PaddedArray::create_unfreeable(ParallelGCThreads + 1); guarantee(_manager_array != NULL, "Could not initialize promotion manager"); _stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads); @@ -54,26 +58,21 @@ void PSPromotionManager::initialize() { // Create and register the PSPromotionManager(s) for the worker threads. for(uint i=0; iregister_queue(i, _manager_array[i]->claimed_stack_depth()); + stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth()); } - // The VMThread gets its own PSPromotionManager, which is not available // for work stealing. - _manager_array[ParallelGCThreads] = new PSPromotionManager(); - guarantee(_manager_array[ParallelGCThreads] != NULL, "Could not create PSPromotionManager"); } PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) { assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range"); assert(_manager_array != NULL, "Sanity"); - return _manager_array[index]; + return &_manager_array[index]; } PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() { assert(_manager_array != NULL, "Sanity"); - return _manager_array[ParallelGCThreads]; + return &_manager_array[ParallelGCThreads]; } void PSPromotionManager::pre_scavenge() { diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp index 8f4731428ac..6707ade2d17 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp @@ -29,6 +29,8 @@ #include "gc_implementation/shared/gcTrace.hpp" #include "gc_implementation/shared/copyFailedInfo.hpp" #include "memory/allocation.hpp" +#include "memory/padded.hpp" +#include "utilities/globalDefinitions.hpp" #include "utilities/taskqueue.hpp" // @@ -51,14 +53,14 @@ class MutableSpace; class PSOldGen; class ParCompactionManager; -class PSPromotionManager : public CHeapObj { +class PSPromotionManager VALUE_OBJ_CLASS_SPEC { friend class PSScavenge; friend class PSRefProcTaskExecutor; private: - static PSPromotionManager** _manager_array; - static OopStarTaskQueueSet* _stack_array_depth; - static PSOldGen* _old_gen; - static MutableSpace* _young_space; + static PaddedEnd* _manager_array; + static OopStarTaskQueueSet* _stack_array_depth; + static PSOldGen* _old_gen; + static MutableSpace* _young_space; #if TASKQUEUE_STATS size_t _masked_pushes; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp index 841ef64f20b..34c935408d8 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp @@ -32,7 +32,7 @@ inline PSPromotionManager* PSPromotionManager::manager_array(int index) { assert(_manager_array != NULL, "access of NULL manager_array"); assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access"); - return _manager_array[index]; + return &_manager_array[index]; } template diff --git a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp index cf95bdd505e..289c458d2dc 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp @@ -32,6 +32,7 @@ #if INCLUDE_SERVICES void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) { +#if INCLUDE_TRACE assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId), "Only call this method if the event is enabled"); @@ -42,6 +43,7 @@ void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong event.set_totalSize(entry->words() * BytesPerWord); event.set_endtime(timestamp); event.commit(); +#endif // INCLUDE_TRACE } bool ObjectCountEventSender::should_send_event() { diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp index f5f9d39bcec..4a3019f867f 100644 --- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp @@ -1209,3 +1209,26 @@ IRT_LEAF(void, InterpreterRuntime::popframe_move_outgoing_args(JavaThread* threa size_of_arguments * Interpreter::stackElementSize); IRT_END #endif + +#if INCLUDE_JVMTI +// This is a support of the JVMTI PopFrame interface. +// Make sure it is an invokestatic of a polymorphic intrinsic that has a member_name argument +// and return it as a vm_result so that it can be reloaded in the list of invokestatic parameters. +// The dmh argument is a reference to a DirectMethoHandle that has a member name field. +IRT_ENTRY(void, InterpreterRuntime::member_name_arg_or_null(JavaThread* thread, address dmh, + Method* method, address bcp)) + Bytecodes::Code code = Bytecodes::code_at(method, bcp); + if (code != Bytecodes::_invokestatic) { + return; + } + ConstantPool* cpool = method->constants(); + int cp_index = Bytes::get_native_u2(bcp + 1) + ConstantPool::CPCACHE_INDEX_TAG; + Symbol* cname = cpool->klass_name_at(cpool->klass_ref_index_at(cp_index)); + Symbol* mname = cpool->name_ref_at(cp_index); + + if (MethodHandles::has_member_arg(cname, mname)) { + oop member_name = java_lang_invoke_DirectMethodHandle::member((oop)dmh); + thread->set_vm_result(member_name); + } +IRT_END +#endif // INCLUDE_JVMTI diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp index d46c43e94e0..ad44210ef4d 100644 --- a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp @@ -95,6 +95,9 @@ class InterpreterRuntime: AllStatic { static void create_exception(JavaThread* thread, char* name, char* message); static void create_klass_exception(JavaThread* thread, char* name, oopDesc* obj); static address exception_handler_for_exception(JavaThread* thread, oopDesc* exception); +#if INCLUDE_JVMTI + static void member_name_arg_or_null(JavaThread* thread, address dmh, Method* m, address bcp); +#endif static void throw_pending_exception(JavaThread* thread); // Statics & fields diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp index 7c21869945b..ddd65d42083 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.cpp +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp @@ -310,46 +310,31 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp, _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this); } -void CardTableRS::clear_into_younger(Generation* gen) { - GenCollectedHeap* gch = GenCollectedHeap::heap(); - // Generations younger than gen have been evacuated. We can clear - // card table entries for gen (we know that it has no pointers - // to younger gens) and for those below. The card tables for - // the youngest gen need never be cleared. +void CardTableRS::clear_into_younger(Generation* old_gen) { + assert(old_gen->level() == 1, "Should only be called for the old generation"); + // The card tables for the youngest gen need never be cleared. // There's a bit of subtlety in the clear() and invalidate() // methods that we exploit here and in invalidate_or_clear() // below to avoid missing cards at the fringes. If clear() or // invalidate() are changed in the future, this code should // be revisited. 20040107.ysr - Generation* g = gen; - for(Generation* prev_gen = gch->prev_gen(g); - prev_gen != NULL; - g = prev_gen, prev_gen = gch->prev_gen(g)) { - MemRegion to_be_cleared_mr = g->prev_used_region(); - clear(to_be_cleared_mr); - } + clear(old_gen->prev_used_region()); } -void CardTableRS::invalidate_or_clear(Generation* gen, bool younger) { - GenCollectedHeap* gch = GenCollectedHeap::heap(); - // For each generation gen (and younger) - // invalidate the cards for the currently occupied part - // of that generation and clear the cards for the +void CardTableRS::invalidate_or_clear(Generation* old_gen) { + assert(old_gen->level() == 1, "Should only be called for the old generation"); + // Invalidate the cards for the currently occupied part of + // the old generation and clear the cards for the // unoccupied part of the generation (if any, making use // of that generation's prev_used_region to determine that // region). No need to do anything for the youngest // generation. Also see note#20040107.ysr above. - Generation* g = gen; - for(Generation* prev_gen = gch->prev_gen(g); prev_gen != NULL; - g = prev_gen, prev_gen = gch->prev_gen(g)) { - MemRegion used_mr = g->used_region(); - MemRegion to_be_cleared_mr = g->prev_used_region().minus(used_mr); - if (!to_be_cleared_mr.is_empty()) { - clear(to_be_cleared_mr); - } - invalidate(used_mr); - if (!younger) break; + MemRegion used_mr = old_gen->used_region(); + MemRegion to_be_cleared_mr = old_gen->prev_used_region().minus(used_mr); + if (!to_be_cleared_mr.is_empty()) { + clear(to_be_cleared_mr); } + invalidate(used_mr); } diff --git a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp index 234b3972db5..25884feac8b 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.hpp +++ b/hotspot/src/share/vm/memory/cardTableRS.hpp @@ -142,12 +142,12 @@ public: void verify_aligned_region_empty(MemRegion mr); void clear(MemRegion mr) { _ct_bs->clear(mr); } - void clear_into_younger(Generation* gen); + void clear_into_younger(Generation* old_gen); void invalidate(MemRegion mr, bool whole_heap = false) { _ct_bs->invalidate(mr, whole_heap); } - void invalidate_or_clear(Generation* gen, bool younger); + void invalidate_or_clear(Generation* old_gen); static uintx ct_max_alignment_constraint() { return CardTableModRefBS::ct_max_alignment_constraint(); diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 177569294af..0b4af29a3e3 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -567,8 +567,6 @@ void DefNewGeneration::collect(bool full, gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start()); _next_gen = gch->next_gen(this); - assert(_next_gen != NULL, - "This must be the youngest gen, and not the only gen"); // If the next generation is too full to accommodate promotion // from this generation, pass on collection; let the next generation @@ -901,8 +899,6 @@ bool DefNewGeneration::collection_attempt_is_safe() { if (_next_gen == NULL) { GenCollectedHeap* gch = GenCollectedHeap::heap(); _next_gen = gch->next_gen(this); - assert(_next_gen != NULL, - "This must be the youngest gen, and not the only gen"); } return _next_gen->promotion_attempt_is_safe(used()); } @@ -1033,6 +1029,9 @@ HeapWord* DefNewGeneration::allocate(size_t word_size, // have to use it here, as well. HeapWord* result = eden()->par_allocate(word_size); if (result != NULL) { + if (CMSEdenChunksRecordAlways && _next_gen != NULL) { + _next_gen->sample_eden_chunk(); + } return result; } do { @@ -1063,13 +1062,19 @@ HeapWord* DefNewGeneration::allocate(size_t word_size, // circular dependency at compile time. if (result == NULL) { result = allocate_from_space(word_size); + } else if (CMSEdenChunksRecordAlways && _next_gen != NULL) { + _next_gen->sample_eden_chunk(); } return result; } HeapWord* DefNewGeneration::par_allocate(size_t word_size, bool is_tlab) { - return eden()->par_allocate(word_size); + HeapWord* res = eden()->par_allocate(word_size); + if (CMSEdenChunksRecordAlways && _next_gen != NULL) { + _next_gen->sample_eden_chunk(); + } + return res; } void DefNewGeneration::gc_prologue(bool full) { diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index ebdb77f6734..2faed4cc818 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -1070,13 +1070,13 @@ GenCollectedHeap* GenCollectedHeap::heap() { void GenCollectedHeap::prepare_for_compaction() { - Generation* scanning_gen = _gens[_n_gens-1]; + guarantee(_n_gens = 2, "Wrong number of generations"); + Generation* old_gen = _gens[1]; // Start by compacting into same gen. - CompactPoint cp(scanning_gen, NULL, NULL); - while (scanning_gen != NULL) { - scanning_gen->prepare_for_compaction(&cp); - scanning_gen = prev_gen(scanning_gen); - } + CompactPoint cp(old_gen, NULL, NULL); + old_gen->prepare_for_compaction(&cp); + Generation* young_gen = _gens[0]; + young_gen->prepare_for_compaction(&cp); } GCStats* GenCollectedHeap::gc_stats(int level) const { @@ -1245,27 +1245,14 @@ void GenCollectedHeap::ensure_parsability(bool retire_tlabs) { generation_iterate(&ep_cl, false); } -oop GenCollectedHeap::handle_failed_promotion(Generation* gen, +oop GenCollectedHeap::handle_failed_promotion(Generation* old_gen, oop obj, size_t obj_size) { + guarantee(old_gen->level() == 1, "We only get here with an old generation"); assert(obj_size == (size_t)obj->size(), "bad obj_size passed in"); HeapWord* result = NULL; - // First give each higher generation a chance to allocate the promoted object. - Generation* allocator = next_gen(gen); - if (allocator != NULL) { - do { - result = allocator->allocate(obj_size, false); - } while (result == NULL && (allocator = next_gen(allocator)) != NULL); - } - - if (result == NULL) { - // Then give gen and higher generations a chance to expand and allocate the - // object. - do { - result = gen->expand_and_allocate(obj_size, false); - } while (result == NULL && (gen = next_gen(gen)) != NULL); - } + result = old_gen->expand_and_allocate(obj_size, false); if (result != NULL) { Copy::aligned_disjoint_words((HeapWord*)obj, result, obj_size); diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index 43338c4da46..9ab9d1991df 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -368,25 +368,23 @@ public: // collection. virtual bool is_maximal_no_gc() const; - // Return the generation before "gen", or else NULL. + // Return the generation before "gen". Generation* prev_gen(Generation* gen) const { int l = gen->level(); - if (l == 0) return NULL; - else return _gens[l-1]; + guarantee(l > 0, "Out of bounds"); + return _gens[l-1]; } - // Return the generation after "gen", or else NULL. + // Return the generation after "gen". Generation* next_gen(Generation* gen) const { int l = gen->level() + 1; - if (l == _n_gens) return NULL; - else return _gens[l]; + guarantee(l < _n_gens, "Out of bounds"); + return _gens[l]; } Generation* get_gen(int i) const { - if (i >= 0 && i < _n_gens) - return _gens[i]; - else - return NULL; + guarantee(i >= 0 && i < _n_gens, "Out of bounds"); + return _gens[i]; } int n_gens() const { @@ -485,9 +483,9 @@ public: // Promotion of obj into gen failed. Try to promote obj to higher // gens in ascending order; return the new location of obj if successful. - // Otherwise, try expand-and-allocate for obj in each generation starting at - // gen; return the new location of obj if successful. Otherwise, return NULL. - oop handle_failed_promotion(Generation* gen, + // Otherwise, try expand-and-allocate for obj in both the young and old + // generation; return the new location of obj if successful. Otherwise, return NULL. + oop handle_failed_promotion(Generation* old_gen, oop obj, size_t obj_size); diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index e53e742be70..fdeba2adaf9 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -52,8 +52,8 @@ #include "utilities/copy.hpp" #include "utilities/events.hpp" -void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, - bool clear_all_softrefs) { +void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool clear_all_softrefs) { + guarantee(level == 1, "We always collect both old and young."); assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); GenCollectedHeap* gch = GenCollectedHeap::heap(); @@ -84,11 +84,6 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, // Capture heap size before collection for printing. size_t gch_prev_used = gch->used(); - // Some of the card table updates below assume that the perm gen is - // also being collected. - assert(level == gch->n_gens() - 1, - "All generations are being collected, ergo perm gen too."); - // Capture used regions for each generation that will be // subject to collection, so that card table adjustments can // be made intelligently (see clear / invalidate further below). @@ -126,17 +121,15 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, all_empty = all_empty && gch->get_gen(i)->used() == 0; } GenRemSet* rs = gch->rem_set(); + Generation* old_gen = gch->get_gen(level); // Clear/invalidate below make use of the "prev_used_regions" saved earlier. if (all_empty) { // We've evacuated all generations below us. - Generation* g = gch->get_gen(level); - rs->clear_into_younger(g); + rs->clear_into_younger(old_gen); } else { // Invalidate the cards corresponding to the currently used - // region and clear those corresponding to the evacuated region - // of all generations just collected (i.e. level and younger). - rs->invalidate_or_clear(gch->get_gen(level), - true /* younger */); + // region and clear those corresponding to the evacuated region. + rs->invalidate_or_clear(old_gen); } Threads::gc_epilogue(); diff --git a/hotspot/src/share/vm/memory/genRemSet.hpp b/hotspot/src/share/vm/memory/genRemSet.hpp index e6b8302ad89..44a43540769 100644 --- a/hotspot/src/share/vm/memory/genRemSet.hpp +++ b/hotspot/src/share/vm/memory/genRemSet.hpp @@ -135,7 +135,7 @@ public: // younger than gen from generations gen and older. // The parameter clear_perm indicates if the perm_gen's // remembered set should also be processed/cleared. - virtual void clear_into_younger(Generation* gen) = 0; + virtual void clear_into_younger(Generation* old_gen) = 0; // Informs the RS that refs in the given "mr" may have changed // arbitrarily, and therefore may contain old-to-young pointers. @@ -146,11 +146,8 @@ public: // Informs the RS that refs in this generation // may have changed arbitrarily, and therefore may contain - // old-to-young pointers in arbitrary locations. The parameter - // younger indicates if the same should be done for younger generations - // as well. The parameter perm indicates if the same should be done for - // perm gen as well. - virtual void invalidate_or_clear(Generation* gen, bool younger) = 0; + // old-to-young pointers in arbitrary locations. + virtual void invalidate_or_clear(Generation* old_gen) = 0; }; #endif // SHARE_VM_MEMORY_GENREMSET_HPP diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp index 44d641feedd..290cce583a0 100644 --- a/hotspot/src/share/vm/memory/generation.hpp +++ b/hotspot/src/share/vm/memory/generation.hpp @@ -455,6 +455,7 @@ class Generation: public CHeapObj { // expected to be GC worker thread-local, with the worker index // indicated by "thr_num". virtual void* get_data_recorder(int thr_num) { return NULL; } + virtual void sample_eden_chunk() {} // Some generations may require some cleanup actions before allowing // a verification. diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 1522eddb76b..f230dcf791d 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -2254,10 +2254,11 @@ ChunkIndex ChunkManager::list_index(size_t size) { void SpaceManager::deallocate(MetaWord* p, size_t word_size) { assert_lock_strong(_lock); + size_t raw_word_size = get_raw_word_size(word_size); size_t min_size = TreeChunk::min_size(); - assert(word_size >= min_size, + assert(raw_word_size >= min_size, err_msg("Should not deallocate dark matter " SIZE_FORMAT, word_size)); - block_freelists()->return_block(p, word_size); + block_freelists()->return_block(p, raw_word_size); } // Adds a chunk to the list of chunks in use. diff --git a/hotspot/src/share/vm/memory/padded.hpp b/hotspot/src/share/vm/memory/padded.hpp new file mode 100644 index 00000000000..4c50b39963e --- /dev/null +++ b/hotspot/src/share/vm/memory/padded.hpp @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_MEMORY_PADDED_HPP +#define SHARE_VM_MEMORY_PADDED_HPP + +#include "memory/allocation.hpp" +#include "utilities/globalDefinitions.hpp" + +// Bytes needed to pad type to avoid cache-line sharing; alignment should be the +// expected cache line size (a power of two). The first addend avoids sharing +// when the start address is not a multiple of alignment; the second maintains +// alignment of starting addresses that happen to be a multiple. +#define PADDING_SIZE(type, alignment) \ + ((alignment) + align_size_up_(sizeof(type), alignment)) + +// Templates to create a subclass padded to avoid cache line sharing. These are +// effective only when applied to derived-most (leaf) classes. + +// When no args are passed to the base ctor. +template +class Padded : public T { + private: + char _pad_buf_[PADDING_SIZE(T, alignment)]; +}; + +// When either 0 or 1 args may be passed to the base ctor. +template +class Padded01 : public T { + public: + Padded01(): T() { } + Padded01(Arg1T arg1): T(arg1) { } + private: + char _pad_buf_[PADDING_SIZE(T, alignment)]; +}; + +// Super class of PaddedEnd when pad_size != 0. +template +class PaddedEndImpl : public T { + private: + char _pad_buf[pad_size]; +}; + +// Super class of PaddedEnd when pad_size == 0. +template +class PaddedEndImpl : public T { + // No padding. +}; + +#define PADDED_END_SIZE(type, alignment) (align_size_up_(sizeof(type), alignment) - sizeof(type)) + +// More memory conservative implementation of Padded. The subclass adds the +// minimal amount of padding needed to make the size of the objects be aligned. +// This will help reducing false sharing, +// if the start address is a multiple of alignment. +template +class PaddedEnd : public PaddedEndImpl { + // C++ don't allow zero-length arrays. The padding is put in a + // super class that is specialized for the pad_size == 0 case. +}; + +// Helper class to create an array of PaddedEnd objects. All elements will +// start at a multiple of alignment and the size will be aligned to alignment. +template +class PaddedArray { + public: + // Creates an aligned padded array. + // The memory can't be deleted since the raw memory chunk is not returned. + static PaddedEnd* create_unfreeable(uint length); +}; + +#endif // SHARE_VM_MEMORY_PADDED_HPP diff --git a/hotspot/src/share/vm/memory/padded.inline.hpp b/hotspot/src/share/vm/memory/padded.inline.hpp new file mode 100644 index 00000000000..1e9994ab647 --- /dev/null +++ b/hotspot/src/share/vm/memory/padded.inline.hpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "memory/allocation.inline.hpp" +#include "memory/padded.hpp" +#include "utilities/debug.hpp" +#include "utilities/globalDefinitions.hpp" + +// Creates an aligned padded array. +// The memory can't be deleted since the raw memory chunk is not returned. +template +PaddedEnd* PaddedArray::create_unfreeable(uint length) { + // Check that the PaddedEnd class works as intended. + STATIC_ASSERT(is_size_aligned_(sizeof(PaddedEnd), alignment)); + + // Allocate a chunk of memory large enough to allow for some alignment. + void* chunk = AllocateHeap(length * sizeof(PaddedEnd) + alignment, flags); + + // Make the initial alignment. + PaddedEnd* aligned_padded_array = (PaddedEnd*)align_pointer_up(chunk, alignment); + + // Call the default constructor for each element. + for (uint i = 0; i < length; i++) { + ::new (&aligned_padded_array[i]) T(); + } + + return aligned_padded_array; +} diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index fa4dd64ec2c..79455db9b6e 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -65,7 +65,8 @@ SharedHeap::SharedHeap(CollectorPolicy* policy_) : } _sh = this; // ch is static, should be set only once. if ((UseParNewGC || - (UseConcMarkSweepGC && CMSParallelRemarkEnabled) || + (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled || + CMSParallelRemarkEnabled)) || UseG1GC) && ParallelGCThreads > 0) { _workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads, diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index 511610bd3bf..33a857f2a7e 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -105,10 +105,9 @@ objArrayOop Universe::_the_empty_class_klass_array = NULL; Array* Universe::_the_array_interfaces_array = NULL; oop Universe::_the_null_string = NULL; oop Universe::_the_min_jint_string = NULL; -LatestMethodOopCache* Universe::_finalizer_register_cache = NULL; -LatestMethodOopCache* Universe::_loader_addClass_cache = NULL; -LatestMethodOopCache* Universe::_pd_implies_cache = NULL; -ActiveMethodOopsCache* Universe::_reflect_invoke_cache = NULL; +LatestMethodCache* Universe::_finalizer_register_cache = NULL; +LatestMethodCache* Universe::_loader_addClass_cache = NULL; +LatestMethodCache* Universe::_pd_implies_cache = NULL; oop Universe::_out_of_memory_error_java_heap = NULL; oop Universe::_out_of_memory_error_metaspace = NULL; oop Universe::_out_of_memory_error_class_metaspace = NULL; @@ -225,7 +224,6 @@ void Universe::serialize(SerializeClosure* f, bool do_all) { f->do_ptr((void**)&_the_empty_klass_array); _finalizer_register_cache->serialize(f); _loader_addClass_cache->serialize(f); - _reflect_invoke_cache->serialize(f); _pd_implies_cache->serialize(f); } @@ -649,10 +647,9 @@ jint universe_init() { // We have a heap so create the Method* caches before // Metaspace::initialize_shared_spaces() tries to populate them. - Universe::_finalizer_register_cache = new LatestMethodOopCache(); - Universe::_loader_addClass_cache = new LatestMethodOopCache(); - Universe::_pd_implies_cache = new LatestMethodOopCache(); - Universe::_reflect_invoke_cache = new ActiveMethodOopsCache(); + Universe::_finalizer_register_cache = new LatestMethodCache(); + Universe::_loader_addClass_cache = new LatestMethodCache(); + Universe::_pd_implies_cache = new LatestMethodCache(); if (UseSharedSpaces) { // Read the data structures supporting the shared spaces (shared @@ -1088,35 +1085,21 @@ bool universe_post_init() { vmSymbols::register_method_name(), vmSymbols::register_method_signature()); if (m == NULL || !m->is_static()) { - THROW_MSG_(vmSymbols::java_lang_NoSuchMethodException(), - "java.lang.ref.Finalizer.register", false); + tty->print_cr("Unable to link/verify Finalizer.register method"); + return false; // initialization failed (cannot throw exception yet) } Universe::_finalizer_register_cache->init( - SystemDictionary::Finalizer_klass(), m, CHECK_false); - - // Resolve on first use and initialize class. - // Note: No race-condition here, since a resolve will always return the same result - - // Setup method for security checks - k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_reflect_Method(), true, CHECK_false); - k_h = instanceKlassHandle(THREAD, k); - k_h->link_class(CHECK_false); - m = k_h->find_method(vmSymbols::invoke_name(), vmSymbols::object_object_array_object_signature()); - if (m == NULL || m->is_static()) { - THROW_MSG_(vmSymbols::java_lang_NoSuchMethodException(), - "java.lang.reflect.Method.invoke", false); - } - Universe::_reflect_invoke_cache->init(k_h(), m, CHECK_false); + SystemDictionary::Finalizer_klass(), m); // Setup method for registering loaded classes in class loader vector InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false); m = InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature()); if (m == NULL || m->is_static()) { - THROW_MSG_(vmSymbols::java_lang_NoSuchMethodException(), - "java.lang.ClassLoader.addClass", false); + tty->print_cr("Unable to link/verify ClassLoader.addClass method"); + return false; // initialization failed (cannot throw exception yet) } Universe::_loader_addClass_cache->init( - SystemDictionary::ClassLoader_klass(), m, CHECK_false); + SystemDictionary::ClassLoader_klass(), m); // Setup method for checking protection domain InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->link_class(CHECK_false); @@ -1132,7 +1115,7 @@ bool universe_post_init() { return false; // initialization failed } Universe::_pd_implies_cache->init( - SystemDictionary::ProtectionDomain_klass(), m, CHECK_false);; + SystemDictionary::ProtectionDomain_klass(), m);; } // The folowing is initializing converter functions for serialization in @@ -1455,7 +1438,7 @@ void Universe::compute_verify_oop_data() { } -void CommonMethodOopCache::init(Klass* k, Method* m, TRAPS) { +void LatestMethodCache::init(Klass* k, Method* m) { if (!UseSharedSpaces) { _klass = k; } @@ -1471,88 +1454,7 @@ void CommonMethodOopCache::init(Klass* k, Method* m, TRAPS) { } -ActiveMethodOopsCache::~ActiveMethodOopsCache() { - if (_prev_methods != NULL) { - delete _prev_methods; - _prev_methods = NULL; - } -} - - -void ActiveMethodOopsCache::add_previous_version(Method* method) { - assert(Thread::current()->is_VM_thread(), - "only VMThread can add previous versions"); - - // Only append the previous method if it is executing on the stack. - if (method->on_stack()) { - - if (_prev_methods == NULL) { - // This is the first previous version so make some space. - // Start with 2 elements under the assumption that the class - // won't be redefined much. - _prev_methods = new (ResourceObj::C_HEAP, mtClass) GrowableArray(2, true); - } - - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00000100, - ("add: %s(%s): adding prev version ref for cached method @%d", - method->name()->as_C_string(), method->signature()->as_C_string(), - _prev_methods->length())); - - _prev_methods->append(method); - } - - - // Since the caller is the VMThread and we are at a safepoint, this is a good - // time to clear out unused method references. - - if (_prev_methods == NULL) return; - - for (int i = _prev_methods->length() - 1; i >= 0; i--) { - Method* method = _prev_methods->at(i); - assert(method != NULL, "weak method ref was unexpectedly cleared"); - - if (!method->on_stack()) { - // This method isn't running anymore so remove it - _prev_methods->remove_at(i); - MetadataFactory::free_metadata(method->method_holder()->class_loader_data(), method); - } else { - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00000400, - ("add: %s(%s): previous cached method @%d is alive", - method->name()->as_C_string(), method->signature()->as_C_string(), i)); - } - } -} // end add_previous_version() - - -bool ActiveMethodOopsCache::is_same_method(const Method* method) const { - InstanceKlass* ik = InstanceKlass::cast(klass()); - const Method* check_method = ik->method_with_idnum(method_idnum()); - assert(check_method != NULL, "sanity check"); - if (check_method == method) { - // done with the easy case - return true; - } - - if (_prev_methods != NULL) { - // The cached method has been redefined at least once so search - // the previous versions for a match. - for (int i = 0; i < _prev_methods->length(); i++) { - check_method = _prev_methods->at(i); - if (check_method == method) { - // a previous version matches - return true; - } - } - } - - // either no previous versions or no previous version matched - return false; -} - - -Method* LatestMethodOopCache::get_Method() { +Method* LatestMethodCache::get_method() { if (klass() == NULL) return NULL; InstanceKlass* ik = InstanceKlass::cast(klass()); Method* m = ik->method_with_idnum(method_idnum()); diff --git a/hotspot/src/share/vm/memory/universe.hpp b/hotspot/src/share/vm/memory/universe.hpp index 24a95e84594..69998434380 100644 --- a/hotspot/src/share/vm/memory/universe.hpp +++ b/hotspot/src/share/vm/memory/universe.hpp @@ -41,10 +41,11 @@ class CollectedHeap; class DeferredObjAllocEvent; -// Common parts of a Method* cache. This cache safely interacts with -// the RedefineClasses API. -// -class CommonMethodOopCache : public CHeapObj { +// A helper class for caching a Method* when the user of the cache +// only cares about the latest version of the Method*. This cache safely +// interacts with the RedefineClasses API. + +class LatestMethodCache : public CHeapObj { // We save the Klass* and the idnum of Method* in order to get // the current cached Method*. private: @@ -52,12 +53,14 @@ class CommonMethodOopCache : public CHeapObj { int _method_idnum; public: - CommonMethodOopCache() { _klass = NULL; _method_idnum = -1; } - ~CommonMethodOopCache() { _klass = NULL; _method_idnum = -1; } + LatestMethodCache() { _klass = NULL; _method_idnum = -1; } + ~LatestMethodCache() { _klass = NULL; _method_idnum = -1; } - void init(Klass* k, Method* m, TRAPS); - Klass* klass() const { return _klass; } - int method_idnum() const { return _method_idnum; } + void init(Klass* k, Method* m); + Klass* klass() const { return _klass; } + int method_idnum() const { return _method_idnum; } + + Method* get_method(); // Enhanced Class Redefinition support void classes_do(void f(Klass*)) { @@ -72,39 +75,6 @@ class CommonMethodOopCache : public CHeapObj { }; -// A helper class for caching a Method* when the user of the cache -// cares about all versions of the Method*. -// -class ActiveMethodOopsCache : public CommonMethodOopCache { - // This subclass adds weak references to older versions of the - // Method* and a query method for a Method*. - - private: - // If the cached Method* has not been redefined, then - // _prev_methods will be NULL. If all of the previous - // versions of the method have been collected, then - // _prev_methods can have a length of zero. - GrowableArray* _prev_methods; - - public: - ActiveMethodOopsCache() { _prev_methods = NULL; } - ~ActiveMethodOopsCache(); - - void add_previous_version(Method* method); - bool is_same_method(const Method* method) const; -}; - - -// A helper class for caching a Method* when the user of the cache -// only cares about the latest version of the Method*. -// -class LatestMethodOopCache : public CommonMethodOopCache { - // This subclass adds a getter method for the latest Method*. - - public: - Method* get_Method(); -}; - // For UseCompressedOops and UseCompressedKlassPointers. struct NarrowPtrStruct { // Base address for oop/klass-within-java-object materialization. @@ -174,10 +144,10 @@ class Universe: AllStatic { static objArrayOop _the_empty_class_klass_array; // Canonicalized obj array of type java.lang.Class static oop _the_null_string; // A cache of "null" as a Java string static oop _the_min_jint_string; // A cache of "-2147483648" as a Java string - static LatestMethodOopCache* _finalizer_register_cache; // static method for registering finalizable objects - static LatestMethodOopCache* _loader_addClass_cache; // method for registering loaded classes in class loader vector - static LatestMethodOopCache* _pd_implies_cache; // method for checking protection domain attributes - static ActiveMethodOopsCache* _reflect_invoke_cache; // method for security checks + static LatestMethodCache* _finalizer_register_cache; // static method for registering finalizable objects + static LatestMethodCache* _loader_addClass_cache; // method for registering loaded classes in class loader vector + static LatestMethodCache* _pd_implies_cache; // method for checking protection domain attributes + // preallocated error objects (no backtrace) static oop _out_of_memory_error_java_heap; static oop _out_of_memory_error_metaspace; @@ -334,11 +304,11 @@ class Universe: AllStatic { static Array* the_array_interfaces_array() { return _the_array_interfaces_array; } static oop the_null_string() { return _the_null_string; } static oop the_min_jint_string() { return _the_min_jint_string; } - static Method* finalizer_register_method() { return _finalizer_register_cache->get_Method(); } - static Method* loader_addClass_method() { return _loader_addClass_cache->get_Method(); } - static Method* protection_domain_implies_method() { return _pd_implies_cache->get_Method(); } - static ActiveMethodOopsCache* reflect_invoke_cache() { return _reflect_invoke_cache; } + static Method* finalizer_register_method() { return _finalizer_register_cache->get_method(); } + static Method* loader_addClass_method() { return _loader_addClass_cache->get_method(); } + + static Method* protection_domain_implies_method() { return _pd_implies_cache->get_method(); } static oop null_ptr_exception_instance() { return _null_ptr_exception_instance; } static oop arithmetic_exception_instance() { return _arithmetic_exception_instance; } diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp index ac210e14834..07cc1aa09cc 100644 --- a/hotspot/src/share/vm/oops/method.cpp +++ b/hotspot/src/share/vm/oops/method.cpp @@ -981,7 +981,6 @@ bool Method::should_not_be_cached() const { bool Method::is_ignored_by_security_stack_walk() const { const bool use_new_reflection = JDK_Version::is_gte_jdk14x_version() && UseNewReflection; - assert(intrinsic_id() != vmIntrinsics::_invoke || Universe::reflect_invoke_cache()->is_same_method((Method*)this), "sanity"); if (intrinsic_id() == vmIntrinsics::_invoke) { // This is Method.invoke() -- ignore it return true; diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp index 0aa41de0120..9153d070886 100644 --- a/hotspot/src/share/vm/opto/block.cpp +++ b/hotspot/src/share/vm/opto/block.cpp @@ -221,7 +221,7 @@ bool Block::has_uncommon_code() const { //------------------------------is_uncommon------------------------------------ // True if block is low enough frequency or guarded by a test which // mostly does not go here. -bool Block::is_uncommon( Block_Array &bbs ) const { +bool Block::is_uncommon(PhaseCFG* cfg) const { // Initial blocks must never be moved, so are never uncommon. if (head()->is_Root() || head()->is_Start()) return false; @@ -238,7 +238,7 @@ bool Block::is_uncommon( Block_Array &bbs ) const { uint uncommon_for_freq_preds = 0; for( uint i=1; i_idx]; + Block* guard = cfg->get_block_for_node(pred(i)); // Check to see if this block follows its guard 1 time out of 10000 // or less. // @@ -285,11 +285,11 @@ void Block::dump_bidx(const Block* orig, outputStream* st) const { } } -void Block::dump_pred(const Block_Array *bbs, Block* orig, outputStream* st) const { +void Block::dump_pred(const PhaseCFG* cfg, Block* orig, outputStream* st) const { if (is_connector()) { for (uint i=1; i_idx]); - p->dump_pred(bbs, orig, st); + Block *p = cfg->get_block_for_node(pred(i)); + p->dump_pred(cfg, orig, st); } } else { dump_bidx(orig, st); @@ -297,7 +297,7 @@ void Block::dump_pred(const Block_Array *bbs, Block* orig, outputStream* st) con } } -void Block::dump_head( const Block_Array *bbs, outputStream* st ) const { +void Block::dump_head(const PhaseCFG* cfg, outputStream* st) const { // Print the basic block dump_bidx(this, st); st->print(": #\t"); @@ -311,26 +311,28 @@ void Block::dump_head( const Block_Array *bbs, outputStream* st ) const { if( head()->is_block_start() ) { for (uint i=1; i_idx]; - p->dump_pred(bbs, p, st); + if (cfg != NULL) { + Block *p = cfg->get_block_for_node(s); + p->dump_pred(cfg, p, st); } else { while (!s->is_block_start()) s = s->in(0); st->print("N%d ", s->_idx ); } } - } else + } else { st->print("BLOCK HEAD IS JUNK "); + } // Print loop, if any const Block *bhead = this; // Head of self-loop Node *bh = bhead->head(); - if( bbs && bh->is_Loop() && !head()->is_Root() ) { + + if ((cfg != NULL) && bh->is_Loop() && !head()->is_Root()) { LoopNode *loop = bh->as_Loop(); - const Block *bx = (*bbs)[loop->in(LoopNode::LoopBackControl)->_idx]; + const Block *bx = cfg->get_block_for_node(loop->in(LoopNode::LoopBackControl)); while (bx->is_connector()) { - bx = (*bbs)[bx->pred(1)->_idx]; + bx = cfg->get_block_for_node(bx->pred(1)); } st->print("\tLoop: B%d-B%d ", bhead->_pre_order, bx->_pre_order); // Dump any loop-specific bits, especially for CountedLoops. @@ -349,29 +351,32 @@ void Block::dump_head( const Block_Array *bbs, outputStream* st ) const { st->print_cr(""); } -void Block::dump() const { dump(NULL); } +void Block::dump() const { + dump(NULL); +} -void Block::dump( const Block_Array *bbs ) const { - dump_head(bbs); - uint cnt = _nodes.size(); - for( uint i=0; idump(); + } tty->print("\n"); } #endif //============================================================================= //------------------------------PhaseCFG--------------------------------------- -PhaseCFG::PhaseCFG( Arena *a, RootNode *r, Matcher &m ) : - Phase(CFG), - _bbs(a), - _root(r), - _node_latency(NULL) +PhaseCFG::PhaseCFG(Arena* arena, RootNode* root, Matcher& matcher) +: Phase(CFG) +, _block_arena(arena) +, _node_to_block_mapping(arena) +, _root(root) +, _node_latency(NULL) #ifndef PRODUCT - , _trace_opto_pipelining(TraceOptoPipelining || C->method_has_option("TraceOptoPipelining")) +, _trace_opto_pipelining(TraceOptoPipelining || C->method_has_option("TraceOptoPipelining")) #endif #ifdef ASSERT - , _raw_oops(a) +, _raw_oops(arena) #endif { ResourceMark rm; @@ -380,13 +385,13 @@ PhaseCFG::PhaseCFG( Arena *a, RootNode *r, Matcher &m ) : // Node on demand. Node *x = new (C) GotoNode(NULL); x->init_req(0, x); - _goto = m.match_tree(x); + _goto = matcher.match_tree(x); assert(_goto != NULL, ""); _goto->set_req(0,_goto); // Build the CFG in Reverse Post Order _num_blocks = build_cfg(); - _broot = _bbs[_root->_idx]; + _broot = get_block_for_node(_root); } //------------------------------build_cfg-------------------------------------- @@ -440,9 +445,9 @@ uint PhaseCFG::build_cfg() { // 'p' now points to the start of this basic block // Put self in array of basic blocks - Block *bb = new (_bbs._arena) Block(_bbs._arena,p); - _bbs.map(p->_idx,bb); - _bbs.map(x->_idx,bb); + Block *bb = new (_block_arena) Block(_block_arena, p); + map_node_to_block(p, bb); + map_node_to_block(x, bb); if( x != p ) { // Only for root is x == p bb->_nodes.push((Node*)x); } @@ -473,16 +478,16 @@ uint PhaseCFG::build_cfg() { // Check if it the fist node pushed on stack at the beginning. if (idx == 0) break; // end of the build // Find predecessor basic block - Block *pb = _bbs[x->_idx]; + Block *pb = get_block_for_node(x); // Insert into nodes array, if not already there - if( !_bbs.lookup(proj->_idx) ) { + if (!has_block(proj)) { assert( x != proj, "" ); // Map basic block of projection - _bbs.map(proj->_idx,pb); + map_node_to_block(proj, pb); pb->_nodes.push(proj); } // Insert self as a child of my predecessor block - pb->_succs.map(pb->_num_succs++, _bbs[np->_idx]); + pb->_succs.map(pb->_num_succs++, get_block_for_node(np)); assert( pb->_nodes[ pb->_nodes.size() - pb->_num_succs ]->is_block_proj(), "too many control users, not a CFG?" ); } @@ -511,15 +516,15 @@ void PhaseCFG::insert_goto_at(uint block_no, uint succ_no) { RegionNode* region = new (C) RegionNode(2); region->init_req(1, proj); // setup corresponding basic block - Block* block = new (_bbs._arena) Block(_bbs._arena, region); - _bbs.map(region->_idx, block); + Block* block = new (_block_arena) Block(_block_arena, region); + map_node_to_block(region, block); C->regalloc()->set_bad(region->_idx); // add a goto node Node* gto = _goto->clone(); // get a new goto node gto->set_req(0, region); // add it to the basic block block->_nodes.push(gto); - _bbs.map(gto->_idx, block); + map_node_to_block(gto, block); C->regalloc()->set_bad(gto->_idx); // hook up successor block block->_succs.map(block->_num_succs++, out); @@ -570,7 +575,7 @@ void PhaseCFG::convert_NeverBranch_to_Goto(Block *b) { gto->set_req(0, b->head()); Node *bp = b->_nodes[end_idx]; b->_nodes.map(end_idx,gto); // Slam over NeverBranch - _bbs.map(gto->_idx, b); + map_node_to_block(gto, b); C->regalloc()->set_bad(gto->_idx); b->_nodes.pop(); // Yank projections b->_nodes.pop(); // Yank projections @@ -613,7 +618,7 @@ bool PhaseCFG::move_to_next(Block* bx, uint b_index) { // If the previous block conditionally falls into bx, return false, // because moving bx will create an extra jump. for(uint k = 1; k < bx->num_preds(); k++ ) { - Block* pred = _bbs[bx->pred(k)->_idx]; + Block* pred = get_block_for_node(bx->pred(k)); if (pred == _blocks[bx_index-1]) { if (pred->_num_succs != 1) { return false; @@ -682,7 +687,7 @@ void PhaseCFG::remove_empty() { // Look for uncommon blocks and move to end. if (!C->do_freq_based_layout()) { - if( b->is_uncommon(_bbs) ) { + if (b->is_uncommon(this)) { move_to_end(b, i); last--; // No longer check for being uncommon! if( no_flip_branch(b) ) { // Fall-thru case must follow? @@ -870,28 +875,31 @@ void PhaseCFG::_dump_cfg( const Node *end, VectorSet &visited ) const { } while( !p->is_block_start() ); // Recursively visit - for( uint i=1; ireq(); i++ ) - _dump_cfg(p->in(i),visited); + for (uint i = 1; i < p->req(); i++) { + _dump_cfg(p->in(i), visited); + } // Dump the block - _bbs[p->_idx]->dump(&_bbs); + get_block_for_node(p)->dump(this); } void PhaseCFG::dump( ) const { tty->print("\n--- CFG --- %d BBs\n",_num_blocks); - if( _blocks.size() ) { // Did we do basic-block layout? - for( uint i=0; i<_num_blocks; i++ ) - _blocks[i]->dump(&_bbs); + if (_blocks.size()) { // Did we do basic-block layout? + for (uint i = 0; i < _num_blocks; i++) { + _blocks[i]->dump(this); + } } else { // Else do it with a DFS - VectorSet visited(_bbs._arena); + VectorSet visited(_block_arena); _dump_cfg(_root,visited); } } void PhaseCFG::dump_headers() { for( uint i = 0; i < _num_blocks; i++ ) { - if( _blocks[i] == NULL ) continue; - _blocks[i]->dump_head(&_bbs); + if (_blocks[i]) { + _blocks[i]->dump_head(this); + } } } @@ -904,7 +912,7 @@ void PhaseCFG::verify( ) const { uint j; for (j = 0; j < cnt; j++) { Node *n = b->_nodes[j]; - assert( _bbs[n->_idx] == b, "" ); + assert(get_block_for_node(n) == b, ""); if (j >= 1 && n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_CreateEx) { assert(j == 1 || b->_nodes[j-1]->is_Phi(), @@ -913,13 +921,12 @@ void PhaseCFG::verify( ) const { for (uint k = 0; k < n->req(); k++) { Node *def = n->in(k); if (def && def != n) { - assert(_bbs[def->_idx] || def->is_Con(), - "must have block; constants for debug info ok"); + assert(get_block_for_node(def) || def->is_Con(), "must have block; constants for debug info ok"); // Verify that instructions in the block is in correct order. // Uses must follow their definition if they are at the same block. // Mostly done to check that MachSpillCopy nodes are placed correctly // when CreateEx node is moved in build_ifg_physical(). - if (_bbs[def->_idx] == b && + if (get_block_for_node(def) == b && !(b->head()->is_Loop() && n->is_Phi()) && // See (+++) comment in reg_split.cpp !(n->jvms() != NULL && n->jvms()->is_monitor_use(k))) { diff --git a/hotspot/src/share/vm/opto/block.hpp b/hotspot/src/share/vm/opto/block.hpp index a2e4615b8d0..cb9384de2ee 100644 --- a/hotspot/src/share/vm/opto/block.hpp +++ b/hotspot/src/share/vm/opto/block.hpp @@ -48,13 +48,12 @@ class Block_Array : public ResourceObj { friend class VMStructs; uint _size; // allocated size, as opposed to formal limit debug_only(uint _limit;) // limit to formal domain + Arena *_arena; // Arena to allocate in protected: Block **_blocks; void grow( uint i ); // Grow array node to fit public: - Arena *_arena; // Arena to allocate in - Block_Array(Arena *a) : _arena(a), _size(OptoBlockListSize) { debug_only(_limit=0); _blocks = NEW_ARENA_ARRAY( a, Block *, OptoBlockListSize ); @@ -77,7 +76,7 @@ class Block_List : public Block_Array { public: uint _cnt; Block_List() : Block_Array(Thread::current()->resource_area()), _cnt(0) {} - void push( Block *b ) { map(_cnt++,b); } + void push( Block *b ) { map(_cnt++,b); } Block *pop() { return _blocks[--_cnt]; } Block *rpop() { Block *b = _blocks[0]; _blocks[0]=_blocks[--_cnt]; return b;} void remove( uint i ); @@ -284,15 +283,15 @@ class Block : public CFGElement { // helper function that adds caller save registers to MachProjNode void add_call_kills(MachProjNode *proj, RegMask& regs, const char* save_policy, bool exclude_soe); // Schedule a call next in the block - uint sched_call(Matcher &matcher, Block_Array &bbs, uint node_cnt, Node_List &worklist, GrowableArray &ready_cnt, MachCallNode *mcall, VectorSet &next_call); + uint sched_call(Matcher &matcher, PhaseCFG* cfg, uint node_cnt, Node_List &worklist, GrowableArray &ready_cnt, MachCallNode *mcall, VectorSet &next_call); // Perform basic-block local scheduling Node *select(PhaseCFG *cfg, Node_List &worklist, GrowableArray &ready_cnt, VectorSet &next_call, uint sched_slot); - void set_next_call( Node *n, VectorSet &next_call, Block_Array &bbs ); - void needed_for_next_call(Node *this_call, VectorSet &next_call, Block_Array &bbs); + void set_next_call( Node *n, VectorSet &next_call, PhaseCFG* cfg); + void needed_for_next_call(Node *this_call, VectorSet &next_call, PhaseCFG* cfg); bool schedule_local(PhaseCFG *cfg, Matcher &m, GrowableArray &ready_cnt, VectorSet &next_call); // Cleanup if any code lands between a Call and his Catch - void call_catch_cleanup(Block_Array &bbs, Compile *C); + void call_catch_cleanup(PhaseCFG* cfg, Compile *C); // Detect implicit-null-check opportunities. Basically, find NULL checks // with suitable memory ops nearby. Use the memory op to do the NULL check. // I can generate a memory op if there is not one nearby. @@ -331,15 +330,15 @@ class Block : public CFGElement { // Use frequency calculations and code shape to predict if the block // is uncommon. - bool is_uncommon( Block_Array &bbs ) const; + bool is_uncommon(PhaseCFG* cfg) const; #ifndef PRODUCT // Debugging print of basic block void dump_bidx(const Block* orig, outputStream* st = tty) const; - void dump_pred(const Block_Array *bbs, Block* orig, outputStream* st = tty) const; - void dump_head( const Block_Array *bbs, outputStream* st = tty ) const; + void dump_pred(const PhaseCFG* cfg, Block* orig, outputStream* st = tty) const; + void dump_head(const PhaseCFG* cfg, outputStream* st = tty) const; void dump() const; - void dump( const Block_Array *bbs ) const; + void dump(const PhaseCFG* cfg) const; #endif }; @@ -349,6 +348,12 @@ class Block : public CFGElement { class PhaseCFG : public Phase { friend class VMStructs; private: + // Arena for the blocks to be stored in + Arena* _block_arena; + + // Map nodes to owning basic block + Block_Array _node_to_block_mapping; + // Build a proper looking cfg. Return count of basic blocks uint build_cfg(); @@ -371,22 +376,42 @@ class PhaseCFG : public Phase { Block* insert_anti_dependences(Block* LCA, Node* load, bool verify = false); void verify_anti_dependences(Block* LCA, Node* load) { - assert(LCA == _bbs[load->_idx], "should already be scheduled"); + assert(LCA == get_block_for_node(load), "should already be scheduled"); insert_anti_dependences(LCA, load, true); } public: - PhaseCFG( Arena *a, RootNode *r, Matcher &m ); + PhaseCFG(Arena* arena, RootNode* root, Matcher& matcher); uint _num_blocks; // Count of basic blocks Block_List _blocks; // List of basic blocks RootNode *_root; // Root of whole program - Block_Array _bbs; // Map Nodes to owning Basic Block Block *_broot; // Basic block of root uint _rpo_ctr; CFGLoop* _root_loop; float _outer_loop_freq; // Outmost loop frequency + + // set which block this node should reside in + void map_node_to_block(const Node* node, Block* block) { + _node_to_block_mapping.map(node->_idx, block); + } + + // removes the mapping from a node to a block + void unmap_node_from_block(const Node* node) { + _node_to_block_mapping.map(node->_idx, NULL); + } + + // get the block in which this node resides + Block* get_block_for_node(const Node* node) const { + return _node_to_block_mapping[node->_idx]; + } + + // does this node reside in a block; return true + bool has_block(const Node* node) const { + return (_node_to_block_mapping.lookup(node->_idx) != NULL); + } + // Per node latency estimation, valid only during GCM GrowableArray *_node_latency; @@ -405,7 +430,7 @@ class PhaseCFG : public Phase { void Estimate_Block_Frequency(); // Global Code Motion. See Click's PLDI95 paper. Place Nodes in specific - // basic blocks; i.e. _bbs now maps _idx for all Nodes to some Block. + // basic blocks; i.e. _node_to_block_mapping now maps _idx for all Nodes to some Block. void GlobalCodeMotion( Matcher &m, uint unique, Node_List &proj_list ); // Compute the (backwards) latency of a node from the uses @@ -454,7 +479,7 @@ class PhaseCFG : public Phase { // Insert a node into a block, and update the _bbs void insert( Block *b, uint idx, Node *n ) { b->_nodes.insert( idx, n ); - _bbs.map( n->_idx, b ); + map_node_to_block(n, b); } #ifndef PRODUCT @@ -543,7 +568,7 @@ class CFGLoop : public CFGElement { _child(NULL), _exit_prob(1.0f) {} CFGLoop* parent() { return _parent; } - void push_pred(Block* blk, int i, Block_List& worklist, Block_Array& node_to_blk); + void push_pred(Block* blk, int i, Block_List& worklist, PhaseCFG* cfg); void add_member(CFGElement *s) { _members.push(s); } void add_nested_loop(CFGLoop* cl); Block* head() { diff --git a/hotspot/src/share/vm/opto/buildOopMap.cpp b/hotspot/src/share/vm/opto/buildOopMap.cpp index fc731604eaa..884142d57df 100644 --- a/hotspot/src/share/vm/opto/buildOopMap.cpp +++ b/hotspot/src/share/vm/opto/buildOopMap.cpp @@ -426,14 +426,16 @@ static void do_liveness( PhaseRegAlloc *regalloc, PhaseCFG *cfg, Block_List *wor } memset( live, 0, cfg->_num_blocks * (max_reg_ints<req(); i++ ) - worklist->push(cfg->_bbs[root->in(i)->_idx]); + for (uint i = 1; i < root->req(); i++) { + Block* block = cfg->get_block_for_node(root->in(i)); + worklist->push(block); + } // ZKM.jar includes tiny infinite loops which are unreached from below. // If we missed any blocks, we'll retry here after pushing all missed // blocks on the worklist. Normally this outer loop never trips more // than once. - while( 1 ) { + while (1) { while( worklist->size() ) { // Standard worklist algorithm Block *b = worklist->rpop(); @@ -537,8 +539,10 @@ static void do_liveness( PhaseRegAlloc *regalloc, PhaseCFG *cfg, Block_List *wor for( l=0; lnum_preds(); l++ ) - worklist->push(cfg->_bbs[b->pred(l)->_idx]); + for (l = 1; l < (int)b->num_preds(); l++) { + Block* block = cfg->get_block_for_node(b->pred(l)); + worklist->push(block); + } } } @@ -629,10 +633,9 @@ void Compile::BuildOopMaps() { // pred to this block. Otherwise we have to grab a new OopFlow. OopFlow *flow = NULL; // Flag for finding optimized flow Block *pred = (Block*)0xdeadbeef; - uint j; // Scan this block's preds to find a done predecessor - for( j=1; jnum_preds(); j++ ) { - Block *p = _cfg->_bbs[b->pred(j)->_idx]; + for (uint j = 1; j < b->num_preds(); j++) { + Block* p = _cfg->get_block_for_node(b->pred(j)); OopFlow *p_flow = flows[p->_pre_order]; if( p_flow ) { // Predecessor is done assert( p_flow->_b == p, "cross check" ); diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index 2e212995f3e..15d8befbbac 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -179,6 +179,9 @@ product_pd(intx, LoopUnrollLimit, \ "Unroll loop bodies with node count less than this") \ \ + product(intx, LoopMaxUnroll, 16, \ + "Maximum number of unrolls for main loop") \ + \ product(intx, LoopUnrollMin, 4, \ "Minimum number of unroll loop bodies before checking progress" \ "of rounds of unroll,optimize,..") \ diff --git a/hotspot/src/share/vm/opto/chaitin.cpp b/hotspot/src/share/vm/opto/chaitin.cpp index 53ffc573284..4fc254f40ca 100644 --- a/hotspot/src/share/vm/opto/chaitin.cpp +++ b/hotspot/src/share/vm/opto/chaitin.cpp @@ -295,7 +295,7 @@ void PhaseChaitin::new_lrg(const Node *x, uint lrg) { bool PhaseChaitin::clone_projs_shared(Block *b, uint idx, Node *con, Node *copy, uint max_lrg_id) { - Block *bcon = _cfg._bbs[con->_idx]; + Block* bcon = _cfg.get_block_for_node(con); uint cindex = bcon->find_node(con); Node *con_next = bcon->_nodes[cindex+1]; if (con_next->in(0) != con || !con_next->is_MachProj()) { @@ -306,7 +306,7 @@ bool PhaseChaitin::clone_projs_shared(Block *b, uint idx, Node *con, Node *copy, Node *kills = con_next->clone(); kills->set_req(0, copy); b->_nodes.insert(idx, kills); - _cfg._bbs.map(kills->_idx, b); + _cfg.map_node_to_block(kills, b); new_lrg(kills, max_lrg_id); return true; } @@ -962,8 +962,7 @@ void PhaseChaitin::gather_lrg_masks( bool after_aggressive ) { // AggressiveCoalesce. This effectively pre-virtual-splits // around uncommon uses of common defs. const RegMask &rm = n->in_RegMask(k); - if( !after_aggressive && - _cfg._bbs[n->in(k)->_idx]->_freq > 1000*b->_freq ) { + if (!after_aggressive && _cfg.get_block_for_node(n->in(k))->_freq > 1000 * b->_freq) { // Since we are BEFORE aggressive coalesce, leave the register // mask untrimmed by the call. This encourages more coalescing. // Later, AFTER aggressive, this live range will have to spill @@ -1709,16 +1708,15 @@ Node *PhaseChaitin::find_base_for_derived( Node **derived_base_map, Node *derive // set control to _root and place it into Start block // (where top() node is placed). base->init_req(0, _cfg._root); - Block *startb = _cfg._bbs[C->top()->_idx]; + Block *startb = _cfg.get_block_for_node(C->top()); startb->_nodes.insert(startb->find_node(C->top()), base ); - _cfg._bbs.map( base->_idx, startb ); + _cfg.map_node_to_block(base, startb); assert(_lrg_map.live_range_id(base) == 0, "should not have LRG yet"); } if (_lrg_map.live_range_id(base) == 0) { new_lrg(base, maxlrg++); } - assert(base->in(0) == _cfg._root && - _cfg._bbs[base->_idx] == _cfg._bbs[C->top()->_idx], "base NULL should be shared"); + assert(base->in(0) == _cfg._root && _cfg.get_block_for_node(base) == _cfg.get_block_for_node(C->top()), "base NULL should be shared"); derived_base_map[derived->_idx] = base; return base; } @@ -1754,12 +1752,12 @@ Node *PhaseChaitin::find_base_for_derived( Node **derived_base_map, Node *derive base->as_Phi()->set_type(t); // Search the current block for an existing base-Phi - Block *b = _cfg._bbs[derived->_idx]; + Block *b = _cfg.get_block_for_node(derived); for( i = 1; i <= b->end_idx(); i++ ) {// Search for matching Phi Node *phi = b->_nodes[i]; if( !phi->is_Phi() ) { // Found end of Phis with no match? b->_nodes.insert( i, base ); // Must insert created Phi here as base - _cfg._bbs.map( base->_idx, b ); + _cfg.map_node_to_block(base, b); new_lrg(base,maxlrg++); break; } @@ -1815,8 +1813,8 @@ bool PhaseChaitin::stretch_base_pointer_live_ranges(ResourceArea *a) { if( n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_CmpI ) { Node *phi = n->in(1); if( phi->is_Phi() && phi->as_Phi()->region()->is_Loop() ) { - Block *phi_block = _cfg._bbs[phi->_idx]; - if( _cfg._bbs[phi_block->pred(2)->_idx] == b ) { + Block *phi_block = _cfg.get_block_for_node(phi); + if (_cfg.get_block_for_node(phi_block->pred(2)) == b) { const RegMask *mask = C->matcher()->idealreg2spillmask[Op_RegI]; Node *spill = new (C) MachSpillCopyNode( phi, *mask, *mask ); insert_proj( phi_block, 1, spill, maxlrg++ ); @@ -1870,7 +1868,7 @@ bool PhaseChaitin::stretch_base_pointer_live_ranges(ResourceArea *a) { if ((_lrg_map.live_range_id(base) >= _lrg_map.max_lrg_id() || // (Brand new base (hence not live) or !liveout.member(_lrg_map.live_range_id(base))) && // not live) AND (_lrg_map.live_range_id(base) > 0) && // not a constant - _cfg._bbs[base->_idx] != b) { // base not def'd in blk) + _cfg.get_block_for_node(base) != b) { // base not def'd in blk) // Base pointer is not currently live. Since I stretched // the base pointer to here and it crosses basic-block // boundaries, the global live info is now incorrect. @@ -1993,8 +1991,8 @@ void PhaseChaitin::dump(const Node *n) const { tty->print("\n"); } -void PhaseChaitin::dump( const Block * b ) const { - b->dump_head( &_cfg._bbs ); +void PhaseChaitin::dump(const Block *b) const { + b->dump_head(&_cfg); // For all instructions for( uint j = 0; j < b->_nodes.size(); j++ ) @@ -2299,7 +2297,7 @@ void PhaseChaitin::dump_lrg( uint lidx, bool defs_only ) const { if (_lrg_map.find_const(n) == lidx) { if (!dump_once++) { tty->cr(); - b->dump_head( &_cfg._bbs ); + b->dump_head(&_cfg); } dump(n); continue; @@ -2314,7 +2312,7 @@ void PhaseChaitin::dump_lrg( uint lidx, bool defs_only ) const { if (_lrg_map.find_const(m) == lidx) { if (!dump_once++) { tty->cr(); - b->dump_head(&_cfg._bbs); + b->dump_head(&_cfg); } dump(n); } diff --git a/hotspot/src/share/vm/opto/coalesce.cpp b/hotspot/src/share/vm/opto/coalesce.cpp index 60c88dc12ba..d1f880a6493 100644 --- a/hotspot/src/share/vm/opto/coalesce.cpp +++ b/hotspot/src/share/vm/opto/coalesce.cpp @@ -52,7 +52,7 @@ void PhaseCoalesce::dump() const { // Print a nice block header tty->print("B%d: ",b->_pre_order); for( j=1; jnum_preds(); j++ ) - tty->print("B%d ", _phc._cfg._bbs[b->pred(j)->_idx]->_pre_order); + tty->print("B%d ", _phc._cfg.get_block_for_node(b->pred(j))->_pre_order); tty->print("-> "); for( j=0; j_num_succs; j++ ) tty->print("B%d ",b->_succs[j]->_pre_order); @@ -208,7 +208,7 @@ void PhaseAggressiveCoalesce::insert_copy_with_overlap( Block *b, Node *copy, ui copy->set_req(idx,tmp); // Save source in temp early, before source is killed b->_nodes.insert(kill_src_idx,tmp); - _phc._cfg._bbs.map( tmp->_idx, b ); + _phc._cfg.map_node_to_block(tmp, b); last_use_idx++; } @@ -286,7 +286,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) { Node *m = n->in(j); uint src_name = _phc._lrg_map.find(m); if (src_name != phi_name) { - Block *pred = _phc._cfg._bbs[b->pred(j)->_idx]; + Block *pred = _phc._cfg.get_block_for_node(b->pred(j)); Node *copy; assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach"); // Rematerialize constants instead of copying them @@ -305,7 +305,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) { } // Insert the copy in the use-def chain n->set_req(j, copy); - _phc._cfg._bbs.map( copy->_idx, pred ); + _phc._cfg.map_node_to_block(copy, pred); // Extend ("register allocate") the names array for the copy. _phc._lrg_map.extend(copy->_idx, phi_name); } // End of if Phi names do not match @@ -343,13 +343,13 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) { n->set_req(idx, copy); // Extend ("register allocate") the names array for the copy. _phc._lrg_map.extend(copy->_idx, name); - _phc._cfg._bbs.map( copy->_idx, b ); + _phc._cfg.map_node_to_block(copy, b); } } // End of is two-adr // Insert a copy at a debug use for a lrg which has high frequency - if (b->_freq < OPTO_DEBUG_SPLIT_FREQ || b->is_uncommon(_phc._cfg._bbs)) { + if (b->_freq < OPTO_DEBUG_SPLIT_FREQ || b->is_uncommon(&_phc._cfg)) { // Walk the debug inputs to the node and check for lrg freq JVMState* jvms = n->jvms(); uint debug_start = jvms ? jvms->debug_start() : 999999; @@ -391,7 +391,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) { uint max_lrg_id = _phc._lrg_map.max_lrg_id(); _phc.new_lrg(copy, max_lrg_id); _phc._lrg_map.set_max_lrg_id(max_lrg_id + 1); - _phc._cfg._bbs.map(copy->_idx, b); + _phc._cfg.map_node_to_block(copy, b); //tty->print_cr("Split a debug use in Aggressive Coalesce"); } // End of if high frequency use/def } // End of for all debug inputs @@ -437,7 +437,10 @@ void PhaseAggressiveCoalesce::coalesce( Block *b ) { Block *bs = b->_succs[i]; // Find index of 'b' in 'bs' predecessors uint j=1; - while( _phc._cfg._bbs[bs->pred(j)->_idx] != b ) j++; + while (_phc._cfg.get_block_for_node(bs->pred(j)) != b) { + j++; + } + // Visit all the Phis in successor block for( uint k = 1; k_nodes.size(); k++ ) { Node *n = bs->_nodes[k]; @@ -510,9 +513,9 @@ void PhaseConservativeCoalesce::union_helper( Node *lr1_node, Node *lr2_node, ui if( bindex < b->_fhrp_index ) b->_fhrp_index--; // Stretched lr1; add it to liveness of intermediate blocks - Block *b2 = _phc._cfg._bbs[src_copy->_idx]; + Block *b2 = _phc._cfg.get_block_for_node(src_copy); while( b != b2 ) { - b = _phc._cfg._bbs[b->pred(1)->_idx]; + b = _phc._cfg.get_block_for_node(b->pred(1)); _phc._live->live(b)->insert(lr1); } } @@ -532,7 +535,7 @@ uint PhaseConservativeCoalesce::compute_separating_interferences(Node *dst_copy, bindex2--; // Chain backwards 1 instruction while( bindex2 == 0 ) { // At block start, find prior block assert( b2->num_preds() == 2, "cannot double coalesce across c-flow" ); - b2 = _phc._cfg._bbs[b2->pred(1)->_idx]; + b2 = _phc._cfg.get_block_for_node(b2->pred(1)); bindex2 = b2->end_idx()-1; } // Get prior instruction @@ -676,8 +679,8 @@ bool PhaseConservativeCoalesce::copy_copy(Node *dst_copy, Node *src_copy, Block if (UseFPUForSpilling && rm.is_AllStack() ) { // Don't coalesce when frequency difference is large - Block *dst_b = _phc._cfg._bbs[dst_copy->_idx]; - Block *src_def_b = _phc._cfg._bbs[src_def->_idx]; + Block *dst_b = _phc._cfg.get_block_for_node(dst_copy); + Block *src_def_b = _phc._cfg.get_block_for_node(src_def); if (src_def_b->_freq > 10*dst_b->_freq ) return false; } @@ -690,7 +693,7 @@ bool PhaseConservativeCoalesce::copy_copy(Node *dst_copy, Node *src_copy, Block // Another early bail-out test is when we are double-coalescing and the // 2 copies are separated by some control flow. if( dst_copy != src_copy ) { - Block *src_b = _phc._cfg._bbs[src_copy->_idx]; + Block *src_b = _phc._cfg.get_block_for_node(src_copy); Block *b2 = b; while( b2 != src_b ) { if( b2->num_preds() > 2 ){// Found merge-point @@ -701,7 +704,7 @@ bool PhaseConservativeCoalesce::copy_copy(Node *dst_copy, Node *src_copy, Block //record_bias( _phc._lrgs, lr1, lr2 ); return false; // To hard to find all interferences } - b2 = _phc._cfg._bbs[b2->pred(1)->_idx]; + b2 = _phc._cfg.get_block_for_node(b2->pred(1)); } } @@ -786,8 +789,9 @@ bool PhaseConservativeCoalesce::copy_copy(Node *dst_copy, Node *src_copy, Block // Conservative (but pessimistic) copy coalescing of a single block void PhaseConservativeCoalesce::coalesce( Block *b ) { // Bail out on infrequent blocks - if( b->is_uncommon(_phc._cfg._bbs) ) + if (b->is_uncommon(&_phc._cfg)) { return; + } // Check this block for copies. for( uint i = 1; iend_idx(); i++ ) { // Check for actual copies on inputs. Coalesce a copy into its diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index cd650b00156..f7cadda849b 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -2262,7 +2262,7 @@ void Compile::dump_asm(int *pcs, uint pc_limit) { tty->print("%3.3x ", pcs[n->_idx]); else tty->print(" "); - b->dump_head( &_cfg->_bbs ); + b->dump_head(_cfg); if (b->is_connector()) { tty->print_cr(" # Empty connector block"); } else if (b->num_preds() == 2 && b->pred(1)->is_CatchProj() && b->pred(1)->as_CatchProj()->_con == CatchProjNode::fall_through_index) { @@ -3525,7 +3525,7 @@ void Compile::ConstantTable::add(Constant& con) { } Compile::Constant Compile::ConstantTable::add(MachConstantNode* n, BasicType type, jvalue value) { - Block* b = Compile::current()->cfg()->_bbs[n->_idx]; + Block* b = Compile::current()->cfg()->get_block_for_node(n); Constant con(type, value, b->_freq); add(con); return con; diff --git a/hotspot/src/share/vm/opto/domgraph.cpp b/hotspot/src/share/vm/opto/domgraph.cpp index 9973cb562f8..b64e291e7ca 100644 --- a/hotspot/src/share/vm/opto/domgraph.cpp +++ b/hotspot/src/share/vm/opto/domgraph.cpp @@ -105,8 +105,8 @@ void PhaseCFG::Dominators( ) { // Step 2: Node *whead = w->_block->head(); - for( uint j=1; j < whead->req(); j++ ) { - Block *b = _bbs[whead->in(j)->_idx]; + for (uint j = 1; j < whead->req(); j++) { + Block* b = get_block_for_node(whead->in(j)); Tarjan *vx = &tarjan[b->_pre_order]; Tarjan *u = vx->EVAL(); if( u->_semi < w->_semi ) diff --git a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp index 811dc5c6c87..9ded635f65f 100644 --- a/hotspot/src/share/vm/opto/gcm.cpp +++ b/hotspot/src/share/vm/opto/gcm.cpp @@ -66,7 +66,7 @@ // are in b also. void PhaseCFG::schedule_node_into_block( Node *n, Block *b ) { // Set basic block of n, Add n to b, - _bbs.map(n->_idx, b); + map_node_to_block(n, b); b->add_inst(n); // After Matching, nearly any old Node may have projections trailing it. @@ -75,11 +75,12 @@ void PhaseCFG::schedule_node_into_block( Node *n, Block *b ) { for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { Node* use = n->fast_out(i); if (use->is_Proj()) { - Block* buse = _bbs[use->_idx]; + Block* buse = get_block_for_node(use); if (buse != b) { // In wrong block? - if (buse != NULL) + if (buse != NULL) { buse->find_remove(use); // Remove from wrong block - _bbs.map(use->_idx, b); // Re-insert in this block + } + map_node_to_block(use, b); b->add_inst(use); } } @@ -97,7 +98,7 @@ void PhaseCFG::replace_block_proj_ctrl( Node *n ) { if (p != NULL && p != n) { // Control from a block projection? assert(!n->pinned() || n->is_MachConstantBase(), "only pinned MachConstantBase node is expected here"); // Find trailing Region - Block *pb = _bbs[in0->_idx]; // Block-projection already has basic block + Block *pb = get_block_for_node(in0); // Block-projection already has basic block uint j = 0; if (pb->_num_succs != 1) { // More then 1 successor? // Search for successor @@ -127,14 +128,15 @@ void PhaseCFG::schedule_pinned_nodes( VectorSet &visited ) { while ( spstack.is_nonempty() ) { Node *n = spstack.pop(); if( !visited.test_set(n->_idx) ) { // Test node and flag it as visited - if( n->pinned() && !_bbs.lookup(n->_idx) ) { // Pinned? Nail it down! + if( n->pinned() && !has_block(n)) { // Pinned? Nail it down! assert( n->in(0), "pinned Node must have Control" ); // Before setting block replace block_proj control edge replace_block_proj_ctrl(n); Node *input = n->in(0); - while( !input->is_block_start() ) + while (!input->is_block_start()) { input = input->in(0); - Block *b = _bbs[input->_idx]; // Basic block of controlling input + } + Block *b = get_block_for_node(input); // Basic block of controlling input schedule_node_into_block(n, b); } for( int i = n->req() - 1; i >= 0; --i ) { // For all inputs @@ -149,7 +151,7 @@ void PhaseCFG::schedule_pinned_nodes( VectorSet &visited ) { // Assert that new input b2 is dominated by all previous inputs. // Check this by by seeing that it is dominated by b1, the deepest // input observed until b2. -static void assert_dom(Block* b1, Block* b2, Node* n, Block_Array &bbs) { +static void assert_dom(Block* b1, Block* b2, Node* n, const PhaseCFG* cfg) { if (b1 == NULL) return; assert(b1->_dom_depth < b2->_dom_depth, "sanity"); Block* tmp = b2; @@ -162,7 +164,7 @@ static void assert_dom(Block* b1, Block* b2, Node* n, Block_Array &bbs) { for (uint j=0; jlen(); j++) { // For all inputs Node* inn = n->in(j); // Get input if (inn == NULL) continue; // Ignore NULL, missing inputs - Block* inb = bbs[inn->_idx]; + Block* inb = cfg->get_block_for_node(inn); tty->print("B%d idom=B%d depth=%2d ",inb->_pre_order, inb->_idom ? inb->_idom->_pre_order : 0, inb->_dom_depth); inn->dump(); @@ -174,20 +176,20 @@ static void assert_dom(Block* b1, Block* b2, Node* n, Block_Array &bbs) { } #endif -static Block* find_deepest_input(Node* n, Block_Array &bbs) { +static Block* find_deepest_input(Node* n, const PhaseCFG* cfg) { // Find the last input dominated by all other inputs. Block* deepb = NULL; // Deepest block so far int deepb_dom_depth = 0; for (uint k = 0; k < n->len(); k++) { // For all inputs Node* inn = n->in(k); // Get input if (inn == NULL) continue; // Ignore NULL, missing inputs - Block* inb = bbs[inn->_idx]; + Block* inb = cfg->get_block_for_node(inn); assert(inb != NULL, "must already have scheduled this input"); if (deepb_dom_depth < (int) inb->_dom_depth) { // The new inb must be dominated by the previous deepb. // The various inputs must be linearly ordered in the dom // tree, or else there will not be a unique deepest block. - DEBUG_ONLY(assert_dom(deepb, inb, n, bbs)); + DEBUG_ONLY(assert_dom(deepb, inb, n, cfg)); deepb = inb; // Save deepest block deepb_dom_depth = deepb->_dom_depth; } @@ -243,7 +245,7 @@ bool PhaseCFG::schedule_early(VectorSet &visited, Node_List &roots) { ++i; if (in == NULL) continue; // Ignore NULL, missing inputs int is_visited = visited.test_set(in->_idx); - if (!_bbs.lookup(in->_idx)) { // Missing block selection? + if (!has_block(in)) { // Missing block selection? if (is_visited) { // assert( !visited.test(in->_idx), "did not schedule early" ); return false; @@ -265,9 +267,9 @@ bool PhaseCFG::schedule_early(VectorSet &visited, Node_List &roots) { // any projections which depend on them. if (!n->pinned()) { // Set earliest legal block. - _bbs.map(n->_idx, find_deepest_input(n, _bbs)); + map_node_to_block(n, find_deepest_input(n, this)); } else { - assert(_bbs[n->_idx] == _bbs[n->in(0)->_idx], "Pinned Node should be at the same block as its control edge"); + assert(get_block_for_node(n) == get_block_for_node(n->in(0)), "Pinned Node should be at the same block as its control edge"); } if (nstack.is_empty()) { @@ -313,8 +315,8 @@ Block* Block::dom_lca(Block* LCA) { // The definition must dominate the use, so move the LCA upward in the // dominator tree to dominate the use. If the use is a phi, adjust // the LCA only with the phi input paths which actually use this def. -static Block* raise_LCA_above_use(Block* LCA, Node* use, Node* def, Block_Array &bbs) { - Block* buse = bbs[use->_idx]; +static Block* raise_LCA_above_use(Block* LCA, Node* use, Node* def, const PhaseCFG* cfg) { + Block* buse = cfg->get_block_for_node(use); if (buse == NULL) return LCA; // Unused killing Projs have no use block if (!use->is_Phi()) return buse->dom_lca(LCA); uint pmax = use->req(); // Number of Phi inputs @@ -329,7 +331,7 @@ static Block* raise_LCA_above_use(Block* LCA, Node* use, Node* def, Block_Array // more than once. for (uint j=1; jin(j) == def) { // Found matching input? - Block* pred = bbs[buse->pred(j)->_idx]; + Block* pred = cfg->get_block_for_node(buse->pred(j)); LCA = pred->dom_lca(LCA); } } @@ -342,8 +344,7 @@ static Block* raise_LCA_above_use(Block* LCA, Node* use, Node* def, Block_Array // which are marked with the given index. Return the LCA (in the dom tree) // of all marked blocks. If there are none marked, return the original // LCA. -static Block* raise_LCA_above_marks(Block* LCA, node_idx_t mark, - Block* early, Block_Array &bbs) { +static Block* raise_LCA_above_marks(Block* LCA, node_idx_t mark, Block* early, const PhaseCFG* cfg) { Block_List worklist; worklist.push(LCA); while (worklist.size() > 0) { @@ -366,7 +367,7 @@ static Block* raise_LCA_above_marks(Block* LCA, node_idx_t mark, } else { // Keep searching through this block's predecessors. for (uint j = 1, jmax = mid->num_preds(); j < jmax; j++) { - Block* mid_parent = bbs[ mid->pred(j)->_idx ]; + Block* mid_parent = cfg->get_block_for_node(mid->pred(j)); worklist.push(mid_parent); } } @@ -384,7 +385,7 @@ static Block* raise_LCA_above_marks(Block* LCA, node_idx_t mark, // be earlier (at a shallower dom_depth) than the true schedule_early // point of the node. We compute this earlier block as a more permissive // site for anti-dependency insertion, but only if subsume_loads is enabled. -static Block* memory_early_block(Node* load, Block* early, Block_Array &bbs) { +static Block* memory_early_block(Node* load, Block* early, const PhaseCFG* cfg) { Node* base; Node* index; Node* store = load->in(MemNode::Memory); @@ -412,12 +413,12 @@ static Block* memory_early_block(Node* load, Block* early, Block_Array &bbs) { Block* deepb = NULL; // Deepest block so far int deepb_dom_depth = 0; for (int i = 0; i < mem_inputs_length; i++) { - Block* inb = bbs[mem_inputs[i]->_idx]; + Block* inb = cfg->get_block_for_node(mem_inputs[i]); if (deepb_dom_depth < (int) inb->_dom_depth) { // The new inb must be dominated by the previous deepb. // The various inputs must be linearly ordered in the dom // tree, or else there will not be a unique deepest block. - DEBUG_ONLY(assert_dom(deepb, inb, load, bbs)); + DEBUG_ONLY(assert_dom(deepb, inb, load, cfg)); deepb = inb; // Save deepest block deepb_dom_depth = deepb->_dom_depth; } @@ -488,14 +489,14 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) { // and other inputs are first available. (Computed by schedule_early.) // For normal loads, 'early' is the shallowest place (dom graph wise) // to look for anti-deps between this load and any store. - Block* early = _bbs[load_index]; + Block* early = get_block_for_node(load); // If we are subsuming loads, compute an "early" block that only considers // memory or address inputs. This block may be different than the // schedule_early block in that it could be at an even shallower depth in the // dominator tree, and allow for a broader discovery of anti-dependences. if (C->subsume_loads()) { - early = memory_early_block(load, early, _bbs); + early = memory_early_block(load, early, this); } ResourceArea *area = Thread::current()->resource_area(); @@ -619,7 +620,7 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) { // or else observe that 'store' is all the way up in the // earliest legal block for 'load'. In the latter case, // immediately insert an anti-dependence edge. - Block* store_block = _bbs[store->_idx]; + Block* store_block = get_block_for_node(store); assert(store_block != NULL, "unused killing projections skipped above"); if (store->is_Phi()) { @@ -637,7 +638,7 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) { for (uint j = PhiNode::Input, jmax = store->req(); j < jmax; j++) { if (store->in(j) == mem) { // Found matching input? DEBUG_ONLY(found_match = true); - Block* pred_block = _bbs[store_block->pred(j)->_idx]; + Block* pred_block = get_block_for_node(store_block->pred(j)); if (pred_block != early) { // If any predecessor of the Phi matches the load's "early block", // we do not need a precedence edge between the Phi and 'load' @@ -711,7 +712,7 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) { // preventing the load from sinking past any block containing // a store that may invalidate the memory state required by 'load'. if (must_raise_LCA) - LCA = raise_LCA_above_marks(LCA, load->_idx, early, _bbs); + LCA = raise_LCA_above_marks(LCA, load->_idx, early, this); if (LCA == early) return LCA; // Insert anti-dependence edges from 'load' to each store @@ -720,7 +721,7 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) { if (LCA->raise_LCA_mark() == load_index) { while (non_early_stores.size() > 0) { Node* store = non_early_stores.pop(); - Block* store_block = _bbs[store->_idx]; + Block* store_block = get_block_for_node(store); if (store_block == LCA) { // add anti_dependence from store to load in its own block assert(store != load->in(0), "dependence cycle found"); @@ -754,7 +755,7 @@ private: public: // Constructor for the iterator - Node_Backward_Iterator(Node *root, VectorSet &visited, Node_List &stack, Block_Array &bbs); + Node_Backward_Iterator(Node *root, VectorSet &visited, Node_List &stack, PhaseCFG &cfg); // Postincrement operator to iterate over the nodes Node *next(); @@ -762,12 +763,12 @@ public: private: VectorSet &_visited; Node_List &_stack; - Block_Array &_bbs; + PhaseCFG &_cfg; }; // Constructor for the Node_Backward_Iterator -Node_Backward_Iterator::Node_Backward_Iterator( Node *root, VectorSet &visited, Node_List &stack, Block_Array &bbs ) - : _visited(visited), _stack(stack), _bbs(bbs) { +Node_Backward_Iterator::Node_Backward_Iterator( Node *root, VectorSet &visited, Node_List &stack, PhaseCFG &cfg) + : _visited(visited), _stack(stack), _cfg(cfg) { // The stack should contain exactly the root stack.clear(); stack.push(root); @@ -797,8 +798,8 @@ Node *Node_Backward_Iterator::next() { _visited.set(self->_idx); // Now schedule all uses as late as possible. - uint src = self->is_Proj() ? self->in(0)->_idx : self->_idx; - uint src_rpo = _bbs[src]->_rpo; + const Node* src = self->is_Proj() ? self->in(0) : self; + uint src_rpo = _cfg.get_block_for_node(src)->_rpo; // Schedule all nodes in a post-order visit Node *unvisited = NULL; // Unvisited anti-dependent Node, if any @@ -814,7 +815,7 @@ Node *Node_Backward_Iterator::next() { // do not traverse backward control edges Node *use = n->is_Proj() ? n->in(0) : n; - uint use_rpo = _bbs[use->_idx]->_rpo; + uint use_rpo = _cfg.get_block_for_node(use)->_rpo; if ( use_rpo < src_rpo ) continue; @@ -852,7 +853,7 @@ void PhaseCFG::ComputeLatenciesBackwards(VectorSet &visited, Node_List &stack) { tty->print("\n#---- ComputeLatenciesBackwards ----\n"); #endif - Node_Backward_Iterator iter((Node *)_root, visited, stack, _bbs); + Node_Backward_Iterator iter((Node *)_root, visited, stack, *this); Node *n; // Walk over all the nodes from last to first @@ -883,7 +884,7 @@ void PhaseCFG::partial_latency_of_defs(Node *n) { uint nlen = n->len(); uint use_latency = _node_latency->at_grow(n->_idx); - uint use_pre_order = _bbs[n->_idx]->_pre_order; + uint use_pre_order = get_block_for_node(n)->_pre_order; for ( uint j=0; jin(j); @@ -903,7 +904,7 @@ void PhaseCFG::partial_latency_of_defs(Node *n) { #endif // If the defining block is not known, assume it is ok - Block *def_block = _bbs[def->_idx]; + Block *def_block = get_block_for_node(def); uint def_pre_order = def_block ? def_block->_pre_order : 0; if ( (use_pre_order < def_pre_order) || @@ -931,10 +932,11 @@ void PhaseCFG::partial_latency_of_defs(Node *n) { // Compute the latency of a specific use int PhaseCFG::latency_from_use(Node *n, const Node *def, Node *use) { // If self-reference, return no latency - if (use == n || use->is_Root()) + if (use == n || use->is_Root()) { return 0; + } - uint def_pre_order = _bbs[def->_idx]->_pre_order; + uint def_pre_order = get_block_for_node(def)->_pre_order; uint latency = 0; // If the use is not a projection, then it is simple... @@ -946,7 +948,7 @@ int PhaseCFG::latency_from_use(Node *n, const Node *def, Node *use) { } #endif - uint use_pre_order = _bbs[use->_idx]->_pre_order; + uint use_pre_order = get_block_for_node(use)->_pre_order; if (use_pre_order < def_pre_order) return 0; @@ -1018,7 +1020,7 @@ Block* PhaseCFG::hoist_to_cheaper_block(Block* LCA, Block* early, Node* self) { uint start_latency = _node_latency->at_grow(LCA->_nodes[0]->_idx); uint end_latency = _node_latency->at_grow(LCA->_nodes[LCA->end_idx()]->_idx); bool in_latency = (target <= start_latency); - const Block* root_block = _bbs[_root->_idx]; + const Block* root_block = get_block_for_node(_root); // Turn off latency scheduling if scheduling is just plain off if (!C->do_scheduling()) @@ -1126,12 +1128,12 @@ void PhaseCFG::schedule_late(VectorSet &visited, Node_List &stack) { tty->print("\n#---- schedule_late ----\n"); #endif - Node_Backward_Iterator iter((Node *)_root, visited, stack, _bbs); + Node_Backward_Iterator iter((Node *)_root, visited, stack, *this); Node *self; // Walk over all the nodes from last to first while (self = iter.next()) { - Block* early = _bbs[self->_idx]; // Earliest legal placement + Block* early = get_block_for_node(self); // Earliest legal placement if (self->is_top()) { // Top node goes in bb #2 with other constants. @@ -1179,7 +1181,7 @@ void PhaseCFG::schedule_late(VectorSet &visited, Node_List &stack) { for (DUIterator_Fast imax, i = self->fast_outs(imax); i < imax; i++) { // For all uses, find LCA Node* use = self->fast_out(i); - LCA = raise_LCA_above_use(LCA, use, self, _bbs); + LCA = raise_LCA_above_use(LCA, use, self, this); } } // (Hide defs of imax, i from rest of block.) @@ -1187,7 +1189,7 @@ void PhaseCFG::schedule_late(VectorSet &visited, Node_List &stack) { // requirement for correctness but it reduces useless // interference between temps and other nodes. if (mach != NULL && mach->is_MachTemp()) { - _bbs.map(self->_idx, LCA); + map_node_to_block(self, LCA); LCA->add_inst(self); continue; } @@ -1262,10 +1264,10 @@ void PhaseCFG::GlobalCodeMotion( Matcher &matcher, uint unique, Node_List &proj_ } #endif - // Initialize the bbs.map for things on the proj_list - uint i; - for( i=0; i < proj_list.size(); i++ ) - _bbs.map(proj_list[i]->_idx, NULL); + // Initialize the node to block mapping for things on the proj_list + for (uint i = 0; i < proj_list.size(); i++) { + unmap_node_from_block(proj_list[i]); + } // Set the basic block for Nodes pinned into blocks Arena *a = Thread::current()->resource_area(); @@ -1333,7 +1335,7 @@ void PhaseCFG::GlobalCodeMotion( Matcher &matcher, uint unique, Node_List &proj_ for( int i= matcher._null_check_tests.size()-2; i>=0; i-=2 ) { Node *proj = matcher._null_check_tests[i ]; Node *val = matcher._null_check_tests[i+1]; - _bbs[proj->_idx]->implicit_null_check(this, proj, val, allowed_reasons); + get_block_for_node(proj)->implicit_null_check(this, proj, val, allowed_reasons); // The implicit_null_check will only perform the transformation // if the null branch is truly uncommon, *and* it leads to an // uncommon trap. Combined with the too_many_traps guards @@ -1353,7 +1355,7 @@ void PhaseCFG::GlobalCodeMotion( Matcher &matcher, uint unique, Node_List &proj_ uint max_idx = C->unique(); GrowableArray ready_cnt(max_idx, max_idx, -1); visited.Clear(); - for (i = 0; i < _num_blocks; i++) { + for (uint i = 0; i < _num_blocks; i++) { if (!_blocks[i]->schedule_local(this, matcher, ready_cnt, visited)) { if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) { C->record_method_not_compilable("local schedule failed"); @@ -1364,8 +1366,9 @@ void PhaseCFG::GlobalCodeMotion( Matcher &matcher, uint unique, Node_List &proj_ // If we inserted any instructions between a Call and his CatchNode, // clone the instructions on all paths below the Catch. - for( i=0; i < _num_blocks; i++ ) - _blocks[i]->call_catch_cleanup(_bbs, C); + for (uint i = 0; i < _num_blocks; i++) { + _blocks[i]->call_catch_cleanup(this, C); + } #ifndef PRODUCT if (trace_opto_pipelining()) { @@ -1392,7 +1395,7 @@ void PhaseCFG::Estimate_Block_Frequency() { Block_List worklist; Block* root_blk = _blocks[0]; for (uint i = 1; i < root_blk->num_preds(); i++) { - Block *pb = _bbs[root_blk->pred(i)->_idx]; + Block *pb = get_block_for_node(root_blk->pred(i)); if (pb->has_uncommon_code()) { worklist.push(pb); } @@ -1401,7 +1404,7 @@ void PhaseCFG::Estimate_Block_Frequency() { Block* uct = worklist.pop(); if (uct == _broot) continue; for (uint i = 1; i < uct->num_preds(); i++) { - Block *pb = _bbs[uct->pred(i)->_idx]; + Block *pb = get_block_for_node(uct->pred(i)); if (pb->_num_succs == 1) { worklist.push(pb); } else if (pb->num_fall_throughs() == 2) { @@ -1430,7 +1433,7 @@ void PhaseCFG::Estimate_Block_Frequency() { Block_List worklist; Block* root_blk = _blocks[0]; for (uint i = 1; i < root_blk->num_preds(); i++) { - Block *pb = _bbs[root_blk->pred(i)->_idx]; + Block *pb = get_block_for_node(root_blk->pred(i)); if (pb->has_uncommon_code()) { worklist.push(pb); } @@ -1439,7 +1442,7 @@ void PhaseCFG::Estimate_Block_Frequency() { Block* uct = worklist.pop(); uct->_freq = PROB_MIN; for (uint i = 1; i < uct->num_preds(); i++) { - Block *pb = _bbs[uct->pred(i)->_idx]; + Block *pb = get_block_for_node(uct->pred(i)); if (pb->_num_succs == 1 && pb->_freq > PROB_MIN) { worklist.push(pb); } @@ -1499,7 +1502,7 @@ CFGLoop* PhaseCFG::create_loop_tree() { Block* loop_head = b; assert(loop_head->num_preds() - 1 == 2, "loop must have 2 predecessors"); Node* tail_n = loop_head->pred(LoopNode::LoopBackControl); - Block* tail = _bbs[tail_n->_idx]; + Block* tail = get_block_for_node(tail_n); // Defensively filter out Loop nodes for non-single-entry loops. // For all reasonable loops, the head occurs before the tail in RPO. @@ -1514,13 +1517,13 @@ CFGLoop* PhaseCFG::create_loop_tree() { loop_head->_loop = nloop; // Add to nloop so push_pred() will skip over inner loops nloop->add_member(loop_head); - nloop->push_pred(loop_head, LoopNode::LoopBackControl, worklist, _bbs); + nloop->push_pred(loop_head, LoopNode::LoopBackControl, worklist, this); while (worklist.size() > 0) { Block* member = worklist.pop(); if (member != loop_head) { for (uint j = 1; j < member->num_preds(); j++) { - nloop->push_pred(member, j, worklist, _bbs); + nloop->push_pred(member, j, worklist, this); } } } @@ -1557,9 +1560,9 @@ CFGLoop* PhaseCFG::create_loop_tree() { } //------------------------------push_pred-------------------------------------- -void CFGLoop::push_pred(Block* blk, int i, Block_List& worklist, Block_Array& node_to_blk) { +void CFGLoop::push_pred(Block* blk, int i, Block_List& worklist, PhaseCFG* cfg) { Node* pred_n = blk->pred(i); - Block* pred = node_to_blk[pred_n->_idx]; + Block* pred = cfg->get_block_for_node(pred_n); CFGLoop *pred_loop = pred->_loop; if (pred_loop == NULL) { // Filter out blocks for non-single-entry loops. @@ -1580,7 +1583,7 @@ void CFGLoop::push_pred(Block* blk, int i, Block_List& worklist, Block_Array& no Block* pred_head = pred_loop->head(); assert(pred_head->num_preds() - 1 == 2, "loop must have 2 predecessors"); assert(pred_head != head(), "loop head in only one loop"); - push_pred(pred_head, LoopNode::EntryControl, worklist, node_to_blk); + push_pred(pred_head, LoopNode::EntryControl, worklist, cfg); } else { assert(pred_loop->_parent == this && _parent == NULL, "just checking"); } diff --git a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp index e6909054324..4330643b8b5 100644 --- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp +++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp @@ -413,9 +413,9 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) { print_prop("debug_idx", node->_debug_idx); #endif - if(C->cfg() != NULL) { - Block *block = C->cfg()->_bbs[node->_idx]; - if(block == NULL) { + if (C->cfg() != NULL) { + Block* block = C->cfg()->get_block_for_node(node); + if (block == NULL) { print_prop("block", C->cfg()->_blocks[0]->_pre_order); } else { print_prop("block", block->_pre_order); diff --git a/hotspot/src/share/vm/opto/ifg.cpp b/hotspot/src/share/vm/opto/ifg.cpp index 96c0957cffb..82a8ea893e4 100644 --- a/hotspot/src/share/vm/opto/ifg.cpp +++ b/hotspot/src/share/vm/opto/ifg.cpp @@ -565,7 +565,7 @@ uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) { lrgs(r)._def = 0; } n->disconnect_inputs(NULL, C); - _cfg._bbs.map(n->_idx,NULL); + _cfg.unmap_node_from_block(n); n->replace_by(C->top()); // Since yanking a Node from block, high pressure moves up one hrp_index[0]--; @@ -607,7 +607,7 @@ uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) { if( n->is_SpillCopy() && lrgs(r).is_singledef() // MultiDef live range can still split && n->outcnt() == 1 // and use must be in this block - && _cfg._bbs[n->unique_out()->_idx] == b ) { + && _cfg.get_block_for_node(n->unique_out()) == b ) { // All single-use MachSpillCopy(s) that immediately precede their // use must color early. If a longer live range steals their // color, the spill copy will split and may push another spill copy diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp index 2b3eca478d9..fc05a79b416 100644 --- a/hotspot/src/share/vm/opto/lcm.cpp +++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -237,7 +237,7 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe } // Check ctrl input to see if the null-check dominates the memory op - Block *cb = cfg->_bbs[mach->_idx]; + Block *cb = cfg->get_block_for_node(mach); cb = cb->_idom; // Always hoist at least 1 block if( !was_store ) { // Stores can be hoisted only one block while( cb->_dom_depth > (_dom_depth + 1)) @@ -262,7 +262,7 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe if( is_decoden ) continue; } // Block of memory-op input - Block *inb = cfg->_bbs[mach->in(j)->_idx]; + Block *inb = cfg->get_block_for_node(mach->in(j)); Block *b = this; // Start from nul check while( b != inb && b->_dom_depth > inb->_dom_depth ) b = b->_idom; // search upwards for input @@ -272,7 +272,7 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe } if( j > 0 ) continue; - Block *mb = cfg->_bbs[mach->_idx]; + Block *mb = cfg->get_block_for_node(mach); // Hoisting stores requires more checks for the anti-dependence case. // Give up hoisting if we have to move the store past any load. if( was_store ) { @@ -291,7 +291,7 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe break; // Found anti-dependent load // Make sure control does not do a merge (would have to check allpaths) if( b->num_preds() != 2 ) break; - b = cfg->_bbs[b->pred(1)->_idx]; // Move up to predecessor block + b = cfg->get_block_for_node(b->pred(1)); // Move up to predecessor block } if( b != this ) continue; } @@ -303,15 +303,15 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe // Found a candidate! Pick one with least dom depth - the highest // in the dom tree should be closest to the null check. - if( !best || - cfg->_bbs[mach->_idx]->_dom_depth < cfg->_bbs[best->_idx]->_dom_depth ) { + if (best == NULL || cfg->get_block_for_node(mach)->_dom_depth < cfg->get_block_for_node(best)->_dom_depth) { best = mach; bidx = vidx; - } } // No candidate! - if( !best ) return; + if (best == NULL) { + return; + } // ---- Found an implicit null check extern int implicit_null_checks; @@ -319,29 +319,29 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe if( is_decoden ) { // Check if we need to hoist decodeHeapOop_not_null first. - Block *valb = cfg->_bbs[val->_idx]; + Block *valb = cfg->get_block_for_node(val); if( this != valb && this->_dom_depth < valb->_dom_depth ) { // Hoist it up to the end of the test block. valb->find_remove(val); this->add_inst(val); - cfg->_bbs.map(val->_idx,this); + cfg->map_node_to_block(val, this); // DecodeN on x86 may kill flags. Check for flag-killing projections // that also need to be hoisted. for (DUIterator_Fast jmax, j = val->fast_outs(jmax); j < jmax; j++) { Node* n = val->fast_out(j); if( n->is_MachProj() ) { - cfg->_bbs[n->_idx]->find_remove(n); + cfg->get_block_for_node(n)->find_remove(n); this->add_inst(n); - cfg->_bbs.map(n->_idx,this); + cfg->map_node_to_block(n, this); } } } } // Hoist the memory candidate up to the end of the test block. - Block *old_block = cfg->_bbs[best->_idx]; + Block *old_block = cfg->get_block_for_node(best); old_block->find_remove(best); add_inst(best); - cfg->_bbs.map(best->_idx,this); + cfg->map_node_to_block(best, this); // Move the control dependence if (best->in(0) && best->in(0) == old_block->_nodes[0]) @@ -352,9 +352,9 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe for (DUIterator_Fast jmax, j = best->fast_outs(jmax); j < jmax; j++) { Node* n = best->fast_out(j); if( n->is_MachProj() ) { - cfg->_bbs[n->_idx]->find_remove(n); + cfg->get_block_for_node(n)->find_remove(n); add_inst(n); - cfg->_bbs.map(n->_idx,this); + cfg->map_node_to_block(n, this); } } @@ -385,7 +385,7 @@ void Block::implicit_null_check(PhaseCFG *cfg, Node *proj, Node *val, int allowe Node *old_tst = proj->in(0); MachNode *nul_chk = new (C) MachNullCheckNode(old_tst->in(0),best,bidx); _nodes.map(end_idx(),nul_chk); - cfg->_bbs.map(nul_chk->_idx,this); + cfg->map_node_to_block(nul_chk, this); // Redirect users of old_test to nul_chk for (DUIterator_Last i2min, i2 = old_tst->last_outs(i2min); i2 >= i2min; --i2) old_tst->last_out(i2)->set_req(0, nul_chk); @@ -468,7 +468,7 @@ Node *Block::select(PhaseCFG *cfg, Node_List &worklist, GrowableArray &read Node* use = n->fast_out(j); // The use is a conditional branch, make them adjacent - if (use->is_MachIf() && cfg->_bbs[use->_idx]==this ) { + if (use->is_MachIf() && cfg->get_block_for_node(use) == this) { found_machif = true; break; } @@ -529,13 +529,14 @@ Node *Block::select(PhaseCFG *cfg, Node_List &worklist, GrowableArray &read //------------------------------set_next_call---------------------------------- -void Block::set_next_call( Node *n, VectorSet &next_call, Block_Array &bbs ) { +void Block::set_next_call( Node *n, VectorSet &next_call, PhaseCFG* cfg) { if( next_call.test_set(n->_idx) ) return; for( uint i=0; ilen(); i++ ) { Node *m = n->in(i); if( !m ) continue; // must see all nodes in block that precede call - if( bbs[m->_idx] == this ) - set_next_call( m, next_call, bbs ); + if (cfg->get_block_for_node(m) == this) { + set_next_call(m, next_call, cfg); + } } } @@ -545,12 +546,12 @@ void Block::set_next_call( Node *n, VectorSet &next_call, Block_Array &bbs ) { // next subroutine call get priority - basically it moves things NOT needed // for the next call till after the call. This prevents me from trying to // carry lots of stuff live across a call. -void Block::needed_for_next_call(Node *this_call, VectorSet &next_call, Block_Array &bbs) { +void Block::needed_for_next_call(Node *this_call, VectorSet &next_call, PhaseCFG* cfg) { // Find the next control-defining Node in this block Node* call = NULL; for (DUIterator_Fast imax, i = this_call->fast_outs(imax); i < imax; i++) { Node* m = this_call->fast_out(i); - if( bbs[m->_idx] == this && // Local-block user + if(cfg->get_block_for_node(m) == this && // Local-block user m != this_call && // Not self-start node m->is_MachCall() ) call = m; @@ -558,7 +559,7 @@ void Block::needed_for_next_call(Node *this_call, VectorSet &next_call, Block_Ar } if (call == NULL) return; // No next call (e.g., block end is near) // Set next-call for all inputs to this call - set_next_call(call, next_call, bbs); + set_next_call(call, next_call, cfg); } //------------------------------add_call_kills------------------------------------- @@ -578,7 +579,7 @@ void Block::add_call_kills(MachProjNode *proj, RegMask& regs, const char* save_p //------------------------------sched_call------------------------------------- -uint Block::sched_call( Matcher &matcher, Block_Array &bbs, uint node_cnt, Node_List &worklist, GrowableArray &ready_cnt, MachCallNode *mcall, VectorSet &next_call ) { +uint Block::sched_call( Matcher &matcher, PhaseCFG* cfg, uint node_cnt, Node_List &worklist, GrowableArray &ready_cnt, MachCallNode *mcall, VectorSet &next_call ) { RegMask regs; // Schedule all the users of the call right now. All the users are @@ -597,12 +598,14 @@ uint Block::sched_call( Matcher &matcher, Block_Array &bbs, uint node_cnt, Node_ // Check for scheduling the next control-definer if( n->bottom_type() == Type::CONTROL ) // Warm up next pile of heuristic bits - needed_for_next_call(n, next_call, bbs); + needed_for_next_call(n, next_call, cfg); // Children of projections are now all ready for (DUIterator_Fast jmax, j = n->fast_outs(jmax); j < jmax; j++) { Node* m = n->fast_out(j); // Get user - if( bbs[m->_idx] != this ) continue; + if(cfg->get_block_for_node(m) != this) { + continue; + } if( m->is_Phi() ) continue; int m_cnt = ready_cnt.at(m->_idx)-1; ready_cnt.at_put(m->_idx, m_cnt); @@ -620,7 +623,7 @@ uint Block::sched_call( Matcher &matcher, Block_Array &bbs, uint node_cnt, Node_ uint r_cnt = mcall->tf()->range()->cnt(); int op = mcall->ideal_Opcode(); MachProjNode *proj = new (matcher.C) MachProjNode( mcall, r_cnt+1, RegMask::Empty, MachProjNode::fat_proj ); - bbs.map(proj->_idx,this); + cfg->map_node_to_block(proj, this); _nodes.insert(node_cnt++, proj); // Select the right register save policy. @@ -708,7 +711,7 @@ bool Block::schedule_local(PhaseCFG *cfg, Matcher &matcher, GrowableArray & uint local = 0; for( uint j=0; jin(j); - if( m && cfg->_bbs[m->_idx] == this && !m->is_top() ) + if( m && cfg->get_block_for_node(m) == this && !m->is_top() ) local++; // One more block-local input } ready_cnt.at_put(n->_idx, local); // Count em up @@ -720,7 +723,7 @@ bool Block::schedule_local(PhaseCFG *cfg, Matcher &matcher, GrowableArray & for (uint prec = n->req(); prec < n->len(); prec++) { Node* oop_store = n->in(prec); if (oop_store != NULL) { - assert(cfg->_bbs[oop_store->_idx]->_dom_depth <= this->_dom_depth, "oop_store must dominate card-mark"); + assert(cfg->get_block_for_node(oop_store)->_dom_depth <= this->_dom_depth, "oop_store must dominate card-mark"); } } } @@ -753,7 +756,7 @@ bool Block::schedule_local(PhaseCFG *cfg, Matcher &matcher, GrowableArray & Node *n = _nodes[i3]; // Get pre-scheduled for (DUIterator_Fast jmax, j = n->fast_outs(jmax); j < jmax; j++) { Node* m = n->fast_out(j); - if( cfg->_bbs[m->_idx] ==this ) { // Local-block user + if (cfg->get_block_for_node(m) == this) { // Local-block user int m_cnt = ready_cnt.at(m->_idx)-1; ready_cnt.at_put(m->_idx, m_cnt); // Fix ready count } @@ -786,7 +789,7 @@ bool Block::schedule_local(PhaseCFG *cfg, Matcher &matcher, GrowableArray & } // Warm up the 'next_call' heuristic bits - needed_for_next_call(_nodes[0], next_call, cfg->_bbs); + needed_for_next_call(_nodes[0], next_call, cfg); #ifndef PRODUCT if (cfg->trace_opto_pipelining()) { @@ -837,7 +840,7 @@ bool Block::schedule_local(PhaseCFG *cfg, Matcher &matcher, GrowableArray & #endif if( n->is_MachCall() ) { MachCallNode *mcall = n->as_MachCall(); - phi_cnt = sched_call(matcher, cfg->_bbs, phi_cnt, worklist, ready_cnt, mcall, next_call); + phi_cnt = sched_call(matcher, cfg, phi_cnt, worklist, ready_cnt, mcall, next_call); continue; } @@ -847,7 +850,7 @@ bool Block::schedule_local(PhaseCFG *cfg, Matcher &matcher, GrowableArray & regs.OR(n->out_RegMask()); MachProjNode *proj = new (matcher.C) MachProjNode( n, 1, RegMask::Empty, MachProjNode::fat_proj ); - cfg->_bbs.map(proj->_idx,this); + cfg->map_node_to_block(proj, this); _nodes.insert(phi_cnt++, proj); add_call_kills(proj, regs, matcher._c_reg_save_policy, false); @@ -856,7 +859,9 @@ bool Block::schedule_local(PhaseCFG *cfg, Matcher &matcher, GrowableArray & // Children are now all ready for (DUIterator_Fast i5max, i5 = n->fast_outs(i5max); i5 < i5max; i5++) { Node* m = n->fast_out(i5); // Get user - if( cfg->_bbs[m->_idx] != this ) continue; + if (cfg->get_block_for_node(m) != this) { + continue; + } if( m->is_Phi() ) continue; if (m->_idx >= max_idx) { // new node, skip it assert(m->is_MachProj() && n->is_Mach() && n->as_Mach()->has_call(), "unexpected node types"); @@ -914,7 +919,7 @@ static void catch_cleanup_fix_all_inputs(Node *use, Node *old_def, Node *new_def } //------------------------------catch_cleanup_find_cloned_def------------------ -static Node *catch_cleanup_find_cloned_def(Block *use_blk, Node *def, Block *def_blk, Block_Array &bbs, int n_clone_idx) { +static Node *catch_cleanup_find_cloned_def(Block *use_blk, Node *def, Block *def_blk, PhaseCFG* cfg, int n_clone_idx) { assert( use_blk != def_blk, "Inter-block cleanup only"); // The use is some block below the Catch. Find and return the clone of the def @@ -940,7 +945,8 @@ static Node *catch_cleanup_find_cloned_def(Block *use_blk, Node *def, Block *def // PhiNode, the PhiNode uses from the def and IT's uses need fixup. Node_Array inputs = new Node_List(Thread::current()->resource_area()); for(uint k = 1; k < use_blk->num_preds(); k++) { - inputs.map(k, catch_cleanup_find_cloned_def(bbs[use_blk->pred(k)->_idx], def, def_blk, bbs, n_clone_idx)); + Block* block = cfg->get_block_for_node(use_blk->pred(k)); + inputs.map(k, catch_cleanup_find_cloned_def(block, def, def_blk, cfg, n_clone_idx)); } // Check to see if the use_blk already has an identical phi inserted. @@ -962,7 +968,7 @@ static Node *catch_cleanup_find_cloned_def(Block *use_blk, Node *def, Block *def if (fixup == NULL) { Node *new_phi = PhiNode::make(use_blk->head(), def); use_blk->_nodes.insert(1, new_phi); - bbs.map(new_phi->_idx, use_blk); + cfg->map_node_to_block(new_phi, use_blk); for (uint k = 1; k < use_blk->num_preds(); k++) { new_phi->set_req(k, inputs[k]); } @@ -1002,17 +1008,17 @@ static void catch_cleanup_intra_block(Node *use, Node *def, Block *blk, int beg, //------------------------------catch_cleanup_inter_block--------------------- // Fix all input edges in use that reference "def". The use is in a different // block than the def. -static void catch_cleanup_inter_block(Node *use, Block *use_blk, Node *def, Block *def_blk, Block_Array &bbs, int n_clone_idx) { +static void catch_cleanup_inter_block(Node *use, Block *use_blk, Node *def, Block *def_blk, PhaseCFG* cfg, int n_clone_idx) { if( !use_blk ) return; // Can happen if the use is a precedence edge - Node *new_def = catch_cleanup_find_cloned_def(use_blk, def, def_blk, bbs, n_clone_idx); + Node *new_def = catch_cleanup_find_cloned_def(use_blk, def, def_blk, cfg, n_clone_idx); catch_cleanup_fix_all_inputs(use, def, new_def); } //------------------------------call_catch_cleanup----------------------------- // If we inserted any instructions between a Call and his CatchNode, // clone the instructions on all paths below the Catch. -void Block::call_catch_cleanup(Block_Array &bbs, Compile* C) { +void Block::call_catch_cleanup(PhaseCFG* cfg, Compile* C) { // End of region to clone uint end = end_idx(); @@ -1037,7 +1043,7 @@ void Block::call_catch_cleanup(Block_Array &bbs, Compile* C) { // since clones dominate on each path. Node *clone = _nodes[j-1]->clone(); sb->_nodes.insert( 1, clone ); - bbs.map(clone->_idx,sb); + cfg->map_node_to_block(clone, sb); } } @@ -1054,18 +1060,19 @@ void Block::call_catch_cleanup(Block_Array &bbs, Compile* C) { uint max = out->size(); for (uint j = 0; j < max; j++) {// For all users Node *use = out->pop(); - Block *buse = bbs[use->_idx]; + Block *buse = cfg->get_block_for_node(use); if( use->is_Phi() ) { for( uint k = 1; k < use->req(); k++ ) if( use->in(k) == n ) { - Node *fixup = catch_cleanup_find_cloned_def(bbs[buse->pred(k)->_idx], n, this, bbs, n_clone_idx); + Block* block = cfg->get_block_for_node(buse->pred(k)); + Node *fixup = catch_cleanup_find_cloned_def(block, n, this, cfg, n_clone_idx); use->set_req(k, fixup); } } else { if (this == buse) { catch_cleanup_intra_block(use, n, this, beg, n_clone_idx); } else { - catch_cleanup_inter_block(use, buse, n, this, bbs, n_clone_idx); + catch_cleanup_inter_block(use, buse, n, this, cfg, n_clone_idx); } } } // End for all users diff --git a/hotspot/src/share/vm/opto/live.cpp b/hotspot/src/share/vm/opto/live.cpp index 773dd1ea2e6..846609e8a49 100644 --- a/hotspot/src/share/vm/opto/live.cpp +++ b/hotspot/src/share/vm/opto/live.cpp @@ -101,7 +101,7 @@ void PhaseLive::compute(uint maxlrg) { for( uint k=1; kin(k); uint nkidx = nk->_idx; - if( _cfg._bbs[nkidx] != b ) { + if (_cfg.get_block_for_node(nk) != b) { uint u = _names[nkidx]; use->insert( u ); DEBUG_ONLY(def_outside->insert( u );) @@ -121,7 +121,7 @@ void PhaseLive::compute(uint maxlrg) { // Push these live-in things to predecessors for( uint l=1; lnum_preds(); l++ ) { - Block *p = _cfg._bbs[b->pred(l)->_idx]; + Block *p = _cfg.get_block_for_node(b->pred(l)); add_liveout( p, use, first_pass ); // PhiNode uses go in the live-out set of prior blocks. @@ -142,8 +142,10 @@ void PhaseLive::compute(uint maxlrg) { assert( delta->count(), "missing delta set" ); // Add new-live-in to predecessors live-out sets - for( uint l=1; lnum_preds(); l++ ) - add_liveout( _cfg._bbs[b->pred(l)->_idx], delta, first_pass ); + for (uint l = 1; l < b->num_preds(); l++) { + Block* block = _cfg.get_block_for_node(b->pred(l)); + add_liveout(block, delta, first_pass); + } freeset(b); } // End of while-worklist-not-empty diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index c438cf9b880..a30fc80df39 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -624,8 +624,6 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const { } -#define MAX_UNROLL 16 // maximum number of unrolls for main loop - //------------------------------policy_unroll---------------------------------- // Return TRUE or FALSE if the loop should be unrolled or not. Unroll if // the loop is a CountedLoop and the body is small enough. @@ -642,7 +640,7 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const { if (cl->trip_count() <= (uint)(cl->is_normal_loop() ? 2 : 1)) return false; int future_unroll_ct = cl->unrolled_count() * 2; - if (future_unroll_ct > MAX_UNROLL) return false; + if (future_unroll_ct > LoopMaxUnroll) return false; // Check for initial stride being a small enough constant if (abs(cl->stride_con()) > (1<<2)*future_unroll_ct) return false; diff --git a/hotspot/src/share/vm/opto/node.hpp b/hotspot/src/share/vm/opto/node.hpp index bb5e8f200d0..0690d21b122 100644 --- a/hotspot/src/share/vm/opto/node.hpp +++ b/hotspot/src/share/vm/opto/node.hpp @@ -42,7 +42,6 @@ class AliasInfo; class AllocateArrayNode; class AllocateNode; class Block; -class Block_Array; class BoolNode; class BoxLockNode; class CMoveNode; diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index f04ab721b97..24a4497c680 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -68,7 +68,6 @@ void Compile::Output() { return; } // Make sure I can find the Start Node - Block_Array& bbs = _cfg->_bbs; Block *entry = _cfg->_blocks[1]; Block *broot = _cfg->_broot; @@ -77,8 +76,8 @@ void Compile::Output() { // Replace StartNode with prolog MachPrologNode *prolog = new (this) MachPrologNode(); entry->_nodes.map( 0, prolog ); - bbs.map( prolog->_idx, entry ); - bbs.map( start->_idx, NULL ); // start is no longer in any block + _cfg->map_node_to_block(prolog, entry); + _cfg->unmap_node_from_block(start); // start is no longer in any block // Virtual methods need an unverified entry point @@ -117,8 +116,7 @@ void Compile::Output() { if( m->is_Mach() && m->as_Mach()->ideal_Opcode() != Op_Halt ) { MachEpilogNode *epilog = new (this) MachEpilogNode(m->as_Mach()->ideal_Opcode() == Op_Return); b->add_inst( epilog ); - bbs.map(epilog->_idx, b); - //_regalloc->set_bad(epilog->_idx); // Already initialized this way. + _cfg->map_node_to_block(epilog, b); } } } @@ -252,7 +250,7 @@ void Compile::Insert_zap_nodes() { if (insert) { Node *zap = call_zap_node(n->as_MachSafePoint(), i); b->_nodes.insert( j, zap ); - _cfg->_bbs.map( zap->_idx, b ); + _cfg->map_node_to_block(zap, b); ++j; } } @@ -1234,7 +1232,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { #ifdef ASSERT if (!b->is_connector()) { stringStream st; - b->dump_head(&_cfg->_bbs, &st); + b->dump_head(_cfg, &st); MacroAssembler(cb).block_comment(st.as_string()); } jmp_target[i] = 0; @@ -1310,7 +1308,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { MachNode *nop = new (this) MachNopNode(nops_cnt); b->_nodes.insert(j++, nop); last_inst++; - _cfg->_bbs.map( nop->_idx, b ); + _cfg->map_node_to_block(nop, b); nop->emit(*cb, _regalloc); cb->flush_bundle(true); current_offset = cb->insts_size(); @@ -1395,7 +1393,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { if (needs_padding && replacement->avoid_back_to_back()) { MachNode *nop = new (this) MachNopNode(); b->_nodes.insert(j++, nop); - _cfg->_bbs.map(nop->_idx, b); + _cfg->map_node_to_block(nop, b); last_inst++; nop->emit(*cb, _regalloc); cb->flush_bundle(true); @@ -1549,7 +1547,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { if( padding > 0 ) { MachNode *nop = new (this) MachNopNode(padding / nop_size); b->_nodes.insert( b->_nodes.size(), nop ); - _cfg->_bbs.map( nop->_idx, b ); + _cfg->map_node_to_block(nop, b); nop->emit(*cb, _regalloc); current_offset = cb->insts_size(); } @@ -1737,7 +1735,6 @@ uint Scheduling::_total_instructions_per_bundle[Pipeline::_max_instrs_per_cycle+ Scheduling::Scheduling(Arena *arena, Compile &compile) : _arena(arena), _cfg(compile.cfg()), - _bbs(compile.cfg()->_bbs), _regalloc(compile.regalloc()), _reg_node(arena), _bundle_instr_count(0), @@ -2085,8 +2082,9 @@ void Scheduling::DecrementUseCounts(Node *n, const Block *bb) { if( def->is_Proj() ) // If this is a machine projection, then def = def->in(0); // propagate usage thru to the base instruction - if( _bbs[def->_idx] != bb ) // Ignore if not block-local + if(_cfg->get_block_for_node(def) != bb) { // Ignore if not block-local continue; + } // Compute the latency uint l = _bundle_cycle_number + n->latency(i); @@ -2358,9 +2356,10 @@ void Scheduling::ComputeUseCount(const Block *bb) { Node *inp = n->in(k); if (!inp) continue; assert(inp != n, "no cycles allowed" ); - if( _bbs[inp->_idx] == bb ) { // Block-local use? - if( inp->is_Proj() ) // Skip through Proj's + if (_cfg->get_block_for_node(inp) == bb) { // Block-local use? + if (inp->is_Proj()) { // Skip through Proj's inp = inp->in(0); + } ++_uses[inp->_idx]; // Count 1 block-local use } } @@ -2643,7 +2642,7 @@ void Scheduling::anti_do_def( Block *b, Node *def, OptoReg::Name def_reg, int is return; Node *pinch = _reg_node[def_reg]; // Get pinch point - if( !pinch || _bbs[pinch->_idx] != b || // No pinch-point yet? + if ((pinch == NULL) || _cfg->get_block_for_node(pinch) != b || // No pinch-point yet? is_def ) { // Check for a true def (not a kill) _reg_node.map(def_reg,def); // Record def/kill as the optimistic pinch-point return; @@ -2669,7 +2668,7 @@ void Scheduling::anti_do_def( Block *b, Node *def, OptoReg::Name def_reg, int is _cfg->C->record_method_not_compilable("too many D-U pinch points"); return; } - _bbs.map(pinch->_idx,b); // Pretend it's valid in this block (lazy init) + _cfg->map_node_to_block(pinch, b); // Pretend it's valid in this block (lazy init) _reg_node.map(def_reg,pinch); // Record pinch-point //_regalloc->set_bad(pinch->_idx); // Already initialized this way. if( later_def->outcnt() == 0 || later_def->ideal_reg() == MachProjNode::fat_proj ) { // Distinguish def from kill @@ -2713,9 +2712,9 @@ void Scheduling::anti_do_use( Block *b, Node *use, OptoReg::Name use_reg ) { return; Node *pinch = _reg_node[use_reg]; // Get pinch point // Check for no later def_reg/kill in block - if( pinch && _bbs[pinch->_idx] == b && + if ((pinch != NULL) && _cfg->get_block_for_node(pinch) == b && // Use has to be block-local as well - _bbs[use->_idx] == b ) { + _cfg->get_block_for_node(use) == b) { if( pinch->Opcode() == Op_Node && // Real pinch-point (not optimistic?) pinch->req() == 1 ) { // pinch not yet in block? pinch->del_req(0); // yank pointer to later-def, also set flag @@ -2895,7 +2894,7 @@ void Scheduling::garbage_collect_pinch_nodes() { int trace_cnt = 0; for (uint k = 0; k < _reg_node.Size(); k++) { Node* pinch = _reg_node[k]; - if (pinch != NULL && pinch->Opcode() == Op_Node && + if ((pinch != NULL) && pinch->Opcode() == Op_Node && // no predecence input edges (pinch->req() == pinch->len() || pinch->in(pinch->req()) == NULL) ) { cleanup_pinch(pinch); diff --git a/hotspot/src/share/vm/opto/output.hpp b/hotspot/src/share/vm/opto/output.hpp index 50b6e76035e..5fb68c6828a 100644 --- a/hotspot/src/share/vm/opto/output.hpp +++ b/hotspot/src/share/vm/opto/output.hpp @@ -96,9 +96,6 @@ private: // List of nodes currently available for choosing for scheduling Node_List _available; - // Mapping from node (index) to basic block - Block_Array& _bbs; - // For each instruction beginning a bundle, the number of following // nodes to be bundled with it. Bundle *_node_bundling_base; diff --git a/hotspot/src/share/vm/opto/postaloc.cpp b/hotspot/src/share/vm/opto/postaloc.cpp index c1b3fdbd231..76c3def2d40 100644 --- a/hotspot/src/share/vm/opto/postaloc.cpp +++ b/hotspot/src/share/vm/opto/postaloc.cpp @@ -78,11 +78,13 @@ bool PhaseChaitin::may_be_copy_of_callee( Node *def ) const { // Helper function for yank_if_dead int PhaseChaitin::yank( Node *old, Block *current_block, Node_List *value, Node_List *regnd ) { int blk_adjust=0; - Block *oldb = _cfg._bbs[old->_idx]; + Block *oldb = _cfg.get_block_for_node(old); oldb->find_remove(old); // Count 1 if deleting an instruction from the current block - if( oldb == current_block ) blk_adjust++; - _cfg._bbs.map(old->_idx,NULL); + if (oldb == current_block) { + blk_adjust++; + } + _cfg.unmap_node_from_block(old); OptoReg::Name old_reg = lrgs(_lrg_map.live_range_id(old)).reg(); if( regnd && (*regnd)[old_reg]==old ) { // Instruction is currently available? value->map(old_reg,NULL); // Yank from value/regnd maps @@ -433,7 +435,7 @@ void PhaseChaitin::post_allocate_copy_removal() { bool missing_some_inputs = false; Block *freed = NULL; for( j = 1; j < b->num_preds(); j++ ) { - Block *pb = _cfg._bbs[b->pred(j)->_idx]; + Block *pb = _cfg.get_block_for_node(b->pred(j)); // Remove copies along phi edges for( uint k=1; k_nodes[k], j, b, *blk2value[pb->_pre_order], *blk2regnd[pb->_pre_order], false ); @@ -478,7 +480,7 @@ void PhaseChaitin::post_allocate_copy_removal() { } else { if( !freed ) { // Didn't get a freebie prior block // Must clone some data - freed = _cfg._bbs[b->pred(1)->_idx]; + freed = _cfg.get_block_for_node(b->pred(1)); Node_List &f_value = *blk2value[freed->_pre_order]; Node_List &f_regnd = *blk2regnd[freed->_pre_order]; for( uint k = 0; k < (uint)_max_reg; k++ ) { @@ -488,7 +490,7 @@ void PhaseChaitin::post_allocate_copy_removal() { } // Merge all inputs together, setting to NULL any conflicts. for( j = 1; j < b->num_preds(); j++ ) { - Block *pb = _cfg._bbs[b->pred(j)->_idx]; + Block *pb = _cfg.get_block_for_node(b->pred(j)); if( pb == freed ) continue; // Did self already via freelist Node_List &p_regnd = *blk2regnd[pb->_pre_order]; for( uint k = 0; k < (uint)_max_reg; k++ ) { @@ -515,8 +517,9 @@ void PhaseChaitin::post_allocate_copy_removal() { u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input } if( u != NodeSentinel ) { // Junk Phi. Remove - b->_nodes.remove(j--); phi_dex--; - _cfg._bbs.map(phi->_idx,NULL); + b->_nodes.remove(j--); + phi_dex--; + _cfg.unmap_node_from_block(phi); phi->replace_by(u); phi->disconnect_inputs(NULL, C); continue; diff --git a/hotspot/src/share/vm/opto/reg_split.cpp b/hotspot/src/share/vm/opto/reg_split.cpp index 30ac26ba989..6e4323b406e 100644 --- a/hotspot/src/share/vm/opto/reg_split.cpp +++ b/hotspot/src/share/vm/opto/reg_split.cpp @@ -132,7 +132,7 @@ void PhaseChaitin::insert_proj( Block *b, uint i, Node *spill, uint maxlrg ) { } b->_nodes.insert(i,spill); // Insert node in block - _cfg._bbs.map(spill->_idx,b); // Update node->block mapping to reflect + _cfg.map_node_to_block(spill, b); // Update node->block mapping to reflect // Adjust the point where we go hi-pressure if( i <= b->_ihrp_index ) b->_ihrp_index++; if( i <= b->_fhrp_index ) b->_fhrp_index++; @@ -219,7 +219,7 @@ uint PhaseChaitin::split_USE( Node *def, Block *b, Node *use, uint useidx, uint use->set_req(useidx, def); } else { // Block and index where the use occurs. - Block *b = _cfg._bbs[use->_idx]; + Block *b = _cfg.get_block_for_node(use); // Put the clone just prior to use int bindex = b->find_node(use); // DEF is UP, so must copy it DOWN and hook in USE @@ -270,7 +270,7 @@ uint PhaseChaitin::split_USE( Node *def, Block *b, Node *use, uint useidx, uint int bindex; // Phi input spill-copys belong at the end of the prior block if( use->is_Phi() ) { - b = _cfg._bbs[b->pred(useidx)->_idx]; + b = _cfg.get_block_for_node(b->pred(useidx)); bindex = b->end_idx(); } else { // Put the clone just prior to use @@ -335,7 +335,7 @@ Node *PhaseChaitin::split_Rematerialize( Node *def, Block *b, uint insidx, uint continue; } - Block *b_def = _cfg._bbs[def->_idx]; + Block *b_def = _cfg.get_block_for_node(def); int idx_def = b_def->find_node(def); Node *in_spill = get_spillcopy_wide( in, def, i ); if( !in_spill ) return 0; // Bailed out @@ -589,7 +589,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { UPblock[slidx] = true; // Record following instruction in case 'n' rematerializes and // kills flags - Block *pred1 = _cfg._bbs[b->pred(1)->_idx]; + Block *pred1 = _cfg.get_block_for_node(b->pred(1)); continue; } @@ -601,7 +601,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { // Grab predecessor block header n1 = b->pred(1); // Grab the appropriate reaching def info for inpidx - pred = _cfg._bbs[n1->_idx]; + pred = _cfg.get_block_for_node(n1); pidx = pred->_pre_order; Node **Ltmp = Reaches[pidx]; bool *Utmp = UP[pidx]; @@ -616,7 +616,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { // Grab predecessor block headers n2 = b->pred(inpidx); // Grab the appropriate reaching def info for inpidx - pred = _cfg._bbs[n2->_idx]; + pred = _cfg.get_block_for_node(n2); pidx = pred->_pre_order; Ltmp = Reaches[pidx]; Utmp = UP[pidx]; @@ -701,7 +701,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { // Grab predecessor block header n1 = b->pred(1); // Grab the appropriate reaching def info for k - pred = _cfg._bbs[n1->_idx]; + pred = _cfg.get_block_for_node(n1); pidx = pred->_pre_order; Node **Ltmp = Reaches[pidx]; bool *Utmp = UP[pidx]; @@ -919,7 +919,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { return 0; } _lrg_map.extend(def->_idx, 0); - _cfg._bbs.map(def->_idx,b); + _cfg.map_node_to_block(def, b); n->set_req(inpidx, def); continue; } @@ -1291,7 +1291,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { for( insidx = 0; insidx < phis->size(); insidx++ ) { Node *phi = phis->at(insidx); assert(phi->is_Phi(),"This list must only contain Phi Nodes"); - Block *b = _cfg._bbs[phi->_idx]; + Block *b = _cfg.get_block_for_node(phi); // Grab the live range number uint lidx = _lrg_map.find_id(phi); uint slidx = lrg2reach[lidx]; @@ -1315,7 +1315,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { // DEF has the wrong UP/DOWN value. for( uint i = 1; i < b->num_preds(); i++ ) { // Get predecessor block pre-order number - Block *pred = _cfg._bbs[b->pred(i)->_idx]; + Block *pred = _cfg.get_block_for_node(b->pred(i)); pidx = pred->_pre_order; // Grab reaching def Node *def = Reaches[pidx][slidx]; diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp index 877ed0e02fb..c6ec25f1406 100644 --- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp +++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp @@ -3217,15 +3217,6 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass, JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints(); jvmti_breakpoints.clearall_in_class_at_safepoint(the_class_oop); - if (the_class_oop == Universe::reflect_invoke_cache()->klass()) { - // We are redefining java.lang.reflect.Method. Method.invoke() is - // cached and users of the cache care about each active version of - // the method so we have to track this previous version. - // Do this before methods get switched - Universe::reflect_invoke_cache()->add_previous_version( - the_class->method_with_idnum(Universe::reflect_invoke_cache()->method_idnum())); - } - // Deoptimize all compiled code that depends on this class flush_dependent_code(the_class, THREAD); diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 5353d36c0e4..0662b6912b9 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -60,6 +60,28 @@ #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" #define DEFAULT_JAVA_LAUNCHER "generic" +// Disable options not supported in this release, with a warning if they +// were explicitly requested on the command-line +#define UNSUPPORTED_OPTION(opt, description) \ +do { \ + if (opt) { \ + if (FLAG_IS_CMDLINE(opt)) { \ + warning(description " is disabled in this release."); \ + } \ + FLAG_SET_DEFAULT(opt, false); \ + } \ +} while(0) + +#define UNSUPPORTED_GC_OPTION(gc) \ +do { \ + if (gc) { \ + if (FLAG_IS_CMDLINE(gc)) { \ + warning(#gc " is not supported in this VM. Using Serial GC."); \ + } \ + FLAG_SET_DEFAULT(gc, false); \ + } \ +} while(0) + char** Arguments::_jvm_flags_array = NULL; int Arguments::_num_jvm_flags = 0; char** Arguments::_jvm_args_array = NULL; @@ -1891,6 +1913,10 @@ void Arguments::check_deprecated_gc_flags() { warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated" "and will likely be removed in future release"); } + if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) { + warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. " + "Use MaxRAMFraction instead."); + } } // Check stack pages settings @@ -3124,14 +3150,17 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req FLAG_SET_DEFAULT(UseLargePages, false); } - // Tiered compilation is undefined with C1. - TieredCompilation = false; #else if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); } #endif +#ifndef TIERED + // Tiered compilation is undefined. + UNSUPPORTED_OPTION(TieredCompilation, "TieredCompilation"); +#endif + // If we are running in a headless jre, force java.awt.headless property // to be true unless the property has already been set. // Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state. @@ -3274,29 +3303,6 @@ void Arguments::set_shared_spaces_flags() { } } -// Disable options not supported in this release, with a warning if they -// were explicitly requested on the command-line -#define UNSUPPORTED_OPTION(opt, description) \ -do { \ - if (opt) { \ - if (FLAG_IS_CMDLINE(opt)) { \ - warning(description " is disabled in this release."); \ - } \ - FLAG_SET_DEFAULT(opt, false); \ - } \ -} while(0) - - -#define UNSUPPORTED_GC_OPTION(gc) \ -do { \ - if (gc) { \ - if (FLAG_IS_CMDLINE(gc)) { \ - warning(#gc " is not supported in this VM. Using Serial GC."); \ - } \ - FLAG_SET_DEFAULT(gc, false); \ - } \ -} while(0) - #if !INCLUDE_ALL_GCS static void force_serial_gc() { FLAG_SET_DEFAULT(UseSerialGC, true); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 3a8a4493cc1..c598c540ecc 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1689,6 +1689,9 @@ class CommandLineFlags { product(bool, CMSAbortSemantics, false, \ "Whether abort-on-overflow semantics is implemented") \ \ + product(bool, CMSParallelInitialMarkEnabled, true, \ + "Use the parallel initial mark.") \ + \ product(bool, CMSParallelRemarkEnabled, true, \ "Whether parallel remark enabled (only if ParNewGC)") \ \ @@ -1700,6 +1703,14 @@ class CommandLineFlags { "Whether to always record survivor space PLAB bdries" \ " (effective only if CMSParallelSurvivorRemarkEnabled)") \ \ + product(bool, CMSEdenChunksRecordAlways, true, \ + "Whether to always record eden chunks used for " \ + "the parallel initial mark or remark of eden" ) \ + \ + product(bool, CMSPrintEdenSurvivorChunks, false, \ + "Print the eden and the survivor chunks used for the parallel " \ + "initial mark or remark of the eden/survivor spaces") \ + \ product(bool, CMSConcurrentMTEnabled, true, \ "Whether multi-threaded concurrent work enabled (if ParNewGC)") \ \ diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index e7de9601c96..163433b524f 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -1098,7 +1098,7 @@ typedef BinaryTreeDictionary MetablockTreeDictionary; \ c2_nonstatic_field(PhaseCFG, _num_blocks, uint) \ c2_nonstatic_field(PhaseCFG, _blocks, Block_List) \ - c2_nonstatic_field(PhaseCFG, _bbs, Block_Array) \ + c2_nonstatic_field(PhaseCFG, _node_to_block_mapping, Block_Array) \ c2_nonstatic_field(PhaseCFG, _broot, Block*) \ \ c2_nonstatic_field(PhaseRegAlloc, _node_regs, OptoRegPair*) \ diff --git a/hotspot/src/share/vm/services/gcNotifier.cpp b/hotspot/src/share/vm/services/gcNotifier.cpp index e6106e29c7d..7d1fe5d8944 100644 --- a/hotspot/src/share/vm/services/gcNotifier.cpp +++ b/hotspot/src/share/vm/services/gcNotifier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -211,9 +211,9 @@ void GCNotifier::sendNotificationInternal(TRAPS) { NotificationMark nm(request); Handle objGcInfo = createGcInfo(request->gcManager, request->gcStatInfo, THREAD); - Handle objName = java_lang_String::create_from_platform_dependent_str(request->gcManager->name(), CHECK); - Handle objAction = java_lang_String::create_from_platform_dependent_str(request->gcAction, CHECK); - Handle objCause = java_lang_String::create_from_platform_dependent_str(request->gcCause, CHECK); + Handle objName = java_lang_String::create_from_str(request->gcManager->name(), CHECK); + Handle objAction = java_lang_String::create_from_str(request->gcAction, CHECK); + Handle objCause = java_lang_String::create_from_str(request->gcCause, CHECK); Klass* k = Management::sun_management_GarbageCollectorImpl_klass(CHECK); instanceKlassHandle gc_mbean_klass(THREAD, k); diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp index 0808ebd0acd..a2c8944ee42 100644 --- a/hotspot/src/share/vm/services/management.cpp +++ b/hotspot/src/share/vm/services/management.cpp @@ -1831,13 +1831,13 @@ class ThreadTimesClosure: public ThreadClosure { private: objArrayHandle _names_strings; char **_names_chars; - typeArrayOop _times; + typeArrayHandle _times; int _names_len; int _times_len; int _count; public: - ThreadTimesClosure(objArrayHandle names, typeArrayOop times); + ThreadTimesClosure(objArrayHandle names, typeArrayHandle times); ~ThreadTimesClosure(); virtual void do_thread(Thread* thread); void do_unlocked(); @@ -1845,9 +1845,9 @@ class ThreadTimesClosure: public ThreadClosure { }; ThreadTimesClosure::ThreadTimesClosure(objArrayHandle names, - typeArrayOop times) { + typeArrayHandle times) { assert(names() != NULL, "names was NULL"); - assert(times != NULL, "times was NULL"); + assert(times() != NULL, "times was NULL"); _names_strings = names; _names_len = names->length(); _names_chars = NEW_C_HEAP_ARRAY(char*, _names_len, mtInternal); @@ -1925,7 +1925,7 @@ JVM_ENTRY(jint, jmm_GetInternalThreadTimes(JNIEnv *env, typeArrayOop ta = typeArrayOop(JNIHandles::resolve_non_null(times)); typeArrayHandle times_ah(THREAD, ta); - ThreadTimesClosure ttc(names_ah, times_ah()); + ThreadTimesClosure ttc(names_ah, times_ah); { MutexLockerEx ml(Threads_lock); Threads::threads_do(&ttc); diff --git a/hotspot/src/share/vm/utilities/debug.hpp b/hotspot/src/share/vm/utilities/debug.hpp index 2450c8fe113..85b26f35fda 100644 --- a/hotspot/src/share/vm/utilities/debug.hpp +++ b/hotspot/src/share/vm/utilities/debug.hpp @@ -225,6 +225,22 @@ void report_untested(const char* file, int line, const char* message); void warning(const char* format, ...); +#ifdef ASSERT +// Compile-time asserts. +template struct StaticAssert; +template <> struct StaticAssert {}; + +// Only StaticAssert is defined, so if cond evaluates to false we get +// a compile time exception when trying to use StaticAssert. +#define STATIC_ASSERT(cond) \ + do { \ + StaticAssert<(cond)> DUMMY_STATIC_ASSERT; \ + (void)DUMMY_STATIC_ASSERT; /* ignore */ \ + } while (false) +#else +#define STATIC_ASSERT(cond) +#endif + // out of shared space reporting enum SharedSpaceType { SharedPermGen, diff --git a/hotspot/src/share/vm/utilities/exceptions.cpp b/hotspot/src/share/vm/utilities/exceptions.cpp index 6083c555cbf..af5f974f126 100644 --- a/hotspot/src/share/vm/utilities/exceptions.cpp +++ b/hotspot/src/share/vm/utilities/exceptions.cpp @@ -125,13 +125,13 @@ void Exceptions::_throw_oop(Thread* thread, const char* file, int line, oop exce } void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) { + ResourceMark rm; assert(h_exception() != NULL, "exception should not be NULL"); // tracing (do this up front - so it works during boot strapping) if (TraceExceptions) { ttyLocker ttyl; - ResourceMark rm; - tty->print_cr("Exception <%s>%s%s (" INTPTR_FORMAT " ) \n" + tty->print_cr("Exception <%s%s%s> (" INTPTR_FORMAT ") \n" "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT, h_exception->print_value_string(), message ? ": " : "", message ? message : "", @@ -141,7 +141,9 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message)); // Check for special boot-strapping/vm-thread handling - if (special_exception(thread, file, line, h_exception)) return; + if (special_exception(thread, file, line, h_exception)) { + return; + } assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable"); @@ -149,7 +151,9 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc thread->set_pending_exception(h_exception(), file, line); // vm log - Events::log_exception(thread, "Threw " INTPTR_FORMAT " at %s:%d", (address)h_exception(), file, line); + Events::log_exception(thread, "Exception <%s%s%s> (" INTPTR_FORMAT ") thrown at [%s, line %d]", + h_exception->print_value_string(), message ? ": " : "", message ? message : "", + (address)h_exception(), file, line); } diff --git a/hotspot/src/share/vm/utilities/exceptions.hpp b/hotspot/src/share/vm/utilities/exceptions.hpp index 32c6f35d8a5..beaabf8dcf7 100644 --- a/hotspot/src/share/vm/utilities/exceptions.hpp +++ b/hotspot/src/share/vm/utilities/exceptions.hpp @@ -306,6 +306,6 @@ class ExceptionMark { // which preserves pre-existing exceptions and does not allow new // exceptions. -#define EXCEPTION_MARK Thread* THREAD; ExceptionMark __em(THREAD); +#define EXCEPTION_MARK Thread* THREAD = NULL; ExceptionMark __em(THREAD); #endif // SHARE_VM_UTILITIES_EXCEPTIONS_HPP diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 181e80a0823..f15bb5da9fe 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -410,6 +410,8 @@ inline intptr_t align_size_down(intptr_t size, intptr_t alignment) { return align_size_down_(size, alignment); } +#define is_size_aligned_(size, alignment) ((size) == (align_size_up_(size, alignment))) + // Align objects by rounding up their size, in HeapWord units. #define align_object_size_(size) align_size_up_(size, MinObjAlignment) @@ -428,6 +430,10 @@ inline intptr_t align_object_offset(intptr_t offset) { return align_size_up(offset, HeapWordsPerLong); } +inline void* align_pointer_up(const void* addr, size_t size) { + return (void*) align_size_up_((uintptr_t)addr, size); +} + // Clamp an address to be within a specific page // 1. If addr is on the page it is returned as is // 2. If addr is above the page_address the start of the *next* page will be returned @@ -449,32 +455,6 @@ inline address clamp_address_in_page(address addr, address page_address, intptr_ // The expected size in bytes of a cache line, used to pad data structures. #define DEFAULT_CACHE_LINE_SIZE 64 -// Bytes needed to pad type to avoid cache-line sharing; alignment should be the -// expected cache line size (a power of two). The first addend avoids sharing -// when the start address is not a multiple of alignment; the second maintains -// alignment of starting addresses that happen to be a multiple. -#define PADDING_SIZE(type, alignment) \ - ((alignment) + align_size_up_(sizeof(type), alignment)) - -// Templates to create a subclass padded to avoid cache line sharing. These are -// effective only when applied to derived-most (leaf) classes. - -// When no args are passed to the base ctor. -template -class Padded: public T { -private: - char _pad_buf_[PADDING_SIZE(T, alignment)]; -}; - -// When either 0 or 1 args may be passed to the base ctor. -template -class Padded01: public T { -public: - Padded01(): T() { } - Padded01(Arg1T arg1): T(arg1) { } -private: - char _pad_buf_[PADDING_SIZE(T, alignment)]; -}; //---------------------------------------------------------------------------------------------------- // Utility macros for compilers diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp index aea96c8581c..d3eafd5de47 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.hpp +++ b/hotspot/src/share/vm/utilities/taskqueue.hpp @@ -395,7 +395,13 @@ bool GenericTaskQueue::pop_local_slow(uint localBot, Age oldAge) { template bool GenericTaskQueue::pop_global(E& t) { Age oldAge = _age.get(); - uint localBot = _bottom; + // Architectures with weak memory model require a barrier here + // to guarantee that bottom is not older than age, + // which is crucial for the correctness of the algorithm. +#if !(defined SPARC || defined IA32 || defined AMD64) + OrderAccess::fence(); +#endif + uint localBot = OrderAccess::load_acquire((volatile juint*)&_bottom); uint n_elems = size(localBot, oldAge.top()); if (n_elems == 0) { return false; @@ -644,7 +650,7 @@ public: template inline bool GenericTaskQueue::push(E t) { uint localBot = _bottom; - assert((localBot >= 0) && (localBot < N), "_bottom out of range."); + assert(localBot < N, "_bottom out of range."); idx_t top = _age.top(); uint dirty_n_elems = dirty_size(localBot, top); assert(dirty_n_elems < N, "n_elems out of range."); diff --git a/hotspot/test/compiler/codecache/CheckUpperLimit.java b/hotspot/test/compiler/codecache/CheckUpperLimit.java index 5e4803226d5..e2a2705b554 100644 --- a/hotspot/test/compiler/codecache/CheckUpperLimit.java +++ b/hotspot/test/compiler/codecache/CheckUpperLimit.java @@ -35,10 +35,6 @@ public class CheckUpperLimit { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2048m", "-version"); - out = new OutputAnalyzer(pb.start()); - out.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version"); out = new OutputAnalyzer(pb.start()); out.shouldContain("Invalid ReservedCodeCacheSize="); diff --git a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java new file mode 100644 index 00000000000..c3f455274dd --- /dev/null +++ b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8016474 + * @summary The bug only happens with C1 and G1 using a different ObjectAlignmentInBytes than KlassAlignmentInBytes (which is 8) + * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 GetUnsafeObjectG1PreBarrier + */ + +import java.lang.reflect.Field; + +import sun.misc.Unsafe; + +public class GetUnsafeObjectG1PreBarrier { + private static final Unsafe unsafe; + private static final int N = 100_000; + + static { + try { + Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); + theUnsafe.setAccessible(true); + unsafe = (Unsafe) theUnsafe.get(null); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new IllegalStateException(e); + } + } + + public Object a; + + public static void main(String[] args) throws Throwable { + new GetUnsafeObjectG1PreBarrier(); + } + + public GetUnsafeObjectG1PreBarrier() throws Throwable { + doit(); + } + + private void doit() throws Throwable { + Field field = GetUnsafeObjectG1PreBarrier.class.getField("a"); + long fieldOffset = unsafe.objectFieldOffset(field); + + for (int i = 0; i < N; i++) { + readField(this, fieldOffset); + } + } + + private void readField(Object o, long fieldOffset) { + unsafe.getObject(o, fieldOffset); + } +} diff --git a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java index 491650d3752..6b718ec8851 100644 --- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java +++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java @@ -26,7 +26,7 @@ * @library /testlibrary /testlibrary/whitebox * @build ClearMethodStateTest * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* ClearMethodStateTest * @summary testing of WB::clearMethodState() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java index 74b467ea670..f09922cec8b 100644 --- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java +++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java @@ -61,6 +61,9 @@ public abstract class CompilerWhiteBoxTest { /** Value of {@code -XX:TieredStopAtLevel} */ protected static final int TIERED_STOP_AT_LEVEL = Integer.parseInt(getVMOption("TieredStopAtLevel", "0")); + /** Flag for verbose output, true if {@code -Dverbose} specified */ + protected static final boolean IS_VERBOSE + = System.getProperty("verbose") != null; /** * Returns value of VM option. @@ -268,7 +271,9 @@ public abstract class CompilerWhiteBoxTest { } result += tmp == null ? 0 : tmp; } - System.out.println("method was invoked " + count + " times"); + if (IS_VERBOSE) { + System.out.println("method was invoked " + count + " times"); + } return result; } } diff --git a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java index c831a23e58c..c659ac164e7 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java @@ -26,7 +26,7 @@ * @library /testlibrary /testlibrary/whitebox * @build DeoptimizeAllTest * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeAllTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* DeoptimizeAllTest * @summary testing of WB::deoptimizeAll() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java index b6c84aeb313..0fedc3402af 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java @@ -26,7 +26,7 @@ * @library /testlibrary /testlibrary/whitebox * @build DeoptimizeMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeMethodTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* DeoptimizeMethodTest * @summary testing of WB::deoptimizeMethod() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java index f87b3235697..b14bd96709f 100644 --- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java +++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java @@ -26,7 +26,7 @@ * @library /testlibrary /testlibrary/whitebox * @build EnqueueMethodForCompilationTest * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* EnqueueMethodForCompilationTest * @summary testing of WB::enqueueMethodForCompilation() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java index e1cfaf4887b..bb7da4ab007 100644 --- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java +++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java @@ -27,7 +27,7 @@ * @library /testlibrary /testlibrary/whitebox * @build IsMethodCompilableTest * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IsMethodCompilableTest + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* IsMethodCompilableTest * @summary testing of WB::isMethodCompilable() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java index 8347049a3d6..8290dcecc3a 100644 --- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java +++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java @@ -27,7 +27,7 @@ * @library /testlibrary /testlibrary/whitebox * @build MakeMethodNotCompilableTest * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* MakeMethodNotCompilableTest * @summary testing of WB::makeMethodNotCompilable() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java index 6a8b61c373f..22912a1058d 100644 --- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java @@ -26,7 +26,7 @@ * @library /testlibrary /testlibrary/whitebox * @build SetDontInlineMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetDontInlineMethodTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* SetDontInlineMethodTest * @summary testing of WB::testSetDontInlineMethod() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java index ca3e54389bb..609be614a2c 100644 --- a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java @@ -26,7 +26,7 @@ * @library /testlibrary /testlibrary/whitebox * @build SetForceInlineMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetForceInlineMethodTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,TestCase$Helper::* SetForceInlineMethodTest * @summary testing of WB::testSetForceInlineMethod() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java new file mode 100644 index 00000000000..193dacf9897 --- /dev/null +++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +*/ + +/* + * @test TestG1HeapRegionSize + * @key gc + * @bug 8021879 + * @summary Verify that the flag G1HeapRegionSize is updated properly + * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576 + * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152 + * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152 + * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432 + */ + +import sun.management.ManagementFactoryHelper; +import com.sun.management.HotSpotDiagnosticMXBean; +import com.sun.management.VMOption; + +public class TestG1HeapRegionSize { + + public static void main(String[] args) { + HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); + + VMOption option = diagnostic.getVMOption("UseG1GC"); + if (option.getValue().equals("false")) { + System.out.println("Skipping this test. It is only a G1 test."); + return; + } + + String expectedValue = getExpectedValue(args); + option = diagnostic.getVMOption("G1HeapRegionSize"); + if (!expectedValue.equals(option.getValue())) { + throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue()); + } + } + + private static String getExpectedValue(String[] args) { + if (args.length != 1) { + throw new RuntimeException("Wrong number of arguments. Expected 1 but got " + args.length); + } + return args[0]; + } + +} diff --git a/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java b/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java index 417b2cc1a39..6bf41391b4f 100644 --- a/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java +++ b/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java @@ -27,7 +27,7 @@ * @bug 8014240 * @summary Test output of G1PrintRegionRememberedSetInfo * @library /testlibrary - * @build TestPrintRegionRememberedSetInfo + * @run main TestPrintRegionRememberedSetInfo * @author thomas.schatzl@oracle.com */ diff --git a/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java b/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java new file mode 100644 index 00000000000..059a526acf4 --- /dev/null +++ b/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +*/ + +/* +* @test TestDefaultMaxRAMFraction +* @key gc +* @bug 8021967 +* @summary Test that the deprecated TestDefaultMaxRAMFraction flag print a warning message +* @library /testlibrary +*/ + +import com.oracle.java.testlibrary.OutputAnalyzer; +import com.oracle.java.testlibrary.ProcessTools; + +public class TestDefaultMaxRAMFraction { + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:DefaultMaxRAMFraction=4", "-version"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("warning: DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. Use MaxRAMFraction instead."); + output.shouldNotContain("error"); + output.shouldHaveExitValue(0); + } + +} diff --git a/hotspot/test/runtime/6929067/Test6929067.sh b/hotspot/test/runtime/6929067/Test6929067.sh index b707e096304..90b96d5e9d8 100644 --- a/hotspot/test/runtime/6929067/Test6929067.sh +++ b/hotspot/test/runtime/6929067/Test6929067.sh @@ -3,6 +3,7 @@ ## ## @test Test6929067.sh ## @bug 6929067 +## @bug 8021296 ## @summary Stack guard pages should be removed when thread is detached ## @compile T.java ## @run shell Test6929067.sh @@ -21,6 +22,11 @@ echo "TESTSRC=${TESTSRC}" OS=`uname -s` case "$OS" in Linux) + gcc_cmd=`which gcc` + if [ "x$gcc_cmd" == "x" ]; then + echo "WARNING: gcc not found. Cannot execute test." 2>&1 + exit 0; + fi NULL=/dev/null PS=":" FS="/" @@ -119,10 +125,10 @@ echo "VM type: ${VMTYPE}" # Check to ensure you have a /usr/lib/libpthread.so if you don't please look # for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation. -gcc -DLINUX ${COMP_FLAG} -o invoke \ - -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \ - -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \ - -ljvm -lpthread invoke.c +$gcc_cmd -DLINUX ${COMP_FLAG} -o invoke \ + -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \ + -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \ + -ljvm -lpthread invoke.c ./invoke exit $? diff --git a/hotspot/test/runtime/7107135/Test7107135.sh b/hotspot/test/runtime/7107135/Test7107135.sh index c283456438d..742c71c1ce2 100644 --- a/hotspot/test/runtime/7107135/Test7107135.sh +++ b/hotspot/test/runtime/7107135/Test7107135.sh @@ -27,6 +27,7 @@ ## ## @test Test7107135.sh ## @bug 7107135 +## @bug 8021296 ## @summary Stack guard pages lost after loading library with executable stack. ## @run shell Test7107135.sh ## @@ -45,11 +46,13 @@ OS=`uname -s` case "$OS" in Linux) echo "Testing on Linux" + gcc_cmd=`which gcc` + if [ "x$gcc_cmd" == "x" ]; then + echo "WARNING: gcc not found. Cannot execute test." 2>&1 + exit 0; + fi ;; *) - NULL=NUL - PS=";" - FS="\\" echo "Test passed; only valid for Linux" exit 0; ;; @@ -62,7 +65,10 @@ THIS_DIR=. cp ${TESTSRC}${FS}*.java ${THIS_DIR} ${TESTJAVA}${FS}bin${FS}javac *.java -gcc -fPIC -shared -c -o test.o -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux ${TESTSRC}${FS}test.c +$gcc_cmd -fPIC -shared -c -o test.o \ + -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \ + ${TESTSRC}${FS}test.c + ld -shared -z execstack -o libtest-rwx.so test.o ld -shared -z noexecstack -o libtest-rw.so test.o @@ -78,14 +84,16 @@ ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw echo echo Test changing of stack protection: -echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw +echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx +JAVA_RETVAL=$? -if [ "$?" == "0" ] +if [ "$JAVA_RETVAL" == "0" ] then echo echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx + JAVA_RETVAL=$? fi -exit $? +exit $JAVA_RETVAL diff --git a/hotspot/test/runtime/8000968/Test8000968.sh b/hotspot/test/runtime/8000968/Test8000968.sh deleted file mode 100644 index cd7183476cf..00000000000 --- a/hotspot/test/runtime/8000968/Test8000968.sh +++ /dev/null @@ -1,99 +0,0 @@ -# -# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - - -# @test Test8000968.sh -# @bug 8000968 -# @summary NPG: UseCompressedKlassPointers asserts with ObjectAlignmentInBytes=32 -# @run shell Test8000968.sh -# - -if [ "${TESTJAVA}" = "" ] -then - PARENT=`dirname \`which java\`` - TESTJAVA=`dirname ${PARENT}` - printf "TESTJAVA not set, selecting " ${TESTJAVA} - printf " If this is incorrect, try setting the variable manually.\n" -fi - - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Windows_* ) - FS="\\" - NULL=NUL - ;; - * ) - FS="/" - NULL=/dev/null - ;; -esac - -JAVA=${TESTJAVA}${FS}bin${FS}java - -# -# See if platform has 64 bit java. -# -${JAVA} ${TESTVMOPTS} -d64 -version 2>&1 | grep -i "does not support" > ${NULL} -if [ "$?" != "1" ] -then - printf "Platform is 32 bit, does not support -XX:ObjectAlignmentInBytes= option.\n" - printf "Passed.\n" - exit 0 -fi - -# -# Test -XX:ObjectAlignmentInBytes with -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops. -# -${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=16 -version 2>&1 > ${NULL} -if [ "$?" != "0" ] -then - printf "FAILED: -XX:ObjectAlignmentInBytes=16 option did not work.\n" - exit 1 -fi - -${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=32 -version 2>&1 > ${NULL} -if [ "$?" != "0" ] -then - printf "FAILED: -XX:ObjectAlignmentInBytes=32 option did not work.\n" - exit 1 -fi - -${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=64 -version 2>&1 > ${NULL} -if [ "$?" != "0" ] -then - printf "FAILED: -XX:ObjectAlignmentInBytes=64 option did not work.\n" - exit 1 -fi - -${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=128 -version 2>&1 > ${NULL} -if [ "$?" != "0" ] -then - printf "FAILED: -XX:ObjectAlignmentInBytes=128 option did not work.\n" - exit 1 -fi - - -printf "Passed.\n" -exit 0 diff --git a/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java b/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java new file mode 100644 index 00000000000..dd0c26d9f10 --- /dev/null +++ b/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8000968 + * @key regression + * @summary NPG: UseCompressedKlassPointers asserts with ObjectAlignmentInBytes=32 + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.*; + +public class CompressedKlassPointerAndOops { + + public static void main(String[] args) throws Exception { + + if (!Platform.is64bit()) { + // Can't test this on 32 bit, just pass + System.out.println("Skipping test on 32bit"); + return; + } + + runWithAlignment(16); + runWithAlignment(32); + runWithAlignment(64); + runWithAlignment(128); + } + + private static void runWithAlignment(int alignment) throws Exception { + ProcessBuilder pb; + OutputAnalyzer output; + + pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UseCompressedKlassPointers", + "-XX:+UseCompressedOops", + "-XX:ObjectAlignmentInBytes=" + alignment, + "-version"); + + output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } +} diff --git a/hotspot/test/runtime/7196045/Test7196045.java b/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java similarity index 82% rename from hotspot/test/runtime/7196045/Test7196045.java rename to hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java index 4c6fcc8c072..3416ce45fec 100644 --- a/hotspot/test/runtime/7196045/Test7196045.java +++ b/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,9 @@ /* * @test * @bug 7196045 + * @bug 8014294 * @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API. - * @run main/othervm -XX:+UsePerfData Test7196045 + * @run main/othervm -XX:+UsePerfData -Xmx32m ThreadCpuTimesDeadlock */ import java.lang.management.ManagementFactory; @@ -35,9 +36,10 @@ import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; -public class Test7196045 { +public class ThreadCpuTimesDeadlock { - public static long duration = 1000 * 60 * 2; + public static byte[] dummy; + public static long duration = 10 * 1000; private static final String HOTSPOT_INTERNAL = "sun.management:type=HotspotInternal"; public static void main(String[] args) { @@ -57,6 +59,18 @@ public class Test7196045 { throw new RuntimeException("Bad object name" + e1); } + // Thread that allocs memory to generate GC's + Thread allocThread = new Thread() { + public void run() { + while (true) { + dummy = new byte[4096]; + } + } + }; + + allocThread.setDaemon(true); + allocThread.start(); + long endTime = System.currentTimeMillis() + duration; long i = 0; while (true) { diff --git a/hotspot/test/runtime/RedefineObject/Agent.java b/hotspot/test/runtime/RedefineObject/Agent.java index 7927094d8aa..b5435c22ca7 100644 --- a/hotspot/test/runtime/RedefineObject/Agent.java +++ b/hotspot/test/runtime/RedefineObject/Agent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,7 @@ */ import java.security.*; import java.lang.instrument.*; +import java.lang.reflect.*; public class Agent implements ClassFileTransformer { public synchronized byte[] transform(final ClassLoader classLoader, @@ -29,23 +30,35 @@ public class Agent implements ClassFileTransformer { Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) { - //System.out.println("Transforming class " + className); + System.out.println("Transforming class " + className); return classfileBuffer; } - public static void premain(String agentArgs, Instrumentation instrumentation) { + public static void redefine(String agentArgs, Instrumentation instrumentation, Class to_redefine) { - Agent transformer = new Agent(); - - instrumentation.addTransformer(transformer, true); - - Class c = Object.class; try { - instrumentation.retransformClasses(c); + instrumentation.retransformClasses(to_redefine); } catch (Exception e) { e.printStackTrace(); } + } + + public static void premain(String agentArgs, Instrumentation instrumentation) { + Agent transformer = new Agent(); + instrumentation.addTransformer(transformer, true); + + // Redefine java/lang/Object and java/lang/reflect/Method.invoke and + // java/lang/ClassLoader + Class object_class = Object.class; + redefine(agentArgs, instrumentation, object_class); + + Class method_class = Method.class; + redefine(agentArgs, instrumentation, method_class); + + Class loader_class = ClassLoader.class; + redefine(agentArgs, instrumentation, loader_class); + instrumentation.removeTransformer(transformer); } @@ -57,5 +70,14 @@ public class Agent implements ClassFileTransformer { System.gc(); ba.clone(); } + try { + // Use java/lang/reflect/Method.invoke to call + WalkThroughInvoke a = new WalkThroughInvoke(); + Class aclass = WalkThroughInvoke.class; + Method m = aclass.getMethod("stackWalk"); + m.invoke(a); + } catch (Exception x) { + x.printStackTrace(); + } } } diff --git a/hotspot/test/runtime/RedefineObject/TestRedefineObject.java b/hotspot/test/runtime/RedefineObject/TestRedefineObject.java index bd5003a588a..437cec25b33 100644 --- a/hotspot/test/runtime/RedefineObject/TestRedefineObject.java +++ b/hotspot/test/runtime/RedefineObject/TestRedefineObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,17 @@ import com.oracle.java.testlibrary.*; /* * Test to redefine java/lang/Object and verify that it doesn't crash on vtable * call on basic array type. + * Test to redefine java/lang/ClassLoader and java/lang/reflect/Method to make + * sure cached versions used afterward are the current version. * * @test * @bug 8005056 + * @bug 8009728 * @library /testlibrary * @build Agent * @run main ClassFileInstaller Agent * @run main TestRedefineObject - * @run main/othervm -javaagent:agent.jar Agent + * @run main/othervm -javaagent:agent.jar -XX:TraceRedefineClasses=5 Agent */ public class TestRedefineObject { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/RedefineObject/WalkThroughInvoke.java b/hotspot/test/runtime/RedefineObject/WalkThroughInvoke.java new file mode 100644 index 00000000000..51f0e635bca --- /dev/null +++ b/hotspot/test/runtime/RedefineObject/WalkThroughInvoke.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.lang.reflect.*; + +public class WalkThroughInvoke { + public void stackWalk() { + try { + Class b = Object.class; + SecurityManager sm = new SecurityManager(); + // Walks the stack with Method.invoke in the stack (which is the + // purpose of the test) before it gets an AccessControlException. + sm.checkMemberAccess(b, Member.DECLARED); + } catch (java.security.AccessControlException e) { + // Ignoring an 'AccessControlException' exception since + // it is expected as part of this test. + } + } +}; diff --git a/hotspot/test/runtime/jsig/Test8017498.sh b/hotspot/test/runtime/jsig/Test8017498.sh index 6a8f4634bc7..fadb01d5fa7 100644 --- a/hotspot/test/runtime/jsig/Test8017498.sh +++ b/hotspot/test/runtime/jsig/Test8017498.sh @@ -27,6 +27,7 @@ ## @test Test8017498.sh ## @bug 8017498 ## @bug 8020791 +## @bug 8021296 ## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX ## @run shell/timeout=30 Test8017498.sh ## @@ -45,6 +46,11 @@ OS=`uname -s` case "$OS" in Linux) echo "Testing on Linux" + gcc_cmd=`which gcc` + if [ "x$gcc_cmd" == "x" ]; then + echo "WARNING: gcc not found. Cannot execute test." 2>&1 + exit 0; + fi if [ "$VM_BITS" = "64" ] then MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so @@ -64,15 +70,11 @@ THIS_DIR=. cp ${TESTSRC}${FS}*.java ${THIS_DIR} ${TESTJAVA}${FS}bin${FS}javac *.java -gcc -DLINUX -fPIC -shared \ +$gcc_cmd -DLINUX -fPIC -shared \ -o ${TESTSRC}${FS}libTestJNI.so \ -I${TESTJAVA}${FS}include \ -I${TESTJAVA}${FS}include${FS}linux \ ${TESTSRC}${FS}TestJNI.c -if [ $? != 0 ] -then - echo "WARNING: the gcc command failed." 2>&1 -fi # run the java test in the background cmd="LD_PRELOAD=$MY_LD_PRELOAD \ diff --git a/hotspot/test/runtime/jsig/TestJNI.c b/hotspot/test/runtime/jsig/TestJNI.c index 20057facd76..c85b778a68b 100644 --- a/hotspot/test/runtime/jsig/TestJNI.c +++ b/hotspot/test/runtime/jsig/TestJNI.c @@ -21,7 +21,6 @@ * questions. */ -#define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h #include #include #include @@ -32,11 +31,8 @@ extern "C" { #endif void sig_handler(int sig, siginfo_t *info, ucontext_t *context) { - int thrNum; printf( " HANDLER (1) " ); - // Move forward RIP to skip failing instruction - context->uc_mcontext.gregs[REG_RIP] += 6; } JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) { diff --git a/hotspot/test/testlibrary/OutputAnalyzerReportingTest.java b/hotspot/test/testlibrary/OutputAnalyzerReportingTest.java new file mode 100644 index 00000000000..068f193efcf --- /dev/null +++ b/hotspot/test/testlibrary/OutputAnalyzerReportingTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @summary Test the OutputAnalyzer reporting functionality, + * such as printing additional diagnostic info + * (exit code, stdout, stderr, command line, etc.) + * @library /testlibrary + */ + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import com.oracle.java.testlibrary.OutputAnalyzer; +import com.oracle.java.testlibrary.ProcessTools; + + +public class OutputAnalyzerReportingTest { + + public static void main(String[] args) throws Exception { + // Create the output analyzer under test + String stdout = "aaaaaa"; + String stderr = "bbbbbb"; + OutputAnalyzer output = new OutputAnalyzer(stdout, stderr); + + // Expected summary values should be the same for all cases, + // since the outputAnalyzer object is the same + String expectedExitValue = "-1"; + String expectedSummary = + " stdout: [" + stdout + "];\n" + + " stderr: [" + stderr + "]\n" + + " exitValue = " + expectedExitValue + "\n"; + + + DiagnosticSummaryTestRunner testRunner = + new DiagnosticSummaryTestRunner(); + + // should have exit value + testRunner.init(expectedSummary); + int unexpectedExitValue = 2; + try { + output.shouldHaveExitValue(unexpectedExitValue); + } catch (RuntimeException e) { } + testRunner.closeAndCheckResults(); + + // should not contain + testRunner.init(expectedSummary); + try { + output.shouldNotContain(stdout); + } catch (RuntimeException e) { } + testRunner.closeAndCheckResults(); + + // should contain + testRunner.init(expectedSummary); + try { + output.shouldContain("unexpected-stuff"); + } catch (RuntimeException e) { } + testRunner.closeAndCheckResults(); + + // should not match + testRunner.init(expectedSummary); + try { + output.shouldNotMatch("[a]"); + } catch (RuntimeException e) { } + testRunner.closeAndCheckResults(); + + // should match + testRunner.init(expectedSummary); + try { + output.shouldMatch("[qwerty]"); + } catch (RuntimeException e) { } + testRunner.closeAndCheckResults(); + + } + + private static class DiagnosticSummaryTestRunner { + private ByteArrayOutputStream byteStream = + new ByteArrayOutputStream(10000); + + private String expectedSummary = ""; + private PrintStream errStream; + + + public void init(String expectedSummary) { + this.expectedSummary = expectedSummary; + byteStream.reset(); + errStream = new PrintStream(byteStream); + System.setErr(errStream); + } + + public void closeAndCheckResults() { + // check results + errStream.close(); + String stdErrStr = byteStream.toString(); + if (!stdErrStr.contains(expectedSummary)) { + throw new RuntimeException("The output does not contain " + + "the diagnostic message, or the message is incorrect"); + } + } + } + +} diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java index ede667f8e58..b9e37128d23 100644 --- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java +++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java @@ -76,7 +76,8 @@ public final class OutputAnalyzer { */ public void shouldContain(String expectedString) { if (!stdout.contains(expectedString) && !stderr.contains(expectedString)) { - throw new RuntimeException("'" + expectedString + "' missing from stdout/stderr: [" + stdout + stderr + "]\n"); + reportDiagnosticSummary(); + throw new RuntimeException("'" + expectedString + "' missing from stdout/stderr \n"); } } @@ -88,7 +89,8 @@ public final class OutputAnalyzer { */ public void stdoutShouldContain(String expectedString) { if (!stdout.contains(expectedString)) { - throw new RuntimeException("'" + expectedString + "' missing from stdout: [" + stdout + "]\n"); + reportDiagnosticSummary(); + throw new RuntimeException("'" + expectedString + "' missing from stdout \n"); } } @@ -100,7 +102,8 @@ public final class OutputAnalyzer { */ public void stderrShouldContain(String expectedString) { if (!stderr.contains(expectedString)) { - throw new RuntimeException("'" + expectedString + "' missing from stderr: [" + stderr + "]\n"); + reportDiagnosticSummary(); + throw new RuntimeException("'" + expectedString + "' missing from stderr \n"); } } @@ -112,10 +115,12 @@ public final class OutputAnalyzer { */ public void shouldNotContain(String notExpectedString) { if (stdout.contains(notExpectedString)) { - throw new RuntimeException("'" + notExpectedString + "' found in stdout: [" + stdout + "]\n"); + reportDiagnosticSummary(); + throw new RuntimeException("'" + notExpectedString + "' found in stdout \n"); } if (stderr.contains(notExpectedString)) { - throw new RuntimeException("'" + notExpectedString + "' found in stderr: [" + stderr + "]\n"); + reportDiagnosticSummary(); + throw new RuntimeException("'" + notExpectedString + "' found in stderr \n"); } } @@ -127,7 +132,8 @@ public final class OutputAnalyzer { */ public void stdoutShouldNotContain(String notExpectedString) { if (stdout.contains(notExpectedString)) { - throw new RuntimeException("'" + notExpectedString + "' found in stdout: [" + stdout + "]\n"); + reportDiagnosticSummary(); + throw new RuntimeException("'" + notExpectedString + "' found in stdout \n"); } } @@ -139,7 +145,8 @@ public final class OutputAnalyzer { */ public void stderrShouldNotContain(String notExpectedString) { if (stderr.contains(notExpectedString)) { - throw new RuntimeException("'" + notExpectedString + "' found in stderr: [" + stderr + "]\n"); + reportDiagnosticSummary(); + throw new RuntimeException("'" + notExpectedString + "' found in stderr \n"); } } @@ -154,9 +161,9 @@ public final class OutputAnalyzer { Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); if (!stdoutMatcher.find() && !stderrMatcher.find()) { + reportDiagnosticSummary(); throw new RuntimeException("'" + pattern - + "' missing from stdout/stderr: [" + stdout + stderr - + "]\n"); + + "' missing from stdout/stderr \n"); } } @@ -170,8 +177,9 @@ public final class OutputAnalyzer { public void stdoutShouldMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); if (!matcher.find()) { + reportDiagnosticSummary(); throw new RuntimeException("'" + pattern - + "' missing from stdout: [" + stdout + "]\n"); + + "' missing from stdout \n"); } } @@ -185,8 +193,9 @@ public final class OutputAnalyzer { public void stderrShouldMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); if (!matcher.find()) { + reportDiagnosticSummary(); throw new RuntimeException("'" + pattern - + "' missing from stderr: [" + stderr + "]\n"); + + "' missing from stderr \n"); } } @@ -200,13 +209,15 @@ public final class OutputAnalyzer { public void shouldNotMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); if (matcher.find()) { + reportDiagnosticSummary(); throw new RuntimeException("'" + pattern - + "' found in stdout: [" + stdout + "]\n"); + + "' found in stdout \n"); } matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); if (matcher.find()) { + reportDiagnosticSummary(); throw new RuntimeException("'" + pattern - + "' found in stderr: [" + stderr + "]\n"); + + "' found in stderr \n"); } } @@ -220,8 +231,9 @@ public final class OutputAnalyzer { public void stdoutShouldNotMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); if (matcher.find()) { + reportDiagnosticSummary(); throw new RuntimeException("'" + pattern - + "' found in stdout: [" + stdout + "]\n"); + + "' found in stdout \n"); } } @@ -235,23 +247,45 @@ public final class OutputAnalyzer { public void stderrShouldNotMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); if (matcher.find()) { + reportDiagnosticSummary(); throw new RuntimeException("'" + pattern - + "' found in stderr: [" + stderr + "]\n"); + + "' found in stderr \n"); } } /** - * Verifiy the exit value of the process + * Verify the exit value of the process * * @param expectedExitValue Expected exit value from process * @throws RuntimeException If the exit value from the process did not match the expected value */ public void shouldHaveExitValue(int expectedExitValue) { if (getExitValue() != expectedExitValue) { - throw new RuntimeException("Exit value " + getExitValue() + " , expected to get " + expectedExitValue); + reportDiagnosticSummary(); + throw new RuntimeException("Expected to get exit value of [" + + expectedExitValue + "]\n"); } } + + /** + * Report summary that will help to diagnose the problem + * Currently includes: + * - standard input produced by the process under test + * - standard output + * - exit code + * Note: the command line is printed by the ProcessTools + */ + private void reportDiagnosticSummary() { + String msg = + " stdout: [" + stdout + "];\n" + + " stderr: [" + stderr + "]\n" + + " exitValue = " + getExitValue() + "\n"; + + System.err.println(msg); + } + + /** * Get the contents of the output buffer (stdout and stderr) * diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java index cfc1a271c13..8e5d303317d 100644 --- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java +++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java @@ -27,6 +27,7 @@ public class Platform { private static final String osName = System.getProperty("os.name"); private static final String dataModel = System.getProperty("sun.arch.data.model"); private static final String vmVersion = System.getProperty("java.vm.version"); + private static final String osArch = System.getProperty("os.arch"); public static boolean is64bit() { return dataModel.equals("64"); @@ -59,4 +60,14 @@ public class Platform { public static String getVMVersion() { return vmVersion; } + + // Returns true for sparc and sparcv9. + public static boolean isSparc() { + return osArch.toLowerCase().startsWith("sparc"); + } + + public static String getOsArch() { + return osArch; + } + } diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java index 6e0fdae6564..56277f046ec 100644 --- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java +++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java @@ -31,6 +31,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; +import java.util.List; import sun.management.VMManagement; @@ -106,6 +107,22 @@ public final class ProcessTools { return pid; } + /** + * Get the string containing input arguments passed to the VM + * + * @return arguments + */ + public static String getVmInputArguments() { + RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); + + List args = runtime.getInputArguments(); + StringBuilder result = new StringBuilder(); + for (String arg : args) + result.append(arg).append(' '); + + return result.toString(); + } + /** * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris) * @@ -132,8 +149,13 @@ public final class ProcessTools { Collections.addAll(args, getPlatformSpecificVMArgs()); Collections.addAll(args, command); - return new ProcessBuilder(args.toArray(new String[args.size()])); + // Reporting + StringBuilder cmdLine = new StringBuilder(); + for (String cmd : args) + cmdLine.append(cmd).append(' '); + System.out.println("Command line: [" + cmdLine.toString() + "]"); + return new ProcessBuilder(args.toArray(new String[args.size()])); } } diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 74a7093e328..03148a2fdb0 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -222,3 +222,6 @@ b8c5f4b6f0fffb44618fc609a584953c4ed67c0b jdk8-b95 15e5bb51bc0cd89304dc2f7f29b4c8002e632353 jdk8-b98 adf49c3ef83c160d53ece623049b2cdccaf78fc7 jdk8-b99 5d1974c1d7b9a86431bc253dc5a6a52d4586622e jdk8-b100 +0a7432f898e579ea35e8c51e3edab37f949168e4 jdk8-b101 +7cffafa606e9fb865e7b5e6a56e0a681ce5cf617 jdk8-b102 +b1ceab582fc6d795b20aaa8a3fde2eba34af9399 jdk8-b103 diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java index 21323af9469..3a6d38f551b 100644 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java +++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java @@ -112,7 +112,7 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser /** Initial EntityResolver */ private final EntityResolver fInitEntityResolver; - private XMLSecurityPropertyManager fSecurityPropertyMgr; + private final XMLSecurityPropertyManager fSecurityPropertyMgr; /** * Create a SAX parser with the associated features @@ -130,8 +130,10 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features, boolean secureProcessing) throws SAXException { + fSecurityPropertyMgr = new XMLSecurityPropertyManager(); + // Instantiate a SAXParser directly and not through SAX so that we use the right ClassLoader - xmlReader = new JAXPSAXParser(this); + xmlReader = new JAXPSAXParser(this, fSecurityPropertyMgr); // JAXP "namespaceAware" == SAX Namespaces feature // Note: there is a compatibility problem here with default values: @@ -150,7 +152,6 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser xmlReader.setFeature0(XINCLUDE_FEATURE, true); } - fSecurityPropertyMgr = new XMLSecurityPropertyManager(); xmlReader.setProperty0(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); // If the secure processing feature is on set a security manager. @@ -397,14 +398,30 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser private final HashMap fInitFeatures = new HashMap(); private final HashMap fInitProperties = new HashMap(); private final SAXParserImpl fSAXParser; + private XMLSecurityPropertyManager fSecurityPropertyMgr; + public JAXPSAXParser() { - this(null); + this(null, null); } - JAXPSAXParser(SAXParserImpl saxParser) { + JAXPSAXParser(SAXParserImpl saxParser, XMLSecurityPropertyManager spm) { super(); fSAXParser = saxParser; + fSecurityPropertyMgr = spm; + + /** + * This class may be used directly. So initialize the security manager if + * it is null. + */ + if (fSecurityPropertyMgr == null) { + fSecurityPropertyMgr = new XMLSecurityPropertyManager(); + try { + super.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr); + } catch (Exception ex) { + //shall not happen + } + } } /** @@ -542,9 +559,9 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser setSchemaValidatorProperty(name, value); } /** Check to see if the property is managed by the property manager **/ - int index = fSAXParser.fSecurityPropertyMgr.getIndex(name); + int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1; if (index > -1) { - fSAXParser.fSecurityPropertyMgr.setValue(index, + fSecurityPropertyMgr.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value); } else { if (!fInitProperties.containsKey(name)) { @@ -564,9 +581,9 @@ public class SAXParserImpl extends javax.xml.parsers.SAXParser // JAXP 1.2 support return fSAXParser.schemaLanguage; } - int index = fSAXParser.fSecurityPropertyMgr.getIndex(name); + int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1; if (index > -1) { - return fSAXParser.fSecurityPropertyMgr.getValueByIndex(index); + return fSecurityPropertyMgr.getValueByIndex(index); } return super.getProperty(name); diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 83a25aa6af6..bc095c0cca8 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -222,3 +222,6 @@ dcde7f049111353ad23175f54985a4f6bfea720c jdk8-b97 b1fb4612a2caea52b5661b87509e560fa044b194 jdk8-b98 8ef83d4b23c933935e28f59b282cea920b1b1f5f jdk8-b99 4fd722afae5c02f00bbd44c3a34425ee474afb1c jdk8-b100 +60b623a361642a0f5aef5f06dad9e5f279b9d9a9 jdk8-b101 +988a5f2ac559dcab05698b8a8633aa453e012260 jdk8-b102 +6cdc6ed987801c175a1217d0d3e53c3bd69ba52e jdk8-b103 diff --git a/jdk/.hgtags b/jdk/.hgtags index e73ad87229f..b185182241f 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -223,3 +223,5 @@ c4908732fef5235f1b98cafe0ce507771ef7892c jdk8-b98 6a099a36589bd933957272ba63e5263bede29971 jdk8-b99 5be9c5bfcfe9b2a40412b4fb364377d49de014eb jdk8-b100 6901612328239fbd471d20823113c1cf3fdaebee jdk8-b101 +8ed8e2b4b90e0ac9aa5b3efef51cd576a9db96a9 jdk8-b102 +e0f6039c0290b7381042a6fec3100a69a5a67e37 jdk8-b103 diff --git a/jdk/makefiles/CompileNativeLibraries.gmk b/jdk/makefiles/CompileNativeLibraries.gmk index 5f1775976b9..d6389d1bb97 100644 --- a/jdk/makefiles/CompileNativeLibraries.gmk +++ b/jdk/makefiles/CompileNativeLibraries.gmk @@ -798,6 +798,16 @@ ifeq ($(OPENJDK_TARGET_OS),solaris) LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15 endif +ifeq ($(OPENJDK_TARGET_OS),linux) +ifndef OPENJDK +include $(JDK_TOPDIR)/make/closed/xawt.gmk +endif + +ifeq ($(DISABLE_XRENDER),true) + LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true +endif +endif + ifeq ($(MILESTONE),internal) LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD endif diff --git a/jdk/src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java b/jdk/src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java index f432bd803d3..270c5fc4c36 100644 --- a/jdk/src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java +++ b/jdk/src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java @@ -31,6 +31,7 @@ import java.awt.peer.MenuComponentPeer; import javax.swing.*; import javax.swing.plaf.MenuBarUI; +import com.apple.laf.ScreenMenuBar; import sun.lwawt.macosx.CMenuBar; import com.apple.laf.AquaMenuBarUI; @@ -72,12 +73,15 @@ class _AppMenuBarHandler { // scan the current frames, and see if any are foreground final Frame[] frames = Frame.getFrames(); for (final Frame frame : frames) { - if (frame.isVisible() && !isFrameMinimized(frame)) return; + if (frame.isVisible() && !isFrameMinimized(frame)) { + return; + } } // if we have no foreground frames, then we have to "kick" the menubar final JFrame pingFrame = new JFrame(); pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f)); + pingFrame.setUndecorated(true); pingFrame.setVisible(true); pingFrame.toFront(); pingFrame.setVisible(false); @@ -101,7 +105,6 @@ class _AppMenuBarHandler { // Aqua was not installed throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel"); } -/* TODO: disabled until ScreenMenuBar is working final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui; final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar(); @@ -118,8 +121,7 @@ class _AppMenuBarHandler { } // grab the pointer to the CMenuBar, and retain it in native - nativeSetDefaultMenuBar(((CMenuBar)peer).getNativeMenuBarPeer()); -*/ + nativeSetDefaultMenuBar(((CMenuBar)peer).getModel()); } void setAboutMenuItemVisible(final boolean present) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java index fdad818c4f0..5a1cf0cdeb7 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java @@ -1856,7 +1856,10 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing // If we're not valid that means we will shortly be validated and // painted, which means we don't have to do anything here. if (!isRunsDirty && index >= 0 && index < tabPane.getTabCount()) { - tabPane.repaint(getTabBounds(tabPane, index)); + Rectangle rect = getTabBounds(tabPane, index); + if (rect != null) { + tabPane.repaint(rect); + } } } diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java index 7dbc187296d..39b55762648 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java @@ -701,6 +701,20 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI { return false; } + /** + * Returns the bounds of the specified tab index. The bounds are + * with respect to the JTabbedPane's coordinate space. If the tab at this + * index is not currently visible in the UI, then returns null. + */ + @Override + public Rectangle getTabBounds(final JTabbedPane pane, final int i) { + if (visibleTabState.needsScrollTabs() + && (visibleTabState.isBefore(i) || visibleTabState.isAfter(i))) { + return null; + } + return super.getTabBounds(pane, i); + } + /** * Returns the tab index which intersects the specified point * in the JTabbedPane's coordinate space. diff --git a/jdk/src/macosx/classes/sun/font/CStrike.java b/jdk/src/macosx/classes/sun/font/CStrike.java index 9635b85a1de..af4f8754cfb 100644 --- a/jdk/src/macosx/classes/sun/font/CStrike.java +++ b/jdk/src/macosx/classes/sun/font/CStrike.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ import java.util.*; import sun.awt.SunHints; -public class CStrike extends FontStrike { +public final class CStrike extends FontStrike { // Creates the native strike private static native long createNativeStrikePtr(long nativeFontPtr, @@ -68,10 +68,10 @@ public class CStrike extends FontStrike { Rectangle2D.Float result, double x, double y); - private CFont nativeFont; + private final CFont nativeFont; private AffineTransform invDevTx; - private GlyphInfoCache glyphInfoCache; - private GlyphAdvanceCache glyphAdvanceCache; + private final GlyphInfoCache glyphInfoCache; + private final GlyphAdvanceCache glyphAdvanceCache; private long nativeStrikePtr; CStrike(final CFont font, final FontStrikeDesc inDesc) { @@ -84,11 +84,11 @@ public class CStrike extends FontStrike { // Normally the device transform should be the identity transform // for screen operations. The device transform only becomes // interesting when we are outputting between different dpi surfaces, - // like when we are printing to postscript. + // like when we are printing to postscript or use retina. if (inDesc.devTx != null && !inDesc.devTx.isIdentity()) { try { invDevTx = inDesc.devTx.createInverse(); - } catch (NoninvertibleTransformException e) { + } catch (NoninvertibleTransformException ignored) { // ignored, since device transforms should not be that // complicated, and if they are - there is nothing we can do, // so we won't worry about it. @@ -134,15 +134,13 @@ public class CStrike extends FontStrike { nativeStrikePtr = 0; } - // the fractional metrics default on our platform is OFF - private boolean useFractionalMetrics() { - return desc.fmHint == SunHints.INTVAL_FRACTIONALMETRICS_ON; - } + @Override public int getNumGlyphs() { return nativeFont.getNumGlyphs(); } + @Override StrikeMetrics getFontMetrics() { if (strikeMetrics == null) { StrikeMetrics metrics = getFontMetrics(getNativeStrikePtr()); @@ -155,74 +153,24 @@ public class CStrike extends FontStrike { return strikeMetrics; } - float getGlyphAdvance(int glyphCode) { - return getScaledAdvanceForAdvance(getCachedNativeGlyphAdvance(glyphCode)); + @Override + float getGlyphAdvance(final int glyphCode) { + return getCachedNativeGlyphAdvance(glyphCode); } - float getCodePointAdvance(int cp) { - float advance = getCachedNativeGlyphAdvance(nativeFont.getMapper().charToGlyph(cp)); - - double glyphScaleX = desc.glyphTx.getScaleX(); - double devScaleX = desc.devTx.getScaleX(); - - if (devScaleX == 0) { - glyphScaleX = Math.sqrt(desc.glyphTx.getDeterminant()); - devScaleX = Math.sqrt(desc.devTx.getDeterminant()); - } - - if (devScaleX == 0) { - devScaleX = Double.NaN; // this an undefined graphics state - } - advance = (float) (advance * glyphScaleX / devScaleX); - return useFractionalMetrics() ? advance : Math.round(advance); + @Override + float getCodePointAdvance(final int cp) { + return getGlyphAdvance(nativeFont.getMapper().charToGlyph(cp)); } - // calculate an advance, and round if not using fractional metrics - private float getScaledAdvanceForAdvance(float advance) { - if (invDevTx != null) { - advance *= invDevTx.getScaleX(); - } - advance *= desc.glyphTx.getScaleX(); - return useFractionalMetrics() ? advance : Math.round(advance); + @Override + Point2D.Float getCharMetrics(final char ch) { + return getGlyphMetrics(nativeFont.getMapper().charToGlyph(ch)); } - Point2D.Float getCharMetrics(char ch) { - return getScaledPointForAdvance(getCachedNativeGlyphAdvance(nativeFont.getMapper().charToGlyph(ch))); - } - - Point2D.Float getGlyphMetrics(int glyphCode) { - return getScaledPointForAdvance(getCachedNativeGlyphAdvance(glyphCode)); - } - - // calculate an advance point, and round if not using fractional metrics - private Point2D.Float getScaledPointForAdvance(float advance) { - Point2D.Float pt = new Point2D.Float(advance, 0); - - if (!desc.glyphTx.isIdentity()) { - return scalePoint(pt); - } - - if (!useFractionalMetrics()) { - pt.x = Math.round(pt.x); - } - return pt; - } - - private Point2D.Float scalePoint(Point2D.Float pt) { - if (invDevTx != null) { - // transform the point out of the device space first - invDevTx.transform(pt, pt); - } - desc.glyphTx.transform(pt, pt); - pt.x -= desc.glyphTx.getTranslateX(); - pt.y -= desc.glyphTx.getTranslateY(); - - if (!useFractionalMetrics()) { - pt.x = Math.round(pt.x); - pt.y = Math.round(pt.y); - } - - return pt; + @Override + Point2D.Float getGlyphMetrics(final int glyphCode) { + return new Point2D.Float(getGlyphAdvance(glyphCode), 0.0f); } Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) { @@ -414,9 +362,7 @@ public class CStrike extends FontStrike { private SparseBitShiftingTwoLayerArray secondLayerCache; private HashMap generalCache; - public GlyphInfoCache(final Font2D nativeFont, - final FontStrikeDesc desc) - { + GlyphInfoCache(final Font2D nativeFont, final FontStrikeDesc desc) { super(nativeFont, desc); firstLayerCache = new long[FIRST_LAYER_SIZE]; } @@ -527,7 +473,7 @@ public class CStrike extends FontStrike { final int shift; final int secondLayerLength; - public SparseBitShiftingTwoLayerArray(final int size, final int shift) { + SparseBitShiftingTwoLayerArray(final int size, final int shift) { this.shift = shift; this.cache = new long[1 << shift][]; this.secondLayerLength = size >> shift; @@ -559,6 +505,12 @@ public class CStrike extends FontStrike { private SparseBitShiftingTwoLayerArray secondLayerCache; private HashMap generalCache; + // Empty non private constructor was added because access to this + // class shouldn't be emulated by a synthetic accessor method. + GlyphAdvanceCache() { + super(); + } + public synchronized float get(final int index) { if (index < 0) { if (-index < SECOND_LAYER_SIZE) { @@ -609,9 +561,7 @@ public class CStrike extends FontStrike { final int shift; final int secondLayerLength; - public SparseBitShiftingTwoLayerArray(final int size, - final int shift) - { + SparseBitShiftingTwoLayerArray(final int size, final int shift) { this.shift = shift; this.cache = new float[1 << shift][]; this.secondLayerLength = size >> shift; diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java index 35c6ef6d54d..b4f0f97823a 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java @@ -182,7 +182,11 @@ public class CDataTransferer extends DataTransferer { Long format = predefinedClipboardNameMap.get(str); if (format == null) { - format = new Long(registerFormatWithPasteboard(str)); + if (java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) { + // Do not try to access native system for the unknown format + return -1L; + } + format = registerFormatWithPasteboard(str); predefinedClipboardNameMap.put(str, format); predefinedClipboardFormatMap.put(format, str); } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java index 0ac7c0cfa65..0cffc90409f 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java @@ -43,7 +43,7 @@ public abstract class CMenuComponent implements MenuComponentPeer { return target; } - long getModel() { + public long getModel() { return modelPtr; } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 124e8f73998..d38946d4376 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -47,7 +47,7 @@ import com.apple.laf.ClientPropertyApplicator.Property; import com.sun.awt.AWTUtilities; public class CPlatformWindow extends CFRetainedResource implements PlatformWindow { - private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h); + private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h); private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data); private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr); private static native Insets nativeGetNSWindowInsets(long nsWindowPtr); @@ -230,7 +230,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo contentView = createContentView(); contentView.initialize(peer, responder); - final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0); + final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L; + final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), ownerPtr, styleBits, 0, 0, 0, 0); setPtr(nativeWindowPtr); if (target instanceof javax.swing.RootPaneContainer) { @@ -829,18 +830,19 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // UTILITY METHODS // ---------------------------------------------------------------------- - /* - * Find image to install into Title or into Application icon. - * First try icons installed for toplevel. If there is no icon - * use default Duke image. - * This method shouldn't return null. + /** + * Find image to install into Title or into Application icon. First try + * icons installed for toplevel. Null is returned, if there is no icon and + * default Duke image should be used. */ private CImage getImageForTarget() { - List icons = target.getIconImages(); - if (icons == null || icons.size() == 0) { - return null; + CImage icon = null; + try { + icon = CImage.getCreator().createFromImages(target.getIconImages()); + } catch (Exception ignored) { + // Perhaps the icon passed into Java is broken. Skipping this icon. } - return CImage.getCreator().createFromImages(icons); + return icon; } /* diff --git a/jdk/src/macosx/native/java/util/SCDynamicStoreConfig.m b/jdk/src/macosx/native/java/util/SCDynamicStoreConfig.m index f6ad5e2e3fa..86e6a67d793 100644 --- a/jdk/src/macosx/native/java/util/SCDynamicStoreConfig.m +++ b/jdk/src/macosx/native/java/util/SCDynamicStoreConfig.m @@ -103,7 +103,6 @@ NSDictionary *realmConfigsForRealms(SCDynamicStoreRef store, NSArray *realms) { CFTypeRef realmInfo = SCDynamicStoreCopyValue(store, (CFStringRef) [NSString stringWithFormat:@"Kerberos:%@", realm]); if (CFGetTypeID(realmInfo) != CFDictionaryGetTypeID()) { - NSLog(@"Unexpected CFType for realm Info: %lu", CFGetTypeID(realmInfo)); return nil; } @@ -140,7 +139,6 @@ JNF_COCOA_ENTER(env); SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("java"), _SCDynamicStoreCallBack, NULL); if (store == NULL) { - NSLog(@"Unable to load SCDynamicStore to install NotificationCallback"); return; } @@ -171,19 +169,11 @@ JNF_COCOA_ENTER(env); SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("java-kerberos"), NULL, NULL); if (store == NULL) { - NSLog(@"Unable to load SCDynamicStore"); - return NULL; - } - - // Create the store if it is NULL and set it. - if (store == NULL) { - NSLog(@"Invalid value for SCDynamicStore"); return NULL; } CFTypeRef realms = SCDynamicStoreCopyValue(store, (CFStringRef) KERBEROS_DEFAULT_REALMS); if (realms == NULL || CFGetTypeID(realms) != CFArrayGetTypeID()) { - NSLog(@"Unable to load realm info from SCDynamicStore"); if (realms) CFRelease(realms); CFRelease(store); return NULL; @@ -192,7 +182,6 @@ JNF_COCOA_ENTER(env); CFTypeRef realmMappings = SCDynamicStoreCopyValue(store, (CFStringRef) KERBEROS_DEFAULT_REALM_MAPPINGS); if (realmMappings == NULL || CFGetTypeID(realmMappings) != CFArrayGetTypeID()) { - NSLog(@"Unable to load realm mapping info from SCDynamicStore"); if (realmMappings) CFRelease(realmMappings); CFRelease(realms); CFRelease(store); diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.h b/jdk/src/macosx/native/sun/awt/AWTWindow.h index c3949a62bb1..698820ade4d 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.h +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h @@ -44,6 +44,7 @@ jint styleBits; BOOL isEnabled; NSWindow *nsWindow; + AWTWindow *ownerWindow; } // An instance of either AWTWindow_Normal or AWTWindow_Panel @@ -51,12 +52,15 @@ @property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow; @property (nonatomic, retain) CMenuBar *javaMenuBar; +@property (nonatomic, retain) AWTWindow *ownerWindow; @property (nonatomic) NSSize javaMinSize; @property (nonatomic) NSSize javaMaxSize; @property (nonatomic) jint styleBits; @property (nonatomic) BOOL isEnabled; + - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow + ownerWindow:owner styleBits:(jint)styleBits frameRect:(NSRect)frameRect contentView:(NSView *)contentView; diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index 2a596bcfa75..5608b4ad98c 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -30,6 +30,7 @@ #import "sun_lwawt_macosx_CPlatformWindow.h" #import "com_apple_eawt_event_GestureHandler.h" #import "com_apple_eawt_FullScreenHandler.h" +#import "ApplicationDelegate.h" #import "AWTWindow.h" #import "AWTView.h" @@ -55,7 +56,7 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow"); // doesn't provide information about "opposite" window, so we // have to do a bit of tracking. This variable points to a window // which had been the key window just before a new key window -// was set. It would be nil if the new key window isn't an AWT +// was set. It would be nil if the new key window isn't an AWT // window or the app currently has no key window. static AWTWindow* lastKeyWindow = nil; @@ -120,6 +121,7 @@ AWT_NS_WINDOW_IMPLEMENTATION @synthesize javaMaxSize; @synthesize styleBits; @synthesize isEnabled; +@synthesize ownerWindow; - (void) updateMinMaxSize:(BOOL)resizable { if (resizable) { @@ -201,6 +203,7 @@ AWT_NS_WINDOW_IMPLEMENTATION } - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)platformWindow + ownerWindow:owner styleBits:(jint)bits frameRect:(NSRect)rect contentView:(NSView *)view @@ -245,6 +248,7 @@ AWT_ASSERT_APPKIT_THREAD; self.isEnabled = YES; self.javaPlatformWindow = platformWindow; self.styleBits = bits; + self.ownerWindow = owner; [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)]; return self; @@ -350,7 +354,7 @@ AWT_ASSERT_APPKIT_THREAD; [self.javaPlatformWindow setJObject:nil withEnv:env]; self.nsWindow = nil; - + self.ownerWindow = nil; [super dealloc]; } @@ -539,11 +543,27 @@ AWT_ASSERT_APPKIT_THREAD; AWT_ASSERT_APPKIT_THREAD; [AWTToolkit eventCountPlusPlus]; AWTWindow *opposite = [AWTWindow lastKeyWindow]; - if (!IS(self.styleBits, IS_DIALOG)) { - [CMenuBar activate:self.javaMenuBar modallyDisabled:NO]; - } else if ((opposite != NULL) && IS(self.styleBits, IS_MODAL)) { - [CMenuBar activate:opposite->javaMenuBar modallyDisabled:YES]; + + // Finds appropriate menubar in our hierarchy, + AWTWindow *awtWindow = self; + while (awtWindow.ownerWindow != nil) { + awtWindow = awtWindow.ownerWindow; } + + CMenuBar *menuBar = nil; + BOOL isDisabled = NO; + if ([awtWindow.nsWindow isVisible]){ + menuBar = awtWindow.javaMenuBar; + isDisabled = !awtWindow.isEnabled; + } + + if (menuBar == nil) { + menuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar]; + isDisabled = NO; + } + + [CMenuBar activate:menuBar modallyDisabled:isDisabled]; + [AWTWindow setLastKeyWindow:nil]; [self _deliverWindowFocusEvent:YES oppositeWindow: opposite]; @@ -555,6 +575,14 @@ AWT_ASSERT_APPKIT_THREAD; [AWTToolkit eventCountPlusPlus]; [self.javaMenuBar deactivate]; + // In theory, this might cause flickering if the window gaining focus + // has its own menu. However, I couldn't reproduce it on practice, so + // perhaps this is a non issue. + CMenuBar* defaultMenu = [[ApplicationDelegate sharedDelegate] defaultMenuBar]; + if (defaultMenu != nil) { + [CMenuBar activate:defaultMenu modallyDisabled:NO]; + } + // the new key window NSWindow *keyWindow = [NSApp keyWindow]; AWTWindow *opposite = nil; @@ -741,7 +769,7 @@ AWT_ASSERT_APPKIT_THREAD; * Signature: (JJIIII)J */ JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCreateNSWindow -(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h) +(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong ownerPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h) { __block AWTWindow *window = nil; @@ -750,13 +778,14 @@ JNF_COCOA_ENTER(env); JNFWeakJObjectWrapper *platformWindow = [JNFWeakJObjectWrapper wrapperWithJObject:obj withEnv:env]; NSView *contentView = OBJC(contentViewPtr); NSRect frameRect = NSMakeRect(x, y, w, h); - + AWTWindow *owner = [OBJC(ownerPtr) delegate]; [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow - styleBits:styleBits - frameRect:frameRect - contentView:contentView]; + ownerWindow:owner + styleBits:styleBits + frameRect:frameRect + contentView:contentView]; // the window is released is CPlatformWindow.nativeDispose() if (window) CFRetain(window.nsWindow); @@ -818,11 +847,19 @@ JNF_COCOA_ENTER(env); AWTWindow *window = (AWTWindow*)[nsWindow delegate]; - if ([nsWindow isKeyWindow]) [window.javaMenuBar deactivate]; + if ([nsWindow isKeyWindow]) { + [window.javaMenuBar deactivate]; + } + window.javaMenuBar = menuBar; + CMenuBar* actualMenuBar = menuBar; + if (actualMenuBar == nil) { + actualMenuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar]; + } + if ([nsWindow isKeyWindow]) { - [CMenuBar activate:window.javaMenuBar modallyDisabled:NO]; + [CMenuBar activate:actualMenuBar modallyDisabled:NO]; } }]; diff --git a/jdk/src/macosx/native/sun/awt/CMenuBar.m b/jdk/src/macosx/native/sun/awt/CMenuBar.m index b0d67f71a2a..7858221dcf5 100644 --- a/jdk/src/macosx/native/sun/awt/CMenuBar.m +++ b/jdk/src/macosx/native/sun/awt/CMenuBar.m @@ -63,7 +63,7 @@ static BOOL sSetupHelpMenu = NO; if (excludingAppleMenu && ![currMenu isJavaMenu]) { continue; } - + [currItem setSubmenu:nil]; [theMainMenu removeItemAtIndex:index]; } @@ -154,7 +154,10 @@ static BOOL sSetupHelpMenu = NO; // Clean up extra items NSUInteger removedIndex, removedCount = [removedMenuArray count]; for (removedIndex=removedCount; removedIndex > 0; removedIndex--) { - [theMainMenu removeItemAtIndex:[[removedMenuArray objectAtIndex:(removedIndex-1)] integerValue]]; + NSUInteger index = [[removedMenuArray objectAtIndex:(removedIndex-1)] integerValue]; + NSMenuItem *currItem = [theMainMenu itemAtIndex:index]; + [currItem setSubmenu:nil]; + [theMainMenu removeItemAtIndex:index]; } i = cmenuIndex; diff --git a/jdk/src/macosx/native/sun/awt/CMenuItem.m b/jdk/src/macosx/native/sun/awt/CMenuItem.m index 0d1ade68ab6..978710eefc7 100644 --- a/jdk/src/macosx/native/sun/awt/CMenuItem.m +++ b/jdk/src/macosx/native/sun/awt/CMenuItem.m @@ -70,9 +70,15 @@ AWT_ASSERT_APPKIT_THREAD; JNIEnv *env = [ThreadUtilities getJNIEnv]; JNF_COCOA_ENTER(env); - // If we are called as a result of user pressing a shorcut, do nothing, + // If we are called as a result of user pressing a shortcut, do nothing, // because AVTView has already sent corresponding key event to the Java - // layer from performKeyEquivalent + // layer from performKeyEquivalent. + // There is an exception from the rule above, though: if a window with + // a menu gets minimized by user and there are no other windows to take + // focus, the window's menu won't be removed from the global menu bar. + // However, the Java layer won't handle invocation by a shortcut coming + // from this "frameless" menu, because there are no active windows. This + // means we have to handle it here. NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent]; if ([currEvent type] == NSKeyDown) { NSString *menuKey = [sender keyEquivalent]; @@ -91,7 +97,8 @@ JNF_COCOA_ENTER(env); eventKey = [NSString stringWithCharacters: &newChar length: 1]; } - if ([menuKey isEqualToString:eventKey]) { + NSWindow *keyWindow = [NSApp keyWindow]; + if ([menuKey isEqualToString:eventKey] && keyWindow != nil) { return; } } diff --git a/jdk/src/macosx/native/sun/font/AWTStrike.h b/jdk/src/macosx/native/sun/font/AWTStrike.h index 41bbe4d5c96..05ef198764b 100644 --- a/jdk/src/macosx/native/sun/font/AWTStrike.h +++ b/jdk/src/macosx/native/sun/font/AWTStrike.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,11 +31,12 @@ @interface AWTStrike : NSObject { @public AWTFont * fAWTFont; - CGFloat fSize; + CGFloat fSize; JRSFontRenderingStyle fStyle; - jint fAAStyle; + jint fAAStyle; CGAffineTransform fTx; + CGAffineTransform fDevTx; CGAffineTransform fAltTx; // alternate strike tx used for Sun2D CGAffineTransform fFontTx; } diff --git a/jdk/src/macosx/native/sun/font/AWTStrike.m b/jdk/src/macosx/native/sun/font/AWTStrike.m index 7f04b530ade..6e4b4291cbb 100644 --- a/jdk/src/macosx/native/sun/font/AWTStrike.m +++ b/jdk/src/macosx/native/sun/font/AWTStrike.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,6 +65,7 @@ static CGAffineTransform sInverseTX = { 1, 0, 0, -1, 0, 0 }; invDevTx.b *= -1; invDevTx.c *= -1; fFontTx = CGAffineTransformConcat(CGAffineTransformConcat(tx, invDevTx), sInverseTX); + fDevTx = CGAffineTransformInvert(invDevTx); // the "font size" is the square root of the determinant of the matrix fSize = sqrt(abs(fFontTx.a * fFontTx.d - fFontTx.b * fFontTx.c)); @@ -148,7 +149,8 @@ Java_sun_font_CStrike_getNativeGlyphAdvance { CGSize advance; JNF_COCOA_ENTER(env); - AWTFont *awtFont = ((AWTStrike *)jlong_to_ptr(awtStrikePtr))->fAWTFont; + AWTStrike *awtStrike = (AWTStrike *)jlong_to_ptr(awtStrikePtr); + AWTFont *awtFont = awtStrike->fAWTFont; // negative glyph codes are really unicodes, which were placed there by the mapper // to indicate we should use CoreText to substitute the character @@ -156,6 +158,10 @@ JNF_COCOA_ENTER(env); const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph); CTFontGetAdvancesForGlyphs(fallback, kCTFontDefaultOrientation, &glyph, &advance, 1); CFRelease(fallback); + advance = CGSizeApplyAffineTransform(advance, awtStrike->fFontTx); + if (!JRSFontStyleUsesFractionalMetrics(awtStrike->fStyle)) { + advance.width = round(advance.width); + } JNF_COCOA_EXIT(env); return advance.width; diff --git a/jdk/src/macosx/native/sun/font/CGGlyphImages.m b/jdk/src/macosx/native/sun/font/CGGlyphImages.m index 508c12766d9..1901c1fc5cb 100644 --- a/jdk/src/macosx/native/sun/font/CGGlyphImages.m +++ b/jdk/src/macosx/native/sun/font/CGGlyphImages.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -455,6 +455,7 @@ CGGI_ClearCanvas(CGGI_GlyphCanvas *canvas, GlyphInfo *info) #define CGGI_GLYPH_BBOX_PADDING 2.0f static inline GlyphInfo * CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox, + const AWTStrike *strike, const CGGI_RenderingMode *mode) { size_t pixelSize = mode->glyphDescriptor->pixelSize; @@ -477,6 +478,12 @@ CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox, width = 1; height = 1; } + advance = CGSizeApplyAffineTransform(advance, strike->fFontTx); + if (!JRSFontStyleUsesFractionalMetrics(strike->fStyle)) { + advance.width = round(advance.width); + advance.height = round(advance.height); + } + advance = CGSizeApplyAffineTransform(advance, strike->fDevTx); #ifdef USE_IMAGE_ALIGNED_MEMORY // create separate memory @@ -564,10 +571,10 @@ CGGI_CreateImageForUnicode JRSFontGetBoundingBoxesForGlyphsAndStyle(fallback, &tx, style, &glyph, 1, &bbox); CGSize advance; - JRSFontGetAdvancesForGlyphsAndStyle(fallback, &tx, strike->fStyle, &glyph, 1, &advance); + CTFontGetAdvancesForGlyphs(fallback, kCTFontDefaultOrientation, &glyph, &advance, 1); // create the Sun2D GlyphInfo we are going to strike into - GlyphInfo *info = CGGI_CreateNewGlyphInfoFrom(advance, bbox, mode); + GlyphInfo *info = CGGI_CreateNewGlyphInfoFrom(advance, bbox, strike, mode); // fix the context size, just in case the substituted character is unexpectedly large CGGI_SizeCanvas(canvas, info->width, info->height, mode->cgFontMode); @@ -715,7 +722,7 @@ CGGI_CreateGlyphInfos(jlong *glyphInfos, const AWTStrike *strike, JRSFontRenderingStyle bboxCGMode = JRSFontAlignStyleForFractionalMeasurement(strike->fStyle); JRSFontGetBoundingBoxesForGlyphsAndStyle((CTFontRef)font->fFont, &tx, bboxCGMode, glyphs, len, bboxes); - JRSFontGetAdvancesForGlyphsAndStyle((CTFontRef)font->fFont, &tx, strike->fStyle, glyphs, len, advances); + CTFontGetAdvancesForGlyphs((CTFontRef)font->fFont, kCTFontDefaultOrientation, glyphs, advances, len); size_t maxWidth = 1; size_t maxHeight = 1; @@ -732,7 +739,7 @@ CGGI_CreateGlyphInfos(jlong *glyphInfos, const AWTStrike *strike, CGSize advance = advances[i]; CGRect bbox = bboxes[i]; - GlyphInfo *glyphInfo = CGGI_CreateNewGlyphInfoFrom(advance, bbox, mode); + GlyphInfo *glyphInfo = CGGI_CreateNewGlyphInfoFrom(advance, bbox, strike, mode); if (maxWidth < glyphInfo->width) maxWidth = glyphInfo->width; if (maxHeight < glyphInfo->height) maxHeight = glyphInfo->height; diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties index 636d88a9b84..dc84d130187 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties @@ -1,54 +1,54 @@ -# Refer to the note in basic.properties for a description as to what -# the mnemonics correspond to and how to calculate them. - - - -# GTK specific properties - -# GTK color chooser properties: -GTKColorChooserPanel.textAndMnemonic=>K Color Chooser -# mnemonic as a VK_ constant - -GTKColorChooserPanel.hue.textAndMnemonic=&Hue: - -GTKColorChooserPanel.red.textAndMnemonic=R&ed: - -GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation: - -GTKColorChooserPanel.green.textAndMnemonic=&Green: - -GTKColorChooserPanel.value.textAndMnemonic=&Value: - -GTKColorChooserPanel.blue.textAndMnemonic=&Blue: - -GTKColorChooserPanel.color.textAndMnemonic=Color &Name: - - - -############ FILE CHOOSER STRINGS ############# - -FileChooser.acceptAllFileFilter.textAndMnemonic=All Files -FileChooser.newFolderButton.textAndMnemonic=&New Folder -FileChooser.newFolderDialog.textAndMnemonic=Folder name: -FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error -FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error creating directory "{0}": No such file or directory -FileChooser.deleteFileButton.textAndMnemonic=De&lete File -FileChooser.renameFileButton.textAndMnemonic=&Rename File -FileChooser.cancelButton.textAndMnemonic=&Cancel -FileChooser.saveButton.textAndMnemonic=&OK -FileChooser.openButton.textAndMnemonic=&OK -FileChooser.saveDialogTitle.textAndMnemonic=Save -FileChooser.openDialogTitle.textAndMnemonic=Open -FileChooser.pathLabel.textAndMnemonic=&Selection: -FileChooser.filterLabel.textAndMnemonic=Filter: -FileChooser.foldersLabel.textAndMnemonic=Fol&ders -FileChooser.filesLabel.textAndMnemonic=&Files - -FileChooser.cancelButtonToolTip.textAndMnemonic=Abort file chooser dialog. -FileChooser.saveButtonToolTip.textAndMnemonic=Save selected file. -FileChooser.openButtonToolTip.textAndMnemonic=Open selected file. - -FileChooser.renameFileDialog.textAndMnemonic=Rename file "{0}" to -FileChooser.renameFileError.titleAndMnemonic=Error -FileChooser.renameFileError.textAndMnemonic=Error renaming file "{0}" to "{1}" - +# Refer to the note in basic.properties for a description as to what +# the mnemonics correspond to and how to calculate them. + + + +# GTK specific properties + +# GTK color chooser properties: +GTKColorChooserPanel.textAndMnemonic=>K Color Chooser +# mnemonic as a VK_ constant + +GTKColorChooserPanel.hue.textAndMnemonic=&Hue: + +GTKColorChooserPanel.red.textAndMnemonic=R&ed: + +GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation: + +GTKColorChooserPanel.green.textAndMnemonic=&Green: + +GTKColorChooserPanel.value.textAndMnemonic=&Value: + +GTKColorChooserPanel.blue.textAndMnemonic=&Blue: + +GTKColorChooserPanel.color.textAndMnemonic=Color &Name: + + + +############ FILE CHOOSER STRINGS ############# + +FileChooser.acceptAllFileFilter.textAndMnemonic=All Files +FileChooser.newFolderButton.textAndMnemonic=&New Folder +FileChooser.newFolderDialog.textAndMnemonic=Folder name: +FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error +FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error creating directory "{0}": No such file or directory +FileChooser.deleteFileButton.textAndMnemonic=De&lete File +FileChooser.renameFileButton.textAndMnemonic=&Rename File +FileChooser.cancelButton.textAndMnemonic=&Cancel +FileChooser.saveButton.textAndMnemonic=&OK +FileChooser.openButton.textAndMnemonic=&OK +FileChooser.saveDialogTitle.textAndMnemonic=Save +FileChooser.openDialogTitle.textAndMnemonic=Open +FileChooser.pathLabel.textAndMnemonic=&Selection: +FileChooser.filterLabel.textAndMnemonic=Filter: +FileChooser.foldersLabel.textAndMnemonic=Fol&ders +FileChooser.filesLabel.textAndMnemonic=&Files + +FileChooser.cancelButtonToolTip.textAndMnemonic=Abort file chooser dialog. +FileChooser.saveButtonToolTip.textAndMnemonic=Save selected file. +FileChooser.openButtonToolTip.textAndMnemonic=Open selected file. + +FileChooser.renameFileDialog.textAndMnemonic=Rename file "{0}" to +FileChooser.renameFileError.titleAndMnemonic=Error +FileChooser.renameFileError.textAndMnemonic=Error renaming file "{0}" to "{1}" + diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java index 30a3d5e572f..3e4c7faa66f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java @@ -499,7 +499,8 @@ public class WindowsComboBoxUI extends BasicComboBoxUI { public void setItem(Object item) { super.setItem(item); - if (editor.hasFocus()) { + Object focus = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); + if ((focus == editor) || (focus == editor.getParent())) { editor.selectAll(); } } diff --git a/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java b/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java index 447eb395b69..2ea13fb3169 100644 --- a/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java +++ b/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,10 @@ import javax.security.auth.PrivateCredentialPermission; import sun.security.util.PropertyExpander; +import sun.security.provider.PolicyParser.PrincipalEntry; +import sun.security.provider.PolicyParser.GrantEntry; +import sun.security.provider.PolicyParser.PermissionEntry; + /** * This class represents a default implementation for * javax.security.auth.Policy. @@ -469,7 +473,8 @@ public class PolicyFile extends javax.security.auth.Policy { * @param policyFile the policy Reader object. */ private void init(URL policy) { - PolicyParser pp = new PolicyParser(expandProperties); + sun.security.provider.PolicyParser pp = + new sun.security.provider.PolicyParser(expandProperties); try { InputStreamReader isr = new InputStreamReader(getInputStream(policy)); @@ -477,12 +482,12 @@ public class PolicyFile extends javax.security.auth.Policy { isr.close(); KeyStore keyStore = initKeyStore(policy, pp.getKeyStoreUrl(), pp.getKeyStoreType()); - Enumeration enum_ = pp.grantElements(); + Enumeration enum_ = pp.grantElements(); while (enum_.hasMoreElements()) { - PolicyParser.GrantEntry ge = enum_.nextElement(); + GrantEntry ge = enum_.nextElement(); addGrantEntry(ge, keyStore); } - } catch (PolicyParser.ParsingException pe) { + } catch (sun.security.provider.PolicyParser.ParsingException pe) { System.err.println(AUTH_POLICY + rb.getString(".error.parsing.") + policy); System.err.println(AUTH_POLICY + @@ -521,8 +526,8 @@ public class PolicyFile extends javax.security.auth.Policy { * * @return null if signedBy alias is not recognized */ - CodeSource getCodeSource(PolicyParser.GrantEntry ge, KeyStore keyStore) - throws java.net.MalformedURLException + CodeSource getCodeSource(GrantEntry ge, KeyStore keyStore) + throws java.net.MalformedURLException { Certificate[] certs = null; if (ge.signedBy != null) { @@ -559,20 +564,18 @@ public class PolicyFile extends javax.security.auth.Policy { /** * Add one policy entry to the vector. */ - private void addGrantEntry(PolicyParser.GrantEntry ge, - KeyStore keyStore) { + private void addGrantEntry(GrantEntry ge, KeyStore keyStore) { if (debug != null) { debug.println("Adding policy entry: "); debug.println(" signedBy " + ge.signedBy); debug.println(" codeBase " + ge.codeBase); if (ge.principals != null && ge.principals.size() > 0) { - ListIterator li = - ge.principals.listIterator(); + ListIterator li = ge.principals.listIterator(); while (li.hasNext()) { - PolicyParser.PrincipalEntry pppe = li.next(); - debug.println(" " + pppe.principalClass + - " " + pppe.principalName); + PrincipalEntry pppe = li.next(); + debug.println(" " + pppe.getPrincipalClass() + + " " + pppe.getPrincipalName()); } } debug.println(); @@ -584,10 +587,9 @@ public class PolicyFile extends javax.security.auth.Policy { if (codesource == null) return; PolicyEntry entry = new PolicyEntry(codesource); - Enumeration enum_ = - ge.permissionElements(); + Enumeration enum_ = ge.permissionElements(); while (enum_.hasMoreElements()) { - PolicyParser.PermissionEntry pe = enum_.nextElement(); + PermissionEntry pe = enum_.nextElement(); try { // XXX special case PrivateCredentialPermission-SELF Permission perm; @@ -998,11 +1000,11 @@ public class PolicyFile extends javax.security.auth.Policy { return true; } - ListIterator pli = - scs.getPrincipals().listIterator(); + ListIterator pli = + scs.getPrincipals().listIterator(); while (pli.hasNext()) { - PolicyParser.PrincipalEntry principal = pli.next(); + PrincipalEntry principal = pli.next(); // XXX // if the Policy entry's Principal does not contain a @@ -1050,30 +1052,29 @@ public class PolicyFile extends javax.security.auth.Policy { * if (y == 1), it's the principal name. */ private String[][] getPrincipalInfo - (PolicyParser.PrincipalEntry principal, - final CodeSource accCs) { + (PrincipalEntry principal, final CodeSource accCs) { // there are 3 possibilities: // 1) the entry's Principal class and name are not wildcarded // 2) the entry's Principal name is wildcarded only // 3) the entry's Principal class and name are wildcarded - if (!principal.principalClass.equals - (PolicyParser.PrincipalEntry.WILDCARD_CLASS) && - !principal.principalName.equals - (PolicyParser.PrincipalEntry.WILDCARD_NAME)) { + if (!principal.getPrincipalClass().equals + (PrincipalEntry.WILDCARD_CLASS) && + !principal.getPrincipalName().equals + (PrincipalEntry.WILDCARD_NAME)) { // build a PrivateCredentialPermission for the principal // from the Policy entry String[][] info = new String[1][2]; - info[0][0] = principal.principalClass; - info[0][1] = principal.principalName; + info[0][0] = principal.getPrincipalClass(); + info[0][1] = principal.getPrincipalName(); return info; - } else if (!principal.principalClass.equals - (PolicyParser.PrincipalEntry.WILDCARD_CLASS) && - principal.principalName.equals - (PolicyParser.PrincipalEntry.WILDCARD_NAME)) { + } else if (!principal.getPrincipalClass().equals + (PrincipalEntry.WILDCARD_CLASS) && + principal.getPrincipalName().equals + (PrincipalEntry.WILDCARD_NAME)) { // build a PrivateCredentialPermission for all // the Subject's principals that are instances of principalClass @@ -1088,7 +1089,7 @@ public class PolicyFile extends javax.security.auth.Policy { // If it doesn't, we should stop here with a ClassCastException. @SuppressWarnings("unchecked") Class pClass = (Class) - Class.forName(principal.principalClass, false, + Class.forName(principal.getPrincipalClass(), false, ClassLoader.getSystemClassLoader()); principalSet = scs.getSubject().getPrincipals(pClass); } catch (Exception e) { @@ -1387,6 +1388,7 @@ public class PolicyFile extends javax.security.auth.Policy { } } +@SuppressWarnings("deprecation") class PolicyPermissions extends PermissionCollection { private static final long serialVersionUID = -1954188373270545523L; diff --git a/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java b/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java index 35d3bf1c410..7e38a087420 100644 --- a/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java +++ b/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import java.security.cert.Certificate; import java.lang.reflect.Constructor; import javax.security.auth.Subject; +import sun.security.provider.PolicyParser.PrincipalEntry; /** *

This SubjectCodeSource class contains @@ -57,7 +58,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { }); private Subject subject; - private LinkedList principals; + private LinkedList principals; private static final Class[] PARAMS = { String.class }; private static final sun.security.util.Debug debug = sun.security.util.Debug.getInstance("auth", "\t[Auth Access]"); @@ -87,14 +88,14 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { * SubjectCodeSource

*/ SubjectCodeSource(Subject subject, - LinkedList principals, + LinkedList principals, URL url, Certificate[] certs) { super(url, certs); this.subject = subject; this.principals = (principals == null ? - new LinkedList() : - new LinkedList(principals)); + new LinkedList() : + new LinkedList(principals)); sysClassLoader = java.security.AccessController.doPrivileged (new java.security.PrivilegedAction() { public ClassLoader run() { @@ -114,7 +115,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { * SubjectCodeSource as a LinkedList * of PolicyParser.PrincipalEntry objects. */ - LinkedList getPrincipals() { + LinkedList getPrincipals() { return principals; } @@ -167,7 +168,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { */ public boolean implies(CodeSource codesource) { - LinkedList subjectList = null; + LinkedList subjectList = null; if (codesource == null || !(codesource instanceof SubjectCodeSource) || @@ -197,20 +198,19 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { return false; } - ListIterator li = - this.principals.listIterator(0); + ListIterator li = this.principals.listIterator(0); while (li.hasNext()) { - PolicyParser.PrincipalEntry pppe = li.next(); + PrincipalEntry pppe = li.next(); try { // handle PrincipalComparators Class principalComparator = Class.forName( - pppe.principalClass, true, sysClassLoader); + pppe.getPrincipalClass(), true, sysClassLoader); Constructor c = principalComparator.getConstructor(PARAMS); PrincipalComparator pc = (PrincipalComparator)c.newInstance - (new Object[] { pppe.principalName }); + (new Object[] { pppe.getPrincipalName() }); if (!pc.implies(that.getSubject())) { if (debug != null) @@ -236,11 +236,10 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { Iterator i = that.getSubject().getPrincipals().iterator(); - subjectList = new LinkedList(); + subjectList = new LinkedList(); while (i.hasNext()) { Principal p = i.next(); - PolicyParser.PrincipalEntry spppe = - new PolicyParser.PrincipalEntry + PrincipalEntry spppe = new PrincipalEntry (p.getClass().getName(), p.getName()); subjectList.add(spppe); } @@ -281,23 +280,19 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { * pppe argument. */ private boolean subjectListImpliesPrincipalEntry( - LinkedList subjectList, - PolicyParser.PrincipalEntry pppe) { + LinkedList subjectList, PrincipalEntry pppe) { - ListIterator li = - subjectList.listIterator(0); + ListIterator li = subjectList.listIterator(0); while (li.hasNext()) { - PolicyParser.PrincipalEntry listPppe = li.next(); + PrincipalEntry listPppe = li.next(); - if (pppe.principalClass.equals - (PolicyParser.PrincipalEntry.WILDCARD_CLASS) || - pppe.principalClass.equals - (listPppe.principalClass)) { - - if (pppe.principalName.equals - (PolicyParser.PrincipalEntry.WILDCARD_NAME) || - pppe.principalName.equals - (listPppe.principalName)) + if (pppe.getPrincipalClass().equals + (PrincipalEntry.WILDCARD_CLASS) || + pppe.getPrincipalClass().equals(listPppe.getPrincipalClass())) + { + if (pppe.getPrincipalName().equals + (PrincipalEntry.WILDCARD_NAME) || + pppe.getPrincipalName().equals(listPppe.getPrincipalName())) return true; } } @@ -390,13 +385,12 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable { } } if (principals != null) { - ListIterator li = - principals.listIterator(); + ListIterator li = principals.listIterator(); while (li.hasNext()) { - PolicyParser.PrincipalEntry pppe = li.next(); + PrincipalEntry pppe = li.next(); returnMe = returnMe + rb.getString("NEWLINE") + - pppe.principalClass + " " + - pppe.principalName; + pppe.getPrincipalClass() + " " + + pppe.getPrincipalName(); } } return returnMe; diff --git a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties index 35d23564492..66f334e6c40 100644 --- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties +++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties @@ -1,45 +1,45 @@ -# This properties file is used to create a PropertyResourceBundle -# It contains Locale specific strings used be the Synth Look and Feel. -# Currently, the following components need this for support: -# -# FileChooser -# -# When this file is read in, the strings are put into the -# defaults table. This is an implementation detail of the current -# workings of Swing. DO NOT DEPEND ON THIS. -# This may change in future versions of Swing as we improve localization -# support. -# -# Refer to the note in basic.properties for a description as to what -# the mnemonics correspond to and how to calculate them. -# -# @author Steve Wilson - - -############ FILE CHOOSER STRINGS ############# - -FileChooser.lookInLabel.textAndMnemonic=Look &In: -FileChooser.saveInLabel.textAndMnemonic=Save In: -FileChooser.fileNameLabel.textAndMnemonic=File &Name: -FileChooser.folderNameLabel.textAndMnemonic=Folder &Name: -FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &Type: -FileChooser.upFolderToolTip.textAndMnemonic=Up One Level -FileChooser.upFolderAccessibleName=Up -FileChooser.homeFolderToolTip.textAndMnemonic=Home -FileChooser.homeFolderAccessibleName=Home -FileChooser.newFolderToolTip.textAndMnemonic=Create New Folder -FileChooser.newFolderAccessibleName=New Folder -FileChooser.newFolderActionLabel.textAndMnemonic=New Folder -FileChooser.listViewButtonToolTip.textAndMnemonic=List -FileChooser.listViewButtonAccessibleName=List -FileChooser.listViewActionLabel.textAndMnemonic=List -FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details -FileChooser.detailsViewButtonAccessibleName=Details -FileChooser.detailsViewActionLabel.textAndMnemonic=Details -FileChooser.refreshActionLabel.textAndMnemonic=Refresh -FileChooser.viewMenuLabel.textAndMnemonic=View -FileChooser.fileNameHeader.textAndMnemonic=Name -FileChooser.fileSizeHeader.textAndMnemonic=Size -FileChooser.fileTypeHeader.textAndMnemonic=Type -FileChooser.fileDateHeader.textAndMnemonic=Modified -FileChooser.fileAttrHeader.textAndMnemonic=Attributes +# This properties file is used to create a PropertyResourceBundle +# It contains Locale specific strings used be the Synth Look and Feel. +# Currently, the following components need this for support: +# +# FileChooser +# +# When this file is read in, the strings are put into the +# defaults table. This is an implementation detail of the current +# workings of Swing. DO NOT DEPEND ON THIS. +# This may change in future versions of Swing as we improve localization +# support. +# +# Refer to the note in basic.properties for a description as to what +# the mnemonics correspond to and how to calculate them. +# +# @author Steve Wilson + + +############ FILE CHOOSER STRINGS ############# + +FileChooser.lookInLabel.textAndMnemonic=Look &In: +FileChooser.saveInLabel.textAndMnemonic=Save In: +FileChooser.fileNameLabel.textAndMnemonic=File &Name: +FileChooser.folderNameLabel.textAndMnemonic=Folder &Name: +FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &Type: +FileChooser.upFolderToolTip.textAndMnemonic=Up One Level +FileChooser.upFolderAccessibleName=Up +FileChooser.homeFolderToolTip.textAndMnemonic=Home +FileChooser.homeFolderAccessibleName=Home +FileChooser.newFolderToolTip.textAndMnemonic=Create New Folder +FileChooser.newFolderAccessibleName=New Folder +FileChooser.newFolderActionLabel.textAndMnemonic=New Folder +FileChooser.listViewButtonToolTip.textAndMnemonic=List +FileChooser.listViewButtonAccessibleName=List +FileChooser.listViewActionLabel.textAndMnemonic=List +FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details +FileChooser.detailsViewButtonAccessibleName=Details +FileChooser.detailsViewActionLabel.textAndMnemonic=Details +FileChooser.refreshActionLabel.textAndMnemonic=Refresh +FileChooser.viewMenuLabel.textAndMnemonic=View +FileChooser.fileNameHeader.textAndMnemonic=Name +FileChooser.fileSizeHeader.textAndMnemonic=Size +FileChooser.fileTypeHeader.textAndMnemonic=Type +FileChooser.fileDateHeader.textAndMnemonic=Modified +FileChooser.fileAttrHeader.textAndMnemonic=Attributes diff --git a/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js b/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js index 468d25ae172..f2c92ab4b0d 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js +++ b/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js @@ -151,7 +151,7 @@ function JavaClassProto() { while (tmp != null) { res[res.length] = tmp; tmp = tmp.superclass; - } + } return res; } @@ -263,16 +263,19 @@ function wrapJavaObject(thing) { if (name == 'class') { return wrapJavaValue(instance.clazz); - } else if (name == 'toString') { - return function() { - return instance.toString(); - } } else if (name == 'wrapped-object') { return instance; } return undefined; - } + }, + __call__: function(name) { + if (name == 'toString') { + return instance.toString(); + } else { + return undefined; + } + } } } @@ -297,7 +300,7 @@ function wrapJavaObject(thing) { return true; } } - return theJavaClassProto[name] != undefined; + return false; }, __get__ : function(name) { for (var i in fields) { @@ -305,7 +308,7 @@ function wrapJavaObject(thing) { return wrapJavaValue(fields[i].value); } } - return theJavaClassProto[name]; + return undefined; } } @@ -322,7 +325,12 @@ function wrapJavaObject(thing) { this.name = jclass.name; this.fields = jclass.fields; this['wrapped-object'] = jclass; - this.__proto__ = this.statics; + } + + for (var i in theJavaClassProto) { + if (typeof theJavaClassProto[i] == 'function') { + JavaClassWrapper.prototype[i] = theJavaClassProto[i]; + } } // returns wrapper for Java object arrays @@ -334,32 +342,35 @@ function wrapJavaObject(thing) { __getIds__ : function() { var res = new Array(elements.length); for (var i = 0; i < elements.length; i++) { - res[i] = i; + res[i] = String(i); } return res; }, __has__: function(name) { - return (typeof(name) == 'number' && - name >= 0 && name < elements.length) || + return (name >= 0 && name < elements.length) || name == 'length' || name == 'class' || name == 'toString' || name == 'wrapped-object'; }, __get__ : function(name) { - if (typeof(name) == 'number' && - name >= 0 && name < elements.length) { + if (name >= 0 && name < elements.length) { return wrapJavaValue(elements[name]); } else if (name == 'length') { return elements.length; } else if (name == 'class') { return wrapJavaValue(array.clazz); - } else if (name == 'toString') { - return function() { return array.toString(); } } else if (name == 'wrapped-object') { return array; } else { return undefined; } - } + }, + __call__: function(name) { + if (name == 'toString') { + return array.toString(); + } else { + return undefined; + } + } } } @@ -373,26 +384,22 @@ function wrapJavaObject(thing) { __getIds__ : function() { var r = new Array(array.length); for (var i = 0; i < array.length; i++) { - r[i] = i; + r[i] = String(i); } return r; }, __has__: function(name) { - return (typeof(name) == 'number' && - name >= 0 && name < array.length) || + return (name >= 0 && name < array.length) || name == 'length' || name == 'class' || name == 'toString' || name == 'wrapped-object'; }, __get__: function(name) { - if (typeof(name) == 'number' && - name >= 0 && name < array.length) { + if (name >= 0 && name < array.length) { return elements[name]; } if (name == 'length') { return array.length; - } else if (name == 'toString') { - return function() { return array.valueString(true); } } else if (name == 'wrapped-object') { return array; } else if (name == 'class') { @@ -400,7 +407,14 @@ function wrapJavaObject(thing) { } else { return undefined; } - } + }, + __call__: function(name) { + if (name == 'toString') { + return array.valueString(true); + } else { + return undefined; + } + } } } return javaObject(thing); @@ -673,34 +687,33 @@ function wrapHeapSnapshot(heap) { __getIds__ : function() { var res = new Array(path.length); for (var i = 0; i < path.length; i++) { - res[i] = i; + res[i] = String(i); } return res; }, __has__ : function (name) { - return (typeof(name) == 'number' && - name >= 0 && name < path.length) || + return (name >= 0 && name < path.length) || name == 'length' || name == 'toHtml' || name == 'toString'; }, __get__ : function(name) { - if (typeof(name) == 'number' && - name >= 0 && name < path.length) { + if (name >= 0 && name < path.length) { return path[name]; } else if (name == 'length') { return path.length; - } else if (name == 'toHtml') { - return function() { - return computeDescription(true); - } - } else if (name == 'toString') { - return function() { - return computeDescription(false); - } } else { return undefined; } }, + __call__: function(name) { + if (name == 'toHtml') { + return computeDescription(true); + } else if (name == 'toString') { + return computeDescription(false); + } else { + return undefined; + } + } }; } @@ -1005,22 +1018,8 @@ function toHtml(obj) { return "" + name + "@" + id + ""; } - } else if ((typeof(obj) == 'object') || (obj instanceof JSAdapter)) { - if (obj instanceof java.lang.Object) { - // script wrapped Java object - obj = wrapIterator(obj); - // special case for enumeration - if (obj instanceof java.util.Enumeration) { - var res = "[ "; - while (obj.hasMoreElements()) { - res += toHtml(obj.nextElement()) + ", "; - } - res += "]"; - return res; - } else { - return obj; - } - } else if (obj instanceof Array) { + } else if (obj instanceof Object) { + if (Array.isArray(obj)) { // script array var res = "[ "; for (var i in obj) { @@ -1047,8 +1046,19 @@ function toHtml(obj) { } } } else { - // JavaScript primitive value - return obj; + // a Java object + obj = wrapIterator(obj); + // special case for enumeration + if (obj instanceof java.util.Enumeration) { + var res = "[ "; + while (obj.hasMoreElements()) { + res += toHtml(obj.nextElement()) + ", "; + } + res += "]"; + return res; + } else { + return obj; + } } } diff --git a/jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html b/jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html index 3937f4a1c39..d660fd3cae8 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html +++ b/jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html @@ -79,7 +79,7 @@ bound to a JavaScript variable of the identifier name specified in select s.value.toString() from java.lang.String s - where /java/(s.value.toString()) + where /java/.test(s.value.toString())

  • show path value of all File objects @@ -219,7 +219,6 @@ Examples:
     
         select heap.findClass("java.lang.System").statics.props
    -    select heap.findClass("java.lang.System").props
     
     
  • get number of fields of java.lang.String class @@ -237,7 +236,7 @@ Examples:
  • select all classes that have name pattern java.net.*
     
    -    select filter(heap.classes(), "/java.net./(it.name)")
    +    select filter(heap.classes(), "/java.net./.test(it.name)")
     
     
    @@ -536,7 +535,7 @@ refer to the following built-in variables. Example: print number of classes that have specific name pattern
     
    -    select count(heap.classes(), "/java.io./(it.name)")
    +    select count(heap.classes(), "/java.io./.test(it.name)")
     
     
    @@ -559,14 +558,14 @@ Examples:
  • show all classes that have java.io.* name pattern
     
    -    select filter(heap.classes(), "/java.io./(it.name)")
    +    select filter(heap.classes(), "/java.io./.test(it.name)")
     
     
  • show all referrers of URL object where the referrer is not from java.net package
     
    -    select filter(referrers(u), "! /java.net./(classof(it).name)")
    +    select filter(referrers(u), "! /java.net./.test(classof(it).name)")
         from java.net.URL u
     
     
    @@ -619,13 +618,13 @@ Examples:
  • find the maximum length of any String instance
     
    -    select max(map(heap.objects('java.lang.String', false), 'it.count'))
    +    select max(map(heap.objects('java.lang.String', false), 'it.value.length'))
     
     
  • find string instance that has the maximum length
     
    -    select max(heap.objects('java.lang.String'), 'lhs.count > rhs.count')
    +    select max(heap.objects('java.lang.String'), 'lhs.value.length > rhs.value.length')
     
     
    @@ -775,7 +774,7 @@ and walk until parent is null using the callback function to map call.
     
    -   select map(filter(heap.findClass('java.lang.System').props.table, 'it != null'), 
    +   select map(filter(heap.findClass('java.lang.System').statics.props.table, 'it != null'), 
                 function (it) {
                     var res = "";
                     while (it != null) {
    diff --git a/jdk/src/share/classes/com/sun/tools/script/shell/init.js b/jdk/src/share/classes/com/sun/tools/script/shell/init.js
    index 5f294b4684f..ae2cdc42d95 100644
    --- a/jdk/src/share/classes/com/sun/tools/script/shell/init.js
    +++ b/jdk/src/share/classes/com/sun/tools/script/shell/init.js
    @@ -332,7 +332,7 @@ function streamClose(stream) {
      * @param str input from which script is loaded and evaluated
      */
     if (typeof(load) == 'undefined') {
    -    var load = function(str) {
    +    this.load = function(str) {
             var stream = inStream(str);
             var bstream = new BufferedInputStream(stream);
             var reader = new BufferedReader(new InputStreamReader(bstream));
    @@ -712,7 +712,7 @@ if (typeof(exit) == 'undefined') {
          * @param exitCode integer code returned to OS shell.
          * optional, defaults to 0
          */
    -    var exit = function (code) {
    +    this.exit = function (code) {
             if (code) {
                 java.lang.System.exit(code + 0);
             } else {
    @@ -725,7 +725,7 @@ if (typeof(quit) == 'undefined') {
         /**
          * synonym for exit
          */
    -    var quit = function (code) {
    +    this.quit = function (code) {
             exit(code);
         }
     }
    @@ -881,7 +881,7 @@ if (typeof(printf) == 'undefined') {
          * @param format string to format the rest of the print items
          * @param args variadic argument list
          */
    -    var printf = function (format, args/*, more args*/) {  
    +    this.printf = function (format, args/*, more args*/) {  
             var array = java.lang.reflect.Array.newInstance(java.lang.Object, 
                         arguments.length - 1);
             for (var i = 0; i < array.length; i++) {
    @@ -921,25 +921,7 @@ function read(prompt, multiline) {
     }
     
     if (typeof(println) == 'undefined') {
    -    var print = function(str, newline) {
    -        if (typeof(str) == 'undefined') {
    -            str = 'undefined';
    -        } else if (str == null) {
    -            str = 'null';
    -        }
    -
    -        if (!(out instanceof java.io.PrintWriter)) {
    -            out = new java.io.PrintWriter(out);
    -        }
    -
    -        out.print(String(str));
    -        if (newline) {
    -            out.print('\n');
    -        }
    -        out.flush();
    -    }
    -
    -    var println = function(str) {
    -        print(str, true);
    -    };
    +    // just synonym to print
    +    this.println = print;
     }
    +
    diff --git a/jdk/src/share/classes/java/applet/AppletContext.java b/jdk/src/share/classes/java/applet/AppletContext.java
    index 87623ee334f..f28308cfb11 100644
    --- a/jdk/src/share/classes/java/applet/AppletContext.java
    +++ b/jdk/src/share/classes/java/applet/AppletContext.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -56,7 +56,7 @@ public interface AppletContext {
     
         /**
          * Returns an Image object that can then be painted on
    -     * the screen. The url argument that is
    +     * the screen. The url argument that is
          * passed as an argument must specify an absolute URL.
          * 

    * This method always returns immediately, whether or not the image @@ -157,7 +157,7 @@ public interface AppletContext { * @param stream stream to be associated with the specified key. If this * parameter is null, the specified key is removed * in this applet context. - * @throws IOException if the stream size exceeds a certain + * @throws IOException if the stream size exceeds a certain * size limit. Size limit is decided by the implementor of this * interface. * @since 1.4 diff --git a/jdk/src/share/classes/java/awt/AWTException.java b/jdk/src/share/classes/java/awt/AWTException.java index a8c555c6c89..3c03635837f 100644 --- a/jdk/src/share/classes/java/awt/AWTException.java +++ b/jdk/src/share/classes/java/awt/AWTException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ package java.awt; /** - * Signals that an Absract Window Toolkit exception has occurred. + * Signals that an Abstract Window Toolkit exception has occurred. * * @author Arthur van Hoff */ diff --git a/jdk/src/share/classes/java/awt/event/ContainerListener.java b/jdk/src/share/classes/java/awt/event/ContainerListener.java index d5c444ff184..6fb8321589b 100644 --- a/jdk/src/share/classes/java/awt/event/ContainerListener.java +++ b/jdk/src/share/classes/java/awt/event/ContainerListener.java @@ -42,7 +42,7 @@ import java.util.EventListener; * Container events are provided for notification purposes ONLY; * The AWT will automatically handle add and remove operations * internally so the program works properly regardless of - * whether the program registers a ComponentListener or not. + * whether the program registers a {@code ContainerListener} or not. * * @see ContainerAdapter * @see ContainerEvent diff --git a/jdk/src/share/classes/java/awt/image/BufferStrategy.java b/jdk/src/share/classes/java/awt/image/BufferStrategy.java index 82ad5e07d97..de7877330b9 100644 --- a/jdk/src/share/classes/java/awt/image/BufferStrategy.java +++ b/jdk/src/share/classes/java/awt/image/BufferStrategy.java @@ -55,7 +55,7 @@ import java.awt.Image; * Alternatively, the contents of the back buffer can be copied, or * blitted forward in a chain instead of moving the video pointer. *

    - *

    + * 
    {@code
      * Double buffering:
      *
      *                    ***********         ***********
    @@ -72,7 +72,7 @@ import java.awt.Image;
      *          *         * <------ *         * <----- *         *
      *          ***********         ***********        ***********
      *
    - * 
    + * }
    *

    * Here is an example of how buffer strategies can be created and used: *

    
    diff --git a/jdk/src/share/classes/java/awt/image/BufferedImage.java b/jdk/src/share/classes/java/awt/image/BufferedImage.java
    index d510dcc1ba4..b4222b1e740 100644
    --- a/jdk/src/share/classes/java/awt/image/BufferedImage.java
    +++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java
    @@ -602,12 +602,12 @@ public class BufferedImage extends java.awt.Image
          *                  the raster has been premultiplied with alpha.
          * @param properties Hashtable of
          *                  String/Object pairs.
    -     * @exception RasterFormatException if the number and
    +     * @exception RasterFormatException if the number and
          * types of bands in the SampleModel of the
          * Raster do not match the number and types required by
          * the ColorModel to represent its color and alpha
          * components.
    -     * @exception IllegalArgumentException if
    +     * @exception IllegalArgumentException if
          *          raster is incompatible with cm
          * @see ColorModel
          * @see Raster
    @@ -927,7 +927,7 @@ public class BufferedImage extends java.awt.Image
          * each color component in the returned data when
          * using this method.  With a specified coordinate (x, y) in the
          * image, the ARGB pixel can be accessed in this way:
    -     * 

    + *

    * *

          *    pixel   = rgbArray[offset + (y-startY)*scansize + (x-startX)]; 
    @@ -1131,7 +1131,7 @@ public class BufferedImage extends java.awt.Image * @return an {@link Object} that is the property referred to by the * specified name or null if the * properties of this image are not yet known. - * @throws NullPointerException if the property name is null. + * @throws NullPointerException if the property name is null. * @see ImageObserver * @see java.awt.Image#UndefinedProperty */ @@ -1144,7 +1144,7 @@ public class BufferedImage extends java.awt.Image * @param name the property name * @return an Object that is the property referred to by * the specified name. - * @throws NullPointerException if the property name is null. + * @throws NullPointerException if the property name is null. */ public Object getProperty(String name) { if (name == null) { @@ -1196,7 +1196,7 @@ public class BufferedImage extends java.awt.Image * @param h the height of the specified rectangular region * @return a BufferedImage that is the subimage of this * BufferedImage. - * @exception RasterFormatException if the specified + * @exception RasterFormatException if the specified * area is not contained within this BufferedImage. */ public BufferedImage getSubimage (int x, int y, int w, int h) { @@ -1388,7 +1388,7 @@ public class BufferedImage extends java.awt.Image * @param tileY the y index of the requested tile in the tile array * @return a Raster that is the tile defined by the * arguments tileX and tileY. - * @exception ArrayIndexOutOfBoundsException if both + * @exception ArrayIndexOutOfBoundsException if both * tileX and tileY are not * equal to 0 */ @@ -1558,7 +1558,7 @@ public class BufferedImage extends java.awt.Image * @return true if the tile specified by the specified * indices is checked out for writing; false * otherwise. - * @exception ArrayIndexOutOfBoundsException if both + * @exception ArrayIndexOutOfBoundsException if both * tileX and tileY are not equal * to 0 */ diff --git a/jdk/src/share/classes/java/awt/image/ByteLookupTable.java b/jdk/src/share/classes/java/awt/image/ByteLookupTable.java index 6f7e67d7432..35968d62ac8 100644 --- a/jdk/src/share/classes/java/awt/image/ByteLookupTable.java +++ b/jdk/src/share/classes/java/awt/image/ByteLookupTable.java @@ -171,7 +171,7 @@ public class ByteLookupTable extends LookupTable { * @exception ArrayIndexOutOfBoundsException if src is * longer than dst or if for any element * i of src, - * (src[i]&0xff)-offset is either less than + * {@code (src[i]&0xff)-offset} is either less than * zero or greater than or equal to the length of the * lookup table for any band. */ diff --git a/jdk/src/share/classes/java/awt/image/ColorModel.java b/jdk/src/share/classes/java/awt/image/ColorModel.java index 5ce313e1bf3..73f5b49fc28 100644 --- a/jdk/src/share/classes/java/awt/image/ColorModel.java +++ b/jdk/src/share/classes/java/awt/image/ColorModel.java @@ -692,12 +692,12 @@ public abstract class ColorModel implements Transparency{ * DataBuffer.TYPE_INT. * @param inData an array of pixel values * @return the value of the green component of the specified pixel. - * @throws ClassCastException if inData + * @throws ClassCastException if inData * is not a primitive array of type transferType - * @throws ArrayIndexOutOfBoundsException if + * @throws ArrayIndexOutOfBoundsException if * inData is not large enough to hold a pixel value * for this ColorModel - * @throws UnsupportedOperationException if this + * @throws UnsupportedOperationException if this * tranferType is not supported by this * ColorModel */ diff --git a/jdk/src/share/classes/java/awt/image/DirectColorModel.java b/jdk/src/share/classes/java/awt/image/DirectColorModel.java index 751d780ba64..2ddd85c1ad1 100644 --- a/jdk/src/share/classes/java/awt/image/DirectColorModel.java +++ b/jdk/src/share/classes/java/awt/image/DirectColorModel.java @@ -642,12 +642,12 @@ public class DirectColorModel extends PackedColorModel { * @param inData the specified pixel * @return the alpha component of the specified pixel, scaled from * 0 to 255. - * @exception ClassCastException if inData + * @exception ClassCastException if inData * is not a primitive array of type transferType - * @exception ArrayIndexOutOfBoundsException if + * @exception ArrayIndexOutOfBoundsException if * inData is not large enough to hold a pixel value * for this ColorModel - * @exception UnsupportedOperationException if this + * @exception UnsupportedOperationException if this * tranferType is not supported by this * ColorModel */ @@ -1055,7 +1055,7 @@ public class DirectColorModel extends PackedColorModel { * begin retrieving the color and alpha components * @return an int pixel value in this * ColorModel corresponding to the specified components. - * @exception ArrayIndexOutOfBoundsException if + * @exception ArrayIndexOutOfBoundsException if * the components array is not large enough to * hold all of the color and alpha components starting at * offset @@ -1097,9 +1097,9 @@ public class DirectColorModel extends PackedColorModel { * and alpha components * @return an Object representing an array of color and * alpha components. - * @exception ClassCastException if obj + * @exception ClassCastException if obj * is not a primitive array of type transferType - * @exception ArrayIndexOutOfBoundsException if + * @exception ArrayIndexOutOfBoundsException if * obj is not large enough to hold a pixel value * for this ColorModel or the components * array is not large enough to hold all of the color and alpha diff --git a/jdk/src/share/classes/java/awt/image/ImageProducer.java b/jdk/src/share/classes/java/awt/image/ImageProducer.java index 768aad50dd9..a419f8bd644 100644 --- a/jdk/src/share/classes/java/awt/image/ImageProducer.java +++ b/jdk/src/share/classes/java/awt/image/ImageProducer.java @@ -100,11 +100,11 @@ public interface ImageProducer { * ImageProducer should respond by executing * the following minimum set of ImageConsumer * method calls: - *
    +     * 
    {@code
          *  ic.setHints(TOPDOWNLEFTRIGHT | < otherhints >);
          *  ic.setPixels(...);      // As many times as needed
          *  ic.imageComplete();
    -     * 
    + * }
    * @param ic the specified ImageConsumer * @see ImageConsumer#setHints */ diff --git a/jdk/src/share/classes/java/awt/image/IndexColorModel.java b/jdk/src/share/classes/java/awt/image/IndexColorModel.java index fabe8d20432..d26e3d381be 100644 --- a/jdk/src/share/classes/java/awt/image/IndexColorModel.java +++ b/jdk/src/share/classes/java/awt/image/IndexColorModel.java @@ -98,6 +98,7 @@ import java.math.BigInteger; * Index values greater than or equal to the map size, but less than * 2n, are undefined and return 0 for all color and * alpha components. + * *

    * For those methods that use a primitive array pixel representation of * type transferType, the array length is always one. diff --git a/jdk/src/share/classes/java/awt/image/MemoryImageSource.java b/jdk/src/share/classes/java/awt/image/MemoryImageSource.java index b5fd99b475f..90519ce26e4 100644 --- a/jdk/src/share/classes/java/awt/image/MemoryImageSource.java +++ b/jdk/src/share/classes/java/awt/image/MemoryImageSource.java @@ -37,7 +37,7 @@ import java.util.Enumeration; * uses an array to produce pixel values for an Image. Here is an example * which calculates a 100x100 image representing a fade from black to blue * along the X axis and a fade from black to red along the Y axis: - *

    + * 
    {@code
      *
      *      int w = 100;
      *      int h = 100;
    @@ -52,12 +52,12 @@ import java.util.Enumeration;
      *      }
      *      Image img = createImage(new MemoryImageSource(w, h, pix, 0, w));
      *
    - * 
    + * }
    * The MemoryImageSource is also capable of managing a memory image which * varies over time to allow animation or custom rendering. Here is an * example showing how to set up the animation source and signal changes * in the data (adapted from the MemoryAnimationSourceDemo by Garth Dickie): - *
    + * 
    {@code
      *
      *      int pixels[];
      *      MemoryImageSource source;
    @@ -96,7 +96,7 @@ import java.util.Enumeration;
      *          }
      *      }
      *
    - * 
    + * }
    * * @see ImageProducer * diff --git a/jdk/src/share/classes/java/awt/image/MultiPixelPackedSampleModel.java b/jdk/src/share/classes/java/awt/image/MultiPixelPackedSampleModel.java index 43d3a8080ba..8095dad2fc5 100644 --- a/jdk/src/share/classes/java/awt/image/MultiPixelPackedSampleModel.java +++ b/jdk/src/share/classes/java/awt/image/MultiPixelPackedSampleModel.java @@ -52,14 +52,14 @@ package java.awt.image; * x, y from DataBuffer data * and storing the pixel data in data elements of type * dataType: - *
    + * 
    {@code
      *      int dataElementSize = DataBuffer.getDataTypeSize(dataType);
      *      int bitnum = dataBitOffset + x*pixelBitStride;
      *      int element = data.getElem(y*scanlineStride + bitnum/dataElementSize);
      *      int shift = dataElementSize - (bitnum & (dataElementSize-1))
      *                  - pixelBitStride;
      *      int pixel = (element >> shift) & ((1 << pixelBitStride) - 1);
    - * 
    + * }
    */ public class MultiPixelPackedSampleModel extends SampleModel diff --git a/jdk/src/share/classes/java/awt/image/PixelGrabber.java b/jdk/src/share/classes/java/awt/image/PixelGrabber.java index 85dde7875ce..2053ed71bdc 100644 --- a/jdk/src/share/classes/java/awt/image/PixelGrabber.java +++ b/jdk/src/share/classes/java/awt/image/PixelGrabber.java @@ -35,7 +35,7 @@ import java.awt.Image; * The PixelGrabber class implements an ImageConsumer which can be attached * to an Image or ImageProducer object to retrieve a subset of the pixels * in that image. Here is an example: - *
    + * 
    {@code
      *
      * public void handlesinglepixel(int x, int y, int pixel) {
      *      int alpha = (pixel >> 24) & 0xff;
    @@ -65,7 +65,7 @@ import java.awt.Image;
      *      }
      * }
      *
    - * 
    + * }
    * * @see ColorModel#getRGBdefault * @@ -165,8 +165,8 @@ public class PixelGrabber implements ImageConsumer { * accumulated in the default RGB ColorModel. If the forceRGB * parameter is true, then the pixels will be accumulated in the * default RGB ColorModel anyway. A buffer is allocated by the - * PixelGrabber to hold the pixels in either case. If (w < 0) or - * (h < 0), then they will default to the remaining width and + * PixelGrabber to hold the pixels in either case. If {@code (w < 0)} or + * {@code (h < 0)}, then they will default to the remaining width and * height of the source data when that information is delivered. * @param img the image to retrieve the image data from * @param x the x coordinate of the upper left corner of the rectangle @@ -233,10 +233,10 @@ public class PixelGrabber implements ImageConsumer { * behaves in the following ways, depending on the value of * ms: *
      - *
    • If ms == 0, waits until all pixels are delivered - *
    • If ms > 0, waits until all pixels are delivered + *
    • If {@code ms == 0}, waits until all pixels are delivered + *
    • If {@code ms > 0}, waits until all pixels are delivered * as timeout expires. - *
    • If ms < 0, returns true if all pixels + *
    • If {@code ms < 0}, returns true if all pixels * are grabbed, false otherwise and does not wait. *
    * @param ms the number of milliseconds to wait for the image pixels diff --git a/jdk/src/share/classes/java/awt/image/RGBImageFilter.java b/jdk/src/share/classes/java/awt/image/RGBImageFilter.java index 59d77e3428d..2f807ddf50f 100644 --- a/jdk/src/share/classes/java/awt/image/RGBImageFilter.java +++ b/jdk/src/share/classes/java/awt/image/RGBImageFilter.java @@ -39,7 +39,7 @@ import java.awt.image.ColorModel; * The only method which needs to be defined to create a useable image * filter is the filterRGB method. Here is an example of a definition * of a filter which swaps the red and blue components of an image: - *
    + * 
    {@code
      *
      *      class RedBlueSwapFilter extends RGBImageFilter {
      *          public RedBlueSwapFilter() {
    @@ -56,7 +56,7 @@ import java.awt.image.ColorModel;
      *          }
      *      }
      *
    - * 
    + * }
    * * @see FilteredImageSource * @see ImageFilter diff --git a/jdk/src/share/classes/java/awt/image/ShortLookupTable.java b/jdk/src/share/classes/java/awt/image/ShortLookupTable.java index 09309e0045e..f0c18e0878e 100644 --- a/jdk/src/share/classes/java/awt/image/ShortLookupTable.java +++ b/jdk/src/share/classes/java/awt/image/ShortLookupTable.java @@ -114,7 +114,7 @@ public class ShortLookupTable extends LookupTable { * @exception ArrayIndexOutOfBoundsException if src is * longer than dst or if for any element * i of src, - * (src[i]&0xffff)-offset is either less than + * {@code (src[i]&0xffff)-offset} is either less than * zero or greater than or equal to the length of the * lookup table for any band. */ @@ -165,7 +165,7 @@ public class ShortLookupTable extends LookupTable { * @exception ArrayIndexOutOfBoundsException if src is * longer than dst or if for any element * i of src, - * (src[i]&0xffff)-offset is either less than + * {@code (src[i]&0xffff)-offset} is either less than * zero or greater than or equal to the length of the * lookup table for any band. */ diff --git a/jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java b/jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java index b99eda6c79e..58c1db0b726 100644 --- a/jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java +++ b/jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java @@ -57,10 +57,10 @@ import java.util.Arrays; * The following code illustrates extracting the bits of the sample * representing band b for pixel x,y * from DataBuffer data: - *
    + * 
    {@code
      *      int sample = data.getElem(y * scanlineStride + x);
      *      sample = (sample & bitMasks[b]) >>> bitOffsets[b];
    - * 
    + * }
    */ public class SinglePixelPackedSampleModel extends SampleModel diff --git a/jdk/src/share/classes/java/awt/image/WritableRaster.java b/jdk/src/share/classes/java/awt/image/WritableRaster.java index d38d7af3f60..190596af0a2 100644 --- a/jdk/src/share/classes/java/awt/image/WritableRaster.java +++ b/jdk/src/share/classes/java/awt/image/WritableRaster.java @@ -372,13 +372,13 @@ public class WritableRaster extends Raster { * integral type and less than or equal to 32 bits in size, then calling * this method is equivalent to executing the following code for all * x,y addresses valid in both Rasters. - *
    +     * 
    {@code
          *       Raster srcRaster;
          *       WritableRaster dstRaster;
          *       for (int b = 0; b < srcRaster.getNumBands(); b++) {
          *           dstRaster.setSample(x, y, b, srcRaster.getSample(x, y, b));
          *       }
    -     * 
    + * }
    * Thus, when copying an integral type source to an integral type * destination, if the source sample size is greater than the destination * sample size for a particular band, the high order bits of the source diff --git a/jdk/src/share/classes/java/beans/AppletInitializer.java b/jdk/src/share/classes/java/beans/AppletInitializer.java index 9e4b7239d61..2c271a236ca 100644 --- a/jdk/src/share/classes/java/beans/AppletInitializer.java +++ b/jdk/src/share/classes/java/beans/AppletInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,7 +68,6 @@ public interface AppletInitializer { * the Applet with its Container during the subsequent invocation of its * addChildren() method. * - *

    * * @param newAppletBean The newly instantiated JavaBean * @param bCtxt The BeanContext intended for this Applet, or diff --git a/jdk/src/share/classes/java/beans/Beans.java b/jdk/src/share/classes/java/beans/Beans.java index 2183d224167..58a411691fd 100644 --- a/jdk/src/share/classes/java/beans/Beans.java +++ b/jdk/src/share/classes/java/beans/Beans.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ public class Beans { *

    * Instantiate a JavaBean. *

    - * + * @return a JavaBean * @param cls the class-loader from which we should create * the bean. If this is null, then the system * class-loader is used. @@ -82,6 +82,7 @@ public class Beans { *

    * Instantiate a JavaBean. *

    + * @return a JavaBean * * @param cls the class-loader from which we should create * the bean. If this is null, then the system @@ -137,6 +138,7 @@ public class Beans { * the JDK appletviewer (for a reference browser environment) and the * BDK BeanBox (for a reference bean container). * + * @return a JavaBean * @param cls the class-loader from which we should create * the bean. If this is null, then the system * class-loader is used. @@ -361,6 +363,8 @@ public class Beans { * This method is provided in Beans 1.0 as a hook to allow the * addition of more flexible bean behaviour in the future. * + * @return an object representing a specified type view of the + * source object * @param bean Object from which we want to obtain a view. * @param targetType The type of view we'd like to get. * @@ -384,7 +388,6 @@ public class Beans { return Introspector.isSubclass(bean.getClass(), targetType); } - /** * Test if we are in design-mode. * diff --git a/jdk/src/share/classes/java/beans/ConstructorProperties.java b/jdk/src/share/classes/java/beans/ConstructorProperties.java index 3166de31747..5ee947c1f1c 100644 --- a/jdk/src/share/classes/java/beans/ConstructorProperties.java +++ b/jdk/src/share/classes/java/beans/ConstructorProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ import static java.lang.annotation.RetentionPolicy.*; the {@code getY()} method. Since parameter names are not in general available at runtime, without the annotation there would be no way to know whether the parameters correspond to {@code getX()} - and {@code getY()} or the other way around.

    + and {@code getY()} or the other way around. @since 1.6 */ diff --git a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java index 3c6c7c2a3d3..de6a1b75178 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -382,6 +382,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { * a class such that no property value depends on the value of * a subsequent property. * + * @param type the type of the instances * @param oldInstance The instance to be copied. * @param newInstance The instance that is to be modified. * @param out The stream to which any initialization statements should be written. diff --git a/jdk/src/share/classes/java/beans/EventHandler.java b/jdk/src/share/classes/java/beans/EventHandler.java index b7635c931b7..b428f2892a1 100644 --- a/jdk/src/share/classes/java/beans/EventHandler.java +++ b/jdk/src/share/classes/java/beans/EventHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -515,6 +515,7 @@ public class EventHandler implements InvocationHandler { *
    * * + * @param the type to create * @param listenerInterface the listener interface to create a proxy for * @param target the object that will perform the action * @param action the name of a (possibly qualified) property or method on @@ -570,6 +571,7 @@ public class EventHandler implements InvocationHandler { *
    * * + * @param the type to create * @param listenerInterface the listener interface to create a proxy for * @param target the object that will perform the action * @param action the name of a (possibly qualified) property or method on @@ -659,6 +661,7 @@ public class EventHandler implements InvocationHandler { * * * + * @param the type to create * @param listenerInterface the listener interface to create a proxy for * @param target the object that will perform the action * @param action the name of a (possibly qualified) property or method on diff --git a/jdk/src/share/classes/java/beans/Expression.java b/jdk/src/share/classes/java/beans/Expression.java index f7a15c3464a..ce6fafb104e 100644 --- a/jdk/src/share/classes/java/beans/Expression.java +++ b/jdk/src/share/classes/java/beans/Expression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,7 +139,7 @@ public class Expression extends Statement { * replaces this default value in the same way that any other value * would, ensuring that expressions are never evaluated more than once. *

    - * See the excecute method for details on how + * See the execute method for details on how * methods are chosen using the dynamic types of the target * and arguments. * @@ -147,6 +147,8 @@ public class Expression extends Statement { * @see #setValue * * @return The result of applying this method to these arguments. + * @throws Exception if the method with the specified methodName + * throws an exception */ public Object getValue() throws Exception { if (value == unbound) { diff --git a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java index d3f16d2901e..1d59f7afddb 100644 --- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java +++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java @@ -207,6 +207,8 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { * Sets the method that should be used to read an indexed property value. * * @param readMethod The new indexed read method. + * @throws IntrospectionException if an exception occurs during + * introspection. */ public synchronized void setIndexedReadMethod(Method readMethod) throws IntrospectionException { @@ -285,6 +287,8 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { * Sets the method that should be used to write an indexed property value. * * @param writeMethod The new indexed write method. + * @throws IntrospectionException if an exception occurs during + * introspection. */ public synchronized void setIndexedWriteMethod(Method writeMethod) throws IntrospectionException { diff --git a/jdk/src/share/classes/java/beans/Introspector.java b/jdk/src/share/classes/java/beans/Introspector.java index 783fcbef315..acc0f77f389 100644 --- a/jdk/src/share/classes/java/beans/Introspector.java +++ b/jdk/src/share/classes/java/beans/Introspector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,8 +93,17 @@ import sun.reflect.misc.ReflectUtil; public class Introspector { // Flags that can be used to control getBeanInfo: + /** + * Flag to indicate to use of all beaninfo. + */ public final static int USE_ALL_BEANINFO = 1; + /** + * Flag to indicate to ignore immediate beaninfo. + */ public final static int IGNORE_IMMEDIATE_BEANINFO = 2; + /** + * Flag to indicate to ignore all beaninfo. + */ public final static int IGNORE_ALL_BEANINFO = 3; // Static Caches to speed up introspection. @@ -202,7 +211,7 @@ public class Introspector { * If the BeanInfo class for a Java Bean has been previously Introspected * based on the same arguments, then the BeanInfo class is retrieved * from the BeanInfo cache. - * + * @return the BeanInfo for the bean * @param beanClass The bean class to be analyzed. * @param stopClass The baseclass at which to stop the analysis. Any * methods/properties/events in the stopClass or in its baseclasses diff --git a/jdk/src/share/classes/java/beans/PersistenceDelegate.java b/jdk/src/share/classes/java/beans/PersistenceDelegate.java index 01c5bb12387..bbdcdbf060c 100644 --- a/jdk/src/share/classes/java/beans/PersistenceDelegate.java +++ b/jdk/src/share/classes/java/beans/PersistenceDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -197,6 +197,7 @@ public abstract class PersistenceDelegate { * The default implementation, calls the initialize * method of the type's superclass. * + * @param type the type of the instances * @param oldInstance The instance to be copied. * @param newInstance The instance that is to be modified. * @param out The stream to which any initialization statements should be written. diff --git a/jdk/src/share/classes/java/beans/PropertyChangeSupport.java b/jdk/src/share/classes/java/beans/PropertyChangeSupport.java index c3c73179b1a..d55ae76efc8 100644 --- a/jdk/src/share/classes/java/beans/PropertyChangeSupport.java +++ b/jdk/src/share/classes/java/beans/PropertyChangeSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -156,7 +156,7 @@ public class PropertyChangeSupport implements Serializable { * PropertyChangeListenerProxy, perform the cast, and examine * the parameter. * - *

    +     * 
    {@code
          * PropertyChangeListener[] listeners = bean.getPropertyChangeListeners();
          * for (int i = 0; i < listeners.length; i++) {
          *   if (listeners[i] instanceof PropertyChangeListenerProxy) {
    @@ -168,7 +168,7 @@ public class PropertyChangeSupport implements Serializable {
          *     }
          *   }
          * }
    -     *
    + * }
    * * @see PropertyChangeListenerProxy * @return all of the PropertyChangeListeners added or an diff --git a/jdk/src/share/classes/java/beans/PropertyDescriptor.java b/jdk/src/share/classes/java/beans/PropertyDescriptor.java index 0abdcad972b..c519b504d58 100644 --- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java +++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java @@ -243,6 +243,7 @@ public class PropertyDescriptor extends FeatureDescriptor { * Sets the method that should be used to read the property value. * * @param readMethod The new read method. + * @throws IntrospectionException if the read method is invalid */ public synchronized void setReadMethod(Method readMethod) throws IntrospectionException { @@ -313,6 +314,7 @@ public class PropertyDescriptor extends FeatureDescriptor { * Sets the method that should be used to write the property value. * * @param writeMethod The new write method. + * @throws IntrospectionException if the write method is invalid */ public synchronized void setWriteMethod(Method writeMethod) throws IntrospectionException { diff --git a/jdk/src/share/classes/java/beans/Transient.java b/jdk/src/share/classes/java/beans/Transient.java index 0a2761ce8b9..165621b39fd 100644 --- a/jdk/src/share/classes/java/beans/Transient.java +++ b/jdk/src/share/classes/java/beans/Transient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * A {@code true} value for the "transient" attribute * indicates to encoders derived from {@link Encoder} * that this feature should be ignored. - *

    + *

    * The {@code Transient} annotation may be be used * in any of the methods that are involved * in a {@link FeatureDescriptor} subclass @@ -49,7 +49,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * to put the annotation and it is this declaration * that takes precedence in the case of multiple annotations * being defined for the same feature. - *

    + *

    * To declare a feature non-transient in a class * whose superclass declares it transient, * use {@code @Transient(false)}. @@ -64,5 +64,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target({METHOD}) @Retention(RUNTIME) public @interface Transient { + /** + * Returns whether or not the {@code Introspector} should + * construct artifacts for the annotated method. + * @return whether or not the {@code Introspector} should + * construct artifacts for the annotated method + */ boolean value() default true; } diff --git a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java index 6b7e268eba7..293ae5af2c6 100644 --- a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java +++ b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import java.util.Map.Entry; *

    * Here is an example of {@code VetoableChangeSupport} usage that follows * the rules and recommendations laid out in the JavaBeans™ specification: - *

    + * 
    {@code
      * public class MyBean {
      *     private final VetoableChangeSupport vcs = new VetoableChangeSupport(this);
      *
    @@ -68,7 +68,7 @@ import java.util.Map.Entry;
      *
      *     [...]
      * }
    - * 
    + * }
    *

    * A {@code VetoableChangeSupport} instance is thread-safe. *

    @@ -156,7 +156,7 @@ public class VetoableChangeSupport implements Serializable { * VetoableChangeListenerProxy, perform the cast, and examine * the parameter. * - *

    +     * 
    {@code
          * VetoableChangeListener[] listeners = bean.getVetoableChangeListeners();
          * for (int i = 0; i < listeners.length; i++) {
          *        if (listeners[i] instanceof VetoableChangeListenerProxy) {
    @@ -168,7 +168,7 @@ public class VetoableChangeSupport implements Serializable {
          *     }
          *   }
          * }
    -     *
    + * }
    * * @see VetoableChangeListenerProxy * @return all of the VetoableChangeListeners added or an diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContext.java b/jdk/src/share/classes/java/beans/beancontext/BeanContext.java index c6217289faf..308147b9e3c 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContext.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,10 +64,12 @@ public interface BeanContext extends BeanContextChild, Collection, DesignMode, V * and is defined by the * java.beans.Beans.instantiate() method. * + * @return a javaBean named as a child of this + * BeanContext * @param beanName The name of the JavaBean to instantiate * as a child of this BeanContext - * @throws IOException - * @throws ClassNotFoundException if the class identified + * @throws IOException if an IO problem occurs + * @throws ClassNotFoundException if the class identified * by the beanName parameter is not found */ Object instantiateChild(String beanName) throws IOException, ClassNotFoundException; @@ -83,7 +85,7 @@ public interface BeanContext extends BeanContextChild, Collection, DesignMode, V * @return an InputStream for reading the resource, * or null if the resource could not * be found. - * @throws IllegalArgumentException if + * @throws IllegalArgumentException if * the resource is not valid */ InputStream getResourceAsStream(String name, BeanContextChild bcc) throws IllegalArgumentException; @@ -98,7 +100,7 @@ public interface BeanContext extends BeanContextChild, Collection, DesignMode, V * @param bcc the specified child * @return a URL for the named * resource for the specified child - * @throws IllegalArgumentException + * @throws IllegalArgumentException * if the resource is not valid */ URL getResource(String name, BeanContextChild bcc) throws IllegalArgumentException; @@ -109,7 +111,7 @@ public interface BeanContext extends BeanContextChild, Collection, DesignMode, V * this BeanContext whenever it adds * or removes a child Component(s). * - * @param bcml the BeanContextMembershipListener to be added + * @param bcml the BeanContextMembershipListener to be added */ void addBeanContextMembershipListener(BeanContextMembershipListener bcml); diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextChild.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextChild.java index 841e3ccbc5e..e84b7a7eeb5 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextChild.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextChild.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,7 +82,7 @@ public interface BeanContextChild { *

    * @param bc The BeanContext with which * to associate this BeanContextChild. - * @throws PropertyVetoException if the + * @throws PropertyVetoException if the * addition of the specified BeanContext is refused. */ void setBeanContext(BeanContext bc) throws PropertyVetoException; diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java index 056913b654a..b2b855867b5 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java @@ -78,6 +78,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * construct a BeanContextChildSupport where the JavaBean component * itself implements BeanContextChild, and encapsulates this, delegating * that interface to this implementation + * @param bcc the underlying bean context child */ public BeanContextChildSupport(BeanContextChild bcc) { @@ -94,7 +95,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * this BeanContextChildSupport. * @param bc the new value to be assigned to the BeanContext * property - * @throws PropertyVetoException if the change is rejected + * @throws PropertyVetoException if the change is rejected */ public synchronized void setBeanContext(BeanContext bc) throws PropertyVetoException { if (bc == beanContext) return; @@ -361,6 +362,9 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer */ protected VetoableChangeSupport vcSupport; + /** + * The bean context. + */ protected transient BeanContext beanContext; /** diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java index 6b5f4f5609c..24406d4e7db 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -103,6 +103,7 @@ public class BeanContextMembershipEvent extends BeanContextEvent { * Is the child specified affected by the event? * @return true if affected, false * if not + * @param child the object to check for being affected */ public boolean contains(Object child) { return children.contains(child); diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java index 168056c260d..0348817bfe8 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,6 +60,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis * @param serviceClass the service to add * @param serviceProvider the BeanContextServiceProvider * associated with the service + * @return true if the service was successful added, false otherwise */ boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider); @@ -108,7 +109,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis * @param bcsrl the * BeanContextServiceRevokedListener to notify * if the service should later become revoked - * @throws TooManyListenersException + * @throws TooManyListenersException if there are too many listeners * @return a reference to this context's named * Service as requested or null */ diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java index 94d104b14bd..ca0942efef9 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -603,12 +603,16 @@ public class BeanContextServicesSupport extends BeanContextSupport serviceProvider = bcsp; } + /** + * Returns the service provider. + * @return the service provider + */ protected BeanContextServiceProvider getServiceProvider() { return serviceProvider; } - /* - * fields + /** + * The service provider. */ protected BeanContextServiceProvider serviceProvider; @@ -618,6 +622,9 @@ public class BeanContextServicesSupport extends BeanContextSupport * subclasses can override this method to create new subclasses of * BCSSServiceProvider without having to overrride addService() in * order to instantiate. + * @param sc the class + * @param bcsp the service provider + * @return a service provider without overriding addService() */ protected BCSSServiceProvider createBCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) { @@ -629,7 +636,7 @@ public class BeanContextServicesSupport extends BeanContextSupport /** * add a BeanContextServicesListener * - * @throws NullPointerException + * @throws NullPointerException if the argument is null */ public void addBeanContextServicesListener(BeanContextServicesListener bcsl) { @@ -660,6 +667,8 @@ public class BeanContextServicesSupport extends BeanContextSupport /** * add a service + * @param serviceClass the service class + * @param bcsp the service provider */ public boolean addService(Class serviceClass, BeanContextServiceProvider bcsp) { @@ -668,6 +677,10 @@ public class BeanContextServicesSupport extends BeanContextSupport /** * add a service + * @param serviceClass the service class + * @param bcsp the service provider + * @param fireEvent whether or not an event should be fired + * @return true if the service was successfully added */ protected boolean addService(Class serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) { @@ -709,6 +722,9 @@ public class BeanContextServicesSupport extends BeanContextSupport /** * remove a service + * @param serviceClass the service class + * @param bcsp the service provider + * @param revokeCurrentServicesNow whether or not to revoke the service */ public void revokeService(Class serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) { @@ -1067,6 +1083,7 @@ public class BeanContextServicesSupport extends BeanContextSupport /** * Fires a BeanContextServiceEvent notifying of a new service. + * @param serviceClass the service class */ protected final void fireServiceAdded(Class serviceClass) { BeanContextServiceAvailableEvent bcssae = new BeanContextServiceAvailableEvent(getBeanContextServicesPeer(), serviceClass); @@ -1109,6 +1126,8 @@ public class BeanContextServicesSupport extends BeanContextSupport * Fires a BeanContextServiceRevokedEvent * indicating that a particular service is * no longer available. + * @param serviceClass the service class + * @param revokeNow whether or not the event should be revoked now */ protected final void fireServiceRevoked(Class serviceClass, boolean revokeNow) { Object[] copy; diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java index 85b1a5a292f..a549e2dc317 100644 --- a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java +++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,6 @@ import java.util.Map; /** * This helper class provides a utility implementation of the * java.beans.beancontext.BeanContext interface. - *

    *

    * Since this class directly implements the BeanContext interface, the class * can, and is intended to be used either by subclassing this implementation, @@ -351,9 +350,8 @@ public class BeanContextSupport extends BeanContextChildSupport * of Child without having to override add() or the other Collection * methods that add children to the set. *

    - * * @param targetChild the child to create the Child on behalf of - * @param peer the peer if the tragetChild and the peer are related by an implementation of BeanContextProxy + * @param peer the peer if the tragetChild and the peer are related by an implementation of BeanContextProxy * @return Subtype-specific subclass of Child without overriding collection methods */ protected BCSChild createBCSChild(Object targetChild, Object peer) { @@ -492,6 +490,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @param callChildSetBC used to indicate that * the child should be notified that it is no * longer nested in this BeanContext. + * @return whether or not was present before being removed */ protected boolean remove(Object targetChild, boolean callChildSetBC) { @@ -580,7 +579,8 @@ public class BeanContextSupport extends BeanContextChildSupport /** * add Collection to set of Children (Unsupported) * implementations must synchronized on the hierarchy lock and "children" protected field - * @throws UnsupportedOperationException + * @throws UnsupportedOperationException thrown unconditionally by this implementation + * @return this implementation unconditionally throws {@code UnsupportedOperationException} */ public boolean addAll(Collection c) { throw new UnsupportedOperationException(); @@ -589,7 +589,9 @@ public class BeanContextSupport extends BeanContextChildSupport /** * remove all specified children (Unsupported) * implementations must synchronized on the hierarchy lock and "children" protected field - * @throws UnsupportedOperationException + * @throws UnsupportedOperationException thrown unconditionally by this implementation + * @return this implementation unconditionally throws {@code UnsupportedOperationException} + */ public boolean removeAll(Collection c) { throw new UnsupportedOperationException(); @@ -599,7 +601,8 @@ public class BeanContextSupport extends BeanContextChildSupport /** * retain only specified children (Unsupported) * implementations must synchronized on the hierarchy lock and "children" protected field - * @throws UnsupportedOperationException + * @throws UnsupportedOperationException thrown unconditionally by this implementation + * @return this implementation unconditionally throws {@code UnsupportedOperationException} */ public boolean retainAll(Collection c) { throw new UnsupportedOperationException(); @@ -608,7 +611,7 @@ public class BeanContextSupport extends BeanContextChildSupport /** * clear the children (Unsupported) * implementations must synchronized on the hierarchy lock and "children" protected field - * @throws UnsupportedOperationException + * @throws UnsupportedOperationException thrown unconditionally by this implementation */ public void clear() { throw new UnsupportedOperationException(); @@ -618,7 +621,7 @@ public class BeanContextSupport extends BeanContextChildSupport * Adds a BeanContextMembershipListener * * @param bcml the BeanContextMembershipListener to add - * @throws NullPointerException + * @throws NullPointerException if the argument is null */ public void addBeanContextMembershipListener(BeanContextMembershipListener bcml) { @@ -636,7 +639,7 @@ public class BeanContextSupport extends BeanContextChildSupport * Removes a BeanContextMembershipListener * * @param bcml the BeanContextMembershipListener to remove - * @throws NullPointerException + * @throws NullPointerException if the argument is null */ public void removeBeanContextMembershipListener(BeanContextMembershipListener bcml) { @@ -655,7 +658,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @param bcc the child object making the request. * * @return the requested resource as an InputStream - * @throws NullPointerException + * @throws NullPointerException if the argument is null */ public InputStream getResourceAsStream(String name, BeanContextChild bcc) { @@ -849,6 +852,8 @@ public class BeanContextSupport extends BeanContextChildSupport * * This method should not however be used by subclasses to replace their * own implementation (if any) of writeObject(). + * @param oos the {@code ObjectOutputStream} to use during serialization + * @throws IOException if serialization failed */ protected void bcsPreSerializationHook(ObjectOutputStream oos) throws IOException { @@ -864,6 +869,9 @@ public class BeanContextSupport extends BeanContextChildSupport * * This method should not however be used by subclasses to replace their * own implementation (if any) of readObject(). + * @param ois the {@code ObjectInputStream} to use during deserialization + * @throws IOException if deserialization failed + * @throws ClassNotFoundException if needed classes are not found */ protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException { @@ -914,6 +922,8 @@ public class BeanContextSupport extends BeanContextChildSupport * used by readObject to deserialize a collection. * @param ois the ObjectInputStream to use * @param coll the Collection + * @throws IOException if deserialization failed + * @throws ClassNotFoundException if needed classes are not found */ protected final void deserialize(ObjectInputStream ois, Collection coll) throws IOException, ClassNotFoundException { int count = 0; @@ -1005,6 +1015,9 @@ public class BeanContextSupport extends BeanContextChildSupport * When an instance of this class is used as a delegate for the * implementation of the BeanContext protocols (and its subprotocols) * there exists a 'chicken and egg' problem during deserialization + * @param ois the ObjectInputStream to use + * @throws IOException if deserialization failed + * @throws ClassNotFoundException if needed classes are not found */ public final void readChildren(ObjectInputStream ois) throws IOException, ClassNotFoundException { @@ -1122,6 +1135,7 @@ public class BeanContextSupport extends BeanContextChildSupport * immediately prior to their being added to the BeanContext. *

    * + * @param targetChild the child to create the Child on behalf of * @return true iff the child may be added to this BeanContext, otherwise false. */ @@ -1136,6 +1150,7 @@ public class BeanContextSupport extends BeanContextChildSupport * immediately prior to their being removed from the BeanContext. *

    * + * @param targetChild the child to create the Child on behalf of * @return true iff the child may be removed from this BeanContext, otherwise false. */ @@ -1147,6 +1162,8 @@ public class BeanContextSupport extends BeanContextChildSupport * subclasses may override this method to simply extend add() semantics * after the child has been added and before the event notification has * occurred. The method is called with the child synchronized. + * @param child the child + * @param bcsc the BCSChild */ protected void childJustAddedHook(Object child, BCSChild bcsc) { @@ -1156,6 +1173,8 @@ public class BeanContextSupport extends BeanContextChildSupport * subclasses may override this method to simply extend remove() semantics * after the child has been removed and before the event notification has * occurred. The method is called with the child synchronized. + * @param child the child + * @param bcsc the BCSChild */ protected void childJustRemovedHook(Object child, BCSChild bcsc) { @@ -1254,6 +1273,7 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Fire a BeanContextshipEvent on the BeanContextMembershipListener interface + * @param bcme the event to fire */ protected final void fireChildrenAdded(BeanContextMembershipEvent bcme) { @@ -1267,6 +1287,7 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Fire a BeanContextshipEvent on the BeanContextMembershipListener interface + * @param bcme the event to fire */ protected final void fireChildrenRemoved(BeanContextMembershipEvent bcme) { diff --git a/jdk/src/share/classes/java/io/DataInput.java b/jdk/src/share/classes/java/io/DataInput.java index 4dad59d55f3..58a3a2bfd3f 100644 --- a/jdk/src/share/classes/java/io/DataInput.java +++ b/jdk/src/share/classes/java/io/DataInput.java @@ -48,132 +48,87 @@ package java.io; * may be thrown if the input stream has been * closed. * - *

    Modified UTF-8

    + *

    Modified UTF-8

    *

    * Implementations of the DataInput and DataOutput interfaces represent * Unicode strings in a format that is a slight modification of UTF-8. * (For information regarding the standard UTF-8 format, see section * 3.9 Unicode Encoding Forms of The Unicode Standard, Version * 4.0). - * Note that in the following tables, the most significant bit appears in the + * Note that in the following table, the most significant bit appears in the * far left-hand column. - *

    - * All characters in the range {@code '\u005Cu0001'} to - * {@code '\u005Cu007F'} are represented by a single byte: * *

    - * * + * + * + * * - * + * * * * - * + * + * + * * - *
    + * All characters in the range {@code '\u005Cu0001'} to + * {@code '\u005Cu007F'} are represented by a single byte:
    Bit ValuesBit Values
    Byte 1 - * - * - * - *
    0
    - *
    bits 6-0
    - *
    - *
    0
    + *
    bits 6-0
    + *
    + * The null character {@code '\u005Cu0000'} and characters + * in the range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are + * represented by a pair of bytes:
    - *
    - * - *

    - * The null character {@code '\u005Cu0000'} and characters in the - * range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are - * represented by a pair of bytes: - * - *

    - * * * - * + * * * * - * + * * * - * + * + * + * * - *
    Bit ValuesBit Values
    Byte 1 - * - * - * - *
    1
    - *
    1
    - *
    0
    - *
    bits 10-6
    - *
    - *
    1
    + *
    1
    + *
    0
    + *
    bits 10-6
    *
    Byte 2 - * - * - * - *
    1
    - *
    0
    - *
    bits 5-0
    - *
    - *
    1
    + *
    0
    + *
    bits 5-0
    + *
    + * {@code char} values in the range {@code '\u005Cu0800'} + * to {@code '\u005CuFFFF'} are represented by three bytes:
    - *
    - * - *
    - * {@code char} values in the range {@code '\u005Cu0800'} to - * {@code '\u005CuFFFF'} are represented by three bytes: - * - *
    - * * * - * + * * * * - * + * * * - * + * * * - * + * *
    Bit ValuesBit Values
    Byte 1 - * - * - * - *
    1
    - *
    1
    - *
    1
    - *
    0
    - *
    bits 15-12
    - *
    - *
    1
    + *
    1
    + *
    1
    + *
    0
    + *
    bits 15-12
    *
    Byte 2 - * - * - * - *
    1
    - *
    0
    - *
    bits 11-6
    - *
    - *
    1
    + *
    0
    + *
    bits 11-6
    *
    Byte 3 - * - * - * - *
    1
    - *
    0
    - *
    bits 5-0
    - *
    - *
    1
    + *
    0
    + *
    bits 5-0
    *
    - *
    - * + * *

    * The differences between this format and the * standard UTF-8 format are the following: diff --git a/jdk/src/share/classes/java/io/File.java b/jdk/src/share/classes/java/io/File.java index 6bab9bb21fe..f11530d2f67 100644 --- a/jdk/src/share/classes/java/io/File.java +++ b/jdk/src/share/classes/java/io/File.java @@ -129,7 +129,7 @@ import sun.security.action.GetPropertyAction; * created, the abstract pathname represented by a File object * will never change. * - *

    Interoperability with {@code java.nio.file} package

    + *

    Interoperability with {@code java.nio.file} package

    * *

    The {@code java.nio.file} * package defines interfaces and classes for the Java virtual machine to access diff --git a/jdk/src/share/classes/java/io/ObjectInputStream.java b/jdk/src/share/classes/java/io/ObjectInputStream.java index ca0400539f9..d754cc2c275 100644 --- a/jdk/src/share/classes/java/io/ObjectInputStream.java +++ b/jdk/src/share/classes/java/io/ObjectInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -313,6 +313,7 @@ public class ObjectInputStream * @throws SecurityException if a security manager exists and its * checkPermission method denies enabling * subclassing. + * @throws IOException if an I/O error occurs while creating this stream * @see SecurityManager#checkPermission * @see java.io.SerializablePermission */ diff --git a/jdk/src/share/classes/java/io/ObjectOutputStream.java b/jdk/src/share/classes/java/io/ObjectOutputStream.java index f7a94bb0342..6f4c1f3e070 100644 --- a/jdk/src/share/classes/java/io/ObjectOutputStream.java +++ b/jdk/src/share/classes/java/io/ObjectOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -265,6 +265,7 @@ public class ObjectOutputStream * @throws SecurityException if a security manager exists and its * checkPermission method denies enabling * subclassing. + * @throws IOException if an I/O error occurs while creating this stream * @see SecurityManager#checkPermission * @see java.io.SerializablePermission */ diff --git a/jdk/src/share/classes/java/io/ObjectStreamField.java b/jdk/src/share/classes/java/io/ObjectStreamField.java index ceae3fd188e..981e4ba8ca2 100644 --- a/jdk/src/share/classes/java/io/ObjectStreamField.java +++ b/jdk/src/share/classes/java/io/ObjectStreamField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -240,6 +240,8 @@ public class ObjectStreamField * Returns boolean value indicating whether or not the serializable field * represented by this ObjectStreamField instance is unshared. * + * @return {@code true} if this field is unshared + * * @since 1.4 */ public boolean isUnshared() { diff --git a/jdk/src/share/classes/java/io/RandomAccessFile.java b/jdk/src/share/classes/java/io/RandomAccessFile.java index 5e32ad5dba1..440cd225c80 100644 --- a/jdk/src/share/classes/java/io/RandomAccessFile.java +++ b/jdk/src/share/classes/java/io/RandomAccessFile.java @@ -128,7 +128,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { * meanings are: * * - * + * * *

    Value

    Meaning

    ValueMeaning
    "r" Open for reading only. Invoking any of the write * methods of the resulting object will cause an {@link diff --git a/jdk/src/share/classes/java/lang/Class.java b/jdk/src/share/classes/java/lang/Class.java index 2e47377996f..9df0805167b 100644 --- a/jdk/src/share/classes/java/lang/Class.java +++ b/jdk/src/share/classes/java/lang/Class.java @@ -157,10 +157,10 @@ public final class Class implements java.io.Serializable, * * The string is formatted as a list of type modifiers, if any, * followed by the kind of type (empty string for primitive types - * and {@code class}, {@code enum}, {@code interface}, or {@code - * @interface}, as appropriate), followed by the type's name, - * followed by an angle-bracketed comma-separated list of the - * type's type parameters, if any. + * and {@code class}, {@code enum}, {@code interface}, or + * @{@code interface}, as appropriate), followed + * by the type's name, followed by an angle-bracketed + * comma-separated list of the type's type parameters, if any. * * A space is used to separate modifiers from one another and to * separate any modifiers from the kind of type. The modifiers diff --git a/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java b/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java index 5cc3c626e36..e1123da59d8 100644 --- a/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java +++ b/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java @@ -29,6 +29,8 @@ package java.lang.invoke; * LambdaConversionException */ public class LambdaConversionException extends Exception { + private static final long serialVersionUID = 292L + 8L; + /** * Constructs a {@code LambdaConversionException}. */ diff --git a/jdk/src/share/classes/java/lang/ref/FinalReference.java b/jdk/src/share/classes/java/lang/ref/FinalReference.java index 4c76d2d5d02..d7637943726 100644 --- a/jdk/src/share/classes/java/lang/ref/FinalReference.java +++ b/jdk/src/share/classes/java/lang/ref/FinalReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,12 @@ package java.lang.ref; - -/* Final references, used to implement finalization */ - +/** + * Final references, used to implement finalization + */ class FinalReference extends Reference { public FinalReference(T referent, ReferenceQueue q) { super(referent, q); } - } diff --git a/jdk/src/share/classes/java/lang/ref/Finalizer.java b/jdk/src/share/classes/java/lang/ref/Finalizer.java index cdba65e4820..2be6466931b 100644 --- a/jdk/src/share/classes/java/lang/ref/Finalizer.java +++ b/jdk/src/share/classes/java/lang/ref/Finalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,16 +29,16 @@ import java.security.PrivilegedAction; import java.security.AccessController; -final class Finalizer extends FinalReference { /* Package-private; must be in - same package as the Reference - class */ +final class Finalizer extends FinalReference { /* Package-private; must be in + same package as the Reference + class */ /* A native method that invokes an arbitrary object's finalize method is required since the finalize method is protected */ static native void invokeFinalizeMethod(Object o) throws Throwable; - private static ReferenceQueue queue = new ReferenceQueue(); + private static ReferenceQueue queue = new ReferenceQueue<>(); private static Finalizer unfinalized = null; private static final Object lock = new Object(); diff --git a/jdk/src/share/classes/java/lang/ref/Reference.java b/jdk/src/share/classes/java/lang/ref/Reference.java index 1cdeefd992b..42d2ba97814 100644 --- a/jdk/src/share/classes/java/lang/ref/Reference.java +++ b/jdk/src/share/classes/java/lang/ref/Reference.java @@ -96,6 +96,7 @@ public abstract class Reference { * Enqueued: next reference in queue (or this if last) * Inactive: this */ + @SuppressWarnings("rawtypes") Reference next; /* When active: next element in a discovered reference list maintained by GC (or this if last) @@ -119,7 +120,7 @@ public abstract class Reference { * them. This list is protected by the above lock object. The * list uses the discovered field to link its elements. */ - private static Reference pending = null; + private static Reference pending = null; /* High-priority thread to enqueue pending References */ @@ -131,7 +132,7 @@ public abstract class Reference { public void run() { for (;;) { - Reference r; + Reference r; synchronized (lock) { if (pending != null) { r = pending; @@ -166,7 +167,7 @@ public abstract class Reference { continue; } - ReferenceQueue q = r.queue; + ReferenceQueue q = r.queue; if (q != ReferenceQueue.NULL) q.enqueue(r); } } diff --git a/jdk/src/share/classes/java/lang/ref/ReferenceQueue.java b/jdk/src/share/classes/java/lang/ref/ReferenceQueue.java index a2fad1cbce3..61eaccbc6ae 100644 --- a/jdk/src/share/classes/java/lang/ref/ReferenceQueue.java +++ b/jdk/src/share/classes/java/lang/ref/ReferenceQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,14 +40,14 @@ public class ReferenceQueue { */ public ReferenceQueue() { } - private static class Null extends ReferenceQueue { - boolean enqueue(Reference r) { + private static class Null extends ReferenceQueue { + boolean enqueue(Reference r) { return false; } } - static ReferenceQueue NULL = new Null(); - static ReferenceQueue ENQUEUED = new Null(); + static ReferenceQueue NULL = new Null<>(); + static ReferenceQueue ENQUEUED = new Null<>(); static private class Lock { }; private Lock lock = new Lock(); @@ -58,7 +58,7 @@ public class ReferenceQueue { synchronized (lock) { // Check that since getting the lock this reference hasn't already been // enqueued (and even then removed) - ReferenceQueue queue = r.queue; + ReferenceQueue queue = r.queue; if ((queue == NULL) || (queue == ENQUEUED)) { return false; } @@ -75,10 +75,13 @@ public class ReferenceQueue { } } + @SuppressWarnings("unchecked") private Reference reallyPoll() { /* Must hold lock */ Reference r = head; if (r != null) { - head = (r.next == r) ? null : r.next; + head = (r.next == r) ? + null : + r.next; // Unchecked due to the next field having a raw type in Reference r.queue = NULL; r.next = r; queueLength--; diff --git a/jdk/src/share/classes/java/lang/reflect/Parameter.java b/jdk/src/share/classes/java/lang/reflect/Parameter.java index f49c1daa436..0568d9ee2e0 100644 --- a/jdk/src/share/classes/java/lang/reflect/Parameter.java +++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java @@ -162,7 +162,7 @@ public final class Parameter implements AnnotatedElement { /** * Returns the name of the parameter. If the parameter's name is - * {@linkplain isNamePresent() present}, then this method returns + * {@linkplain #isNamePresent() present}, then this method returns * the name provided by the class file. Otherwise, this method * synthesizes a name of the form argN, where N is the index of * the parameter in the descriptor of the method which declares diff --git a/jdk/src/share/classes/java/math/BigInteger.java b/jdk/src/share/classes/java/math/BigInteger.java index 6569fcb1796..e8cedf8a564 100644 --- a/jdk/src/share/classes/java/math/BigInteger.java +++ b/jdk/src/share/classes/java/math/BigInteger.java @@ -33,7 +33,6 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamField; -import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import sun.misc.DoubleConsts; @@ -101,6 +100,7 @@ import sun.misc.FloatConsts; * @author Josh Bloch * @author Michael McCloskey * @author Alan Eliasen + * @author Timothy Buktu * @since JDK1.1 */ @@ -214,6 +214,14 @@ public class BigInteger extends Number implements Comparable { */ private static final int TOOM_COOK_SQUARE_THRESHOLD = 140; + /** + * The threshold value for using Burnikel-Ziegler division. If the number + * of ints in the number are larger than this value, + * Burnikel-Ziegler division will be used. This value is found + * experimentally to work well. + */ + static final int BURNIKEL_ZIEGLER_THRESHOLD = 50; + /** * The threshold value for using Schoenhage recursive base conversion. If * the number of ints in the number are larger than this value, @@ -290,7 +298,7 @@ public class BigInteger extends Number implements Comparable { if (signum < -1 || signum > 1) throw(new NumberFormatException("Invalid signum value")); - if (this.mag.length==0) { + if (this.mag.length == 0) { this.signum = 0; } else { if (signum == 0) @@ -311,7 +319,7 @@ public class BigInteger extends Number implements Comparable { if (signum < -1 || signum > 1) throw(new NumberFormatException("Invalid signum value")); - if (this.mag.length==0) { + if (this.mag.length == 0) { this.signum = 0; } else { if (signum == 0) @@ -364,8 +372,10 @@ public class BigInteger extends Number implements Comparable { // Skip leading zeros and compute number of digits in magnitude while (cursor < len && - Character.digit(val.charAt(cursor), radix) == 0) + Character.digit(val.charAt(cursor), radix) == 0) { cursor++; + } + if (cursor == len) { signum = 0; mag = ZERO.mag; @@ -455,7 +465,7 @@ public class BigInteger extends Number implements Comparable { if (result == -1) throw new NumberFormatException(new String(source)); - for (int index = start; index { int highBit = 1 << ((bitLength+31) & 0x1f); // High bit of high int int highMask = (highBit << 1) - 1; // Bits to keep in high int - while(true) { + while (true) { // Construct a candidate - for (int i=0; i 2) @@ -710,7 +720,7 @@ public class BigInteger extends Number implements Comparable { if (!result.testBit(0)) result = result.add(ONE); - while(true) { + while (true) { // Do cheap "pre-test" if applicable if (result.bitLength() > 6) { long r = result.remainder(SMALL_PRIME_PRODUCT).longValue(); @@ -741,7 +751,7 @@ public class BigInteger extends Number implements Comparable { // Looking for the next large prime int searchLen = (result.bitLength() / 20) * 64; - while(true) { + while (true) { BitSieve searchSieve = new BitSieve(result, searchLen); BigInteger candidate = searchSieve.retrieve(result, DEFAULT_PRIME_CERTAINTY, null); @@ -808,7 +818,7 @@ public class BigInteger extends Number implements Comparable { int d = 5; while (jacobiSymbol(d, this) != -1) { // 5, -7, 9, -11, ... - d = (d<0) ? Math.abs(d)+2 : -(d+2); + d = (d < 0) ? Math.abs(d)+2 : -(d+2); } // Step 2 @@ -881,7 +891,7 @@ public class BigInteger extends Number implements Comparable { BigInteger u = ONE; BigInteger u2; BigInteger v = ONE; BigInteger v2; - for (int i=k.bitLength()-2; i>=0; i--) { + for (int i=k.bitLength()-2; i >= 0; i--) { u2 = u.multiply(v).mod(n); v2 = v.square().add(d.multiply(u.square())).mod(n); @@ -937,7 +947,7 @@ public class BigInteger extends Number implements Comparable { if (rnd == null) { rnd = getSecureRandom(); } - for (int i=0; i { int j = 0; BigInteger z = b.modPow(m, this); - while(!((j==0 && z.equals(ONE)) || z.equals(thisMinusOne))) { - if (j>0 && z.equals(ONE) || ++j==a) + while (!((j == 0 && z.equals(ONE)) || z.equals(thisMinusOne))) { + if (j > 0 && z.equals(ONE) || ++j == a) return false; z = z.modPow(TWO, this); } @@ -961,7 +971,7 @@ public class BigInteger extends Number implements Comparable { * arguments are correct, and it doesn't copy the magnitude array. */ BigInteger(int[] magnitude, int signum) { - this.signum = (magnitude.length==0 ? 0 : signum); + this.signum = (magnitude.length == 0 ? 0 : signum); this.mag = magnitude; } @@ -970,7 +980,7 @@ public class BigInteger extends Number implements Comparable { * arguments are correct. */ private BigInteger(byte[] magnitude, int signum) { - this.signum = (magnitude.length==0 ? 0 : signum); + this.signum = (magnitude.length == 0 ? 0 : signum); this.mag = stripLeadingZeroBytes(magnitude); } @@ -1009,7 +1019,7 @@ public class BigInteger extends Number implements Comparable { } int highWord = (int)(val >>> 32); - if (highWord==0) { + if (highWord == 0) { mag = new int[1]; mag[0] = (int)val; } else { @@ -1025,7 +1035,7 @@ public class BigInteger extends Number implements Comparable { * BigInteger will reference the input array if feasible). */ private static BigInteger valueOf(int val[]) { - return (val[0]>0 ? new BigInteger(val, 1) : new BigInteger(val)); + return (val[0] > 0 ? new BigInteger(val, 1) : new BigInteger(val)); } // Constants @@ -1066,8 +1076,7 @@ public class BigInteger extends Number implements Comparable { powerCache = new BigInteger[Character.MAX_RADIX+1][]; logCache = new double[Character.MAX_RADIX+1]; - for (int i=Character.MIN_RADIX; i<=Character.MAX_RADIX; i++) - { + for (int i=Character.MIN_RADIX; i <= Character.MAX_RADIX; i++) { powerCache[i] = new BigInteger[] { BigInteger.valueOf(i) }; logCache[i] = Math.log(i); } @@ -1161,7 +1170,7 @@ public class BigInteger extends Number implements Comparable { int xIndex = x.length; int[] result; int highWord = (int)(val >>> 32); - if (highWord==0) { + if (highWord == 0) { result = new int[xIndex]; sum = (x[--xIndex] & LONG_MASK) + val; result[xIndex] = (int)sum; @@ -1214,12 +1223,12 @@ public class BigInteger extends Number implements Comparable { int yIndex = y.length; int result[] = new int[xIndex]; long sum = 0; - if(yIndex==1) { + if (yIndex == 1) { sum = (x[--xIndex] & LONG_MASK) + (y[0] & LONG_MASK) ; result[xIndex] = (int)sum; } else { // Add common parts of both numbers - while(yIndex > 0) { + while (yIndex > 0) { sum = (x[--xIndex] & LONG_MASK) + (y[--yIndex] & LONG_MASK) + (sum >>> 32); result[xIndex] = (int)sum; @@ -1246,24 +1255,24 @@ public class BigInteger extends Number implements Comparable { private static int[] subtract(long val, int[] little) { int highWord = (int)(val >>> 32); - if (highWord==0) { + if (highWord == 0) { int result[] = new int[1]; result[0] = (int)(val - (little[0] & LONG_MASK)); return result; } else { int result[] = new int[2]; - if(little.length==1) { + if (little.length == 1) { long difference = ((int)val & LONG_MASK) - (little[0] & LONG_MASK); result[1] = (int)difference; // Subtract remainder of longer number while borrow propagates boolean borrow = (difference >> 32 != 0); - if(borrow) { + if (borrow) { result[0] = highWord - 1; } else { // Copy remainder of longer number result[0] = highWord; } return result; - } else { // little.length==2 + } else { // little.length == 2 long difference = ((int)val & LONG_MASK) - (little[1] & LONG_MASK); result[1] = (int)difference; difference = (highWord & LONG_MASK) - (little[0] & LONG_MASK) + (difference >> 32); @@ -1286,7 +1295,7 @@ public class BigInteger extends Number implements Comparable { int result[] = new int[bigIndex]; long difference = 0; - if (highWord==0) { + if (highWord == 0) { difference = (big[--bigIndex] & LONG_MASK) - val; result[bigIndex] = (int)difference; } else { @@ -1296,7 +1305,6 @@ public class BigInteger extends Number implements Comparable { result[bigIndex] = (int)difference; } - // Subtract remainder of longer number while borrow propagates boolean borrow = (difference >> 32 != 0); while (bigIndex > 0 && borrow) @@ -1345,7 +1353,7 @@ public class BigInteger extends Number implements Comparable { long difference = 0; // Subtract common parts of both numbers - while(littleIndex > 0) { + while (littleIndex > 0) { difference = (big[--bigIndex] & LONG_MASK) - (little[--littleIndex] & LONG_MASK) + (difference >> 32); @@ -1377,29 +1385,29 @@ public class BigInteger extends Number implements Comparable { int xlen = mag.length; int ylen = val.mag.length; - if ((xlen < KARATSUBA_THRESHOLD) || (ylen < KARATSUBA_THRESHOLD)) - { + if ((xlen < KARATSUBA_THRESHOLD) || (ylen < KARATSUBA_THRESHOLD)) { int resultSign = signum == val.signum ? 1 : -1; if (val.mag.length == 1) { return multiplyByInt(mag,val.mag[0], resultSign); } - if(mag.length == 1) { + if (mag.length == 1) { return multiplyByInt(val.mag,mag[0], resultSign); } int[] result = multiplyToLen(mag, xlen, val.mag, ylen, null); result = trustedStripLeadingZeroInts(result); return new BigInteger(result, resultSign); - } - else - if ((xlen < TOOM_COOK_THRESHOLD) && (ylen < TOOM_COOK_THRESHOLD)) + } else { + if ((xlen < TOOM_COOK_THRESHOLD) && (ylen < TOOM_COOK_THRESHOLD)) { return multiplyKaratsuba(this, val); - else + } else { return multiplyToomCook3(this, val); + } + } } private static BigInteger multiplyByInt(int[] x, int y, int sign) { - if(Integer.bitCount(y)==1) { + if (Integer.bitCount(y) == 1) { return new BigInteger(shiftLeft(x,Integer.numberOfTrailingZeros(y)), sign); } int xlen = x.length; @@ -1474,7 +1482,7 @@ public class BigInteger extends Number implements Comparable { z = new int[xlen+ylen]; long carry = 0; - for (int j=ystart, k=ystart+1+xstart; j>=0; j--, k--) { + for (int j=ystart, k=ystart+1+xstart; j >= 0; j--, k--) { long product = (y[j] & LONG_MASK) * (x[xstart] & LONG_MASK) + carry; z[k] = (int)product; @@ -1484,7 +1492,7 @@ public class BigInteger extends Number implements Comparable { for (int i = xstart-1; i >= 0; i--) { carry = 0; - for (int j=ystart, k=ystart+1+i; j>=0; j--, k--) { + for (int j=ystart, k=ystart+1+i; j >= 0; j--, k--) { long product = (y[j] & LONG_MASK) * (x[i] & LONG_MASK) + (z[k] & LONG_MASK) + carry; @@ -1511,8 +1519,7 @@ public class BigInteger extends Number implements Comparable { * * See: http://en.wikipedia.org/wiki/Karatsuba_algorithm */ - private static BigInteger multiplyKaratsuba(BigInteger x, BigInteger y) - { + private static BigInteger multiplyKaratsuba(BigInteger x, BigInteger y) { int xlen = x.mag.length; int ylen = y.mag.length; @@ -1535,10 +1542,11 @@ public class BigInteger extends Number implements Comparable { // result = p1 * 2^(32*2*half) + (p3 - p1 - p2) * 2^(32*half) + p2 BigInteger result = p1.shiftLeft(32*half).add(p3.subtract(p1).subtract(p2)).shiftLeft(32*half).add(p2); - if (x.signum != y.signum) + if (x.signum != y.signum) { return result.negate(); - else + } else { return result; + } } /** @@ -1569,8 +1577,7 @@ public class BigInteger extends Number implements Comparable { * LNCS #4547. Springer, Madrid, Spain, June 21-22, 2007. * */ - private static BigInteger multiplyToomCook3(BigInteger a, BigInteger b) - { + private static BigInteger multiplyToomCook3(BigInteger a, BigInteger b) { int alen = a.mag.length; int blen = b.mag.length; @@ -1605,12 +1612,12 @@ public class BigInteger extends Number implements Comparable { db1.add(b2).shiftLeft(1).subtract(b0)); vinf = a2.multiply(b2); - /* The algorithm requires two divisions by 2 and one by 3. - All divisions are known to be exact, that is, they do not produce - remainders, and all results are positive. The divisions by 2 are - implemented as right shifts which are relatively efficient, leaving - only an exact division by 3, which is done by a specialized - linear-time algorithm. */ + // The algorithm requires two divisions by 2 and one by 3. + // All divisions are known to be exact, that is, they do not produce + // remainders, and all results are positive. The divisions by 2 are + // implemented as right shifts which are relatively efficient, leaving + // only an exact division by 3, which is done by a specialized + // linear-time algorithm. t2 = v2.subtract(vm1).exactDivideBy3(); tm1 = v1.subtract(vm1).shiftRight(1); t1 = v1.subtract(v0); @@ -1624,10 +1631,11 @@ public class BigInteger extends Number implements Comparable { BigInteger result = vinf.shiftLeft(ss).add(t2).shiftLeft(ss).add(t1).shiftLeft(ss).add(tm1).shiftLeft(ss).add(v0); - if (a.signum != b.signum) + if (a.signum != b.signum) { return result.negate(); - else + } else { return result; + } } @@ -1645,38 +1653,38 @@ public class BigInteger extends Number implements Comparable { * numbers. */ private BigInteger getToomSlice(int lowerSize, int upperSize, int slice, - int fullsize) - { + int fullsize) { int start, end, sliceSize, len, offset; len = mag.length; offset = fullsize - len; - if (slice == 0) - { + if (slice == 0) { start = 0 - offset; end = upperSize - 1 - offset; - } - else - { + } else { start = upperSize + (slice-1)*lowerSize - offset; end = start + lowerSize - 1; } - if (start < 0) + if (start < 0) { start = 0; - if (end < 0) + } + if (end < 0) { return ZERO; + } sliceSize = (end-start) + 1; - if (sliceSize <= 0) + if (sliceSize <= 0) { return ZERO; + } // While performing Toom-Cook, all slices are positive and // the sign is adjusted when the final number is composed. - if (start==0 && sliceSize >= len) + if (start == 0 && sliceSize >= len) { return this.abs(); + } int intSlice[] = new int[sliceSize]; System.arraycopy(mag, start, intSlice, 0, sliceSize); @@ -1692,20 +1700,19 @@ public class BigInteger extends Number implements Comparable { * undefined. Note that this is expected to be called with positive * arguments only. */ - private BigInteger exactDivideBy3() - { + private BigInteger exactDivideBy3() { int len = mag.length; int[] result = new int[len]; long x, w, q, borrow; borrow = 0L; - for (int i=len-1; i>=0; i--) - { + for (int i=len-1; i >= 0; i--) { x = (mag[i] & LONG_MASK); w = x - borrow; - if (borrow > x) // Did we make the number go negative? + if (borrow > x) { // Did we make the number go negative? borrow = 1L; - else + } else { borrow = 0L; + } // 0xAAAAAAAB is the modular inverse of 3 (mod 2^32). Thus, // the effect of this is to divide by 3 (mod 2^32). @@ -1715,8 +1722,7 @@ public class BigInteger extends Number implements Comparable { // Now check the borrow. The second check can of course be // eliminated if the first fails. - if (q >= 0x55555556L) - { + if (q >= 0x55555556L) { borrow++; if (q >= 0xAAAAAAABL) borrow++; @@ -1733,8 +1739,9 @@ public class BigInteger extends Number implements Comparable { private BigInteger getLower(int n) { int len = mag.length; - if (len <= n) + if (len <= n) { return this; + } int lowerInts[] = new int[n]; System.arraycopy(mag, len-n, lowerInts, 0, n); @@ -1750,8 +1757,9 @@ public class BigInteger extends Number implements Comparable { private BigInteger getUpper(int n) { int len = mag.length; - if (len <= n) + if (len <= n) { return ZERO; + } int upperLen = len - n; int upperInts[] = new int[upperLen]; @@ -1768,20 +1776,21 @@ public class BigInteger extends Number implements Comparable { * @return {@code this2} */ private BigInteger square() { - if (signum == 0) + if (signum == 0) { return ZERO; + } int len = mag.length; - if (len < KARATSUBA_SQUARE_THRESHOLD) - { + if (len < KARATSUBA_SQUARE_THRESHOLD) { int[] z = squareToLen(mag, len, null); return new BigInteger(trustedStripLeadingZeroInts(z), 1); - } - else - if (len < TOOM_COOK_SQUARE_THRESHOLD) + } else { + if (len < TOOM_COOK_SQUARE_THRESHOLD) { return squareKaratsuba(); - else - return squareToomCook3(); + } else { + return squareToomCook3(); + } + } } /** @@ -1829,7 +1838,7 @@ public class BigInteger extends Number implements Comparable { // Store the squares, right shifted one bit (i.e., divided by 2) int lastProductLowWord = 0; - for (int j=0, i=0; j>> 33); @@ -1838,7 +1847,7 @@ public class BigInteger extends Number implements Comparable { } // Add in off-diagonal sums - for (int i=len, offset=1; i>0; i--, offset+=2) { + for (int i=len, offset=1; i > 0; i--, offset+=2) { int t = x[i-1]; t = mulAdd(z, x, offset, i-1, t); addOne(z, offset-1, i, t); @@ -1858,8 +1867,7 @@ public class BigInteger extends Number implements Comparable { * has better asymptotic performance than the algorithm used in * squareToLen. */ - private BigInteger squareKaratsuba() - { + private BigInteger squareKaratsuba() { int half = (mag.length+1) / 2; BigInteger xl = getLower(half); @@ -1879,8 +1887,7 @@ public class BigInteger extends Number implements Comparable { * that has better asymptotic performance than the algorithm used in * squareToLen or squareKaratsuba. */ - private BigInteger squareToomCook3() - { + private BigInteger squareToomCook3() { int len = mag.length; // k is the size (in ints) of the lower-order slices. @@ -1905,13 +1912,12 @@ public class BigInteger extends Number implements Comparable { vinf = a2.square(); v2 = da1.add(a2).shiftLeft(1).subtract(a0).square(); - /* The algorithm requires two divisions by 2 and one by 3. - All divisions are known to be exact, that is, they do not produce - remainders, and all results are positive. The divisions by 2 are - implemented as right shifts which are relatively efficient, leaving - only a division by 3. - The division by 3 is done by an optimized algorithm for this case. - */ + // The algorithm requires two divisions by 2 and one by 3. + // All divisions are known to be exact, that is, they do not produce + // remainders, and all results are positive. The divisions by 2 are + // implemented as right shifts which are relatively efficient, leaving + // only a division by 3. + // The division by 3 is done by an optimized algorithm for this case. t2 = v2.subtract(vm1).exactDivideBy3(); tm1 = v1.subtract(vm1).shiftRight(1); t1 = v1.subtract(v0); @@ -1936,11 +1942,28 @@ public class BigInteger extends Number implements Comparable { * @throws ArithmeticException if {@code val} is zero. */ public BigInteger divide(BigInteger val) { + if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD || + val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) { + return divideKnuth(val); + } else { + return divideBurnikelZiegler(val); + } + } + + /** + * Returns a BigInteger whose value is {@code (this / val)} using an O(n^2) algorithm from Knuth. + * + * @param val value by which this BigInteger is to be divided. + * @return {@code this / val} + * @throws ArithmeticException if {@code val} is zero. + * @see MutableBigInteger#divideKnuth(MutableBigInteger, MutableBigInteger, boolean) + */ + private BigInteger divideKnuth(BigInteger val) { MutableBigInteger q = new MutableBigInteger(), a = new MutableBigInteger(this.mag), b = new MutableBigInteger(val.mag); - a.divide(b, q, false); + a.divideKnuth(b, q, false); return q.toBigInteger(this.signum * val.signum); } @@ -1956,11 +1979,21 @@ public class BigInteger extends Number implements Comparable { * @throws ArithmeticException if {@code val} is zero. */ public BigInteger[] divideAndRemainder(BigInteger val) { + if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD || + val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) { + return divideAndRemainderKnuth(val); + } else { + return divideAndRemainderBurnikelZiegler(val); + } + } + + /** Long division */ + private BigInteger[] divideAndRemainderKnuth(BigInteger val) { BigInteger[] result = new BigInteger[2]; MutableBigInteger q = new MutableBigInteger(), a = new MutableBigInteger(this.mag), b = new MutableBigInteger(val.mag); - MutableBigInteger r = a.divide(b, q); + MutableBigInteger r = a.divideKnuth(b, q); result[0] = q.toBigInteger(this.signum == val.signum ? 1 : -1); result[1] = r.toBigInteger(this.signum); return result; @@ -1975,11 +2008,53 @@ public class BigInteger extends Number implements Comparable { * @throws ArithmeticException if {@code val} is zero. */ public BigInteger remainder(BigInteger val) { + if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD || + val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) { + return remainderKnuth(val); + } else { + return remainderBurnikelZiegler(val); + } + } + + /** Long division */ + private BigInteger remainderKnuth(BigInteger val) { MutableBigInteger q = new MutableBigInteger(), a = new MutableBigInteger(this.mag), b = new MutableBigInteger(val.mag); - return a.divide(b, q).toBigInteger(this.signum); + return a.divideKnuth(b, q).toBigInteger(this.signum); + } + + /** + * Calculates {@code this / val} using the Burnikel-Ziegler algorithm. + * @param val the divisor + * @return {@code this / val} + */ + private BigInteger divideBurnikelZiegler(BigInteger val) { + return divideAndRemainderBurnikelZiegler(val)[0]; + } + + /** + * Calculates {@code this % val} using the Burnikel-Ziegler algorithm. + * @param val the divisor + * @return {@code this % val} + */ + private BigInteger remainderBurnikelZiegler(BigInteger val) { + return divideAndRemainderBurnikelZiegler(val)[1]; + } + + /** + * Computes {@code this / val} and {@code this % val} using the + * Burnikel-Ziegler algorithm. + * @param val the divisor + * @return an array containing the quotient and remainder + */ + private BigInteger[] divideAndRemainderBurnikelZiegler(BigInteger val) { + MutableBigInteger q = new MutableBigInteger(); + MutableBigInteger r = new MutableBigInteger(this).divideAndRemainderBurnikelZiegler(new MutableBigInteger(val), q); + BigInteger qBigInt = q.isZero() ? ZERO : q.toBigInteger(signum*val.signum); + BigInteger rBigInt = r.isZero() ? ZERO : r.toBigInteger(signum); + return new BigInteger[] {qBigInt, rBigInt}; } /** @@ -1992,10 +2067,12 @@ public class BigInteger extends Number implements Comparable { * cause the operation to yield a non-integer value.) */ public BigInteger pow(int exponent) { - if (exponent < 0) + if (exponent < 0) { throw new ArithmeticException("Negative exponent"); - if (signum==0) - return (exponent==0 ? ONE : this); + } + if (signum == 0) { + return (exponent == 0 ? ONE : this); + } BigInteger partToSquare = this.abs(); @@ -2008,24 +2085,25 @@ public class BigInteger extends Number implements Comparable { int remainingBits; // Factor the powers of two out quickly by shifting right, if needed. - if (powersOfTwo > 0) - { + if (powersOfTwo > 0) { partToSquare = partToSquare.shiftRight(powersOfTwo); remainingBits = partToSquare.bitLength(); - if (remainingBits == 1) // Nothing left but +/- 1? - if (signum<0 && (exponent&1)==1) + if (remainingBits == 1) { // Nothing left but +/- 1? + if (signum < 0 && (exponent&1) == 1) { return NEGATIVE_ONE.shiftLeft(powersOfTwo*exponent); - else + } else { return ONE.shiftLeft(powersOfTwo*exponent); - } - else - { + } + } + } else { remainingBits = partToSquare.bitLength(); - if (remainingBits == 1) // Nothing left but +/- 1? - if (signum<0 && (exponent&1)==1) + if (remainingBits == 1) { // Nothing left but +/- 1? + if (signum < 0 && (exponent&1) == 1) { return NEGATIVE_ONE; - else + } else { return ONE; + } + } } // This is a quick way to approximate the size of the result, @@ -2035,10 +2113,9 @@ public class BigInteger extends Number implements Comparable { // Use slightly different algorithms for small and large operands. // See if the result will safely fit into a long. (Largest 2^63-1) - if (partToSquare.mag.length==1 && scaleFactor <= 62) - { + if (partToSquare.mag.length == 1 && scaleFactor <= 62) { // Small number algorithm. Everything fits into a long. - int newSign = (signum<0 && (exponent&1)==1 ? -1 : 1); + int newSign = (signum <0 && (exponent&1) == 1 ? -1 : 1); long result = 1; long baseToPow2 = partToSquare.mag[0] & LONG_MASK; @@ -2046,27 +2123,28 @@ public class BigInteger extends Number implements Comparable { // Perform exponentiation using repeated squaring trick while (workingExponent != 0) { - if ((workingExponent & 1)==1) + if ((workingExponent & 1) == 1) { result = result * baseToPow2; + } - if ((workingExponent >>>= 1) != 0) + if ((workingExponent >>>= 1) != 0) { baseToPow2 = baseToPow2 * baseToPow2; + } } // Multiply back the powers of two (quickly, by shifting left) - if (powersOfTwo > 0) - { + if (powersOfTwo > 0) { int bitsToShift = powersOfTwo*exponent; - if (bitsToShift + scaleFactor <= 62) // Fits in long? + if (bitsToShift + scaleFactor <= 62) { // Fits in long? return valueOf((result << bitsToShift) * newSign); - else + } else { return valueOf(result*newSign).shiftLeft(bitsToShift); + } } - else + else { return valueOf(result*newSign); - } - else - { + } + } else { // Large number algorithm. This is basically identical to // the algorithm above, but calls multiply() and square() // which may use more efficient algorithms for large numbers. @@ -2075,28 +2153,32 @@ public class BigInteger extends Number implements Comparable { int workingExponent = exponent; // Perform exponentiation using repeated squaring trick while (workingExponent != 0) { - if ((workingExponent & 1)==1) + if ((workingExponent & 1) == 1) { answer = answer.multiply(partToSquare); + } - if ((workingExponent >>>= 1) != 0) + if ((workingExponent >>>= 1) != 0) { partToSquare = partToSquare.square(); + } } // Multiply back the (exponentiated) powers of two (quickly, // by shifting left) - if (powersOfTwo > 0) + if (powersOfTwo > 0) { answer = answer.shiftLeft(powersOfTwo*exponent); + } - if (signum<0 && (exponent&1)==1) + if (signum < 0 && (exponent&1) == 1) { return answer.negate(); - else + } else { return answer; + } } } /** * Returns a BigInteger whose value is the greatest common divisor of * {@code abs(this)} and {@code abs(val)}. Returns 0 if - * {@code this==0 && val==0}. + * {@code this == 0 && val == 0}. * * @param val value with which the GCD is to be computed. * @return {@code GCD(abs(this), abs(val))} @@ -2153,7 +2235,7 @@ public class BigInteger extends Number implements Comparable { // shifts a up to len right n bits assumes no leading zeros, 00; i--) { + for (int i=len-1, c=a[i]; i > 0; i--) { int b = c; c = a[i-1]; a[i] = (c << n2) | (b >>> n); @@ -2167,7 +2249,7 @@ public class BigInteger extends Number implements Comparable { return; int n2 = 32 - n; - for (int i=0, c=a[i], m=i+len-1; i>> n2); @@ -2378,7 +2460,7 @@ public class BigInteger extends Number implements Comparable { return this; // Special case for base of zero - if (signum==0) + if (signum == 0) return ZERO; int[] base = mag.clone(); @@ -2401,7 +2483,7 @@ public class BigInteger extends Number implements Comparable { // Allocate table for precomputed odd powers of base in Montgomery form int[][] table = new int[tblmask][]; - for (int i=0; i { if (table[0].length < modLen) { int offset = modLen - table[0].length; int[] t2 = new int[modLen]; - for (int i=0; i { int[] t = Arrays.copyOf(b, modLen); // Fill in the table with odd powers of the base - for (int i=1; i { isone = false; // The main loop - while(true) { + while (true) { ebits--; // Advance the window buf <<= 1; @@ -2551,9 +2633,9 @@ public class BigInteger extends Number implements Comparable { int carry = mulAdd(n, mod, offset, mlen, inv * nEnd); c += addOne(n, offset, mlen, carry); offset++; - } while(--len > 0); + } while (--len > 0); - while(c>0) + while (c > 0) c += subN(n, mod, mlen); while (intArrayCmpToLen(n, mod, mlen) >= 0) @@ -2568,7 +2650,7 @@ public class BigInteger extends Number implements Comparable { * equal to, or greater than arg2 up to length len. */ private static int intArrayCmpToLen(int[] arg1, int[] arg2, int len) { - for (int i=0; i { private static int subN(int[] a, int[] b, int len) { long sum = 0; - while(--len >= 0) { + while (--len >= 0) { sum = (a[len] & LONG_MASK) - (b[len] & LONG_MASK) + (sum >> 32); a[len] = (int)sum; @@ -2679,7 +2761,7 @@ public class BigInteger extends Number implements Comparable { int excessBits = (numInts << 5) - p; mag[0] &= (1L << (32-excessBits)) - 1; - return (mag[0]==0 ? new BigInteger(1, mag) : new BigInteger(mag, 1)); + return (mag[0] == 0 ? new BigInteger(1, mag) : new BigInteger(mag, 1)); } /** @@ -2730,9 +2812,9 @@ public class BigInteger extends Number implements Comparable { public BigInteger shiftLeft(int n) { if (signum == 0) return ZERO; - if (n==0) + if (n == 0) return this; - if (n<0) { + if (n < 0) { if (n == Integer.MIN_VALUE) { throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported."); } else { @@ -2784,9 +2866,9 @@ public class BigInteger extends Number implements Comparable { * @see #shiftLeft */ public BigInteger shiftRight(int n) { - if (n==0) + if (n == 0) return this; - if (n<0) { + if (n < 0) { if (n == Integer.MIN_VALUE) { throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported."); } else { @@ -2825,7 +2907,7 @@ public class BigInteger extends Number implements Comparable { if (signum < 0) { // Find out whether any one-bits were shifted off the end. boolean onesLost = false; - for (int i=magLen-1, j=magLen-nInts; i>=j && !onesLost; i--) + for (int i=magLen-1, j=magLen-nInts; i >= j && !onesLost; i--) onesLost = (mag[i] != 0); if (!onesLost && nBits != 0) onesLost = (mag[magLen - nInts - 1] << (32 - nBits) != 0); @@ -2860,7 +2942,7 @@ public class BigInteger extends Number implements Comparable { */ public BigInteger and(BigInteger val) { int[] result = new int[Math.max(intLength(), val.intLength())]; - for (int i=0; i { */ public BigInteger or(BigInteger val) { int[] result = new int[Math.max(intLength(), val.intLength())]; - for (int i=0; i { */ public BigInteger xor(BigInteger val) { int[] result = new int[Math.max(intLength(), val.intLength())]; - for (int i=0; i { */ public BigInteger not() { int[] result = new int[intLength()]; - for (int i=0; i { */ public BigInteger andNot(BigInteger val) { int[] result = new int[Math.max(intLength(), val.intLength())]; - for (int i=0; i { * @throws ArithmeticException {@code n} is negative. */ public boolean testBit(int n) { - if (n<0) + if (n < 0) throw new ArithmeticException("Negative bit address"); return (getInt(n >>> 5) & (1 << (n & 31))) != 0; @@ -2962,13 +3044,13 @@ public class BigInteger extends Number implements Comparable { * @throws ArithmeticException {@code n} is negative. */ public BigInteger setBit(int n) { - if (n<0) + if (n < 0) throw new ArithmeticException("Negative bit address"); int intNum = n >>> 5; int[] result = new int[Math.max(intLength(), intNum+2)]; - for (int i=0; i { * @throws ArithmeticException {@code n} is negative. */ public BigInteger clearBit(int n) { - if (n<0) + if (n < 0) throw new ArithmeticException("Negative bit address"); int intNum = n >>> 5; int[] result = new int[Math.max(intLength(), ((n + 1) >>> 5) + 1)]; - for (int i=0; i { * @throws ArithmeticException {@code n} is negative. */ public BigInteger flipBit(int n) { - if (n<0) + if (n < 0) throw new ArithmeticException("Negative bit address"); int intNum = n >>> 5; int[] result = new int[Math.max(intLength(), intNum+2)]; - for (int i=0; i { * Returns the index of the rightmost (lowest-order) one bit in this * BigInteger (the number of zero bits to the right of the rightmost * one bit). Returns -1 if this BigInteger contains no one bits. - * (Computes {@code (this==0? -1 : log2(this & -this))}.) + * (Computes {@code (this == 0? -1 : log2(this & -this))}.) * * @return index of the rightmost one bit in this BigInteger. */ @@ -3041,7 +3123,7 @@ public class BigInteger extends Number implements Comparable { } else { // Search for lowest order nonzero int int i,b; - for (i=0; (b = getInt(i))==0; i++) + for (i=0; (b = getInt(i)) == 0; i++) ; lsb += (i << 5) + Integer.numberOfTrailingZeros(b); } @@ -3102,12 +3184,12 @@ public class BigInteger extends Number implements Comparable { if (bc == -1) { // bitCount not initialized yet bc = 0; // offset by one to initialize // Count the bits in the magnitude - for (int i=0; i { assert val != Long.MIN_VALUE; int[] m1 = mag; int len = m1.length; - if(len > 2) { + if (len > 2) { return 1; } if (val < 0) { val = -val; } int highWord = (int)(val >>> 32); - if (highWord==0) { + if (highWord == 0) { if (len < 1) return -1; if (len > 1) @@ -3283,7 +3365,7 @@ public class BigInteger extends Number implements Comparable { * {@code val}. If they are equal, either may be returned. */ public BigInteger min(BigInteger val) { - return (compareTo(val)<0 ? this : val); + return (compareTo(val) < 0 ? this : val); } /** @@ -3294,7 +3376,7 @@ public class BigInteger extends Number implements Comparable { * {@code val}. If they are equal, either may be returned. */ public BigInteger max(BigInteger val) { - return (compareTo(val)>0 ? this : val); + return (compareTo(val) > 0 ? this : val); } @@ -3308,7 +3390,7 @@ public class BigInteger extends Number implements Comparable { public int hashCode() { int hashCode = 0; - for (int i=0; i { /** This method is used to perform toString when arguments are small. */ private String smallToString(int radix) { - if (signum == 0) + if (signum == 0) { return "0"; + } // Compute upper bound on number of digit groups and allocate space int maxNumDigitGroups = (4*mag.length + 6)/7; @@ -3382,16 +3465,18 @@ public class BigInteger extends Number implements Comparable { // Put sign (if any) and first digit group into result buffer StringBuilder buf = new StringBuilder(numGroups*digitsPerLong[radix]+1); - if (signum<0) + if (signum < 0) { buf.append('-'); + } buf.append(digitGroup[numGroups-1]); // Append remaining digit groups padded with leading zeros - for (int i=numGroups-2; i>=0; i--) { + for (int i=numGroups-2; i >= 0; i--) { // Prepend (any) leading zeros for this digit group int numLeadingZeros = digitsPerLong[radix]-digitGroup[i].length(); - if (numLeadingZeros != 0) + if (numLeadingZeros != 0) { buf.append(zeros[numLeadingZeros]); + } buf.append(digitGroup[i]); } return buf.toString(); @@ -3399,7 +3484,7 @@ public class BigInteger extends Number implements Comparable { /** * Converts the specified BigInteger to a string and appends to - * sb. This implements the recursive Schoenhage algorithm + * {@code sb}. This implements the recursive Schoenhage algorithm * for base conversions. *

    * See Knuth, Donald, _The Art of Computer Programming_, Vol. 2, @@ -3419,9 +3504,11 @@ public class BigInteger extends Number implements Comparable { // Pad with internal zeros if necessary. // Don't pad if we're at the beginning of the string. - if ((s.length() < digits) && (sb.length() > 0)) - for (int i=s.length(); i 0)) { + for (int i=s.length(); i < digits; i++) { // May be a faster way to sb.append('0'); // do this? + } + } sb.append(s); return; @@ -3450,7 +3537,7 @@ public class BigInteger extends Number implements Comparable { * If this value doesn't already exist in the cache, it is added. *

    * This could be changed to a more complicated caching method using - * Future. + * {@code Future}. */ private static BigInteger getRadixConversionCache(int radix, int exponent) { BigInteger[] cacheLine = powerCache[radix]; // volatile read @@ -3478,7 +3565,7 @@ public class BigInteger extends Number implements Comparable { static { zeros[63] = "000000000000000000000000000000000000000000000000000000000000000"; - for (int i=0; i<63; i++) + for (int i=0; i < 63; i++) zeros[i] = zeros[63].substring(0, i); } @@ -3516,7 +3603,7 @@ public class BigInteger extends Number implements Comparable { int byteLen = bitLength()/8 + 1; byte[] byteArray = new byte[byteLen]; - for (int i=byteLen-1, bytesCopied=4, nextInt=0, intIndex=0; i>=0; i--) { + for (int i=byteLen-1, bytesCopied=4, nextInt=0, intIndex=0; i >= 0; i--) { if (bytesCopied == 4) { nextInt = getInt(intIndex++); bytesCopied = 1; @@ -3568,7 +3655,7 @@ public class BigInteger extends Number implements Comparable { public long longValue() { long result = 0; - for (int i=1; i>=0; i--) + for (int i=1; i >= 0; i--) result = (result << 32) + (getInt(i) & LONG_MASK); return result; } @@ -3784,7 +3871,7 @@ public class BigInteger extends Number implements Comparable { int keep; // Find first nonzero byte - for (keep = 0; keep < byteLength && a[keep]==0; keep++) + for (keep = 0; keep < byteLength && a[keep] == 0; keep++) ; // Allocate new array and copy relevant part of input array @@ -3810,16 +3897,16 @@ public class BigInteger extends Number implements Comparable { int byteLength = a.length; // Find first non-sign (0xff) byte of input - for (keep=0; keep { } // Add one to one's complement to generate two's complement - for (int i=result.length-1; i>=0; i--) { + for (int i=result.length-1; i >= 0; i--) { result[i] = (int)((result[i] & LONG_MASK) + 1); if (result[i] != 0) break; @@ -3857,23 +3944,23 @@ public class BigInteger extends Number implements Comparable { int keep, j; // Find first non-sign (0xffffffff) int of input - for (keep=0; keep { byte[] result = new byte[byteLen]; for (int i = byteLen - 1, bytesCopied = 4, intIndex = len - 1, nextInt = 0; - i>=0; i--) { + i >= 0; i--) { if (bytesCopied == 4) { nextInt = mag[intIndex--]; bytesCopied = 1; diff --git a/jdk/src/share/classes/java/math/MutableBigInteger.java b/jdk/src/share/classes/java/math/MutableBigInteger.java index 363e5d46e02..804d8be8e7a 100644 --- a/jdk/src/share/classes/java/math/MutableBigInteger.java +++ b/jdk/src/share/classes/java/math/MutableBigInteger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,13 +38,13 @@ package java.math; * * @see BigInteger * @author Michael McCloskey + * @author Timothy Buktu * @since 1.3 */ -import java.util.Arrays; - -import static java.math.BigInteger.LONG_MASK; import static java.math.BigDecimal.INFLATED; +import static java.math.BigInteger.LONG_MASK; +import java.util.Arrays; class MutableBigInteger { /** @@ -75,6 +75,24 @@ class MutableBigInteger { */ static final MutableBigInteger ONE = new MutableBigInteger(1); + /** + * The minimum {@code intLen} for cancelling powers of two before + * dividing. + * If the number of ints is less than this threshold, + * {@code divideKnuth} does not eliminate common powers of two from + * the dividend and divisor. + */ + static final int KNUTH_POW2_THRESH_LEN = 6; + + /** + * The minimum number of trailing zero ints for cancelling powers of two + * before dividing. + * If the dividend and divisor don't share at least this many zero ints + * at the end, {@code divideKnuth} does not eliminate common powers + * of two from the dividend and divisor. + */ + static final int KNUTH_POW2_THRESH_ZEROS = 3; + // Constructors /** @@ -123,6 +141,20 @@ class MutableBigInteger { value = Arrays.copyOfRange(val.value, val.offset, val.offset + intLen); } + /** + * Makes this number an {@code n}-int number all of whose bits are ones. + * Used by Burnikel-Ziegler division. + * @param n number of ints in the {@code value} array + * @return a number equal to {@code ((1<<(32*n)))-1} + */ + private void ones(int n) { + if (n > value.length) + value = new int[n]; + Arrays.fill(value, -1); + offset = 0; + intLen = n; + } + /** * Internal helper method to return the magnitude array. The caller is not * supposed to modify the returned array. @@ -154,6 +186,14 @@ class MutableBigInteger { return new BigInteger(getMagnitudeArray(), sign); } + /** + * Converts this number to a nonnegative {@code BigInteger}. + */ + BigInteger toBigInteger() { + normalize(); + return toBigInteger(isZero() ? 0 : 1); + } + /** * Convert this MutableBigInteger to BigDecimal object with the specified sign * and scale. @@ -237,6 +277,32 @@ class MutableBigInteger { return 0; } + /** + * Returns a value equal to what {@code b.leftShift(32*ints); return compare(b);} + * would return, but doesn't change the value of {@code b}. + */ + private int compareShifted(MutableBigInteger b, int ints) { + int blen = b.intLen; + int alen = intLen - ints; + if (alen < blen) + return -1; + if (alen > blen) + return 1; + + // Add Integer.MIN_VALUE to make the comparison act as unsigned integer + // comparison. + int[] bval = b.value; + for (int i = offset, j = b.offset; i < alen + offset; i++, j++) { + int b1 = value[i] + 0x80000000; + int b2 = bval[j] + 0x80000000; + if (b1 < b2) + return -1; + if (b1 > b2) + return 1; + } + return 0; + } + /** * Compare this against half of a MutableBigInteger object (Needed for * remainder tests). @@ -247,7 +313,7 @@ class MutableBigInteger { int blen = b.intLen; int len = intLen; if (len <= 0) - return blen <=0 ? 0 : -1; + return blen <= 0 ? 0 : -1; if (len > blen) return 1; if (len < blen - 1) @@ -274,7 +340,7 @@ class MutableBigInteger { return v < hb ? -1 : 1; carry = (bv & 1) << 31; // carray will be either 0x80000000 or 0 } - return carry == 0? 0 : -1; + return carry == 0 ? 0 : -1; } /** @@ -285,10 +351,10 @@ class MutableBigInteger { if (intLen == 0) return -1; int j, b; - for (j=intLen-1; (j>0) && (value[j+offset]==0); j--) + for (j=intLen-1; (j > 0) && (value[j+offset] == 0); j--) ; b = value[j+offset]; - if (b==0) + if (b == 0) return -1; return ((intLen-1-j)<<5) + Integer.numberOfTrailingZeros(b); } @@ -329,11 +395,11 @@ class MutableBigInteger { int indexBound = index+intLen; do { index++; - } while(index < indexBound && value[index]==0); + } while(index < indexBound && value[index] == 0); int numZeros = index - offset; intLen -= numZeros; - offset = (intLen==0 ? 0 : offset+numZeros); + offset = (intLen == 0 ? 0 : offset+numZeros); } /** @@ -354,7 +420,7 @@ class MutableBigInteger { */ int[] toIntArray() { int[] result = new int[intLen]; - for(int i=0; i value.length) return false; - if (intLen ==0) + if (intLen == 0) return true; return (value[offset] != 0); } @@ -453,6 +519,17 @@ class MutableBigInteger { return b.toString(); } + /** + * Like {@link #rightShift(int)} but {@code n} can be greater than the length of the number. + */ + void safeRightShift(int n) { + if (n/32 >= intLen) { + reset(); + } else { + rightShift(n); + } + } + /** * Right shift this MutableBigInteger n bits. The MutableBigInteger is left * in normal form. @@ -474,6 +551,15 @@ class MutableBigInteger { } } + /** + * Like {@link #leftShift(int)} but {@code n} can be zero. + */ + void safeLeftShift(int n) { + if (n > 0) { + leftShift(n); + } + } + /** * Left shift this MutableBigInteger n bits. */ @@ -502,18 +588,18 @@ class MutableBigInteger { if (value.length < newLen) { // The array must grow int[] result = new int[newLen]; - for (int i=0; i= newLen) { // Use space on right - for(int i=0; ioffset; i--) { + for (int i=offset+intLen-1, c=val[i]; i > offset; i--) { int b = c; c = val[i-1]; val[i] = (c << n2) | (b >>> n); @@ -606,7 +692,7 @@ class MutableBigInteger { private final void primitiveLeftShift(int n) { int[] val = value; int n2 = 32 - n; - for (int i=offset, c=val[i], m=i+intLen-1; i>> n2); @@ -614,6 +700,35 @@ class MutableBigInteger { val[offset+intLen-1] <<= n; } + /** + * Returns a {@code BigInteger} equal to the {@code n} + * low ints of this number. + */ + private BigInteger getLower(int n) { + if (isZero()) { + return BigInteger.ZERO; + } else if (intLen < n) { + return toBigInteger(1); + } else { + // strip zeros + int len = n; + while (len > 0 && value[offset+intLen-len] == 0) + len--; + int sign = len > 0 ? 1 : 0; + return new BigInteger(Arrays.copyOfRange(value, offset+intLen-len, offset+intLen), sign); + } + } + + /** + * Discards all ints whose index is greater than {@code n}. + */ + private void keepLower(int n) { + if (intLen >= n) { + offset += intLen - n; + intLen = n; + } + } + /** * Adds the contents of two MutableBigInteger objects.The result * is placed within this MutableBigInteger. @@ -630,7 +745,7 @@ class MutableBigInteger { long carry = 0; // Add common parts of both numbers - while(x>0 && y>0) { + while(x > 0 && y > 0) { x--; y--; sum = (value[x+offset] & LONG_MASK) + (addend.value[y+addend.offset] & LONG_MASK) + carry; @@ -639,7 +754,7 @@ class MutableBigInteger { } // Add remainder of the longer number - while(x>0) { + while(x > 0) { x--; if (carry == 0 && result == value && rstart == (x + offset)) return; @@ -647,7 +762,7 @@ class MutableBigInteger { result[rstart--] = (int)sum; carry = sum >>> 32; } - while(y>0) { + while(y > 0) { y--; sum = (addend.value[y+addend.offset] & LONG_MASK) + carry; result[rstart--] = (int)sum; @@ -673,6 +788,123 @@ class MutableBigInteger { offset = result.length - resultLen; } + /** + * Adds the value of {@code addend} shifted {@code n} ints to the left. + * Has the same effect as {@code addend.leftShift(32*ints); add(addend);} + * but doesn't change the value of {@code addend}. + */ + void addShifted(MutableBigInteger addend, int n) { + if (addend.isZero()) { + return; + } + + int x = intLen; + int y = addend.intLen + n; + int resultLen = (intLen > y ? intLen : y); + int[] result = (value.length < resultLen ? new int[resultLen] : value); + + int rstart = result.length-1; + long sum; + long carry = 0; + + // Add common parts of both numbers + while (x > 0 && y > 0) { + x--; y--; + int bval = y+addend.offset < addend.value.length ? addend.value[y+addend.offset] : 0; + sum = (value[x+offset] & LONG_MASK) + + (bval & LONG_MASK) + carry; + result[rstart--] = (int)sum; + carry = sum >>> 32; + } + + // Add remainder of the longer number + while (x > 0) { + x--; + if (carry == 0 && result == value && rstart == (x + offset)) { + return; + } + sum = (value[x+offset] & LONG_MASK) + carry; + result[rstart--] = (int)sum; + carry = sum >>> 32; + } + while (y > 0) { + y--; + int bval = y+addend.offset < addend.value.length ? addend.value[y+addend.offset] : 0; + sum = (bval & LONG_MASK) + carry; + result[rstart--] = (int)sum; + carry = sum >>> 32; + } + + if (carry > 0) { // Result must grow in length + resultLen++; + if (result.length < resultLen) { + int temp[] = new int[resultLen]; + // Result one word longer from carry-out; copy low-order + // bits into new result. + System.arraycopy(result, 0, temp, 1, result.length); + temp[0] = 1; + result = temp; + } else { + result[rstart--] = 1; + } + } + + value = result; + intLen = resultLen; + offset = result.length - resultLen; + } + + /** + * Like {@link #addShifted(MutableBigInteger, int)} but {@code this.intLen} must + * not be greater than {@code n}. In other words, concatenates {@code this} + * and {@code addend}. + */ + void addDisjoint(MutableBigInteger addend, int n) { + if (addend.isZero()) + return; + + int x = intLen; + int y = addend.intLen + n; + int resultLen = (intLen > y ? intLen : y); + int[] result; + if (value.length < resultLen) + result = new int[resultLen]; + else { + result = value; + Arrays.fill(value, offset+intLen, value.length, 0); + } + + int rstart = result.length-1; + + // copy from this if needed + System.arraycopy(value, offset, result, rstart+1-x, x); + y -= x; + rstart -= x; + + int len = Math.min(y, addend.value.length-addend.offset); + System.arraycopy(addend.value, addend.offset, result, rstart+1-y, len); + + // zero the gap + for (int i=rstart+1-y+len; i < rstart+1; i++) + result[i] = 0; + + value = result; + intLen = resultLen; + offset = result.length - resultLen; + } + + /** + * Adds the low {@code n} ints of {@code addend}. + */ + void addLower(MutableBigInteger addend, int n) { + MutableBigInteger a = new MutableBigInteger(addend); + if (a.offset + a.intLen >= n) { + a.offset = a.offset + a.intLen - n; + a.intLen = n; + } + a.normalize(); + add(a); + } /** * Subtracts the smaller of this and b from the larger and places the @@ -704,7 +936,7 @@ class MutableBigInteger { int rstart = result.length - 1; // Subtract common parts of both numbers - while (y>0) { + while (y > 0) { x--; y--; diff = (a.value[x+a.offset] & LONG_MASK) - @@ -712,7 +944,7 @@ class MutableBigInteger { result[rstart--] = (int)diff; } // Subtract remainder of longer number - while (x>0) { + while (x > 0) { x--; diff = (a.value[x+a.offset] & LONG_MASK) - ((int)-(diff>>32)); result[rstart--] = (int)diff; @@ -733,7 +965,7 @@ class MutableBigInteger { private int difference(MutableBigInteger b) { MutableBigInteger a = this; int sign = a.compare(b); - if (sign ==0) + if (sign == 0) return 0; if (sign < 0) { MutableBigInteger tmp = a; @@ -746,14 +978,14 @@ class MutableBigInteger { int y = b.intLen; // Subtract common parts of both numbers - while (y>0) { + while (y > 0) { x--; y--; diff = (a.value[a.offset+ x] & LONG_MASK) - (b.value[b.offset+ y] & LONG_MASK) - ((int)-(diff>>32)); a.value[a.offset+x] = (int)diff; } // Subtract remainder of longer number - while (x>0) { + while (x > 0) { x--; diff = (a.value[a.offset+ x] & LONG_MASK) - ((int)-(diff>>32)); a.value[a.offset+x] = (int)diff; @@ -822,7 +1054,7 @@ class MutableBigInteger { // Perform the multiplication word by word long ylong = y & LONG_MASK; - int[] zval = (z.value.length= 0; i--) { @@ -906,6 +1138,31 @@ class MutableBigInteger { return rem; } + /** + * Calculates the quotient of this div b and places the quotient in the + * provided MutableBigInteger objects and the remainder object is returned. + * + */ + MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient) { + return divide(b,quotient,true); + } + + MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient, boolean needRemainder) { + if (intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD || + b.intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD) { + return divideKnuth(b, quotient, needRemainder); + } else { + return divideAndRemainderBurnikelZiegler(b, quotient); + } + } + + /** + * @see #divideKnuth(MutableBigInteger, MutableBigInteger, boolean) + */ + MutableBigInteger divideKnuth(MutableBigInteger b, MutableBigInteger quotient) { + return divideKnuth(b,quotient,true); + } + /** * Calculates the quotient of this div b and places the quotient in the * provided MutableBigInteger objects and the remainder object is returned. @@ -917,38 +1174,34 @@ class MutableBigInteger { * changed. * */ - MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient) { - return divide(b,quotient,true); - } - - MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient, boolean needReminder) { + MutableBigInteger divideKnuth(MutableBigInteger b, MutableBigInteger quotient, boolean needRemainder) { if (b.intLen == 0) throw new ArithmeticException("BigInteger divide by zero"); // Dividend is zero if (intLen == 0) { - quotient.intLen = quotient.offset; - return needReminder ? new MutableBigInteger() : null; + quotient.intLen = quotient.offset = 0; + return needRemainder ? new MutableBigInteger() : null; } int cmp = compare(b); // Dividend less than divisor if (cmp < 0) { quotient.intLen = quotient.offset = 0; - return needReminder ? new MutableBigInteger(this) : null; + return needRemainder ? new MutableBigInteger(this) : null; } // Dividend equal to divisor if (cmp == 0) { quotient.value[0] = quotient.intLen = 1; quotient.offset = 0; - return needReminder ? new MutableBigInteger() : null; + return needRemainder ? new MutableBigInteger() : null; } quotient.clear(); // Special case one word divisor if (b.intLen == 1) { int r = divideOneWord(b.value[b.offset], quotient); - if(needReminder) { + if(needRemainder) { if (r == 0) return new MutableBigInteger(); return new MutableBigInteger(r); @@ -956,7 +1209,220 @@ class MutableBigInteger { return null; } } - return divideMagnitude(b, quotient, needReminder); + + // Cancel common powers of two if we're above the KNUTH_POW2_* thresholds + if (intLen >= KNUTH_POW2_THRESH_LEN) { + int trailingZeroBits = Math.min(getLowestSetBit(), b.getLowestSetBit()); + if (trailingZeroBits >= KNUTH_POW2_THRESH_ZEROS*32) { + MutableBigInteger a = new MutableBigInteger(this); + b = new MutableBigInteger(b); + a.rightShift(trailingZeroBits); + b.rightShift(trailingZeroBits); + MutableBigInteger r = a.divideKnuth(b, quotient); + r.leftShift(trailingZeroBits); + return r; + } + } + + return divideMagnitude(b, quotient, needRemainder); + } + + /** + * Computes {@code this/b} and {@code this%b} using the + * Burnikel-Ziegler algorithm. + * This method implements algorithm 3 from pg. 9 of the Burnikel-Ziegler paper. + * The parameter beta was chosen to b 232 so almost all shifts are + * multiples of 32 bits.
    + * {@code this} and {@code b} must be nonnegative. + * @param b the divisor + * @param quotient output parameter for {@code this/b} + * @return the remainder + */ + MutableBigInteger divideAndRemainderBurnikelZiegler(MutableBigInteger b, MutableBigInteger quotient) { + int r = intLen; + int s = b.intLen; + + if (r < s) { + return this; + } else { + // Unlike Knuth division, we don't check for common powers of two here because + // BZ already runs faster if both numbers contain powers of two and cancelling them has no + // additional benefit. + + // step 1: let m = min{2^k | (2^k)*BURNIKEL_ZIEGLER_THRESHOLD > s} + int m = 1 << (32-Integer.numberOfLeadingZeros(s/BigInteger.BURNIKEL_ZIEGLER_THRESHOLD)); + + int j = (s+m-1) / m; // step 2a: j = ceil(s/m) + int n = j * m; // step 2b: block length in 32-bit units + int n32 = 32 * n; // block length in bits + int sigma = Math.max(0, n32 - b.bitLength()); // step 3: sigma = max{T | (2^T)*B < beta^n} + MutableBigInteger bShifted = new MutableBigInteger(b); + bShifted.safeLeftShift(sigma); // step 4a: shift b so its length is a multiple of n + safeLeftShift(sigma); // step 4b: shift this by the same amount + + // step 5: t is the number of blocks needed to accommodate this plus one additional bit + int t = (bitLength()+n32) / n32; + if (t < 2) { + t = 2; + } + + // step 6: conceptually split this into blocks a[t-1], ..., a[0] + MutableBigInteger a1 = getBlock(t-1, t, n); // the most significant block of this + + // step 7: z[t-2] = [a[t-1], a[t-2]] + MutableBigInteger z = getBlock(t-2, t, n); // the second to most significant block + z.addDisjoint(a1, n); // z[t-2] + + // do schoolbook division on blocks, dividing 2-block numbers by 1-block numbers + MutableBigInteger qi = new MutableBigInteger(); + MutableBigInteger ri; + quotient.offset = quotient.intLen = 0; + for (int i=t-2; i > 0; i--) { + // step 8a: compute (qi,ri) such that z=b*qi+ri + ri = z.divide2n1n(bShifted, qi); + + // step 8b: z = [ri, a[i-1]] + z = getBlock(i-1, t, n); // a[i-1] + z.addDisjoint(ri, n); + quotient.addShifted(qi, i*n); // update q (part of step 9) + } + // final iteration of step 8: do the loop one more time for i=0 but leave z unchanged + ri = z.divide2n1n(bShifted, qi); + quotient.add(qi); + + ri.rightShift(sigma); // step 9: this and b were shifted, so shift back + return ri; + } + } + + /** + * This method implements algorithm 1 from pg. 4 of the Burnikel-Ziegler paper. + * It divides a 2n-digit number by a n-digit number.
    + * The parameter beta is 232 so all shifts are multiples of 32 bits. + *
    + * {@code this} must be a nonnegative number such that {@code this.bitLength() <= 2*b.bitLength()} + * @param b a positive number such that {@code b.bitLength()} is even + * @param quotient output parameter for {@code this/b} + * @return {@code this%b} + */ + private MutableBigInteger divide2n1n(MutableBigInteger b, MutableBigInteger quotient) { + int n = b.intLen; + + // step 1: base case + if (n%2 != 0 || n < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD) { + return divideKnuth(b, quotient); + } + + // step 2: view this as [a1,a2,a3,a4] where each ai is n/2 ints or less + MutableBigInteger aUpper = new MutableBigInteger(this); + aUpper.safeRightShift(32*(n/2)); // aUpper = [a1,a2,a3] + keepLower(n/2); // this = a4 + + // step 3: q1=aUpper/b, r1=aUpper%b + MutableBigInteger q1 = new MutableBigInteger(); + MutableBigInteger r1 = aUpper.divide3n2n(b, q1); + + // step 4: quotient=[r1,this]/b, r2=[r1,this]%b + addDisjoint(r1, n/2); // this = [r1,this] + MutableBigInteger r2 = divide3n2n(b, quotient); + + // step 5: let quotient=[q1,quotient] and return r2 + quotient.addDisjoint(q1, n/2); + return r2; + } + + /** + * This method implements algorithm 2 from pg. 5 of the Burnikel-Ziegler paper. + * It divides a 3n-digit number by a 2n-digit number.
    + * The parameter beta is 232 so all shifts are multiples of 32 bits.
    + *
    + * {@code this} must be a nonnegative number such that {@code 2*this.bitLength() <= 3*b.bitLength()} + * @param quotient output parameter for {@code this/b} + * @return {@code this%b} + */ + private MutableBigInteger divide3n2n(MutableBigInteger b, MutableBigInteger quotient) { + int n = b.intLen / 2; // half the length of b in ints + + // step 1: view this as [a1,a2,a3] where each ai is n ints or less; let a12=[a1,a2] + MutableBigInteger a12 = new MutableBigInteger(this); + a12.safeRightShift(32*n); + + // step 2: view b as [b1,b2] where each bi is n ints or less + MutableBigInteger b1 = new MutableBigInteger(b); + b1.safeRightShift(n * 32); + BigInteger b2 = b.getLower(n); + + MutableBigInteger r; + MutableBigInteger d; + if (compareShifted(b, n) < 0) { + // step 3a: if a1=b1, let quotient=beta^n-1 and r=a12-b1*2^n+b1 + quotient.ones(n); + a12.add(b1); + b1.leftShift(32*n); + a12.subtract(b1); + r = a12; + + // step 4: d=quotient*b2=(b2 << 32*n) - b2 + d = new MutableBigInteger(b2); + d.leftShift(32 * n); + d.subtract(new MutableBigInteger(b2)); + } + + // step 5: r = r*beta^n + a3 - d (paper says a4) + // However, don't subtract d until after the while loop so r doesn't become negative + r.leftShift(32 * n); + r.addLower(this, n); + + // step 6: add b until r>=d + while (r.compare(d) < 0) { + r.add(b); + quotient.subtract(MutableBigInteger.ONE); + } + r.subtract(d); + + return r; + } + + /** + * Returns a {@code MutableBigInteger} containing {@code blockLength} ints from + * {@code this} number, starting at {@code index*blockLength}.
    + * Used by Burnikel-Ziegler division. + * @param index the block index + * @param numBlocks the total number of blocks in {@code this} number + * @param blockLength length of one block in units of 32 bits + * @return + */ + private MutableBigInteger getBlock(int index, int numBlocks, int blockLength) { + int blockStart = index * blockLength; + if (blockStart >= intLen) { + return new MutableBigInteger(); + } + + int blockEnd; + if (index == numBlocks-1) { + blockEnd = intLen; + } else { + blockEnd = (index+1) * blockLength; + } + if (blockEnd > intLen) { + return new MutableBigInteger(); + } + + int[] newVal = Arrays.copyOfRange(value, offset+intLen-blockEnd, offset+intLen-blockStart); + return new MutableBigInteger(newVal); + } + + /** @see BigInteger#bitLength() */ + int bitLength() { + if (intLen == 0) + return 0; + return intLen*32 - Integer.numberOfLeadingZeros(value[offset]); } /** @@ -1006,7 +1472,7 @@ class MutableBigInteger { */ private MutableBigInteger divideMagnitude(MutableBigInteger div, MutableBigInteger quotient, - boolean needReminder ) { + boolean needRemainder ) { // assert div.intLen > 1 // D1 normalize the divisor int shift = Integer.numberOfLeadingZeros(div.value[div.offset]); @@ -1017,7 +1483,7 @@ class MutableBigInteger { if (shift > 0) { divisor = new int[dlen]; copyAndShift(div.value,div.offset,dlen,divisor,0,shift); - if(Integer.numberOfLeadingZeros(value[offset])>=shift) { + if (Integer.numberOfLeadingZeros(value[offset]) >= shift) { int[] remarr = new int[intLen + 1]; rem = new MutableBigInteger(remarr); rem.intLen = intLen; @@ -1070,7 +1536,7 @@ class MutableBigInteger { int dl = divisor[1]; // D2 Initialize j - for(int j=0; j nh2) { // D6 Add back - if(needReminder) + if(needRemainder) divadd(divisor, rem.value, limit - 1 + 1 + rem.offset); qhat--; } @@ -1194,14 +1660,14 @@ class MutableBigInteger { } - if(needReminder) { + if (needRemainder) { // D8 Unnormalize if (shift > 0) rem.rightShift(shift); rem.normalize(); } quotient.normalize(); - return needReminder ? rem : null; + return needRemainder ? rem : null; } /** @@ -1367,7 +1833,7 @@ class MutableBigInteger { * This method divides a long quantity by an int to estimate * qhat for two multi precision numbers. It is used when * the signed value of n is less than zero. - * Returns long value where high 32 bits contain reminder value and + * Returns long value where high 32 bits contain remainder value and * low 32 bits contain quotient value. */ static long divWord(long n, int d) { @@ -1436,7 +1902,7 @@ class MutableBigInteger { } // step B2 - boolean uOdd = (k==s1); + boolean uOdd = (k == s1); MutableBigInteger t = uOdd ? v: u; int tsign = uOdd ? -1 : 1; @@ -1478,9 +1944,9 @@ class MutableBigInteger { * Calculate GCD of a and b interpreted as unsigned integers. */ static int binaryGcd(int a, int b) { - if (b==0) + if (b == 0) return a; - if (a==0) + if (a == 0) return b; // Right shift a & b till their last bits equal to 1. @@ -1582,7 +2048,7 @@ class MutableBigInteger { return result; } - /* + /** * Returns the multiplicative inverse of val mod 2^32. Assumes val is odd. */ static int inverseMod32(int val) { @@ -1595,7 +2061,7 @@ class MutableBigInteger { return t; } - /* + /** * Calculate the multiplicative inverse of 2^k mod mod, where mod is odd. */ static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) { @@ -1631,7 +2097,7 @@ class MutableBigInteger { } // The Almost Inverse Algorithm - while(!f.isOne()) { + while (!f.isOne()) { // If gcd(f, g) != 1, number is not invertible modulo mod if (f.isZero()) throw new ArithmeticException("BigInteger not invertible."); @@ -1665,7 +2131,7 @@ class MutableBigInteger { return fixup(c, p, k); } - /* + /** * The Fixup Algorithm * Calculates X such that X = C * 2^(-k) (mod P) * Assumes C

    > 5; i> 5; i < numWords; i++) { // V = R * c (mod 2^j) int v = r * c.value[c.offset + c.intLen-1]; // c = c + (v * p) diff --git a/jdk/src/share/classes/java/net/Authenticator.java b/jdk/src/share/classes/java/net/Authenticator.java index bc9945c5ddb..28df05ca0d3 100644 --- a/jdk/src/share/classes/java/net/Authenticator.java +++ b/jdk/src/share/classes/java/net/Authenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -103,17 +103,17 @@ class Authenticator { * Sets the authenticator that will be used by the networking code * when a proxy or an HTTP server asks for authentication. *

    - * First, if there is a security manager, its checkPermission + * First, if there is a security manager, its {@code checkPermission} * method is called with a - * NetPermission("setDefaultAuthenticator") permission. + * {@code NetPermission("setDefaultAuthenticator")} permission. * This may result in a java.lang.SecurityException. * - * @param a The authenticator to be set. If a is null then + * @param a The authenticator to be set. If a is {@code null} then * any previously set authenticator is removed. * * @throws SecurityException * if a security manager exists and its - * checkPermission method doesn't allow + * {@code checkPermission} method doesn't allow * setting the default authenticator. * * @see SecurityManager#checkPermission @@ -134,9 +134,9 @@ class Authenticator { * Ask the authenticator that has been registered with the system * for a password. *

    - * First, if there is a security manager, its checkPermission + * First, if there is a security manager, its {@code checkPermission} * method is called with a - * NetPermission("requestPasswordAuthentication") permission. + * {@code NetPermission("requestPasswordAuthentication")} permission. * This may result in a java.lang.SecurityException. * * @param addr The InetAddress of the site requesting authorization, @@ -151,7 +151,7 @@ class Authenticator { * * @throws SecurityException * if a security manager exists and its - * checkPermission method doesn't allow + * {@code checkPermission} method doesn't allow * the password authentication request. * * @see SecurityManager#checkPermission @@ -193,9 +193,9 @@ class Authenticator { * because the hostname can be provided in cases where the InetAddress * is not available. *

    - * First, if there is a security manager, its checkPermission + * First, if there is a security manager, its {@code checkPermission} * method is called with a - * NetPermission("requestPasswordAuthentication") permission. + * {@code NetPermission("requestPasswordAuthentication")} permission. * This may result in a java.lang.SecurityException. * * @param host The hostname of the site requesting authentication. @@ -211,7 +211,7 @@ class Authenticator { * * @throws SecurityException * if a security manager exists and its - * checkPermission method doesn't allow + * {@code checkPermission} method doesn't allow * the password authentication request. * * @see SecurityManager#checkPermission @@ -254,9 +254,9 @@ class Authenticator { * Ask the authenticator that has been registered with the system * for a password. *

    - * First, if there is a security manager, its checkPermission + * First, if there is a security manager, its {@code checkPermission} * method is called with a - * NetPermission("requestPasswordAuthentication") permission. + * {@code NetPermission("requestPasswordAuthentication")} permission. * This may result in a java.lang.SecurityException. * * @param host The hostname of the site requesting authentication. @@ -275,7 +275,7 @@ class Authenticator { * * @throws SecurityException * if a security manager exists and its - * checkPermission method doesn't allow + * {@code checkPermission} method doesn't allow * the password authentication request. * * @see SecurityManager#checkPermission @@ -320,8 +320,8 @@ class Authenticator { } /** - * Gets the hostname of the - * site or proxy requesting authentication, or null + * Gets the {@code hostname} of the + * site or proxy requesting authentication, or {@code null} * if not available. * * @return the hostname of the connection requiring authentication, or null @@ -333,8 +333,8 @@ class Authenticator { } /** - * Gets the InetAddress of the - * site requesting authorization, or null + * Gets the {@code InetAddress} of the + * site requesting authorization, or {@code null} * if not available. * * @return the InetAddress of the site requesting authorization, or null @@ -346,7 +346,7 @@ class Authenticator { /** * Gets the port number for the requested connection. - * @return an int indicating the + * @return an {@code int} indicating the * port for the requested connection. */ protected final int getRequestingPort() { diff --git a/jdk/src/share/classes/java/net/ContentHandler.java b/jdk/src/share/classes/java/net/ContentHandler.java index 79bcb0a30ca..8c585cbf354 100644 --- a/jdk/src/share/classes/java/net/ContentHandler.java +++ b/jdk/src/share/classes/java/net/ContentHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,21 +28,21 @@ package java.net; import java.io.IOException; /** - * The abstract class ContentHandler is the superclass - * of all classes that read an Object from a - * URLConnection. + * The abstract class {@code ContentHandler} is the superclass + * of all classes that read an {@code Object} from a + * {@code URLConnection}. *

    * An application does not generally call the - * getContent method in this class directly. Instead, an - * application calls the getContent method in class - * URL or in URLConnection. + * {@code getContent} method in this class directly. Instead, an + * application calls the {@code getContent} method in class + * {@code URL} or in {@code URLConnection}. * The application's content handler factory (an instance of a class that - * implements the interface ContentHandlerFactory set - * up by a call to setContentHandler) is - * called with a String giving the MIME type of the + * implements the interface {@code ContentHandlerFactory} set + * up by a call to {@code setContentHandler}) is + * called with a {@code String} giving the MIME type of the * object being received on the socket. The factory returns an - * instance of a subclass of ContentHandler, and its - * getContent method is called to create the object. + * instance of a subclass of {@code ContentHandler}, and its + * {@code getContent} method is called to create the object. *

    * If no content handler could be found, URLConnection will * look for a content handler in a user-defineable set of places. @@ -75,7 +75,7 @@ abstract public class ContentHandler { * creates an object from it. * * @param urlc a URL connection. - * @return the object read by the ContentHandler. + * @return the object read by the {@code ContentHandler}. * @exception IOException if an I/O error occurs while reading the object. */ abstract public Object getContent(URLConnection urlc) throws IOException; @@ -90,7 +90,7 @@ abstract public class ContentHandler { * * @param urlc a URL connection. * @param classes an array of types requested - * @return the object read by the ContentHandler that is + * @return the object read by the {@code ContentHandler} that is * the first match of the suggested types. * null if none of the requested are supported. * @exception IOException if an I/O error occurs while reading the object. diff --git a/jdk/src/share/classes/java/net/ContentHandlerFactory.java b/jdk/src/share/classes/java/net/ContentHandlerFactory.java index 69a909c5795..64112e3a806 100644 --- a/jdk/src/share/classes/java/net/ContentHandlerFactory.java +++ b/jdk/src/share/classes/java/net/ContentHandlerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,10 +28,10 @@ package java.net; /** * This interface defines a factory for content handlers. An * implementation of this interface should map a MIME type into an - * instance of ContentHandler. + * instance of {@code ContentHandler}. *

    - * This interface is used by the URLStreamHandler class - * to create a ContentHandler for a MIME type. + * This interface is used by the {@code URLStreamHandler} class + * to create a {@code ContentHandler} for a MIME type. * * @author James Gosling * @see java.net.ContentHandler @@ -40,13 +40,13 @@ package java.net; */ public interface ContentHandlerFactory { /** - * Creates a new ContentHandler to read an object from - * a URLStreamHandler. + * Creates a new {@code ContentHandler} to read an object from + * a {@code URLStreamHandler}. * * @param mimetype the MIME type for which a content handler is desired. - * @return a new ContentHandler to read an object from a - * URLStreamHandler. + * @return a new {@code ContentHandler} to read an object from a + * {@code URLStreamHandler}. * @see java.net.ContentHandler * @see java.net.URLStreamHandler */ diff --git a/jdk/src/share/classes/java/net/CookieHandler.java b/jdk/src/share/classes/java/net/CookieHandler.java index 3fbc5bc1ce1..ef91d009feb 100644 --- a/jdk/src/share/classes/java/net/CookieHandler.java +++ b/jdk/src/share/classes/java/net/CookieHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ public abstract class CookieHandler { * there is no system-wide cookie handler currently set. * @throws SecurityException * If a security manager has been installed and it denies - * {@link NetPermission}("getCookieHandler") + * {@link NetPermission}{@code ("getCookieHandler")} * @see #setDefault(CookieHandler) */ public synchronized static CookieHandler getDefault() { @@ -83,10 +83,10 @@ public abstract class CookieHandler { * Note: non-standard http protocol handlers may ignore this setting. * * @param cHandler The HTTP cookie handler, or - * null to unset. + * {@code null} to unset. * @throws SecurityException * If a security manager has been installed and it denies - * {@link NetPermission}("setCookieHandler") + * {@link NetPermission}{@code ("setCookieHandler")} * @see #getDefault() */ public synchronized static void setDefault(CookieHandler cHandler) { @@ -114,7 +114,7 @@ public abstract class CookieHandler { * called after all request headers related to choosing cookies * are added, and before the request is sent.

    * - * @param uri a URI representing the intended use for the + * @param uri a {@code URI} representing the intended use for the * cookies * @param requestHeaders - a Map from request header * field names to lists of field values representing @@ -136,7 +136,7 @@ public abstract class CookieHandler { * fields that are named Set-Cookie2, present in the response * headers into a cookie cache. * - * @param uri a URI where the cookies come from + * @param uri a {@code URI} where the cookies come from * @param responseHeaders an immutable map from field names to * lists of field values representing the response * header fields returned diff --git a/jdk/src/share/classes/java/net/CookieManager.java b/jdk/src/share/classes/java/net/CookieManager.java index b8cae55342b..bb80f0a7f25 100644 --- a/jdk/src/share/classes/java/net/CookieManager.java +++ b/jdk/src/share/classes/java/net/CookieManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,7 +131,7 @@ public class CookieManager extends CookieHandler * *

    This constructor will create new cookie manager with default * cookie store and accept policy. The effect is same as - * CookieManager(null, null). + * {@code CookieManager(null, null)}. */ public CookieManager() { this(null, null); @@ -141,12 +141,12 @@ public class CookieManager extends CookieHandler /** * Create a new cookie manager with specified cookie store and cookie policy. * - * @param store a CookieStore to be used by cookie manager. - * if null, cookie manager will use a default one, + * @param store a {@code CookieStore} to be used by cookie manager. + * if {@code null}, cookie manager will use a default one, * which is an in-memory CookieStore implmentation. - * @param cookiePolicy a CookiePolicy instance + * @param cookiePolicy a {@code CookiePolicy} instance * to be used by cookie manager as policy callback. - * if null, ACCEPT_ORIGINAL_SERVER will + * if {@code null}, ACCEPT_ORIGINAL_SERVER will * be used. */ public CookieManager(CookieStore store, @@ -170,11 +170,11 @@ public class CookieManager extends CookieHandler /** * To set the cookie policy of this cookie manager. * - *

    A instance of CookieManager will have + *

    A instance of {@code CookieManager} will have * cookie policy ACCEPT_ORIGINAL_SERVER by default. Users always * can call this method to set another cookie policy. * - * @param cookiePolicy the cookie policy. Can be null, which + * @param cookiePolicy the cookie policy. Can be {@code null}, which * has no effects on current cookie policy. */ public void setCookiePolicy(CookiePolicy cookiePolicy) { diff --git a/jdk/src/share/classes/java/net/CookiePolicy.java b/jdk/src/share/classes/java/net/CookiePolicy.java index 3de98f904da..80948359153 100644 --- a/jdk/src/share/classes/java/net/CookiePolicy.java +++ b/jdk/src/share/classes/java/net/CookiePolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,8 +71,8 @@ public interface CookiePolicy { * * @param uri the URI to consult accept policy with * @param cookie the HttpCookie object in question - * @return true if this cookie should be accepted; - * otherwise, false + * @return {@code true} if this cookie should be accepted; + * otherwise, {@code false} */ public boolean shouldAccept(URI uri, HttpCookie cookie); } diff --git a/jdk/src/share/classes/java/net/CookieStore.java b/jdk/src/share/classes/java/net/CookieStore.java index 89b9c41dd01..648817e4b52 100644 --- a/jdk/src/share/classes/java/net/CookieStore.java +++ b/jdk/src/share/classes/java/net/CookieStore.java @@ -32,8 +32,8 @@ import java.util.Map; * A CookieStore object represents a storage for cookie. Can store and retrieve * cookies. * - *

    {@link CookieManager} will call CookieStore.add to save cookies - * for every incoming HTTP response, and call CookieStore.get to + *

    {@link CookieManager} will call {@code CookieStore.add} to save cookies + * for every incoming HTTP response, and call {@code CookieStore.get} to * retrieve cookie for every outgoing HTTP request. A CookieStore * is responsible for removing HttpCookie instances which have expired. * @@ -55,11 +55,11 @@ public interface CookieStore { * then it is replaced with the new one. * * @param uri the uri this cookie associated with. - * if null, this cookie will not be associated + * if {@code null}, this cookie will not be associated * with an URI * @param cookie the cookie to store * - * @throws NullPointerException if cookie is null + * @throws NullPointerException if {@code cookie} is {@code null} * * @see #get * @@ -77,7 +77,7 @@ public interface CookieStore { * * @param uri the uri associated with the cookies to be returned * - * @throws NullPointerException if uri is null + * @throws NullPointerException if {@code uri} is {@code null} * * @see #add * @@ -108,14 +108,14 @@ public interface CookieStore { * Remove a cookie from store. * * @param uri the uri this cookie associated with. - * if null, the cookie to be removed is not associated - * with an URI when added; if not null, the cookie + * if {@code null}, the cookie to be removed is not associated + * with an URI when added; if not {@code null}, the cookie * to be removed is associated with the given URI when added. * @param cookie the cookie to remove * - * @return true if this store contained the specified cookie + * @return {@code true} if this store contained the specified cookie * - * @throws NullPointerException if cookie is null + * @throws NullPointerException if {@code cookie} is {@code null} */ public boolean remove(URI uri, HttpCookie cookie); @@ -123,7 +123,7 @@ public interface CookieStore { /** * Remove all cookies in this cookie store. * - * @return true if this store changed as a result of the call + * @return {@code true} if this store changed as a result of the call */ public boolean removeAll(); } diff --git a/jdk/src/share/classes/java/net/DatagramPacket.java b/jdk/src/share/classes/java/net/DatagramPacket.java index 1f6af9eb939..b0728f01cd0 100644 --- a/jdk/src/share/classes/java/net/DatagramPacket.java +++ b/jdk/src/share/classes/java/net/DatagramPacket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,11 +68,11 @@ class DatagramPacket { int port; /** - * Constructs a DatagramPacket for receiving packets of - * length length, specifying an offset into the buffer. + * Constructs a {@code DatagramPacket} for receiving packets of + * length {@code length}, specifying an offset into the buffer. *

    - * The length argument must be less than or equal to - * buf.length. + * The {@code length} argument must be less than or equal to + * {@code buf.length}. * * @param buf buffer for holding the incoming datagram. * @param offset the offset for the buffer @@ -87,11 +87,11 @@ class DatagramPacket { } /** - * Constructs a DatagramPacket for receiving packets of - * length length. + * Constructs a {@code DatagramPacket} for receiving packets of + * length {@code length}. *

    - * The length argument must be less than or equal to - * buf.length. + * The {@code length} argument must be less than or equal to + * {@code buf.length}. * * @param buf buffer for holding the incoming datagram. * @param length the number of bytes to read. @@ -102,10 +102,10 @@ class DatagramPacket { /** * Constructs a datagram packet for sending packets of length - * length with offset ioffsetto the + * {@code length} with offset {@code ioffset}to the * specified port number on the specified host. The - * length argument must be less than or equal to - * buf.length. + * {@code length} argument must be less than or equal to + * {@code buf.length}. * * @param buf the packet data. * @param offset the packet data offset. @@ -125,10 +125,10 @@ class DatagramPacket { /** * Constructs a datagram packet for sending packets of length - * length with offset ioffsetto the + * {@code length} with offset {@code ioffset}to the * specified port number on the specified host. The - * length argument must be less than or equal to - * buf.length. + * {@code length} argument must be less than or equal to + * {@code buf.length}. * * @param buf the packet data. * @param offset the packet data offset. @@ -147,9 +147,9 @@ class DatagramPacket { /** * Constructs a datagram packet for sending packets of length - * length to the specified port number on the specified - * host. The length argument must be less than or equal - * to buf.length. + * {@code length} to the specified port number on the specified + * host. The {@code length} argument must be less than or equal + * to {@code buf.length}. * * @param buf the packet data. * @param length the packet length. @@ -164,9 +164,9 @@ class DatagramPacket { /** * Constructs a datagram packet for sending packets of length - * length to the specified port number on the specified - * host. The length argument must be less than or equal - * to buf.length. + * {@code length} to the specified port number on the specified + * host. The {@code length} argument must be less than or equal + * to {@code buf.length}. * * @param buf the packet data. * @param length the packet length. @@ -207,8 +207,8 @@ class DatagramPacket { /** * Returns the data buffer. The data received or the data to be sent - * starts from the offset in the buffer, - * and runs for length long. + * starts from the {@code offset} in the buffer, + * and runs for {@code length} long. * * @return the buffer used to receive or send data * @see #setData(byte[], int, int) @@ -277,7 +277,7 @@ class DatagramPacket { /** * Sets the IP address of the machine to which this datagram * is being sent. - * @param iaddr the InetAddress + * @param iaddr the {@code InetAddress} * @since JDK1.1 * @see #getAddress() */ @@ -303,7 +303,7 @@ class DatagramPacket { * Sets the SocketAddress (usually IP address + port number) of the remote * host to which this datagram is being sent. * - * @param address the SocketAddress + * @param address the {@code SocketAddress} * @throws IllegalArgumentException if address is null or is a * SocketAddress subclass not supported by this socket * @@ -324,7 +324,7 @@ class DatagramPacket { * Gets the SocketAddress (usually IP address + port number) of the remote * host that this packet is being sent to or is coming from. * - * @return the SocketAddress + * @return the {@code SocketAddress} * @since 1.4 * @see #setSocketAddress */ @@ -335,7 +335,7 @@ class DatagramPacket { /** * Set the data buffer for this packet. With the offset of * this DatagramPacket set to 0, and the length set to - * the length of buf. + * the length of {@code buf}. * * @param buf the buffer to set for this packet. * diff --git a/jdk/src/share/classes/java/net/DatagramSocket.java b/jdk/src/share/classes/java/net/DatagramSocket.java index d6ffca23755..ab60a263ac7 100644 --- a/jdk/src/share/classes/java/net/DatagramSocket.java +++ b/jdk/src/share/classes/java/net/DatagramSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,14 +47,14 @@ import java.security.PrivilegedExceptionAction; * a DatagramSocket is bound to a more specific address. *

    * Example: - * + * {@code * DatagramSocket s = new DatagramSocket(null); * s.bind(new InetSocketAddress(8888)); - * + * } * Which is equivalent to: - * + * {@code * DatagramSocket s = new DatagramSocket(8888); - * + * } * Both cases will create a DatagramSocket able to receive broadcasts on * UDP port 8888. * @@ -161,14 +161,14 @@ class DatagramSocket implements java.io.Closeable { * an IP address chosen by the kernel. * *

    If there is a security manager, - * its checkListen method is first called + * its {@code checkListen} method is first called * with 0 as its argument to ensure the operation is allowed. * This could result in a SecurityException. * * @exception SocketException if the socket could not be opened, * or the socket could not bind to the specified local port. * @exception SecurityException if a security manager exists and its - * checkListen method doesn't allow the operation. + * {@code checkListen} method doesn't allow the operation. * * @see SecurityManager#checkListen */ @@ -195,21 +195,21 @@ class DatagramSocket implements java.io.Closeable { * Creates a datagram socket, bound to the specified local * socket address. *

    - * If, if the address is null, creates an unbound socket. + * If, if the address is {@code null}, creates an unbound socket. *

    *

    If there is a security manager, - * its checkListen method is first called + * its {@code checkListen} method is first called * with the port from the socket address * as its argument to ensure the operation is allowed. * This could result in a SecurityException. * - * @param bindaddr local socket address to bind, or null + * @param bindaddr local socket address to bind, or {@code null} * for an unbound socket. * * @exception SocketException if the socket could not be opened, * or the socket could not bind to the specified local port. * @exception SecurityException if a security manager exists and its - * checkListen method doesn't allow the operation. + * {@code checkListen} method doesn't allow the operation. * * @see SecurityManager#checkListen * @since 1.4 @@ -234,8 +234,8 @@ class DatagramSocket implements java.io.Closeable { * an IP address chosen by the kernel. * *

    If there is a security manager, - * its checkListen method is first called - * with the port argument + * its {@code checkListen} method is first called + * with the {@code port} argument * as its argument to ensure the operation is allowed. * This could result in a SecurityException. * @@ -243,7 +243,7 @@ class DatagramSocket implements java.io.Closeable { * @exception SocketException if the socket could not be opened, * or the socket could not bind to the specified local port. * @exception SecurityException if a security manager exists and its - * checkListen method doesn't allow the operation. + * {@code checkListen} method doesn't allow the operation. * * @see SecurityManager#checkListen */ @@ -259,8 +259,8 @@ class DatagramSocket implements java.io.Closeable { * an IP address chosen by the kernel. * *

    If there is a security manager, - * its checkListen method is first called - * with the port argument + * its {@code checkListen} method is first called + * with the {@code port} argument * as its argument to ensure the operation is allowed. * This could result in a SecurityException. * @@ -270,7 +270,7 @@ class DatagramSocket implements java.io.Closeable { * @exception SocketException if the socket could not be opened, * or the socket could not bind to the specified local port. * @exception SecurityException if a security manager exists and its - * checkListen method doesn't allow the operation. + * {@code checkListen} method doesn't allow the operation. * * @see SecurityManager#checkListen * @since JDK1.1 @@ -319,10 +319,10 @@ class DatagramSocket implements java.io.Closeable { } /** - * Get the DatagramSocketImpl attached to this socket, + * Get the {@code DatagramSocketImpl} attached to this socket, * creating it if necessary. * - * @return the DatagramSocketImpl attached to that + * @return the {@code DatagramSocketImpl} attached to that * DatagramSocket * @throws SocketException if creation fails. * @since 1.4 @@ -336,14 +336,14 @@ class DatagramSocket implements java.io.Closeable { /** * Binds this DatagramSocket to a specific address and port. *

    - * If the address is null, then the system will pick up + * If the address is {@code null}, then the system will pick up * an ephemeral port and a valid local address to bind the socket. *

    * @param addr The address and port to bind to. * @throws SocketException if any error happens during the bind, or if the * socket is already bound. * @throws SecurityException if a security manager exists and its - * checkListen method doesn't allow the operation. + * {@code checkListen} method doesn't allow the operation. * @throws IllegalArgumentException if addr is a SocketAddress subclass * not supported by this socket. * @since 1.4 @@ -496,7 +496,7 @@ class DatagramSocket implements java.io.Closeable { * Returns the binding state of the socket. *

    * If the socket was bound prior to being {@link #close closed}, - * then this method will continue to return true + * then this method will continue to return {@code true} * after the socket is closed. * * @return true if the socket successfully bound to an address @@ -510,7 +510,7 @@ class DatagramSocket implements java.io.Closeable { * Returns the connection state of the socket. *

    * If the socket was connected prior to being {@link #close closed}, - * then this method will continue to return true + * then this method will continue to return {@code true} * after the socket is closed. * * @return true if the socket successfully connected to a server @@ -522,7 +522,7 @@ class DatagramSocket implements java.io.Closeable { /** * Returns the address to which this socket is connected. Returns - * null if the socket is not connected. + * {@code null} if the socket is not connected. *

    * If the socket was connected prior to being {@link #close closed}, * then this method will continue to return the connected address @@ -536,7 +536,7 @@ class DatagramSocket implements java.io.Closeable { /** * Returns the port number to which this socket is connected. - * Returns -1 if the socket is not connected. + * Returns {@code -1} if the socket is not connected. *

    * If the socket was connected prior to being {@link #close closed}, * then this method will continue to return the connected port number @@ -550,14 +550,14 @@ class DatagramSocket implements java.io.Closeable { /** * Returns the address of the endpoint this socket is connected to, or - * null if it is unconnected. + * {@code null} if it is unconnected. *

    * If the socket was connected prior to being {@link #close closed}, * then this method will continue to return the connected address * after the socket is closed. * - * @return a SocketAddress representing the remote - * endpoint of this socket, or null if it is + * @return a {@code SocketAddress} representing the remote + * endpoint of this socket, or {@code null} if it is * not connected yet. * @see #getInetAddress() * @see #getPort() @@ -573,8 +573,8 @@ class DatagramSocket implements java.io.Closeable { /** * Returns the address of the endpoint this socket is bound to. * - * @return a SocketAddress representing the local endpoint of this - * socket, or null if it is closed or not bound yet. + * @return a {@code SocketAddress} representing the local endpoint of this + * socket, or {@code null} if it is closed or not bound yet. * @see #getLocalAddress() * @see #getLocalPort() * @see #bind(SocketAddress) @@ -591,28 +591,28 @@ class DatagramSocket implements java.io.Closeable { /** * Sends a datagram packet from this socket. The - * DatagramPacket includes information indicating the + * {@code DatagramPacket} includes information indicating the * data to be sent, its length, the IP address of the remote host, * and the port number on the remote host. * *

    If there is a security manager, and the socket is not currently * connected to a remote address, this method first performs some - * security checks. First, if p.getAddress().isMulticastAddress() + * security checks. First, if {@code p.getAddress().isMulticastAddress()} * is true, this method calls the - * security manager's checkMulticast method - * with p.getAddress() as its argument. + * security manager's {@code checkMulticast} method + * with {@code p.getAddress()} as its argument. * If the evaluation of that expression is false, * this method instead calls the security manager's - * checkConnect method with arguments - * p.getAddress().getHostAddress() and - * p.getPort(). Each call to a security manager method + * {@code checkConnect} method with arguments + * {@code p.getAddress().getHostAddress()} and + * {@code p.getPort()}. Each call to a security manager method * could result in a SecurityException if the operation is not allowed. * - * @param p the DatagramPacket to be sent. + * @param p the {@code DatagramPacket} to be sent. * * @exception IOException if an I/O error occurs. * @exception SecurityException if a security manager exists and its - * checkMulticast or checkConnect + * {@code checkMulticast} or {@code checkConnect} * method doesn't allow the send. * @exception PortUnreachableException may be thrown if the socket is connected * to a currently unreachable destination. Note, there is no @@ -674,20 +674,20 @@ class DatagramSocket implements java.io.Closeable { /** * Receives a datagram packet from this socket. When this method - * returns, the DatagramPacket's buffer is filled with + * returns, the {@code DatagramPacket}'s buffer is filled with * the data received. The datagram packet also contains the sender's * IP address, and the port number on the sender's machine. *

    * This method blocks until a datagram is received. The - * length field of the datagram packet object contains + * {@code length} field of the datagram packet object contains * the length of the received message. If the message is longer than * the packet's length, the message is truncated. *

    * If there is a security manager, a packet cannot be received if the - * security manager's checkAccept method + * security manager's {@code checkAccept} method * does not allow it. * - * @param p the DatagramPacket into which to place + * @param p the {@code DatagramPacket} into which to place * the incoming data. * @exception IOException if an I/O error occurs. * @exception SocketTimeoutException if setSoTimeout was previously called @@ -786,17 +786,17 @@ class DatagramSocket implements java.io.Closeable { * Gets the local address to which the socket is bound. * *

    If there is a security manager, its - * checkConnect method is first called - * with the host address and -1 + * {@code checkConnect} method is first called + * with the host address and {@code -1} * as its arguments to see if the operation is allowed. * * @see SecurityManager#checkConnect * @return the local address to which the socket is bound, - * null if the socket is closed, or - * an InetAddress representing + * {@code null} if the socket is closed, or + * an {@code InetAddress} representing * {@link InetAddress#isAnyLocalAddress wildcard} * address if either the socket is not bound, or - * the security manager checkConnect + * the security manager {@code checkConnect} * method does not allow the operation * @since 1.1 */ @@ -824,8 +824,8 @@ class DatagramSocket implements java.io.Closeable { * is bound. * * @return the port number on the local host to which this socket is bound, - -1 if the socket is closed, or - 0 if it is not bound yet. + {@code -1} if the socket is closed, or + {@code 0} if it is not bound yet. */ public int getLocalPort() { if (isClosed()) @@ -883,7 +883,7 @@ class DatagramSocket implements java.io.Closeable { /** * Sets the SO_SNDBUF option to the specified value for this - * DatagramSocket. The SO_SNDBUF option is used by the + * {@code DatagramSocket}. The SO_SNDBUF option is used by the * network implementation as a hint to size the underlying * network I/O buffers. The SO_SNDBUF setting may also be used * by the network implementation to determine the maximum size @@ -897,7 +897,7 @@ class DatagramSocket implements java.io.Closeable { * is high. *

    * Note: If {@link #send(DatagramPacket)} is used to send a - * DatagramPacket that is larger than the setting + * {@code DatagramPacket} that is larger than the setting * of SO_SNDBUF then it is implementation specific if the * packet is sent or discarded. * @@ -921,10 +921,10 @@ class DatagramSocket implements java.io.Closeable { } /** - * Get value of the SO_SNDBUF option for this DatagramSocket, that is the - * buffer size used by the platform for output on this DatagramSocket. + * Get value of the SO_SNDBUF option for this {@code DatagramSocket}, that is the + * buffer size used by the platform for output on this {@code DatagramSocket}. * - * @return the value of the SO_SNDBUF option for this DatagramSocket + * @return the value of the SO_SNDBUF option for this {@code DatagramSocket} * @exception SocketException if there is an error in * the underlying protocol, such as an UDP error. * @see #setSendBufferSize @@ -942,7 +942,7 @@ class DatagramSocket implements java.io.Closeable { /** * Sets the SO_RCVBUF option to the specified value for this - * DatagramSocket. The SO_RCVBUF option is used by the + * {@code DatagramSocket}. The SO_RCVBUF option is used by the * the network implementation as a hint to size the underlying * network I/O buffers. The SO_RCVBUF setting may also be used * by the network implementation to determine the maximum size @@ -979,10 +979,10 @@ class DatagramSocket implements java.io.Closeable { } /** - * Get value of the SO_RCVBUF option for this DatagramSocket, that is the - * buffer size used by the platform for input on this DatagramSocket. + * Get value of the SO_RCVBUF option for this {@code DatagramSocket}, that is the + * buffer size used by the platform for input on this {@code DatagramSocket}. * - * @return the value of the SO_RCVBUF option for this DatagramSocket + * @return the value of the SO_RCVBUF option for this {@code DatagramSocket} * @exception SocketException if there is an error in the underlying protocol, such as an UDP error. * @see #setReceiveBufferSize(int) */ @@ -1005,26 +1005,26 @@ class DatagramSocket implements java.io.Closeable { * socket to the same socket address. This is typically for the * purpose of receiving multicast packets * (See {@link java.net.MulticastSocket}). The - * SO_REUSEADDR socket option allows multiple + * {@code SO_REUSEADDR} socket option allows multiple * sockets to be bound to the same socket address if the - * SO_REUSEADDR socket option is enabled prior + * {@code SO_REUSEADDR} socket option is enabled prior * to binding the socket using {@link #bind(SocketAddress)}. *

    * Note: This functionality is not supported by all existing platforms, * so it is implementation specific whether this option will be ignored * or not. However, if it is not supported then - * {@link #getReuseAddress()} will always return false. + * {@link #getReuseAddress()} will always return {@code false}. *

    - * When a DatagramSocket is created the initial setting - * of SO_REUSEADDR is disabled. + * When a {@code DatagramSocket} is created the initial setting + * of {@code SO_REUSEADDR} is disabled. *

    - * The behaviour when SO_REUSEADDR is enabled or + * The behaviour when {@code SO_REUSEADDR} is enabled or * disabled after a socket is bound (See {@link #isBound()}) * is not defined. * * @param on whether to enable or disable the * @exception SocketException if an error occurs enabling or - * disabling the SO_RESUEADDR socket option, + * disabling the {@code SO_RESUEADDR} socket option, * or the socket is closed. * @since 1.4 * @see #getReuseAddress() @@ -1045,7 +1045,7 @@ class DatagramSocket implements java.io.Closeable { /** * Tests if SO_REUSEADDR is enabled. * - * @return a boolean indicating whether or not SO_REUSEADDR is enabled. + * @return a {@code boolean} indicating whether or not SO_REUSEADDR is enabled. * @exception SocketException if there is an error * in the underlying protocol, such as an UDP error. * @since 1.4 @@ -1083,7 +1083,7 @@ class DatagramSocket implements java.io.Closeable { /** * Tests if SO_BROADCAST is enabled. - * @return a boolean indicating whether or not SO_BROADCAST is enabled. + * @return a {@code boolean} indicating whether or not SO_BROADCAST is enabled. * @exception SocketException if there is an error * in the underlying protocol, such as an UDP error. * @since 1.4 @@ -1105,7 +1105,7 @@ class DatagramSocket implements java.io.Closeable { * 255} or an IllegalArgumentException will be thrown. *

    Notes: *

    For Internet Protocol v4 the value consists of an - * integer, the least significant 8 bits of which + * {@code integer}, the least significant 8 bits of which * represent the value of the TOS octet in IP packets sent by * the socket. * RFC 1349 defines the TOS values as follows: @@ -1123,10 +1123,10 @@ class DatagramSocket implements java.io.Closeable { * SocketException indicating that the operation is not * permitted. *

    - * for Internet Protocol v6 tc is the value that + * for Internet Protocol v6 {@code tc} is the value that * would be placed into the sin6_flowinfo field of the IP header. * - * @param tc an int value for the bitset. + * @param tc an {@code int} value for the bitset. * @throws SocketException if there is an error setting the * traffic class or type-of-service * @since 1.4 @@ -1205,7 +1205,7 @@ class DatagramSocket implements java.io.Closeable { * DatagramChannel.open} method. * * @return the datagram channel associated with this datagram socket, - * or null if this socket was not created for a channel + * or {@code null} if this socket was not created for a channel * * @since 1.4 * @spec JSR-51 @@ -1224,14 +1224,14 @@ class DatagramSocket implements java.io.Closeable { * application. The factory can be specified only once. *

    * When an application creates a new datagram socket, the socket - * implementation factory's createDatagramSocketImpl method is + * implementation factory's {@code createDatagramSocketImpl} method is * called to create the actual datagram socket implementation. *

    - * Passing null to the method is a no-op unless the factory + * Passing {@code null} to the method is a no-op unless the factory * was already set. * *

    If there is a security manager, this method first calls - * the security manager's checkSetFactory method + * the security manager's {@code checkSetFactory} method * to ensure the operation is allowed. * This could result in a SecurityException. * @@ -1240,7 +1240,7 @@ class DatagramSocket implements java.io.Closeable { * datagram socket factory. * @exception SocketException if the factory is already defined. * @exception SecurityException if a security manager exists and its - * checkSetFactory method doesn't allow the + * {@code checkSetFactory} method doesn't allow the operation. * @see java.net.DatagramSocketImplFactory#createDatagramSocketImpl() diff --git a/jdk/src/share/classes/java/net/DatagramSocketImpl.java b/jdk/src/share/classes/java/net/DatagramSocketImpl.java index 3ed11e4b9d2..524f06b83ca 100644 --- a/jdk/src/share/classes/java/net/DatagramSocketImpl.java +++ b/jdk/src/share/classes/java/net/DatagramSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,7 +101,7 @@ public abstract class DatagramSocketImpl implements SocketOptions { protected void disconnect() {} /** - * Peek at the packet to see who it is from. Updates the specified InetAddress + * Peek at the packet to see who it is from. Updates the specified {@code InetAddress} * to the address which the packet came from. * @param i an InetAddress object * @return the port number which the packet came from. @@ -114,7 +114,7 @@ public abstract class DatagramSocketImpl implements SocketOptions { /** * Peek at the packet to see who it is from. The data is copied into the specified - * DatagramPacket. The data is returned, + * {@code DatagramPacket}. The data is returned, * but not consumed, so that a subsequent peekData/receive operation * will see the same data. * @param p the Packet Received. @@ -163,7 +163,7 @@ public abstract class DatagramSocketImpl implements SocketOptions { /** * Set the TTL (time-to-live) option. - * @param ttl an int specifying the time-to-live value + * @param ttl an {@code int} specifying the time-to-live value * @exception IOException if an I/O exception occurs * while setting the time-to-live option. * @see #getTimeToLive() @@ -174,7 +174,7 @@ public abstract class DatagramSocketImpl implements SocketOptions { * Retrieve the TTL (time-to-live) option. * @exception IOException if an I/O exception occurs * while retrieving the time-to-live option - * @return an int representing the time-to-live value + * @return an {@code int} representing the time-to-live value * @see #setTimeToLive(int) */ protected abstract int getTimeToLive() throws IOException; @@ -227,7 +227,7 @@ public abstract class DatagramSocketImpl implements SocketOptions { /** * Gets the local port. - * @return an int representing the local port value + * @return an {@code int} representing the local port value */ protected int getLocalPort() { return localPort; @@ -235,7 +235,7 @@ public abstract class DatagramSocketImpl implements SocketOptions { /** * Gets the datagram socket file descriptor. - * @return a FileDescriptor object representing the datagram socket + * @return a {@code FileDescriptor} object representing the datagram socket * file descriptor */ protected FileDescriptor getFileDescriptor() { diff --git a/jdk/src/share/classes/java/net/DatagramSocketImplFactory.java b/jdk/src/share/classes/java/net/DatagramSocketImplFactory.java index e89aeb30a6c..4d891962ae2 100644 --- a/jdk/src/share/classes/java/net/DatagramSocketImplFactory.java +++ b/jdk/src/share/classes/java/net/DatagramSocketImplFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ package java.net; /** * This interface defines a factory for datagram socket implementations. It - * is used by the classes DatagramSocket to create actual socket + * is used by the classes {@code DatagramSocket} to create actual socket * implementations. * * @author Yingxian Wang @@ -37,9 +37,9 @@ package java.net; public interface DatagramSocketImplFactory { /** - * Creates a new DatagramSocketImpl instance. + * Creates a new {@code DatagramSocketImpl} instance. * - * @return a new instance of DatagramSocketImpl. + * @return a new instance of {@code DatagramSocketImpl}. * @see java.net.DatagramSocketImpl */ DatagramSocketImpl createDatagramSocketImpl(); diff --git a/jdk/src/share/classes/java/net/FileNameMap.java b/jdk/src/share/classes/java/net/FileNameMap.java index b9bdb6e53e0..393b5aa6d9e 100644 --- a/jdk/src/share/classes/java/net/FileNameMap.java +++ b/jdk/src/share/classes/java/net/FileNameMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ public interface FileNameMap { /** * Gets the MIME type for the specified file name. * @param fileName the specified file name - * @return a String indicating the MIME + * @return a {@code String} indicating the MIME * type for the specified file name. */ public String getContentTypeFor(String fileName); diff --git a/jdk/src/share/classes/java/net/HttpCookie.java b/jdk/src/share/classes/java/net/HttpCookie.java index d265e284c26..fb02ae3e03d 100644 --- a/jdk/src/share/classes/java/net/HttpCookie.java +++ b/jdk/src/share/classes/java/net/HttpCookie.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -470,7 +470,7 @@ public final class HttpCookie implements Cloneable { * protocol. * * @return {@code false} if the cookie can be sent over any standard - * protocol; otherwise, true + * protocol; otherwise, {@code true} * * @see #setSecure */ diff --git a/jdk/src/share/classes/java/net/HttpRetryException.java b/jdk/src/share/classes/java/net/HttpRetryException.java index 8829c1e90dd..d498a653f1c 100644 --- a/jdk/src/share/classes/java/net/HttpRetryException.java +++ b/jdk/src/share/classes/java/net/HttpRetryException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ class HttpRetryException extends IOException { private String location; /** - * Constructs a new HttpRetryException from the + * Constructs a new {@code HttpRetryException} from the * specified response code and exception detail message * * @param detail the detail message. @@ -55,7 +55,7 @@ class HttpRetryException extends IOException { } /** - * Constructs a new HttpRetryException with detail message + * Constructs a new {@code HttpRetryException} with detail message * responseCode and the contents of the Location response header field. * * @param detail the detail message. diff --git a/jdk/src/share/classes/java/net/HttpURLConnection.java b/jdk/src/share/classes/java/net/HttpURLConnection.java index b93f1e731bd..be23241e5a6 100644 --- a/jdk/src/share/classes/java/net/HttpURLConnection.java +++ b/jdk/src/share/classes/java/net/HttpURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,14 +76,14 @@ abstract public class HttpURLConnection extends URLConnection { /** * The chunk-length when using chunked encoding streaming mode for output. - * A value of -1 means chunked encoding is disabled for output. + * A value of {@code -1} means chunked encoding is disabled for output. * @since 1.5 */ protected int chunkLength = -1; /** * The fixed content-length when using fixed-length streaming mode. - * A value of -1 means fixed-length streaming mode is disabled + * A value of {@code -1} means fixed-length streaming mode is disabled * for output. * *

    NOTE: {@link #fixedContentLengthLong} is recommended instead @@ -103,15 +103,15 @@ abstract public class HttpURLConnection extends URLConnection { protected long fixedContentLengthLong = -1; /** - * Returns the key for the nth header field. - * Some implementations may treat the 0th + * Returns the key for the {@code n}th header field. + * Some implementations may treat the {@code 0}th * header field as special, i.e. as the status line returned by the HTTP * server. In this case, {@link #getHeaderField(int) getHeaderField(0)} returns the status - * line, but getHeaderFieldKey(0) returns null. + * line, but {@code getHeaderFieldKey(0)} returns null. * * @param n an index, where {@code n >=0}. - * @return the key for the nth header field, - * or null if the key does not exist. + * @return the key for the {@code n}th header field, + * or {@code null} if the key does not exist. */ public String getHeaderFieldKey (int n) { return null; @@ -251,8 +251,8 @@ abstract public class HttpURLConnection extends URLConnection { } /** - * Returns the value for the nth header field. - * Some implementations may treat the 0th + * Returns the value for the {@code n}th header field. + * Some implementations may treat the {@code 0}th * header field as special, i.e. as the status line returned by the HTTP * server. *

    @@ -261,8 +261,8 @@ abstract public class HttpURLConnection extends URLConnection { * the headers in the message. * * @param n an index, where {@code n>=0}. - * @return the value of the nth header field, - * or null if the value does not exist. + * @return the value of the {@code n}th header field, + * or {@code null} if the value does not exist. * @see java.net.HttpURLConnection#getHeaderFieldKey(int) */ public String getHeaderField(int n) { @@ -270,7 +270,7 @@ abstract public class HttpURLConnection extends URLConnection { } /** - * An int representing the three digit HTTP Status-Code. + * An {@code int} representing the three digit HTTP Status-Code. *

      *
    • 1xx: Informational *
    • 2xx: Success @@ -292,12 +292,12 @@ abstract public class HttpURLConnection extends URLConnection { private static boolean followRedirects = true; /** - * If true, the protocol will automatically follow redirects. - * If false, the protocol will not automatically follow + * If {@code true}, the protocol will automatically follow redirects. + * If {@code false}, the protocol will not automatically follow * redirects. *

      - * This field is set by the setInstanceFollowRedirects - * method. Its value is returned by the getInstanceFollowRedirects + * This field is set by the {@code setInstanceFollowRedirects} + * method. Its value is returned by the {@code getInstanceFollowRedirects} * method. *

      * Its default value is based on the value of the static followRedirects @@ -328,14 +328,14 @@ abstract public class HttpURLConnection extends URLConnection { * cannot change this variable. *

      * If there is a security manager, this method first calls - * the security manager's checkSetFactory method + * the security manager's {@code checkSetFactory} method * to ensure the operation is allowed. * This could result in a SecurityException. * - * @param set a boolean indicating whether or not + * @param set a {@code boolean} indicating whether or not * to follow HTTP redirects. * @exception SecurityException if a security manager exists and its - * checkSetFactory method doesn't + * {@code checkSetFactory} method doesn't * allow the operation. * @see SecurityManager#checkSetFactory * @see #getFollowRedirects() @@ -350,12 +350,12 @@ abstract public class HttpURLConnection extends URLConnection { } /** - * Returns a boolean indicating + * Returns a {@code boolean} indicating * whether or not HTTP redirects (3xx) should * be automatically followed. * - * @return true if HTTP redirects should - * be automatically followed, false if not. + * @return {@code true} if HTTP redirects should + * be automatically followed, {@code false} if not. * @see #setFollowRedirects(boolean) */ public static boolean getFollowRedirects() { @@ -364,13 +364,13 @@ abstract public class HttpURLConnection extends URLConnection { /** * Sets whether HTTP redirects (requests with response code 3xx) should - * be automatically followed by this HttpURLConnection + * be automatically followed by this {@code HttpURLConnection} * instance. *

      * The default value comes from followRedirects, which defaults to * true. * - * @param followRedirects a boolean indicating + * @param followRedirects a {@code boolean} indicating * whether or not to follow HTTP redirects. * * @see java.net.HttpURLConnection#instanceFollowRedirects @@ -382,11 +382,11 @@ abstract public class HttpURLConnection extends URLConnection { } /** - * Returns the value of this HttpURLConnection's - * instanceFollowRedirects field. + * Returns the value of this {@code HttpURLConnection}'s + * {@code instanceFollowRedirects} field. * - * @return the value of this HttpURLConnection's - * instanceFollowRedirects field. + * @return the value of this {@code HttpURLConnection}'s + * {@code instanceFollowRedirects} field. * @see java.net.HttpURLConnection#instanceFollowRedirects * @see #setInstanceFollowRedirects(boolean) * @since 1.3 @@ -540,7 +540,7 @@ abstract public class HttpURLConnection extends URLConnection { * Returns null if none could be discerned from the responses * (the result was not valid HTTP). * @throws IOException if an error occurred connecting to the server. - * @return the HTTP response message, or null + * @return the HTTP response message, or {@code null} */ public String getResponseMessage() throws IOException { getResponseCode(); @@ -583,7 +583,7 @@ abstract public class HttpURLConnection extends URLConnection { * @exception IOException if an error occurs while computing * the permission. * - * @return a SocketPermission object representing the + * @return a {@code SocketPermission} object representing the * permission necessary to connect to the destination * host and port. */ diff --git a/jdk/src/share/classes/java/net/IDN.java b/jdk/src/share/classes/java/net/IDN.java index 563d356804f..0e481558956 100644 --- a/jdk/src/share/classes/java/net/IDN.java +++ b/jdk/src/share/classes/java/net/IDN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,7 +104,7 @@ public final class IDN { * @param input the string to be processed * @param flag process flag; can be 0 or any logical OR of possible flags * - * @return the translated String + * @return the translated {@code String} * * @throws IllegalArgumentException if the input string doesn't conform to RFC 3490 specification */ @@ -130,13 +130,13 @@ public final class IDN { * *

      This convenience method works as if by invoking the * two-argument counterpart as follows: - *

      + *
      * {@link #toASCII(String, int) toASCII}(input, 0); - *
      + *
      * * @param input the string to be processed * - * @return the translated String + * @return the translated {@code String} * * @throws IllegalArgumentException if the input string doesn't conform to RFC 3490 specification */ @@ -161,7 +161,7 @@ public final class IDN { * @param input the string to be processed * @param flag process flag; can be 0 or any logical OR of possible flags * - * @return the translated String + * @return the translated {@code String} */ public static String toUnicode(String input, int flag) { int p = 0, q = 0; @@ -184,13 +184,13 @@ public final class IDN { * *

      This convenience method works as if by invoking the * two-argument counterpart as follows: - *

      + *
      * {@link #toUnicode(String, int) toUnicode}(input, 0); - *
      + *
      * * @param input the string to be processed * - * @return the translated String + * @return the translated {@code String} */ public static String toUnicode(String input) { return toUnicode(input, 0); diff --git a/jdk/src/share/classes/java/net/Inet4Address.java b/jdk/src/share/classes/java/net/Inet4Address.java index 6c59a692f82..528b2767465 100644 --- a/jdk/src/share/classes/java/net/Inet4Address.java +++ b/jdk/src/share/classes/java/net/Inet4Address.java @@ -42,10 +42,10 @@ import java.io.ObjectStreamException; * takes one of the following forms: * *
      - * - * - * - * + * + * + * + * *
      d.d.d.d
      d.d.d
      d.d
      d
      {@code d.d.d.d}
      {@code d.d.d}
      {@code d.d}
      {@code d}
      * *

      When four parts are specified, each is interpreted as a byte of @@ -153,7 +153,7 @@ class Inet4Address extends InetAddress { * Utility routine to check if the InetAddress is an * IP multicast address. IP multicast address is a Class D * address i.e first four bits of the address are 1110. - * @return a boolean indicating if the InetAddress is + * @return a {@code boolean} indicating if the InetAddress is * an IP multicast address * @since JDK1.1 */ @@ -163,7 +163,7 @@ class Inet4Address 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 */ @@ -174,7 +174,7 @@ class Inet4Address extends InetAddress { /** * Utility routine to check if the InetAddress is a loopback address. * - * @return a boolean indicating if the InetAddress is + * @return a {@code boolean} indicating if the InetAddress is * a loopback address; or false otherwise. * @since 1.4 */ @@ -187,7 +187,7 @@ class Inet4Address extends InetAddress { /** * Utility routine to check if the InetAddress is an link local address. * - * @return a boolean indicating if the InetAddress is + * @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 */ @@ -204,7 +204,7 @@ class Inet4Address extends InetAddress { /** * Utility routine to check if the InetAddress is a site local address. * - * @return a boolean indicating if the InetAddress is + * @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 */ @@ -224,7 +224,7 @@ class Inet4Address extends InetAddress { /** * Utility routine to check if the multicast address has global scope. * - * @return a boolean indicating if the address has + * @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 @@ -240,7 +240,7 @@ class Inet4Address extends InetAddress { /** * Utility routine to check if the multicast address has node scope. * - * @return a boolean indicating if the address has + * @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 @@ -253,7 +253,7 @@ class Inet4Address extends InetAddress { /** * Utility routine to check if the multicast address has link scope. * - * @return a boolean indicating if the address has + * @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 @@ -269,7 +269,7 @@ class Inet4Address extends InetAddress { /** * Utility routine to check if the multicast address has site scope. * - * @return a boolean indicating if the address has + * @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 @@ -284,7 +284,7 @@ class Inet4Address extends InetAddress { /** * Utility routine to check if the multicast address has organization scope. * - * @return a boolean indicating if the address has + * @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 @@ -299,9 +299,9 @@ class Inet4Address extends InetAddress { } /** - * Returns the raw IP address of this InetAddress + * 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 getAddress()[0]. + * byte of the address is in {@code getAddress()[0]}. * * @return the raw IP address of this object. */ @@ -337,18 +337,18 @@ class Inet4Address 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 + * 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 InetAddress represent the same IP + * Two instances of {@code 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 + * {@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() */ public boolean equals(Object obj) { diff --git a/jdk/src/share/classes/java/net/Inet6Address.java b/jdk/src/share/classes/java/net/Inet6Address.java index 169a180de11..7b10db96c08 100644 --- a/jdk/src/share/classes/java/net/Inet6Address.java +++ b/jdk/src/share/classes/java/net/Inet6Address.java @@ -47,7 +47,7 @@ import java.util.Enumeration; * address. This is the full form. For example, * *

      - * + * *
      1080:0:0:0:8:800:200C:417A
      {@code 1080:0:0:0:8:800:200C:417A}
      * *

      Note that it is not necessary to write the leading zeros in @@ -64,7 +64,7 @@ import java.util.Enumeration; * zeros in an address. For example, * *

      - * + * *
      1080::8:800:200C:417A
      {@code 1080::8:800:200C:417A}
      * *
    • An alternative form that is sometimes more convenient @@ -75,8 +75,8 @@ import java.util.Enumeration; * standard IPv4 representation address, for example, * *

      - * - * + * + * *
      ::FFFF:129.144.52.38
      ::129.144.52.38
      {@code ::FFFF:129.144.52.38}
      {@code ::129.144.52.38}
      * *

      where "::FFFF:d.d.d.d" and "::d.d.d.d" are, respectively, the @@ -85,23 +85,23 @@ import java.util.Enumeration; * in the "d.d.d.d" form. The following forms are invalid: * *

      - * - * - * - * + * + * + * + * *
      ::FFFF:d.d.d
      ::FFFF:d.d
      ::d.d.d
      ::d.d
      {@code ::FFFF:d.d.d}
      {@code ::FFFF:d.d}
      {@code ::d.d.d}
      {@code ::d.d}
      * *

      The following form: * *

      - * + * *
      ::FFFF:d
      {@code ::FFFF:d}
      * *

      is valid, however it is an unconventional representation of * the IPv4-compatible IPv6 address, * *

      - * + * *
      ::255.255.0.d
      {@code ::255.255.0.d}
      * *

      while "::d" corresponds to the general IPv6 address @@ -258,7 +258,7 @@ 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 value corresponding to the given interface for the address - * type specified in addr. The call will fail with an + * type specified in {@code 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 diff --git a/jdk/src/share/classes/java/net/InetAddress.java b/jdk/src/share/classes/java/net/InetAddress.java index aa5ef16705d..0232cfc4198 100644 --- a/jdk/src/share/classes/java/net/InetAddress.java +++ b/jdk/src/share/classes/java/net/InetAddress.java @@ -296,7 +296,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the InetAddress is an * IP multicast address. - * @return a boolean indicating if the InetAddress is + * @return a {@code boolean} indicating if the InetAddress is * an IP multicast address * @since JDK1.1 */ @@ -306,7 +306,7 @@ class InetAddress implements java.io.Serializable { /** * 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 */ @@ -317,7 +317,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the InetAddress is a loopback address. * - * @return a boolean indicating if the InetAddress is + * @return a {@code boolean} indicating if the InetAddress is * a loopback address; or false otherwise. * @since 1.4 */ @@ -328,7 +328,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the InetAddress is an link local address. * - * @return a boolean indicating if the InetAddress is + * @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 */ @@ -339,7 +339,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the InetAddress is a site local address. * - * @return a boolean indicating if the InetAddress is + * @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 */ @@ -350,7 +350,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the multicast address has global scope. * - * @return a boolean indicating if the address has + * @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 @@ -362,7 +362,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the multicast address has node scope. * - * @return a boolean indicating if the address has + * @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 @@ -374,7 +374,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the multicast address has link scope. * - * @return a boolean indicating if the address has + * @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 @@ -386,7 +386,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the multicast address has site scope. * - * @return a boolean indicating if the address has + * @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 @@ -398,7 +398,7 @@ class InetAddress implements java.io.Serializable { /** * Utility routine to check if the multicast address has organization scope. * - * @return a boolean indicating if the address has + * @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 @@ -424,9 +424,9 @@ class InetAddress implements java.io.Serializable { * in an IllegalArgumentException being thrown. * * @param timeout the time, in milliseconds, before the call aborts - * @return a boolean indicating if the address is reachable. + * @return a {@code boolean} indicating if the address is reachable. * @throws IOException if a network error occurs - * @throws IllegalArgumentException if timeout is negative. + * @throws IllegalArgumentException if {@code timeout} is negative. * @since 1.5 */ public boolean isReachable(int timeout) throws IOException { @@ -442,10 +442,10 @@ class InetAddress implements java.io.Serializable { * privilege can be obtained, otherwise it will try to establish * a TCP connection on port 7 (Echo) of the destination host. *

      - * The network interface and ttl parameters + * The {@code network interface} and {@code ttl} parameters * let the caller specify which network interface the test will go through * and the maximum number of hops the packets should go through. - * A negative value for the ttl will result in an + * A negative value for the {@code ttl} will result in an * IllegalArgumentException being thrown. *

      * The timeout value, in milliseconds, indicates the maximum amount of time @@ -458,9 +458,9 @@ class InetAddress implements java.io.Serializable { * @param ttl the maximum numbers of hops to try or 0 for the * default * @param timeout the time, in milliseconds, before the call aborts - * @throws IllegalArgumentException if either timeout - * or ttl are negative. - * @return a booleanindicating if the address is reachable. + * @throws IllegalArgumentException if either {@code timeout} + * or {@code ttl} are negative. + * @return a {@code boolean}indicating if the address is reachable. * @throws IOException if a network error occurs * @since 1.5 */ @@ -486,8 +486,8 @@ class InetAddress implements java.io.Serializable { * {@link #getCanonicalHostName() getCanonicalHostName}. * *

      If there is a security manager, its - * checkConnect method is first called - * with the hostname and -1 + * {@code checkConnect} method is first called + * with the hostname and {@code -1} * as its arguments to see if the operation is allowed. * If the operation is not allowed, it will return * the textual representation of the IP address. @@ -511,8 +511,8 @@ class InetAddress implements java.io.Serializable { * here without a security check. * *

      If there is a security manager, this method first - * calls its checkConnect method - * with the hostname and -1 + * calls its {@code checkConnect} method + * with the hostname and {@code -1} * as its arguments to see if the calling code is allowed to know * the hostname for this IP address, i.e., to connect to the host. * If the operation is not allowed, it will return @@ -539,8 +539,8 @@ class InetAddress implements java.io.Serializable { * the FQDN depending on the underlying system configuration. * *

      If there is a security manager, this method first - * calls its checkConnect method - * with the hostname and -1 + * calls its {@code checkConnect} method + * with the hostname and {@code -1} * as its arguments to see if the calling code is allowed to know * the hostname for this IP address, i.e., to connect to the host. * If the operation is not allowed, it will return @@ -566,8 +566,8 @@ class InetAddress implements java.io.Serializable { * Returns the hostname for this address. * *

      If there is a security manager, this method first - * calls its checkConnect method - * with the hostname and -1 + * calls its {@code checkConnect} method + * with the hostname and {@code -1} * as its arguments to see if the calling code is allowed to know * the hostname for this IP address, i.e., to connect to the host. * If the operation is not allowed, it will return @@ -633,9 +633,9 @@ class InetAddress implements java.io.Serializable { } /** - * Returns the raw IP address of this InetAddress + * 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 getAddress()[0]. + * byte of the address is in {@code getAddress()[0]}. * * @return the raw IP address of this object. */ @@ -664,18 +664,18 @@ class InetAddress implements java.io.Serializable { /** * 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 + * 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 InetAddress represent the same IP + * Two instances of {@code 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 + * {@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() */ public boolean equals(Object obj) { @@ -683,7 +683,7 @@ class InetAddress implements java.io.Serializable { } /** - * Converts this IP address to a String. The + * Converts this IP address to a {@code String}. The * string returned is of the form: hostname / literal IP * address. * @@ -974,7 +974,7 @@ class InetAddress implements java.io.Serializable { * No name service is checked for the validity of the address. * *

      The host name can either be a machine name, such as - * "java.sun.com", or a textual representation of its IP + * "{@code java.sun.com}", or a textual representation of its IP * address. *

      No validity checking is done on the host name either. * @@ -1019,26 +1019,26 @@ class InetAddress implements java.io.Serializable { * Determines the IP address of a host, given the host's name. * *

      The host name can either be a machine name, such as - * "java.sun.com", or a textual representation of its + * "{@code java.sun.com}", or a textual representation of its * IP address. If a literal IP address is supplied, only the * validity of the address format is checked. * - *

      For host specified in literal IPv6 address, + *

      For {@code host} specified in literal IPv6 address, * either the form defined in RFC 2732 or the literal IPv6 address * format defined in RFC 2373 is accepted. IPv6 scoped addresses are also * supported. See here for a description of IPv6 * scoped addresses. * - *

      If the host is null then an InetAddress + *

      If the host is {@code null} then an {@code InetAddress} * representing an address of the loopback interface is returned. * See RFC 3330 * section 2 and RFC 2373 * section 2.5.3.

      * - * @param host the specified host, or null. + * @param host the specified host, or {@code null}. * @return an IP address for the given host name. * @exception UnknownHostException if no IP address for the - * host could be found, or if a scope_id was specified + * {@code host} could be found, or if a scope_id was specified * for a global IPv6 address. * @exception SecurityException if a security manager exists * and its checkConnect method doesn't allow the operation @@ -1059,37 +1059,37 @@ class InetAddress implements java.io.Serializable { * based on the configured name service on the system. * *

      The host name can either be a machine name, such as - * "java.sun.com", or a textual representation of its IP + * "{@code java.sun.com}", or a textual representation of its IP * address. If a literal IP address is supplied, only the * validity of the address format is checked. * - *

      For host specified in literal IPv6 address, + *

      For {@code host} specified in literal IPv6 address, * either the form defined in RFC 2732 or the literal IPv6 address * format defined in RFC 2373 is accepted. A literal IPv6 address may * also be qualified by appending a scoped zone identifier or scope_id. * The syntax and usage of scope_ids is described * here. - *

      If the host is null then an InetAddress + *

      If the host is {@code null} then an {@code InetAddress} * representing an address of the loopback interface is returned. * See RFC 3330 * section 2 and RFC 2373 * section 2.5.3.

      * - *

      If there is a security manager and host is not - * null and host.length() is not equal to zero, the + *

      If there is a security manager and {@code host} is not + * null and {@code host.length() } is not equal to zero, the * security manager's - * checkConnect method is called - * with the hostname and -1 + * {@code checkConnect} method is called + * with the hostname and {@code -1} * as its arguments to see if the operation is allowed. * - * @param host the name of the host, or null. + * @param host the name of the host, or {@code null}. * @return an array of all the IP addresses for a given host name. * * @exception UnknownHostException if no IP address for the - * host could be found, or if a scope_id was specified + * {@code host} could be found, or if a scope_id was specified * for a global IPv6 address. * @exception SecurityException if a security manager exists and its - * checkConnect method doesn't allow the operation. + * {@code checkConnect} method doesn't allow the operation. * * @see SecurityManager#checkConnect */ @@ -1389,9 +1389,9 @@ class InetAddress implements java.io.Serializable { } /** - * Returns an InetAddress object given the raw IP address . + * Returns an {@code InetAddress} object given the raw IP address . * The argument is in network byte order: the highest order - * byte of the address is in getAddress()[0]. + * byte of the address is in {@code getAddress()[0]}. * *

      This method doesn't block, i.e. no reverse name service lookup * is performed. @@ -1417,14 +1417,14 @@ class InetAddress implements java.io.Serializable { /** * Returns the address of the local host. This is achieved by retrieving * the name of the host from the system, then resolving that name into - * an InetAddress. + * an {@code InetAddress}. * *

      Note: The resolved address may be cached for a short period of time. *

      * *

      If there is a security manager, its - * checkConnect method is called - * with the local host name and -1 + * {@code checkConnect} method is called + * with the local host name and {@code -1} * as its arguments to see if the operation is allowed. * If the operation is not allowed, an InetAddress representing * the loopback address is returned. diff --git a/jdk/src/share/classes/java/net/InetSocketAddress.java b/jdk/src/share/classes/java/net/InetSocketAddress.java index 44604c664aa..6792979312b 100644 --- a/jdk/src/share/classes/java/net/InetSocketAddress.java +++ b/jdk/src/share/classes/java/net/InetSocketAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ import java.io.ObjectStreamField; * as returned values. *

      * The wildcard is a special local IP address. It usually means "any" - * and can only be used for bind operations. + * and can only be used for {@code bind} operations. * * @see java.net.Socket * @see java.net.ServerSocket @@ -155,8 +155,8 @@ public class InetSocketAddress * and the port number a specified value. *

      * A valid port value is between 0 and 65535. - * A port number of zero will let the system pick up an - * ephemeral port in a bind operation. + * A port number of {@code zero} will let the system pick up an + * ephemeral port in a {@code bind} operation. *

      * @param port The port number * @throws IllegalArgumentException if the port parameter is outside the specified @@ -171,10 +171,10 @@ public class InetSocketAddress * Creates a socket address from an IP address and a port number. *

      * A valid port value is between 0 and 65535. - * A port number of zero will let the system pick up an - * ephemeral port in a bind operation. + * A port number of {@code zero} will let the system pick up an + * ephemeral port in a {@code bind} operation. *

      - * A null address will assign the wildcard address. + * A {@code null} address will assign the wildcard address. *

      * @param addr The IP address * @param port The port number @@ -195,13 +195,13 @@ public class InetSocketAddress * An attempt will be made to resolve the hostname into an InetAddress. * If that attempt fails, the address will be flagged as unresolved. *

      - * If there is a security manager, its checkConnect method + * If there is a security manager, its {@code checkConnect} method * is called with the host name as its argument to check the permissiom * to resolve it. This could result in a SecurityException. *

      * A valid port value is between 0 and 65535. - * A port number of zero will let the system pick up an - * ephemeral port in a bind operation. + * A port number of {@code zero} will let the system pick up an + * ephemeral port in a {@code bind} operation. *

      * @param hostname the Host name * @param port The port number @@ -237,8 +237,8 @@ public class InetSocketAddress * The address will be flagged as unresolved. *

      * A valid port value is between 0 and 65535. - * A port number of zero will let the system pick up an - * ephemeral port in a bind operation. + * A port number of {@code zero} will let the system pick up an + * ephemeral port in a {@code bind} operation. *

      * @param host the Host name * @param port The port number @@ -246,7 +246,7 @@ public class InetSocketAddress * the range of valid port values, or if the hostname * parameter is null. * @see #isUnresolved() - * @return a InetSocketAddress representing the unresolved + * @return a {@code InetSocketAddress} representing the unresolved * socket address * @since 1.5 */ @@ -326,16 +326,16 @@ public class InetSocketAddress /** * - * Gets the InetAddress. + * Gets the {@code InetAddress}. * - * @return the InetAdress or null if it is unresolved. + * @return the InetAdress or {@code null} if it is unresolved. */ public final InetAddress getAddress() { return holder.getAddress(); } /** - * Gets the hostname. + * Gets the {@code hostname}. * Note: This method may trigger a name service reverse lookup if the * address was created with a literal IP address. * @@ -360,8 +360,8 @@ public class InetSocketAddress /** * Checks whether the address has been resolved or not. * - * @return true if the hostname couldn't be resolved into - * an InetAddress. + * @return {@code true} if the hostname couldn't be resolved into + * an {@code InetAddress}. */ public final boolean isUnresolved() { return holder.isUnresolved(); @@ -382,11 +382,11 @@ public class InetSocketAddress /** * 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 address as + * The result is {@code true} if and only if the argument is + * not {@code null} and it represents the same address as * this object. *

      - * Two instances of InetSocketAddress represent the same + * Two instances of {@code InetSocketAddress} represent the same * address if both the InetAddresses (or hostnames if it is unresolved) and port * numbers are equal. * If both addresses are unresolved, then the hostname and the port number @@ -396,8 +396,8 @@ public class InetSocketAddress * considered equal. * * @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#equals(java.lang.Object) */ @Override diff --git a/jdk/src/share/classes/java/net/InterfaceAddress.java b/jdk/src/share/classes/java/net/InterfaceAddress.java index 1fb18ae0f6c..704e1fae9d5 100644 --- a/jdk/src/share/classes/java/net/InterfaceAddress.java +++ b/jdk/src/share/classes/java/net/InterfaceAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,23 +47,23 @@ public class InterfaceAddress { } /** - * Returns an InetAddress for this address. + * Returns an {@code InetAddress} for this address. * - * @return the InetAddress for this address. + * @return the {@code InetAddress} for this address. */ public InetAddress getAddress() { return address; } /** - * Returns an InetAddress for the brodcast address + * Returns an {@code InetAddress} for the brodcast address * for this InterfaceAddress. *

      * Only IPv4 networks have broadcast address therefore, in the case - * of an IPv6 network, null will be returned. + * of an IPv6 network, {@code null} will be returned. * - * @return the InetAddress representing the broadcast - * address or null if there is no broadcast address. + * @return the {@code InetAddress} representing the broadcast + * address or {@code null} if there is no broadcast address. */ public InetAddress getBroadcast() { return broadcast; @@ -76,7 +76,7 @@ public class InterfaceAddress { * or 24 (255.255.255.0).

      * Typical IPv6 values would be 128 (::1/128) or 10 (fe80::203:baff:fe27:1243/10) * - * @return a short representing the prefix length for the + * @return a {@code short} representing the prefix length for the * subnet of that address. */ public short getNetworkPrefixLength() { @@ -85,17 +85,17 @@ public class InterfaceAddress { /** * 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 interface address as + * The result is {@code true} if and only if the argument is + * not {@code null} and it represents the same interface address as * this object. *

      - * Two instances of InterfaceAddress represent the same + * Two instances of {@code InterfaceAddress} represent the same * address if the InetAddress, the prefix length and the broadcast are * the same for both. * * @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.InterfaceAddress#hashCode() */ public boolean equals(Object obj) { @@ -122,7 +122,7 @@ public class InterfaceAddress { } /** - * Converts this Interface address to a String. The + * Converts this Interface address to a {@code String}. The * string returned is of the form: InetAddress / prefix length [ broadcast address ]. * * @return a string representation of this Interface address. diff --git a/jdk/src/share/classes/java/net/JarURLConnection.java b/jdk/src/share/classes/java/net/JarURLConnection.java index 433be8cfdb9..c6fd8cf94f7 100644 --- a/jdk/src/share/classes/java/net/JarURLConnection.java +++ b/jdk/src/share/classes/java/net/JarURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,18 +45,14 @@ import sun.net.www.ParseUtil; * *

      for example: * - *

      - * jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class
      - *
      + *

      {@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class} * *

      Jar URLs should be used to refer to a JAR file or entries in * a JAR file. The example above is a JAR URL which refers to a JAR * entry. If the entry name is omitted, the URL refers to the whole * JAR file: * - * - * jar:http://www.foo.com/bar/baz.jar!/ - * + * {@code jar:http://www.foo.com/bar/baz.jar!/} * *

      Users should cast the generic URLConnection to a * JarURLConnection when they know that the URL they created is a JAR @@ -76,19 +72,19 @@ import sun.net.www.ParseUtil; *

      * *
      A Jar entry - *
      jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class + *
      {@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class} * *
      A Jar file - *
      jar:http://www.foo.com/bar/baz.jar!/ + *
      {@code jar:http://www.foo.com/bar/baz.jar!/} * *
      A Jar directory - *
      jar:http://www.foo.com/bar/baz.jar!/COM/foo/ + *
      {@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/} * *
      * - *

      !/ is refered to as the separator. + *

      {@code !/} is refered to as the separator. * - *

      When constructing a JAR url via new URL(context, spec), + *

      When constructing a JAR url via {@code new URL(context, spec)}, * the following rules apply: * *

        @@ -294,7 +290,7 @@ public abstract class JarURLConnection extends URLConnection { * can only be called once * the connection has been completely verified by reading * from the input stream until the end of the stream has been - * reached. Otherwise, this method will return null + * reached. Otherwise, this method will return {@code null} * * @return the Certificate object for this connection if the URL * for it points to a JAR file entry, null otherwise. diff --git a/jdk/src/share/classes/java/net/MalformedURLException.java b/jdk/src/share/classes/java/net/MalformedURLException.java index f6ed89219fa..7aef75c7821 100644 --- a/jdk/src/share/classes/java/net/MalformedURLException.java +++ b/jdk/src/share/classes/java/net/MalformedURLException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,13 +39,13 @@ public class MalformedURLException extends IOException { private static final long serialVersionUID = -182787522200415866L; /** - * Constructs a MalformedURLException with no detail message. + * Constructs a {@code MalformedURLException} with no detail message. */ public MalformedURLException() { } /** - * Constructs a MalformedURLException with the + * Constructs a {@code MalformedURLException} with the * specified detail message. * * @param msg the detail message. diff --git a/jdk/src/share/classes/java/net/MulticastSocket.java b/jdk/src/share/classes/java/net/MulticastSocket.java index 0a4d7c1023d..9c5cb05acbb 100644 --- a/jdk/src/share/classes/java/net/MulticastSocket.java +++ b/jdk/src/share/classes/java/net/MulticastSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,7 +92,7 @@ class MulticastSocket extends DatagramSocket { * Create a multicast socket. * *

        If there is a security manager, - * its checkListen method is first called + * its {@code checkListen} method is first called * with 0 as its argument to ensure the operation is allowed. * This could result in a SecurityException. *

        @@ -103,7 +103,7 @@ class MulticastSocket extends DatagramSocket { * @exception IOException if an I/O exception occurs * while creating the MulticastSocket * @exception SecurityException if a security manager exists and its - * checkListen method doesn't allow the operation. + * {@code checkListen} method doesn't allow the operation. * @see SecurityManager#checkListen * @see java.net.DatagramSocket#setReuseAddress(boolean) */ @@ -115,8 +115,8 @@ class MulticastSocket extends DatagramSocket { * Create a multicast socket and bind it to a specific port. * *

        If there is a security manager, - * its checkListen method is first called - * with the port argument + * its {@code checkListen} method is first called + * with the {@code port} argument * as its argument to ensure the operation is allowed. * This could result in a SecurityException. *

        @@ -128,7 +128,7 @@ class MulticastSocket extends DatagramSocket { * @exception IOException if an I/O exception occurs * while creating the MulticastSocket * @exception SecurityException if a security manager exists and its - * checkListen method doesn't allow the operation. + * {@code checkListen} method doesn't allow the operation. * @see SecurityManager#checkListen * @see java.net.DatagramSocket#setReuseAddress(boolean) */ @@ -139,10 +139,10 @@ class MulticastSocket extends DatagramSocket { /** * Create a MulticastSocket bound to the specified socket address. *

        - * Or, if the address is null, create an unbound socket. + * Or, if the address is {@code null}, create an unbound socket. *

        *

        If there is a security manager, - * its checkListen method is first called + * its {@code checkListen} method is first called * with the SocketAddress port as its argument to ensure the operation is allowed. * This could result in a SecurityException. *

        @@ -150,12 +150,12 @@ class MulticastSocket extends DatagramSocket { * {@link DatagramSocket#setReuseAddress(boolean)} method is * called to enable the SO_REUSEADDR socket option. * - * @param bindaddr Socket address to bind to, or null for + * @param bindaddr Socket address to bind to, or {@code null} for * an unbound socket. * @exception IOException if an I/O exception occurs * while creating the MulticastSocket * @exception SecurityException if a security manager exists and its - * checkListen method doesn't allow the operation. + * {@code checkListen} method doesn't allow the operation. * @see SecurityManager#checkListen * @see java.net.DatagramSocket#setReuseAddress(boolean) * @@ -197,7 +197,7 @@ class MulticastSocket extends DatagramSocket { /** * Set the default time-to-live for multicast packets sent out - * on this MulticastSocket in order to control the + * on this {@code MulticastSocket} in order to control the * scope of the multicasts. * *

        The ttl is an unsigned 8-bit quantity, and so must be @@ -279,11 +279,11 @@ class MulticastSocket extends DatagramSocket { /** * Joins a multicast group. Its behavior may be affected by - * setInterface or setNetworkInterface. + * {@code setInterface} or {@code setNetworkInterface}. * *

        If there is a security manager, this method first - * calls its checkMulticast method - * with the mcastaddr argument + * calls its {@code checkMulticast} method + * with the {@code mcastaddr} argument * as its argument. * * @param mcastaddr is the multicast address to join @@ -291,7 +291,7 @@ class MulticastSocket extends DatagramSocket { * @exception IOException if there is an error joining * or when the address is not a multicast address. * @exception SecurityException if a security manager exists and its - * checkMulticast method doesn't allow the join. + * {@code checkMulticast} method doesn't allow the join. * * @see SecurityManager#checkMulticast(InetAddress) */ @@ -325,18 +325,18 @@ class MulticastSocket extends DatagramSocket { /** * Leave a multicast group. Its behavior may be affected by - * setInterface or setNetworkInterface. + * {@code setInterface} or {@code setNetworkInterface}. * *

        If there is a security manager, this method first - * calls its checkMulticast method - * with the mcastaddr argument + * calls its {@code checkMulticast} method + * with the {@code mcastaddr} argument * as its argument. * * @param mcastaddr is the multicast address to leave * @exception IOException if there is an error leaving * or when the address is not a multicast address. * @exception SecurityException if a security manager exists and its - * checkMulticast method doesn't allow the operation. + * {@code checkMulticast} method doesn't allow the operation. * * @see SecurityManager#checkMulticast(InetAddress) */ @@ -362,8 +362,8 @@ class MulticastSocket extends DatagramSocket { * Joins the specified multicast group at the specified interface. * *

        If there is a security manager, this method first - * calls its checkMulticast method - * with the mcastaddr argument + * calls its {@code checkMulticast} method + * with the {@code mcastaddr} argument * as its argument. * * @param mcastaddr is the multicast address to join @@ -375,7 +375,7 @@ class MulticastSocket extends DatagramSocket { * @exception IOException if there is an error joining * or when the address is not a multicast address. * @exception SecurityException if a security manager exists and its - * checkMulticast method doesn't allow the join. + * {@code checkMulticast} method doesn't allow the join. * @throws IllegalArgumentException if mcastaddr is null or is a * SocketAddress subclass not supported by this socket * @@ -410,8 +410,8 @@ class MulticastSocket extends DatagramSocket { * Leave a multicast group on a specified local interface. * *

        If there is a security manager, this method first - * calls its checkMulticast method - * with the mcastaddr argument + * calls its {@code checkMulticast} method + * with the {@code mcastaddr} argument * as its argument. * * @param mcastaddr is the multicast address to leave @@ -422,7 +422,7 @@ class MulticastSocket extends DatagramSocket { * @exception IOException if there is an error leaving * or when the address is not a multicast address. * @exception SecurityException if a security manager exists and its - * checkMulticast method doesn't allow the operation. + * {@code checkMulticast} method doesn't allow the operation. * @throws IllegalArgumentException if mcastaddr is null or is a * SocketAddress subclass not supported by this socket * @@ -478,7 +478,7 @@ class MulticastSocket extends DatagramSocket { * Retrieve the address of the network interface used for * multicast packets. * - * @return An InetAddress representing + * @return An {@code InetAddress} representing * the address of the network interface used for * multicast packets. * @@ -562,7 +562,7 @@ class MulticastSocket extends DatagramSocket { * * @exception SocketException if there is an error in * the underlying protocol, such as a TCP error. - * @return the multicast NetworkInterface currently set + * @return the multicast {@code NetworkInterface} currently set * @see #setNetworkInterface(NetworkInterface) * @since 1.4 */ @@ -587,7 +587,7 @@ class MulticastSocket extends DatagramSocket { *

        Because this option is a hint, applications that want to * verify what loopback mode is set to should call * {@link #getLoopbackMode()} - * @param disable true to disable the LoopbackMode + * @param disable {@code true} to disable the LoopbackMode * @throws SocketException if an error occurs while setting the value * @since 1.4 * @see #getLoopbackMode @@ -615,18 +615,18 @@ class MulticastSocket extends DatagramSocket { * otherwise it is preferable to set a TTL once on the socket, and * use that default TTL for all packets. This method does not * alter the default TTL for the socket. Its behavior may be - * affected by setInterface. + * affected by {@code setInterface}. * *

        If there is a security manager, this method first performs some - * security checks. First, if p.getAddress().isMulticastAddress() + * security checks. First, if {@code p.getAddress().isMulticastAddress()} * is true, this method calls the - * security manager's checkMulticast method - * with p.getAddress() and ttl as its arguments. + * security manager's {@code checkMulticast} method + * with {@code p.getAddress()} and {@code ttl} as its arguments. * If the evaluation of that expression is false, * this method instead calls the security manager's - * checkConnect method with arguments - * p.getAddress().getHostAddress() and - * p.getPort(). Each call to a security manager method + * {@code checkConnect} method with arguments + * {@code p.getAddress().getHostAddress()} and + * {@code p.getPort()}. Each call to a security manager method * could result in a SecurityException if the operation is not allowed. * * @param p is the packet to be sent. The packet should contain @@ -639,7 +639,7 @@ class MulticastSocket extends DatagramSocket { * @exception IOException is raised if an error occurs i.e * error while setting ttl. * @exception SecurityException if a security manager exists and its - * checkMulticast or checkConnect + * {@code checkMulticast} or {@code checkConnect} * method doesn't allow the send. * * @deprecated Use the following code or its equivalent instead: diff --git a/jdk/src/share/classes/java/net/NetPermission.java b/jdk/src/share/classes/java/net/NetPermission.java index f11337e5b9e..cf7cbd2af67 100644 --- a/jdk/src/share/classes/java/net/NetPermission.java +++ b/jdk/src/share/classes/java/net/NetPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -177,8 +177,8 @@ public final class NetPermission extends BasicPermission { * * @param name the name of the NetPermission. * - * @throws NullPointerException if name is null. - * @throws IllegalArgumentException if name is empty. + * @throws NullPointerException if {@code name} is {@code null}. + * @throws IllegalArgumentException if {@code name} is empty. */ public NetPermission(String name) @@ -194,8 +194,8 @@ public final class NetPermission extends BasicPermission { * @param name the name of the NetPermission. * @param actions should be null. * - * @throws NullPointerException if name is null. - * @throws IllegalArgumentException if name is empty. + * @throws NullPointerException if {@code name} is {@code null}. + * @throws IllegalArgumentException if {@code name} is empty. */ public NetPermission(String name, String actions) diff --git a/jdk/src/share/classes/java/net/NetworkInterface.java b/jdk/src/share/classes/java/net/NetworkInterface.java index c1644dea2bc..411d8df14b9 100644 --- a/jdk/src/share/classes/java/net/NetworkInterface.java +++ b/jdk/src/share/classes/java/net/NetworkInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,9 +98,9 @@ public final class NetworkInterface { * Convenience method to return an Enumeration with all or a * subset of the InetAddresses bound to this network interface. *

        - * If there is a security manager, its checkConnect + * If there is a security manager, its {@code checkConnect} * method is called for each InetAddress. Only InetAddresses where - * the checkConnect doesn't throw a SecurityException + * the {@code checkConnect} doesn't throw a SecurityException * will be returned in the Enumeration. However, if the caller has the * {@link NetPermission}("getNetworkInformation") permission, then all * InetAddresses are returned. @@ -154,15 +154,15 @@ public final class NetworkInterface { } /** - * Get a List of all or a subset of the InterfaceAddresses + * Get a List of all or a subset of the {@code InterfaceAddresses} * of this network interface. *

        - * If there is a security manager, its checkConnect + * If there is a security manager, its {@code checkConnect} * method is called with the InetAddress for each InterfaceAddress. - * Only InterfaceAddresses where the checkConnect doesn't throw + * Only InterfaceAddresses where the {@code checkConnect} doesn't throw * a SecurityException will be returned in the List. * - * @return a List object with all or a subset of the + * @return a {@code List} object with all or a subset of the * InterfaceAddresss of this network interface * @since 1.6 */ @@ -216,10 +216,10 @@ public final class NetworkInterface { /** * Returns the parent NetworkInterface of this interface if this is - * a subinterface, or null if it is a physical + * a subinterface, or {@code null} if it is a physical * (non virtual) interface or has no parent. * - * @return The NetworkInterface this interface is attached to. + * @return The {@code NetworkInterface} this interface is attached to. * @since 1.6 */ public NetworkInterface getParent() { @@ -260,15 +260,15 @@ public final class NetworkInterface { * @param name * The name of the network interface. * - * @return A NetworkInterface with the specified name, - * or null if there is no network interface + * @return A {@code NetworkInterface} with the specified name, + * or {@code null} if there is no network interface * with the specified name. * * @throws SocketException * If an I/O error occurs. * * @throws NullPointerException - * If the specified name is null. + * If the specified name is {@code null}. */ public static NetworkInterface getByName(String name) throws SocketException { if (name == null) @@ -303,17 +303,17 @@ public final class NetworkInterface { * returned. * * @param addr - * The InetAddress to search with. + * The {@code InetAddress} to search with. * - * @return A NetworkInterface - * or null if there is no network interface + * @return A {@code NetworkInterface} + * or {@code null} if there is no network interface * with the specified IP address. * * @throws SocketException * If an I/O error occurs. * * @throws NullPointerException - * If the specified address is null. + * If the specified address is {@code null}. */ public static NetworkInterface getByInetAddress(InetAddress addr) throws SocketException { if (addr == null) { @@ -378,7 +378,7 @@ public final class NetworkInterface { /** * Returns whether a network interface is up and running. * - * @return true if the interface is up and running. + * @return {@code true} if the interface is up and running. * @exception SocketException if an I/O error occurs. * @since 1.6 */ @@ -390,7 +390,7 @@ public final class NetworkInterface { /** * Returns whether a network interface is a loopback interface. * - * @return true if the interface is a loopback interface. + * @return {@code true} if the interface is a loopback interface. * @exception SocketException if an I/O error occurs. * @since 1.6 */ @@ -404,7 +404,7 @@ public final class NetworkInterface { * A typical point to point interface would be a PPP connection through * a modem. * - * @return true if the interface is a point to point + * @return {@code true} if the interface is a point to point * interface. * @exception SocketException if an I/O error occurs. * @since 1.6 @@ -417,7 +417,7 @@ public final class NetworkInterface { /** * Returns whether a network interface supports multicasting or not. * - * @return true if the interface supports Multicasting. + * @return {@code true} if the interface supports Multicasting. * @exception SocketException if an I/O error occurs. * @since 1.6 */ @@ -432,7 +432,7 @@ public final class NetworkInterface { * If a security manager is set, then the caller must have * the permission {@link NetPermission}("getNetworkInformation"). * - * @return a byte array containing the address, or null if + * @return a byte array containing the address, or {@code null} if * the address doesn't exist, is not accessible or a security * manager is set and the caller does not have the permission * NetPermission("getNetworkInformation") @@ -481,7 +481,7 @@ public final class NetworkInterface { * can be several virtual interfaces attached to a single physical * interface. * - * @return true if this interface is a virtual interface. + * @return {@code true} if this interface is a virtual interface. * @since 1.6 */ public boolean isVirtual() { @@ -497,16 +497,16 @@ public final class NetworkInterface { /** * 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 NetworkInterface + * The result is {@code true} if and only if the argument is + * not {@code null} and it represents the same NetworkInterface * as this object. *

        - * Two instances of NetworkInterface represent the same + * Two instances of {@code NetworkInterface} represent the same * NetworkInterface if both name and addrs are the same for both. * * @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() */ public boolean equals(Object obj) { diff --git a/jdk/src/share/classes/java/net/PasswordAuthentication.java b/jdk/src/share/classes/java/net/PasswordAuthentication.java index ee2280fc730..5529568f3a3 100644 --- a/jdk/src/share/classes/java/net/PasswordAuthentication.java +++ b/jdk/src/share/classes/java/net/PasswordAuthentication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,11 +43,11 @@ public final class PasswordAuthentication { private char[] password; /** - * Creates a new PasswordAuthentication object from the given + * Creates a new {@code PasswordAuthentication} object from the given * user name and password. * *

        Note that the given user password is cloned before it is stored in - * the new PasswordAuthentication object. + * the new {@code PasswordAuthentication} object. * * @param userName the user name * @param password the user's password diff --git a/jdk/src/share/classes/java/net/PortUnreachableException.java b/jdk/src/share/classes/java/net/PortUnreachableException.java index c21345fb7d9..8d1f21b0e87 100644 --- a/jdk/src/share/classes/java/net/PortUnreachableException.java +++ b/jdk/src/share/classes/java/net/PortUnreachableException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ public class PortUnreachableException extends SocketException { private static final long serialVersionUID = 8462541992376507323L; /** - * Constructs a new PortUnreachableException with a + * Constructs a new {@code PortUnreachableException} with a * detail message. * @param msg the detail message */ @@ -45,7 +45,7 @@ public class PortUnreachableException extends SocketException { } /** - * Construct a new PortUnreachableException with no + * Construct a new {@code PortUnreachableException} with no * detailed message. */ public PortUnreachableException() {} diff --git a/jdk/src/share/classes/java/net/ProtocolException.java b/jdk/src/share/classes/java/net/ProtocolException.java index 74ff4f1322e..ebb94eb16ca 100644 --- a/jdk/src/share/classes/java/net/ProtocolException.java +++ b/jdk/src/share/classes/java/net/ProtocolException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ class ProtocolException extends IOException { private static final long serialVersionUID = -6098449442062388080L; /** - * Constructs a new ProtocolException with the + * Constructs a new {@code ProtocolException} with the * specified detail message. * * @param host the detail message. @@ -49,7 +49,7 @@ class ProtocolException extends IOException { } /** - * Constructs a new ProtocolException with no detail message. + * Constructs a new {@code ProtocolException} with no detail message. */ public ProtocolException() { } diff --git a/jdk/src/share/classes/java/net/Proxy.java b/jdk/src/share/classes/java/net/Proxy.java index 4b8b6f148d5..fe481fadfa2 100644 --- a/jdk/src/share/classes/java/net/Proxy.java +++ b/jdk/src/share/classes/java/net/Proxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ package java.net; /** * This class represents a proxy setting, typically a type (http, socks) and * a socket address. - * A Proxy is an immutable object. + * A {@code Proxy} is an immutable object. * * @see java.net.ProxySelector * @author Yingxian Wang @@ -61,17 +61,17 @@ public class Proxy { private SocketAddress sa; /** - * A proxy setting that represents a DIRECT connection, + * A proxy setting that represents a {@code DIRECT} connection, * basically telling the protocol handler not to use any proxying. * Used, for instance, to create sockets bypassing any other global * proxy settings (like SOCKS): *

        - * Socket s = new Socket(Proxy.NO_PROXY);
        + * {@code Socket s = new Socket(Proxy.NO_PROXY);}
        *

        */ public final static Proxy NO_PROXY = new Proxy(); - // Creates the proxy that represents a DIRECT connection. + // Creates the proxy that represents a {@code DIRECT} connection. private Proxy() { type = Type.DIRECT; sa = null; @@ -82,11 +82,11 @@ public class Proxy { * Certain combinations are illegal. For instance, for types Http, and * Socks, a SocketAddress must be provided. *

        - * Use the Proxy.NO_PROXY constant + * Use the {@code Proxy.NO_PROXY} constant * for representing a direct connection. * - * @param type the Type of the proxy - * @param sa the SocketAddress for that proxy + * @param type the {@code Type} of the proxy + * @param sa the {@code SocketAddress} for that proxy * @throws IllegalArgumentException when the type and the address are * incompatible */ @@ -108,9 +108,9 @@ public class Proxy { /** * Returns the socket address of the proxy, or - * null if its a direct connection. + * {@code null} if its a direct connection. * - * @return a SocketAddress representing the socket end + * @return a {@code SocketAddress} representing the socket end * point of the proxy */ public SocketAddress address() { @@ -121,7 +121,7 @@ public class Proxy { * Constructs a string representation of this Proxy. * This String is constructed by calling toString() on its type * and concatenating " @ " and the toString() result from its address - * if its type is not DIRECT. + * if its type is not {@code DIRECT}. * * @return a string representation of this object. */ @@ -133,16 +133,16 @@ public class Proxy { /** * 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 proxy as + * The result is {@code true} if and only if the argument is + * not {@code null} and it represents the same proxy as * this object. *

        - * Two instances of Proxy represent the same + * Two instances of {@code Proxy} represent the same * address if both the SocketAddresses and type are equal. * * @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.InetSocketAddress#equals(java.lang.Object) */ public final boolean equals(Object obj) { diff --git a/jdk/src/share/classes/java/net/ProxySelector.java b/jdk/src/share/classes/java/net/ProxySelector.java index 6aa01ffd2e3..d6bb53656fd 100644 --- a/jdk/src/share/classes/java/net/ProxySelector.java +++ b/jdk/src/share/classes/java/net/ProxySelector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,9 +83,9 @@ public abstract class ProxySelector { * * @throws SecurityException * If a security manager has been installed and it denies - * {@link NetPermission}("getProxySelector") + * {@link NetPermission}{@code ("getProxySelector")} * @see #setDefault(ProxySelector) - * @return the system-wide ProxySelector + * @return the system-wide {@code ProxySelector} * @since 1.5 */ public static ProxySelector getDefault() { @@ -102,11 +102,11 @@ public abstract class ProxySelector { * Note: non-standard protocol handlers may ignore this setting. * * @param ps The HTTP proxy selector, or - * null to unset the proxy selector. + * {@code null} to unset the proxy selector. * * @throws SecurityException * If a security manager has been installed and it denies - * {@link NetPermission}("setProxySelector") + * {@link NetPermission}{@code ("setProxySelector")} * * @see #getDefault() * @since 1.5 @@ -127,7 +127,7 @@ public abstract class ProxySelector { *

          *
        • http URI for http connections
        • *
        • https URI for https connections - *
        • socket://host:port
          + *
        • {@code socket://host:port}
          * for tcp client sockets connections
        • *
        * diff --git a/jdk/src/share/classes/java/net/ResponseCache.java b/jdk/src/share/classes/java/net/ResponseCache.java index 6a67bf655b3..2dfaf4aa9f9 100644 --- a/jdk/src/share/classes/java/net/ResponseCache.java +++ b/jdk/src/share/classes/java/net/ResponseCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,10 +74,10 @@ public abstract class ResponseCache { * * @throws SecurityException * If a security manager has been installed and it denies - * {@link NetPermission}("getResponseCache") + * {@link NetPermission}{@code ("getResponseCache")} * * @see #setDefault(ResponseCache) - * @return the system-wide ResponseCache + * @return the system-wide {@code ResponseCache} * @since 1.5 */ public synchronized static ResponseCache getDefault() { @@ -94,11 +94,11 @@ public abstract class ResponseCache { * Note: non-standard procotol handlers may ignore this setting. * * @param responseCache The response cache, or - * null to unset the cache. + * {@code null} to unset the cache. * * @throws SecurityException * If a security manager has been installed and it denies - * {@link NetPermission}("setResponseCache") + * {@link NetPermission}{@code ("setResponseCache")} * * @see #getDefault() * @since 1.5 @@ -118,14 +118,14 @@ public abstract class ResponseCache { * to get the network resource. If a cached response is returned, * that resource is used instead. * - * @param uri a URI used to reference the requested + * @param uri a {@code URI} used to reference the requested * network resource - * @param rqstMethod a String representing the request + * @param rqstMethod a {@code String} representing the request * method * @param rqstHeaders - a Map from request header * field names to lists of field values representing * the current request headers - * @return a CacheResponse instance if available + * @return a {@code CacheResponse} instance if available * from cache, or null otherwise * @throws IOException if an I/O error occurs * @throws IllegalArgumentException if any one of the arguments is null @@ -148,11 +148,11 @@ public abstract class ResponseCache { * use to write the resource into the cache. If the resource is * not to be cached, then put must return null. * - * @param uri a URI used to reference the requested + * @param uri a {@code URI} used to reference the requested * network resource * @param conn - a URLConnection instance that is used to fetch * the response to be cached - * @return a CacheRequest for recording the + * @return a {@code CacheRequest} for recording the * response to be cached. Null return indicates that * the caller does not intend to cache the response. * @throws IOException if an I/O error occurs diff --git a/jdk/src/share/classes/java/net/ServerSocket.java b/jdk/src/share/classes/java/net/ServerSocket.java index 0b69ad6a266..bcc77ae42f3 100644 --- a/jdk/src/share/classes/java/net/ServerSocket.java +++ b/jdk/src/share/classes/java/net/ServerSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ import java.security.PrivilegedExceptionAction; * based on that request, and then possibly returns a result to the requester. *

        * The actual work of the server socket is performed by an instance - * of the SocketImpl class. An application can + * of the {@code SocketImpl} class. An application can * change the socket factory that creates the socket * implementation to configure itself to create sockets * appropriate to the local firewall. @@ -89,31 +89,31 @@ class ServerSocket implements java.io.Closeable { /** * Creates a server socket, bound to the specified port. A port number - * of 0 means that the port number is automatically + * of {@code 0} means that the port number is automatically * allocated, typically from an ephemeral port range. This port * number can then be retrieved by calling {@link #getLocalPort getLocalPort}. *

        * The maximum queue length for incoming connection indications (a - * request to connect) is set to 50. If a connection + * request to connect) is set to {@code 50}. If a connection * indication arrives when the queue is full, the connection is refused. *

        * If the application has specified a server socket factory, that - * factory's createSocketImpl method is called to create + * factory's {@code createSocketImpl} method is called to create * the actual socket implementation. Otherwise a "plain" socket is created. *

        * If there is a security manager, - * its checkListen method is called - * with the port argument + * its {@code checkListen} method is called + * with the {@code port} argument * as its argument to ensure the operation is allowed. * This could result in a SecurityException. * * - * @param port the port number, or 0 to use a port + * @param port the port number, or {@code 0} to use a port * number that is automatically allocated. * * @exception IOException if an I/O error occurs when opening the socket. * @exception SecurityException - * if a security manager exists and its checkListen + * if a security manager exists and its {@code checkListen} * method doesn't allow the operation. * @exception IllegalArgumentException if the port parameter is outside * the specified range of valid port values, which is between @@ -131,42 +131,42 @@ class ServerSocket implements java.io.Closeable { /** * Creates a server socket and binds it to the specified local port * number, with the specified backlog. - * A port number of 0 means that the port number is + * A port number of {@code 0} means that the port number is * automatically allocated, typically from an ephemeral port range. * This port number can then be retrieved by calling * {@link #getLocalPort getLocalPort}. *

        * The maximum queue length for incoming connection indications (a - * request to connect) is set to the backlog parameter. If + * request to connect) is set to the {@code backlog} parameter. If * a connection indication arrives when the queue is full, the * connection is refused. *

        * If the application has specified a server socket factory, that - * factory's createSocketImpl method is called to create + * factory's {@code createSocketImpl} method is called to create * the actual socket implementation. Otherwise a "plain" socket is created. *

        * If there is a security manager, - * its checkListen method is called - * with the port argument + * its {@code checkListen} method is called + * with the {@code port} argument * as its argument to ensure the operation is allowed. * This could result in a SecurityException. * - * The backlog argument is the requested maximum number of + * The {@code backlog} argument is the requested maximum number of * pending connections on the socket. Its exact semantics are implementation * specific. In particular, an implementation may impose a maximum length * or may choose to ignore the parameter altogther. The value provided - * should be greater than 0. If it is less than or equal to - * 0, then an implementation specific default will be used. + * should be greater than {@code 0}. If it is less than or equal to + * {@code 0}, then an implementation specific default will be used. *

        * - * @param port the port number, or 0 to use a port + * @param port the port number, or {@code 0} to use a port * number that is automatically allocated. * @param backlog requested maximum length of the queue of incoming * connections. * * @exception IOException if an I/O error occurs when opening the socket. * @exception SecurityException - * if a security manager exists and its checkListen + * if a security manager exists and its {@code checkListen} * method doesn't allow the operation. * @exception IllegalArgumentException if the port parameter is outside * the specified range of valid port values, which is between @@ -189,32 +189,32 @@ class ServerSocket implements java.io.Closeable { * If bindAddr is null, it will default accepting * connections on any/all local addresses. * The port must be between 0 and 65535, inclusive. - * A port number of 0 means that the port number is + * A port number of {@code 0} means that the port number is * automatically allocated, typically from an ephemeral port range. * This port number can then be retrieved by calling * {@link #getLocalPort getLocalPort}. * *

        If there is a security manager, this method - * calls its checkListen method - * with the port argument + * calls its {@code checkListen} method + * with the {@code port} argument * as its argument to ensure the operation is allowed. * This could result in a SecurityException. * - * The backlog argument is the requested maximum number of + * The {@code backlog} argument is the requested maximum number of * pending connections on the socket. Its exact semantics are implementation * specific. In particular, an implementation may impose a maximum length * or may choose to ignore the parameter altogther. The value provided - * should be greater than 0. If it is less than or equal to - * 0, then an implementation specific default will be used. + * should be greater than {@code 0}. If it is less than or equal to + * {@code 0}, then an implementation specific default will be used. *

        - * @param port the port number, or 0 to use a port + * @param port the port number, or {@code 0} to use a port * number that is automatically allocated. * @param backlog requested maximum length of the queue of incoming * connections. * @param bindAddr the local InetAddress the server will bind to * * @throws SecurityException if a security manager exists and - * its checkListen method doesn't allow the operation. + * its {@code checkListen} method doesn't allow the operation. * * @throws IOException if an I/O error occurs when opening the socket. * @exception IllegalArgumentException if the port parameter is outside @@ -245,10 +245,10 @@ class ServerSocket implements java.io.Closeable { } /** - * Get the SocketImpl attached to this socket, creating + * Get the {@code SocketImpl} attached to this socket, creating * it if necessary. * - * @return the SocketImpl attached to that ServerSocket. + * @return the {@code SocketImpl} attached to that ServerSocket. * @throws SocketException if creation fails. * @since 1.4 */ @@ -310,17 +310,17 @@ class ServerSocket implements java.io.Closeable { /** * - * Binds the ServerSocket to a specific address + * Binds the {@code ServerSocket} to a specific address * (IP address and port number). *

        - * If the address is null, then the system will pick up + * If the address is {@code null}, then the system will pick up * an ephemeral port and a valid local address to bind the socket. *

        * @param endpoint The IP address and port number to bind to. * @throws IOException if the bind operation fails, or if the socket * is already bound. - * @throws SecurityException if a SecurityManager is present and - * its checkListen method doesn't allow the operation. + * @throws SecurityException if a {@code SecurityManager} is present and + * its {@code checkListen} method doesn't allow the operation. * @throws IllegalArgumentException if endpoint is a * SocketAddress subclass not supported by this socket * @since 1.4 @@ -331,25 +331,25 @@ class ServerSocket implements java.io.Closeable { /** * - * Binds the ServerSocket to a specific address + * Binds the {@code ServerSocket} to a specific address * (IP address and port number). *

        - * If the address is null, then the system will pick up + * If the address is {@code null}, then the system will pick up * an ephemeral port and a valid local address to bind the socket. *

        - * The backlog argument is the requested maximum number of + * The {@code backlog} argument is the requested maximum number of * pending connections on the socket. Its exact semantics are implementation * specific. In particular, an implementation may impose a maximum length * or may choose to ignore the parameter altogther. The value provided - * should be greater than 0. If it is less than or equal to - * 0, then an implementation specific default will be used. + * should be greater than {@code 0}. If it is less than or equal to + * {@code 0}, then an implementation specific default will be used. * @param endpoint The IP address and port number to bind to. * @param backlog requested maximum length of the queue of * incoming connections. * @throws IOException if the bind operation fails, or if the socket * is already bound. - * @throws SecurityException if a SecurityManager is present and - * its checkListen method doesn't allow the operation. + * @throws SecurityException if a {@code SecurityManager} is present and + * its {@code checkListen} method doesn't allow the operation. * @throws IllegalArgumentException if endpoint is a * SocketAddress subclass not supported by this socket * @since 1.4 @@ -480,18 +480,18 @@ class ServerSocket implements java.io.Closeable { * Listens for a connection to be made to this socket and accepts * it. The method blocks until a connection is made. * - *

        A new Socket s is created and, if there + *

        A new Socket {@code s} is created and, if there * is a security manager, - * the security manager's checkAccept method is called - * with s.getInetAddress().getHostAddress() and - * s.getPort() + * the security manager's {@code checkAccept} method is called + * with {@code s.getInetAddress().getHostAddress()} and + * {@code s.getPort()} * as its arguments to ensure the operation is allowed. * This could result in a SecurityException. * * @exception IOException if an I/O error occurs when waiting for a * connection. * @exception SecurityException if a security manager exists and its - * checkAccept method doesn't allow the operation. + * {@code checkAccept} method doesn't allow the operation. * @exception SocketTimeoutException if a timeout was previously set with setSoTimeout and * the timeout has been reached. * @exception java.nio.channels.IllegalBlockingModeException @@ -597,7 +597,7 @@ class ServerSocket implements java.io.Closeable { * method. * * @return the server-socket channel associated with this socket, - * or null if this socket was not created + * or {@code null} if this socket was not created * for a channel * * @since 1.4 @@ -678,18 +678,18 @@ class ServerSocket implements java.io.Closeable { *

        * When a TCP connection is closed the connection may remain * in a timeout state for a period of time after the connection - * is closed (typically known as the TIME_WAIT state - * or 2MSL wait state). + * is closed (typically known as the {@code TIME_WAIT} state + * or {@code 2MSL} wait state). * For applications using a well known socket address or port * it may not be possible to bind a socket to the required - * SocketAddress if there is a connection in the + * {@code SocketAddress} if there is a connection in the * timeout state involving the socket address or port. *

        * Enabling {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} prior to * binding the socket using {@link #bind(SocketAddress)} allows the socket * to be bound even though a previous connection is in a timeout state. *

        - * When a ServerSocket is created the initial setting + * When a {@code ServerSocket} is created the initial setting * of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is not defined. * Applications can use {@link #getReuseAddress()} to determine the initial * setting of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR}. @@ -717,7 +717,7 @@ class ServerSocket implements java.io.Closeable { /** * Tests if {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled. * - * @return a boolean indicating whether or not + * @return a {@code boolean} indicating whether or not * {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled. * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. @@ -732,7 +732,7 @@ class ServerSocket implements java.io.Closeable { /** * Returns the implementation address and implementation port of - * this socket as a String. + * this socket as a {@code String}. *

        * If there is a security manager set, its {@code checkConnect} method is * called with the local address and {@code -1} as its arguments to see @@ -773,14 +773,14 @@ class ServerSocket implements java.io.Closeable { * application. The factory can be specified only once. *

        * When an application creates a new server socket, the socket - * implementation factory's createSocketImpl method is + * implementation factory's {@code createSocketImpl} method is * called to create the actual socket implementation. *

        - * Passing null to the method is a no-op unless the factory + * Passing {@code null} to the method is a no-op unless the factory * was already set. *

        * If there is a security manager, this method first calls - * the security manager's checkSetFactory method + * the security manager's {@code checkSetFactory} method * to ensure the operation is allowed. * This could result in a SecurityException. * @@ -789,7 +789,7 @@ class ServerSocket implements java.io.Closeable { * socket factory. * @exception SocketException if the factory has already been defined. * @exception SecurityException if a security manager exists and its - * checkSetFactory method doesn't allow the operation. + * {@code checkSetFactory} method doesn't allow the operation. * @see java.net.SocketImplFactory#createSocketImpl() * @see SecurityManager#checkSetFactory */ @@ -807,7 +807,7 @@ class ServerSocket implements java.io.Closeable { /** * Sets a default proposed value for the * {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option for sockets - * accepted from this ServerSocket. The value actually set + * accepted from this {@code ServerSocket}. The value actually set * in the accepted socket must be determined by calling * {@link Socket#getReceiveBufferSize()} after the socket * is returned by {@link #accept()}. @@ -851,13 +851,13 @@ class ServerSocket implements java.io.Closeable { /** * Gets the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option - * for this ServerSocket, that is the proposed buffer size that - * will be used for Sockets accepted from this ServerSocket. + * for this {@code ServerSocket}, that is the proposed buffer size that + * will be used for Sockets accepted from this {@code ServerSocket}. * *

        Note, the value actually set in the accepted socket is determined by * calling {@link Socket#getReceiveBufferSize()}. * @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} - * option for this Socket. + * option for this {@code Socket}. * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. * @see #setReceiveBufferSize(int) @@ -891,24 +891,24 @@ class ServerSocket implements java.io.Closeable { * compared, with larger values indicating stronger preferences. If the * application prefers short connection time over both low latency and high * bandwidth, for example, then it could invoke this method with the values - * (1, 0, 0). If the application prefers high bandwidth above low + * {@code (1, 0, 0)}. If the application prefers high bandwidth above low * latency, and low latency above short connection time, then it could - * invoke this method with the values (0, 1, 2). + * invoke this method with the values {@code (0, 1, 2)}. * *

        Invoking this method after this socket has been bound * will have no effect. This implies that in order to use this capability * requires the socket to be created with the no-argument constructor. * * @param connectionTime - * An int expressing the relative importance of a short + * An {@code int} expressing the relative importance of a short * connection time * * @param latency - * An int expressing the relative importance of low + * An {@code int} expressing the relative importance of low * latency * * @param bandwidth - * An int expressing the relative importance of high + * An {@code int} expressing the relative importance of high * bandwidth * * @since 1.5 diff --git a/jdk/src/share/classes/java/net/Socket.java b/jdk/src/share/classes/java/net/Socket.java index 8ab5e866ee2..361260351f5 100644 --- a/jdk/src/share/classes/java/net/Socket.java +++ b/jdk/src/share/classes/java/net/Socket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ import java.security.PrivilegedAction; * between two machines. *

        * The actual work of the socket is performed by an instance of the - * SocketImpl class. An application, by changing + * {@code SocketImpl} class. An application, by changing * the socket factory that creates the socket implementation, * can configure itself to create sockets appropriate to the local * firewall. @@ -88,14 +88,14 @@ class Socket implements java.io.Closeable { * Creates an unconnected socket, specifying the type of proxy, if any, * that should be used regardless of any other settings. *

        - * If there is a security manager, its checkConnect method + * If there is a security manager, its {@code checkConnect} method * is called with the proxy host address and port number * as its arguments. This could result in a SecurityException. *

        * Examples: - *

        • Socket s = new Socket(Proxy.NO_PROXY); will create + *
          • {@code Socket s = new Socket(Proxy.NO_PROXY);} will create * a plain socket ignoring any other proxy configuration.
          • - *
          • Socket s = new Socket(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("socks.mydom.com", 1080))); + *
          • {@code Socket s = new Socket(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("socks.mydom.com", 1080)));} * will create a socket connecting through the specified SOCKS proxy * server.
          • *
          @@ -103,7 +103,7 @@ class Socket implements java.io.Closeable { * @param proxy a {@link java.net.Proxy Proxy} object specifying what kind * of proxying should be used. * @throws IllegalArgumentException if the proxy is of an invalid type - * or null. + * or {@code null}. * @throws SecurityException if a security manager is present and * permission to connect to the proxy is * denied. @@ -173,21 +173,22 @@ class Socket implements java.io.Closeable { * Creates a stream socket and connects it to the specified port * number on the named host. *

          - * If the specified host is null it is the equivalent of - * specifying the address as {@link java.net.InetAddress#getByName InetAddress.getByName}(null). + * If the specified host is {@code null} it is the equivalent of + * specifying the address as + * {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}. * In other words, it is equivalent to specifying an address of the * loopback interface.

          *

          * If the application has specified a server socket factory, that - * factory's createSocketImpl method is called to create + * factory's {@code createSocketImpl} method is called to create * the actual socket implementation. Otherwise a "plain" socket is created. *

          * If there is a security manager, its - * checkConnect method is called - * with the host address and port + * {@code checkConnect} method is called + * with the host address and {@code port} * as its arguments. This could result in a SecurityException. * - * @param host the host name, or null for the loopback address. + * @param host the host name, or {@code null} for the loopback address. * @param port the port number. * * @exception UnknownHostException if the IP address of @@ -195,7 +196,7 @@ class Socket implements java.io.Closeable { * * @exception IOException if an I/O error occurs when creating the socket. * @exception SecurityException if a security manager exists and its - * checkConnect method doesn't allow the operation. + * {@code checkConnect} method doesn't allow the operation. * @exception IllegalArgumentException if the port parameter is outside * the specified range of valid port values, which is between * 0 and 65535, inclusive. @@ -217,23 +218,23 @@ class Socket implements java.io.Closeable { * number at the specified IP address. *

          * If the application has specified a socket factory, that factory's - * createSocketImpl method is called to create the + * {@code createSocketImpl} method is called to create the * actual socket implementation. Otherwise a "plain" socket is created. *

          * If there is a security manager, its - * checkConnect method is called - * with the host address and port + * {@code checkConnect} method is called + * with the host address and {@code port} * as its arguments. This could result in a SecurityException. * * @param address the IP address. * @param port the port number. * @exception IOException if an I/O error occurs when creating the socket. * @exception SecurityException if a security manager exists and its - * checkConnect method doesn't allow the operation. + * {@code checkConnect} method doesn't allow the operation. * @exception IllegalArgumentException if the port parameter is outside * the specified range of valid port values, which is between * 0 and 65535, inclusive. - * @exception NullPointerException if address is null. + * @exception NullPointerException if {@code address} is null. * @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory) * @see java.net.SocketImpl * @see java.net.SocketImplFactory#createSocketImpl() @@ -249,28 +250,29 @@ class Socket implements java.io.Closeable { * the specified remote port. The Socket will also bind() to the local * address and port supplied. *

          - * If the specified host is null it is the equivalent of - * specifying the address as {@link java.net.InetAddress#getByName InetAddress.getByName}(null). + * If the specified host is {@code null} it is the equivalent of + * specifying the address as + * {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}. * In other words, it is equivalent to specifying an address of the * loopback interface.

          *

          - * A local port number of zero will let the system pick up a - * free port in the bind operation.

          + * A local port number of {@code zero} will let the system pick up a + * free port in the {@code bind} operation.

          *

          * If there is a security manager, its - * checkConnect method is called - * with the host address and port + * {@code checkConnect} method is called + * with the host address and {@code port} * as its arguments. This could result in a SecurityException. * - * @param host the name of the remote host, or null for the loopback address. + * @param host the name of the remote host, or {@code null} for the loopback address. * @param port the remote port * @param localAddr the local address the socket is bound to, or - * null for the anyLocal address. + * {@code null} for the {@code anyLocal} address. * @param localPort the local port the socket is bound to, or - * zero for a system selected free port. + * {@code zero} for a system selected free port. * @exception IOException if an I/O error occurs when creating the socket. * @exception SecurityException if a security manager exists and its - * checkConnect method doesn't allow the operation. + * {@code checkConnect} method doesn't allow the operation. * @exception IllegalArgumentException if the port parameter or localPort * parameter is outside the specified range of valid port values, * which is between 0 and 65535, inclusive. @@ -289,30 +291,31 @@ class Socket implements java.io.Closeable { * the specified remote port. The Socket will also bind() to the local * address and port supplied. *

          - * If the specified local address is null it is the equivalent of - * specifying the address as the AnyLocal address (see {@link java.net.InetAddress#isAnyLocalAddress InetAddress.isAnyLocalAddress}()). + * If the specified local address is {@code null} it is the equivalent of + * specifying the address as the AnyLocal address + * (see {@link java.net.InetAddress#isAnyLocalAddress InetAddress.isAnyLocalAddress}{@code ()}). *

          - * A local port number of zero will let the system pick up a - * free port in the bind operation.

          + * A local port number of {@code zero} will let the system pick up a + * free port in the {@code bind} operation.

          *

          * If there is a security manager, its - * checkConnect method is called - * with the host address and port + * {@code checkConnect} method is called + * with the host address and {@code port} * as its arguments. This could result in a SecurityException. * * @param address the remote address * @param port the remote port * @param localAddr the local address the socket is bound to, or - * null for the anyLocal address. + * {@code null} for the {@code anyLocal} address. * @param localPort the local port the socket is bound to or - * zero for a system selected free port. + * {@code zero} for a system selected free port. * @exception IOException if an I/O error occurs when creating the socket. * @exception SecurityException if a security manager exists and its - * checkConnect method doesn't allow the operation. + * {@code checkConnect} method doesn't allow the operation. * @exception IllegalArgumentException if the port parameter or localPort * parameter is outside the specified range of valid port values, * which is between 0 and 65535, inclusive. - * @exception NullPointerException if address is null. + * @exception NullPointerException if {@code address} is null. * @see SecurityManager#checkConnect * @since JDK1.1 */ @@ -326,33 +329,34 @@ class Socket implements java.io.Closeable { * Creates a stream socket and connects it to the specified port * number on the named host. *

          - * If the specified host is null it is the equivalent of - * specifying the address as {@link java.net.InetAddress#getByName InetAddress.getByName}(null). + * If the specified host is {@code null} it is the equivalent of + * specifying the address as + * {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}. * In other words, it is equivalent to specifying an address of the * loopback interface.

          *

          - * If the stream argument is true, this creates a - * stream socket. If the stream argument is false, it + * If the stream argument is {@code true}, this creates a + * stream socket. If the stream argument is {@code false}, it * creates a datagram socket. *

          * If the application has specified a server socket factory, that - * factory's createSocketImpl method is called to create + * factory's {@code createSocketImpl} method is called to create * the actual socket implementation. Otherwise a "plain" socket is created. *

          * If there is a security manager, its - * checkConnect method is called - * with the host address and port + * {@code checkConnect} method is called + * with the host address and {@code port} * as its arguments. This could result in a SecurityException. *

          * If a UDP socket is used, TCP/IP related socket options will not apply. * - * @param host the host name, or null for the loopback address. + * @param host the host name, or {@code null} for the loopback address. * @param port the port number. - * @param stream a boolean indicating whether this is + * @param stream a {@code boolean} indicating whether this is * a stream socket or a datagram socket. * @exception IOException if an I/O error occurs when creating the socket. * @exception SecurityException if a security manager exists and its - * checkConnect method doesn't allow the operation. + * {@code checkConnect} method doesn't allow the operation. * @exception IllegalArgumentException if the port parameter is outside * the specified range of valid port values, which is between * 0 and 65535, inclusive. @@ -373,32 +377,32 @@ class Socket implements java.io.Closeable { * Creates a socket and connects it to the specified port number at * the specified IP address. *

          - * If the stream argument is true, this creates a - * stream socket. If the stream argument is false, it + * If the stream argument is {@code true}, this creates a + * stream socket. If the stream argument is {@code false}, it * creates a datagram socket. *

          * If the application has specified a server socket factory, that - * factory's createSocketImpl method is called to create + * factory's {@code createSocketImpl} method is called to create * the actual socket implementation. Otherwise a "plain" socket is created. * *

          If there is a security manager, its - * checkConnect method is called - * with host.getHostAddress() and port + * {@code checkConnect} method is called + * with {@code host.getHostAddress()} and {@code port} * as its arguments. This could result in a SecurityException. *

          * If UDP socket is used, TCP/IP related socket options will not apply. * * @param host the IP address. * @param port the port number. - * @param stream if true, create a stream socket; + * @param stream if {@code true}, create a stream socket; * otherwise, create a datagram socket. * @exception IOException if an I/O error occurs when creating the socket. * @exception SecurityException if a security manager exists and its - * checkConnect method doesn't allow the operation. + * {@code checkConnect} method doesn't allow the operation. * @exception IllegalArgumentException if the port parameter is outside * the specified range of valid port values, which is between * 0 and 65535, inclusive. - * @exception NullPointerException if host is null. + * @exception NullPointerException if {@code host} is null. * @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory) * @see java.net.SocketImpl * @see java.net.SocketImplFactory#createSocketImpl() @@ -437,8 +441,8 @@ class Socket implements java.io.Closeable { /** * Creates the socket implementation. * - * @param stream a boolean value : true for a TCP socket, - * false for UDP. + * @param stream a {@code boolean} value : {@code true} for a TCP socket, + * {@code false} for UDP. * @throws IOException if creation fails * @since 1.4 */ @@ -500,10 +504,10 @@ class Socket implements java.io.Closeable { /** - * Get the SocketImpl attached to this socket, creating + * Get the {@code SocketImpl} attached to this socket, creating * it if necessary. * - * @return the SocketImpl attached to that ServerSocket. + * @return the {@code SocketImpl} attached to that ServerSocket. * @throws SocketException if creation fails * @since 1.4 */ @@ -516,7 +520,7 @@ class Socket implements java.io.Closeable { /** * Connects this socket to the server. * - * @param endpoint the SocketAddress + * @param endpoint the {@code SocketAddress} * @throws IOException if an error occurs during the connection * @throws java.nio.channels.IllegalBlockingModeException * if this socket has an associated channel, @@ -535,7 +539,7 @@ class Socket implements java.io.Closeable { * A timeout of zero is interpreted as an infinite timeout. The connection * will then block until established or an error occurs. * - * @param endpoint the SocketAddress + * @param endpoint the {@code SocketAddress} * @param timeout the timeout value to be used in milliseconds. * @throws IOException if an error occurs during the connection * @throws SocketTimeoutException if timeout expires before connecting @@ -597,10 +601,10 @@ class Socket implements java.io.Closeable { /** * Binds the socket to a local address. *

          - * If the address is null, then the system will pick up + * If the address is {@code null}, then the system will pick up * an ephemeral port and a valid local address to bind the socket. * - * @param bindpoint the SocketAddress to bind to + * @param bindpoint the {@code SocketAddress} to bind to * @throws IOException if the bind operation fails, or if the socket * is already bound. * @throws IllegalArgumentException if bindpoint is a @@ -668,7 +672,7 @@ class Socket implements java.io.Closeable { * after the socket is closed. * * @return the remote IP address to which this socket is connected, - * or null if the socket is not connected. + * or {@code null} if the socket is not connected. */ public InetAddress getInetAddress() { if (!isConnected()) @@ -760,15 +764,15 @@ class Socket implements java.io.Closeable { /** * Returns the address of the endpoint this socket is connected to, or - * null if it is unconnected. + * {@code null} if it is unconnected. *

          * If the socket was connected prior to being {@link #close closed}, * then this method will continue to return the connected address * after the socket is closed. * - * @return a SocketAddress representing the remote endpoint of this - * socket, or null if it is not connected yet. + * @return a {@code SocketAddress} representing the remote endpoint of this + * socket, or {@code null} if it is not connected yet. * @see #getInetAddress() * @see #getPort() * @see #connect(SocketAddress, int) @@ -785,10 +789,10 @@ class Socket implements java.io.Closeable { * Returns the address of the endpoint this socket is bound to. *

          * If a socket bound to an endpoint represented by an - * InetSocketAddress is {@link #close closed}, - * then this method will continue to return an InetSocketAddress + * {@code InetSocketAddress } is {@link #close closed}, + * then this method will continue to return an {@code InetSocketAddress} * after the socket is closed. In that case the returned - * InetSocketAddress's address is the + * {@code InetSocketAddress}'s address is the * {@link InetAddress#isAnyLocalAddress wildcard} address * and its port is the local port that it was bound to. *

          @@ -828,7 +832,7 @@ class Socket implements java.io.Closeable { * methods. * * @return the socket channel associated with this socket, - * or null if this socket was not created + * or {@code null} if this socket was not created * for a channel * * @since 1.4 @@ -843,7 +847,7 @@ class Socket implements java.io.Closeable { * *

          If this socket has an associated channel then the resulting input * stream delegates all of its operations to the channel. If the channel - * is in non-blocking mode then the input stream's read operations + * is in non-blocking mode then the input stream's {@code read} operations * will throw an {@link java.nio.channels.IllegalBlockingModeException}. * *

          Under abnormal conditions the underlying connection may be @@ -867,7 +871,7 @@ class Socket implements java.io.Closeable { *

        • If there are no bytes buffered on the socket, and the * socket has not been closed using {@link #close close}, then * {@link java.io.InputStream#available available} will - * return 0. + * return {@code 0}. * *

        * @@ -910,7 +914,7 @@ class Socket implements java.io.Closeable { * *

        If this socket has an associated channel then the resulting output * stream delegates all of its operations to the channel. If the channel - * is in non-blocking mode then the output stream's write + * is in non-blocking mode then the output stream's {@code write} * operations will throw an {@link * java.nio.channels.IllegalBlockingModeException}. * @@ -949,8 +953,8 @@ class Socket implements java.io.Closeable { * Enable/disable {@link SocketOptions#TCP_NODELAY TCP_NODELAY} * (disable/enable Nagle's algorithm). * - * @param on true to enable TCP_NODELAY, - * false to disable. + * @param on {@code true} to enable TCP_NODELAY, + * {@code false} to disable. * * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. @@ -968,7 +972,7 @@ class Socket implements java.io.Closeable { /** * Tests if {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled. * - * @return a boolean indicating whether or not + * @return a {@code boolean} indicating whether or not * {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled. * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. @@ -1066,9 +1070,9 @@ class Socket implements java.io.Closeable { * and there is no capability to distinguish between normal data and urgent * data unless provided by a higher level protocol. * - * @param on true to enable + * @param on {@code true} to enable * {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE}, - * false to disable. + * {@code false} to disable. * * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. @@ -1086,7 +1090,7 @@ class Socket implements java.io.Closeable { /** * Tests if {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE} is enabled. * - * @return a boolean indicating whether or not + * @return a {@code boolean} indicating whether or not * {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE}is enabled. * * @exception SocketException if there is an error @@ -1151,7 +1155,7 @@ class Socket implements java.io.Closeable { /** * Sets the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option to the - * specified value for this Socket. + * specified value for this {@code Socket}. * The {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option is used by the * platform's networking code as a hint for the size to set the underlying * network I/O buffers. @@ -1184,10 +1188,10 @@ class Socket implements java.io.Closeable { /** * Get value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option - * for this Socket, that is the buffer size used by the platform - * for output on this Socket. + * for this {@code Socket}, that is the buffer size used by the platform + * for output on this {@code Socket}. * @return the value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} - * option for this Socket. + * option for this {@code Socket}. * * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. @@ -1208,7 +1212,7 @@ class Socket implements java.io.Closeable { /** * Sets the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option to the - * specified value for this Socket. The + * specified value for this {@code Socket}. The * {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option is * used by the platform's networking code as a hint for the size to set * the underlying network I/O buffers. @@ -1258,11 +1262,11 @@ class Socket implements java.io.Closeable { /** * Gets the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option - * for this Socket, that is the buffer size used by the platform - * for input on this Socket. + * for this {@code Socket}, that is the buffer size used by the platform + * for input on this {@code Socket}. * * @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} - * option for this Socket. + * option for this {@code Socket}. * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. * @see #setReceiveBufferSize(int) @@ -1298,7 +1302,7 @@ class Socket implements java.io.Closeable { /** * Tests if {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled. * - * @return a boolean indicating whether or not + * @return a {@code boolean} indicating whether or not * {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled. * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. @@ -1321,7 +1325,7 @@ class Socket implements java.io.Closeable { * 255} or an IllegalArgumentException will be thrown. *

        Notes: *

        For Internet Protocol v4 the value consists of an - * integer, the least significant 8 bits of which + * {@code integer}, the least significant 8 bits of which * represent the value of the TOS octet in IP packets sent by * the socket. * RFC 1349 defines the TOS values as follows: @@ -1347,10 +1351,10 @@ class Socket implements java.io.Closeable { * in the underlying platform. Applications should not assume that * they can change the TOS field after the connection. *

        - * For Internet Protocol v6 tc is the value that + * For Internet Protocol v6 {@code tc} is the value that * would be placed into the sin6_flowinfo field of the IP header. * - * @param tc an int value for the bitset. + * @param tc an {@code int} value for the bitset. * @throws SocketException if there is an error setting the * traffic class or type-of-service * @since 1.4 @@ -1392,11 +1396,11 @@ class Socket implements java.io.Closeable { *

        * When a TCP connection is closed the connection may remain * in a timeout state for a period of time after the connection - * is closed (typically known as the TIME_WAIT state - * or 2MSL wait state). + * is closed (typically known as the {@code TIME_WAIT} state + * or {@code 2MSL} wait state). * For applications using a well known socket address or port * it may not be possible to bind a socket to the required - * SocketAddress if there is a connection in the + * {@code SocketAddress} if there is a connection in the * timeout state involving the socket address or port. *

        * Enabling {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} @@ -1404,7 +1408,7 @@ class Socket implements java.io.Closeable { * the socket to be bound even though a previous connection is in a timeout * state. *

        - * When a Socket is created the initial setting + * When a {@code Socket} is created the initial setting * of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is disabled. *

        * The behaviour when {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is @@ -1430,7 +1434,7 @@ class Socket implements java.io.Closeable { /** * Tests if {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled. * - * @return a boolean indicating whether or not + * @return a {@code boolean} indicating whether or not * {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled. * @exception SocketException if there is an error * in the underlying protocol, such as a TCP error. @@ -1536,7 +1540,7 @@ class Socket implements java.io.Closeable { } /** - * Converts this socket to a String. + * Converts this socket to a {@code String}. * * @return a string representation of this socket. */ @@ -1555,7 +1559,7 @@ class Socket implements java.io.Closeable { * Returns the connection state of the socket. *

        * Note: Closing a socket doesn't clear its connection state, which means - * this method will return true for a closed socket + * this method will return {@code true} for a closed socket * (see {@link #isClosed()}) if it was successfuly connected prior * to being closed. * @@ -1571,7 +1575,7 @@ class Socket implements java.io.Closeable { * Returns the binding state of the socket. *

        * Note: Closing a socket doesn't clear its binding state, which means - * this method will return true for a closed socket + * this method will return {@code true} for a closed socket * (see {@link #isClosed()}) if it was successfuly bound prior * to being closed. * @@ -1629,13 +1633,13 @@ class Socket implements java.io.Closeable { * application. The factory can be specified only once. *

        * When an application creates a new client socket, the socket - * implementation factory's createSocketImpl method is + * implementation factory's {@code createSocketImpl} method is * called to create the actual socket implementation. *

        - * Passing null to the method is a no-op unless the factory + * Passing {@code null} to the method is a no-op unless the factory * was already set. *

        If there is a security manager, this method first calls - * the security manager's checkSetFactory method + * the security manager's {@code checkSetFactory} method * to ensure the operation is allowed. * This could result in a SecurityException. * @@ -1644,7 +1648,7 @@ class Socket implements java.io.Closeable { * socket factory. * @exception SocketException if the factory is already defined. * @exception SecurityException if a security manager exists and its - * checkSetFactory method doesn't allow the operation. + * {@code checkSetFactory} method doesn't allow the operation. * @see java.net.SocketImplFactory#createSocketImpl() * @see SecurityManager#checkSetFactory */ @@ -1678,23 +1682,23 @@ class Socket implements java.io.Closeable { * values represent a lower priority than positive values. If the * application prefers short connection time over both low latency and high * bandwidth, for example, then it could invoke this method with the values - * (1, 0, 0). If the application prefers high bandwidth above low + * {@code (1, 0, 0)}. If the application prefers high bandwidth above low * latency, and low latency above short connection time, then it could - * invoke this method with the values (0, 1, 2). + * invoke this method with the values {@code (0, 1, 2)}. * *

        Invoking this method after this socket has been connected * will have no effect. * * @param connectionTime - * An int expressing the relative importance of a short + * An {@code int} expressing the relative importance of a short * connection time * * @param latency - * An int expressing the relative importance of low + * An {@code int} expressing the relative importance of low * latency * * @param bandwidth - * An int expressing the relative importance of high + * An {@code int} expressing the relative importance of high * bandwidth * * @since 1.5 diff --git a/jdk/src/share/classes/java/net/SocketAddress.java b/jdk/src/share/classes/java/net/SocketAddress.java index 5cdd4a519cb..a3ee4ee52f5 100644 --- a/jdk/src/share/classes/java/net/SocketAddress.java +++ b/jdk/src/share/classes/java/net/SocketAddress.java @@ -39,4 +39,7 @@ package java.net; * @since 1.4 */ public abstract class SocketAddress implements java.io.Serializable { + + static final long serialVersionUID = 5215720748342549866L; + } diff --git a/jdk/src/share/classes/java/net/SocketException.java b/jdk/src/share/classes/java/net/SocketException.java index eae84d92bab..690fc4f55bd 100644 --- a/jdk/src/share/classes/java/net/SocketException.java +++ b/jdk/src/share/classes/java/net/SocketException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ class SocketException extends IOException { private static final long serialVersionUID = -5935874303556886934L; /** - * Constructs a new SocketException with the + * Constructs a new {@code SocketException} with the * specified detail message. * * @param msg the detail message. @@ -48,7 +48,7 @@ class SocketException extends IOException { } /** - * Constructs a new SocketException with no detail message. + * Constructs a new {@code SocketException} with no detail message. */ public SocketException() { } diff --git a/jdk/src/share/classes/java/net/SocketImpl.java b/jdk/src/share/classes/java/net/SocketImpl.java index 3dbb7b355ed..67286a1cd60 100644 --- a/jdk/src/share/classes/java/net/SocketImpl.java +++ b/jdk/src/share/classes/java/net/SocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ import java.io.OutputStream; import java.io.FileDescriptor; /** - * The abstract class SocketImpl is a common superclass + * The abstract class {@code SocketImpl} is a common superclass * of all classes that actually implement sockets. It is used to * create both client and server sockets. *

        @@ -71,7 +71,7 @@ public abstract class SocketImpl implements SocketOptions { /** * Creates either a stream or a datagram socket. * - * @param stream if true, create a stream socket; + * @param stream if {@code true}, create a stream socket; * otherwise, create a datagram socket. * @exception IOException if an I/O error occurs while creating the * socket. @@ -122,7 +122,7 @@ public abstract class SocketImpl implements SocketOptions { /** * Sets the maximum queue length for incoming connection indications - * (a request to connect) to the count argument. If a + * (a request to connect) to the {@code count} argument. If a * connection indication arrives when the queue is full, the * connection is refused. * @@ -217,9 +217,9 @@ public abstract class SocketImpl implements SocketOptions { } /** - * Returns the value of this socket's fd field. + * Returns the value of this socket's {@code fd} field. * - * @return the value of this socket's fd field. + * @return the value of this socket's {@code fd} field. * @see java.net.SocketImpl#fd */ protected FileDescriptor getFileDescriptor() { @@ -227,9 +227,9 @@ public abstract class SocketImpl implements SocketOptions { } /** - * Returns the value of this socket's address field. + * Returns the value of this socket's {@code address} field. * - * @return the value of this socket's address field. + * @return the value of this socket's {@code address} field. * @see java.net.SocketImpl#address */ protected InetAddress getInetAddress() { @@ -237,9 +237,9 @@ public abstract class SocketImpl implements SocketOptions { } /** - * Returns the value of this socket's port field. + * Returns the value of this socket's {@code port} field. * - * @return the value of this socket's port field. + * @return the value of this socket's {@code port} field. * @see java.net.SocketImpl#port */ protected int getPort() { @@ -270,9 +270,9 @@ public abstract class SocketImpl implements SocketOptions { protected abstract void sendUrgentData (int data) throws IOException; /** - * Returns the value of this socket's localport field. + * Returns the value of this socket's {@code localport} field. * - * @return the value of this socket's localport field. + * @return the value of this socket's {@code localport} field. * @see java.net.SocketImpl#localport */ protected int getLocalPort() { @@ -296,7 +296,7 @@ public abstract class SocketImpl implements SocketOptions { } /** - * Returns the address and port of this socket as a String. + * Returns the address and port of this socket as a {@code String}. * * @return a string representation of this socket. */ @@ -328,23 +328,23 @@ public abstract class SocketImpl implements SocketOptions { * values represent a lower priority than positive values. If the * application prefers short connection time over both low latency and high * bandwidth, for example, then it could invoke this method with the values - * (1, 0, 0). If the application prefers high bandwidth above low + * {@code (1, 0, 0)}. If the application prefers high bandwidth above low * latency, and low latency above short connection time, then it could - * invoke this method with the values (0, 1, 2). + * invoke this method with the values {@code (0, 1, 2)}. * * By default, this method does nothing, unless it is overridden in a * a sub-class. * * @param connectionTime - * An int expressing the relative importance of a short + * An {@code int} expressing the relative importance of a short * connection time * * @param latency - * An int expressing the relative importance of low + * An {@code int} expressing the relative importance of low * latency * * @param bandwidth - * An int expressing the relative importance of high + * An {@code int} expressing the relative importance of high * bandwidth * * @since 1.5 diff --git a/jdk/src/share/classes/java/net/SocketImplFactory.java b/jdk/src/share/classes/java/net/SocketImplFactory.java index 52ab3277aac..7aa6363b4fd 100644 --- a/jdk/src/share/classes/java/net/SocketImplFactory.java +++ b/jdk/src/share/classes/java/net/SocketImplFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ package java.net; /** * This interface defines a factory for socket implementations. It - * is used by the classes Socket and - * ServerSocket to create actual socket + * is used by the classes {@code Socket} and + * {@code ServerSocket} to create actual socket * implementations. * * @author Arthur van Hoff @@ -39,9 +39,9 @@ package java.net; public interface SocketImplFactory { /** - * Creates a new SocketImpl instance. + * Creates a new {@code SocketImpl} instance. * - * @return a new instance of SocketImpl. + * @return a new instance of {@code SocketImpl}. * @see java.net.SocketImpl */ SocketImpl createSocketImpl(); diff --git a/jdk/src/share/classes/java/net/SocketInputStream.java b/jdk/src/share/classes/java/net/SocketInputStream.java index b708436a783..224051ff608 100644 --- a/jdk/src/share/classes/java/net/SocketInputStream.java +++ b/jdk/src/share/classes/java/net/SocketInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,8 +67,8 @@ class SocketInputStream extends FileInputStream * Returns the unique {@link java.nio.channels.FileChannel FileChannel} * object associated with this file input stream.

        * - * The getChannel method of SocketInputStream - * returns null since it is a socket based stream.

        + * The {@code getChannel} method of {@code SocketInputStream} + * returns {@code null} since it is a socket based stream.

        * * @return the file channel associated with this file input stream * diff --git a/jdk/src/share/classes/java/net/SocketOptions.java b/jdk/src/share/classes/java/net/SocketOptions.java index 44dd1b9b40d..b9508dbb266 100644 --- a/jdk/src/share/classes/java/net/SocketOptions.java +++ b/jdk/src/share/classes/java/net/SocketOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -115,7 +115,7 @@ public interface SocketOptions { * } * * - * @param optID an int identifying the option to fetch + * @param optID an {@code int} identifying the option to fetch * @return the value of the option * @throws SocketException if the socket is closed * @throws SocketException if optID is unknown along the diff --git a/jdk/src/share/classes/java/net/SocketOutputStream.java b/jdk/src/share/classes/java/net/SocketOutputStream.java index 06e234efc4a..2404e9583f4 100644 --- a/jdk/src/share/classes/java/net/SocketOutputStream.java +++ b/jdk/src/share/classes/java/net/SocketOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,8 +64,8 @@ class SocketOutputStream extends FileOutputStream * Returns the unique {@link java.nio.channels.FileChannel FileChannel} * object associated with this file output stream.

        * - * The getChannel method of SocketOutputStream - * returns null since it is a socket based stream.

        + * The {@code getChannel} method of {@code SocketOutputStream} + * returns {@code null} since it is a socket based stream.

        * * @return the file channel associated with this file output stream * diff --git a/jdk/src/share/classes/java/net/SocketPermission.java b/jdk/src/share/classes/java/net/SocketPermission.java index 43650068ae2..e90856eac8e 100644 --- a/jdk/src/share/classes/java/net/SocketPermission.java +++ b/jdk/src/share/classes/java/net/SocketPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -110,7 +110,7 @@ import sun.security.util.Debug; * * * is granted to some code, it allows that code to connect to port 7777 on - * puffin.eng.sun.com, and to accept connections on that port. + * {@code puffin.eng.sun.com}, and to accept connections on that port. * *

        Similarly, if the following permission: * @@ -788,7 +788,7 @@ public final class SocketPermission extends Permission * port range is ignored when p only contains the action, 'resolve'.

        *

      * - * Then implies checks each of the following, in order, + * Then {@code implies} checks each of the following, in order, * and for each returns true if the stated condition is true:

      *

        *
      • If this object was initialized with a single IP address and one of p's @@ -802,7 +802,7 @@ public final class SocketPermission extends Permission *
      • If this canonical name equals p's canonical name.

        *

      * - * If none of the above are true, implies returns false. + * If none of the above are true, {@code implies} returns false. * @param p the permission to check against. * * @return true if the specified permission is implied by this object, @@ -1131,7 +1131,7 @@ public final class SocketPermission extends Permission *

      * SocketPermission objects must be stored in a manner that allows them * to be inserted into the collection in any order, but that also enables the - * PermissionCollection implies + * PermissionCollection {@code implies} * method to be implemented in an efficient (and consistent) manner. * * @return a new PermissionCollection object suitable for storing SocketPermissions. diff --git a/jdk/src/share/classes/java/net/SocksSocketImpl.java b/jdk/src/share/classes/java/net/SocksSocketImpl.java index 16155d2f115..3e4fb5fe74a 100644 --- a/jdk/src/share/classes/java/net/SocksSocketImpl.java +++ b/jdk/src/share/classes/java/net/SocksSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -315,7 +315,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { * grants the connections, then the connect is successful and all * further traffic will go to the "real" endpoint. * - * @param endpoint the SocketAddress to connect to. + * @param endpoint the {@code SocketAddress} to connect to. * @param timeout the timeout value in milliseconds * @throws IOException if the connection can't be established. * @throws SecurityException if there is a security manager and it @@ -1032,9 +1032,9 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { /** - * Returns the value of this socket's address field. + * Returns the value of this socket's {@code address} field. * - * @return the value of this socket's address field. + * @return the value of this socket's {@code address} field. * @see java.net.SocketImpl#address */ @Override @@ -1046,9 +1046,9 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { } /** - * Returns the value of this socket's port field. + * Returns the value of this socket's {@code port} field. * - * @return the value of this socket's port field. + * @return the value of this socket's {@code port} field. * @see java.net.SocketImpl#port */ @Override diff --git a/jdk/src/share/classes/java/net/URI.java b/jdk/src/share/classes/java/net/URI.java index 643c8af8a71..77c2f7a178f 100644 --- a/jdk/src/share/classes/java/net/URI.java +++ b/jdk/src/share/classes/java/net/URI.java @@ -67,24 +67,24 @@ import java.lang.NullPointerException; // for javadoc * form has the syntax * *

      - * [scheme:]scheme-specific-part[#fragment] + * [scheme{@code :}]scheme-specific-part[{@code #}fragment] *
      * * where square brackets [...] delineate optional components and the characters - * : and # stand for themselves. + * {@code :} and {@code #} stand for themselves. * *

      An absolute URI specifies a scheme; a URI that is not absolute is * said to be relative. URIs are also classified according to whether * they are opaque or hierarchical. * *

      An opaque URI is an absolute URI whose scheme-specific part does - * not begin with a slash character ('/'). Opaque URIs are not + * not begin with a slash character ({@code '/'}). Opaque URIs are not * subject to further parsing. Some examples of opaque URIs are: * *

      - * - * - * + * + * + * *
      mailto:java-net@java.sun.com
      news:comp.lang.java
      urn:isbn:096139210x
      {@code mailto:java-net@java.sun.com}
      {@code news:comp.lang.java}
      {@code urn:isbn:096139210x}
      * *

      A hierarchical URI is either an absolute URI whose @@ -93,20 +93,20 @@ import java.lang.NullPointerException; // for javadoc * URIs are: * *

      - * http://java.sun.com/j2se/1.3/
      - * docs/guide/collections/designfaq.html#28
      - * ../../../demo/jfc/SwingSet2/src/SwingSet2.java
      - * file:///~/calendar + * {@code http://java.sun.com/j2se/1.3/}
      + * {@code docs/guide/collections/designfaq.html#28}
      + * {@code ../../../demo/jfc/SwingSet2/src/SwingSet2.java}
      + * {@code file:///~/calendar} *
      * *

      A hierarchical URI is subject to further parsing according to the syntax * *

      - * [scheme:][//authority][path][?query][#fragment] + * [scheme{@code :}][{@code //}authority][path][{@code ?}query][{@code #}fragment] *
      * - * where the characters :, /, - * ?, and # stand for themselves. The + * where the characters {@code :}, {@code /}, + * {@code ?}, and {@code #} stand for themselves. The * scheme-specific part of a hierarchical URI consists of the characters * between the scheme and fragment components. * @@ -115,16 +115,16 @@ import java.lang.NullPointerException; // for javadoc * parses according to the familiar syntax * *
      - * [user-info@]host[:port] + * [user-info{@code @}]host[{@code :}port] *
      * - * where the characters @ and : stand for + * where the characters {@code @} and {@code :} stand for * themselves. Nearly all URI schemes currently in use are server-based. An * authority component that does not parse in this way is considered to be * registry-based. * *

      The path component of a hierarchical URI is itself said to be absolute - * if it begins with a slash character ('/'); otherwise it is + * if it begins with a slash character ({@code '/'}); otherwise it is * relative. The path of a hierarchical URI that is either absolute or * specifies an authority is always absolute. * @@ -132,21 +132,21 @@ import java.lang.NullPointerException; // for javadoc * *

      * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * *
      ComponentType
      schemeString
      scheme-specific-part    String
      authorityString
      user-infoString
      hostString
      portint
      pathString
      queryString
      fragmentString
      scheme{@code String}
      scheme-specific-part    {@code String}
      authority{@code String}
      user-info{@code String}
      host{@code String}
      port{@code int}
      path{@code String}
      query{@code String}
      fragment{@code String}
      * * In a given instance any particular component is either undefined or * defined with a distinct value. Undefined string components are - * represented by null, while undefined integer components are - * represented by -1. A string component may be defined to have the + * represented by {@code null}, while undefined integer components are + * represented by {@code -1}. A string component may be defined to have the * empty string as its value; this is not equivalent to that component being * undefined. * @@ -165,10 +165,10 @@ import java.lang.NullPointerException; // for javadoc * The key operations supported by this class are those of * normalization, resolution, and relativization. * - *

      Normalization is the process of removing unnecessary "." - * and ".." segments from the path component of a hierarchical URI. - * Each "." segment is simply removed. A ".." segment is - * removed only if it is preceded by a non-".." segment. + *

      Normalization is the process of removing unnecessary {@code "."} + * and {@code ".."} segments from the path component of a hierarchical URI. + * Each {@code "."} segment is simply removed. A {@code ".."} segment is + * removed only if it is preceded by a non-{@code ".."} segment. * Normalization has no effect upon opaque URIs. * *

      Resolution is the process of resolving one URI against another, @@ -179,45 +179,47 @@ import java.lang.NullPointerException; // for javadoc * normalized. The result, for example, of resolving * *

      - * docs/guide/collections/designfaq.html#28          (1) + * {@code docs/guide/collections/designfaq.html#28} + *              + *     (1) *
      * - * against the base URI http://java.sun.com/j2se/1.3/ is the result + * against the base URI {@code http://java.sun.com/j2se/1.3/} is the result * URI * *
      - * http://java.sun.com/j2se/1.3/docs/guide/collections/designfaq.html#28 + * {@code http://java.sun.com/j2se/1.3/docs/guide/collections/designfaq.html#28} *
      * * Resolving the relative URI * *
      - * ../../../demo/jfc/SwingSet2/src/SwingSet2.java    (2) + * {@code ../../../demo/jfc/SwingSet2/src/SwingSet2.java}    (2) *
      * * against this result yields, in turn, * *
      - * http://java.sun.com/j2se/1.3/demo/jfc/SwingSet2/src/SwingSet2.java + * {@code http://java.sun.com/j2se/1.3/demo/jfc/SwingSet2/src/SwingSet2.java} *
      * * Resolution of both absolute and relative URIs, and of both absolute and * relative paths in the case of hierarchical URIs, is supported. Resolving - * the URI file:///~calendar against any other URI simply yields the + * the URI {@code file:///~calendar} against any other URI simply yields the * original URI, since it is absolute. Resolving the relative URI (2) above * against the relative base URI (1) yields the normalized, but still relative, * URI * *
      - * demo/jfc/SwingSet2/src/SwingSet2.java + * {@code demo/jfc/SwingSet2/src/SwingSet2.java} *
      * *

      Relativization, finally, is the inverse of resolution: For any * two normalized URIs u and v, * *

      - * u.relativize(u.resolve(v)).equals(v)  and
      - * u.resolve(u.relativize(v)).equals(v)  .
      + * u{@code .relativize(}u{@code .resolve(}v{@code )).equals(}v{@code )}  and
      + * u{@code .resolve(}u{@code .relativize(}v{@code )).equals(}v{@code )}  .
      *
      * * This operation is often useful when constructing a document containing URIs @@ -225,16 +227,16 @@ import java.lang.NullPointerException; // for javadoc * possible. For example, relativizing the URI * *
      - * http://java.sun.com/j2se/1.3/docs/guide/index.html + * {@code http://java.sun.com/j2se/1.3/docs/guide/index.html} *
      * * against the base URI * *
      - * http://java.sun.com/j2se/1.3 + * {@code http://java.sun.com/j2se/1.3} *
      * - * yields the relative URI docs/guide/index.html. + * yields the relative URI {@code docs/guide/index.html}. * * *

      Character categories

      @@ -247,26 +249,26 @@ import java.lang.NullPointerException; // for javadoc *
      * * + * {@code 'A'} through {@code 'Z'} + * and {@code 'a'} through {@code 'z'} * * + * {@code '0'} through {@code '9'} * * * * + * {@code "_-!.~'()*"} * - * + * * * + * {@code "?/[]@"} * * + * character ({@code '%'}) followed by two hexadecimal digits + * ({@code '0'}-{@code '9'}, {@code 'A'}-{@code 'F'}, and + * {@code 'a'}-{@code 'f'}) * *
      alphaThe US-ASCII alphabetic characters, - * 'A' through 'Z' - * and 'a' through 'z'
      digitThe US-ASCII decimal digit characters, - * '0' through '9'
      alphanumAll alpha and digit characters
      unreserved    All alphanum characters together with those in the string - * "_-!.~'()*"
      punctThe characters in the string ",;:$&+="
      The characters in the string {@code ",;:$&+="}
      reservedAll punct characters together with those in the string - * "?/[]@"
      escapedEscaped octets, that is, triplets consisting of the percent - * character ('%') followed by two hexadecimal digits - * ('0'-'9', 'A'-'F', and - * 'a'-'f')
      otherThe Unicode characters that are not in the US-ASCII character set, * are not control characters (according to the {@link @@ -306,14 +308,14 @@ import java.lang.NullPointerException; // for javadoc * *
    • A character is encoded by replacing it * with the sequence of escaped octets that represent that character in the - * UTF-8 character set. The Euro currency symbol ('\u20AC'), - * for example, is encoded as "%E2%82%AC". (Deviation from + * UTF-8 character set. The Euro currency symbol ({@code '\u005Cu20AC'}), + * for example, is encoded as {@code "%E2%82%AC"}. (Deviation from * RFC 2396, which does not specify any particular character * set.)

    • * *
    • An illegal character is quoted simply by * encoding it. The space character, for example, is quoted by replacing it - * with "%20". UTF-8 contains US-ASCII, hence for US-ASCII + * with {@code "%20"}. UTF-8 contains US-ASCII, hence for US-ASCII * characters this transformation has exactly the effect required by * RFC 2396.

    • * @@ -325,7 +327,7 @@ import java.lang.NullPointerException; // for javadoc * decoding any encoded non-US-ASCII characters. If a decoding error occurs * when decoding the escaped octets then the erroneous octets are replaced by - * '\uFFFD', the Unicode replacement character.

      + * {@code '\u005CuFFFD'}, the Unicode replacement character.

      * * * @@ -343,7 +345,7 @@ import java.lang.NullPointerException; // for javadoc * #URI(java.lang.String,java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String) * multi-argument constructors} quote illegal characters as * required by the components in which they appear. The percent character - * ('%') is always quoted by these constructors. Any other + * ({@code '%'}) is always quoted by these constructors. Any other * characters are preserved.

      * *
    • The {@link #getRawUserInfo() getRawUserInfo}, {@link #getRawPath() @@ -379,42 +381,33 @@ import java.lang.NullPointerException; // for javadoc * For any URI u, it is always the case that * *

      - * new URI(u.toString()).equals(u) . + * {@code new URI(}u{@code .toString()).equals(}u{@code )} . *
      * * For any URI u that does not contain redundant syntax such as two - * slashes before an empty authority (as in file:///tmp/ ) or a + * slashes before an empty authority (as in {@code file:///tmp/} ) or a * colon following a host name but no port (as in - * http://java.sun.com: ), and that does not encode characters + * {@code http://java.sun.com:} ), and that does not encode characters * except those that must be quoted, the following identities also hold: - * - *
      - * new URI(u.getScheme(),
      - *         
      u.getSchemeSpecificPart(),
      - *         
      u.getFragment())
      - * .equals(
      u) - *
      - * + *

      + *     new URI(u.getScheme(),
      + *             u.getSchemeSpecificPart(),
      + *             u.getFragment())
      + *     .equals(u)
      * in all cases, - * - *
      - * new URI(u.getScheme(),
      - *         
      u.getUserInfo(), u.getAuthority(),
      - *         
      u.getPath(), u.getQuery(),
      - *         
      u.getFragment())
      - * .equals(
      u) - *
      - * + *

      + *     new URI(u.getScheme(),
      + *             u.getUserInfo(), u.getAuthority(),
      + *             u.getPath(), u.getQuery(),
      + *             u.getFragment())
      + *     .equals(u)
      * if u is hierarchical, and - * - *
      - * new URI(u.getScheme(),
      - *         
      u.getUserInfo(), u.getHost(), u.getPort(),
      - *         
      u.getPath(), u.getQuery(),
      - *         
      u.getFragment())
      - * .equals(
      u) - *
      - * + *

      + *     new URI(u.getScheme(),
      + *             u.getUserInfo(), u.getHost(), u.getPort(),
      + *             u.getPath(), u.getQuery(),
      + *             u.getFragment())
      + *     .equals(u)
      * if u is hierarchical and has either no authority or a server-based * authority. * @@ -425,8 +418,8 @@ import java.lang.NullPointerException; // for javadoc * resource locator. Hence every URL is a URI, abstractly speaking, but * not every URI is a URL. This is because there is another subcategory of * URIs, uniform resource names (URNs), which name resources but do not - * specify how to locate them. The mailto, news, and - * isbn URIs shown above are examples of URNs. + * specify how to locate them. The {@code mailto}, {@code news}, and + * {@code isbn} URIs shown above are examples of URNs. * *

      The conceptual distinction between URIs and URLs is reflected in the * differences between this class and the {@link URL} class. @@ -530,12 +523,12 @@ public final class URI * href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, * Appendix A, except for the following deviations:

      * - *
        + *
          * *
        • An empty authority component is permitted as long as it is * followed by a non-empty path, a query component, or a fragment * component. This allows the parsing of URIs such as - * "file:///foo/bar", which seems to be the intent of + * {@code "file:///foo/bar"}, which seems to be the intent of * RFC 2396 although the grammar does not permit it. If the * authority component is empty then the user-information, host, and port * components are undefined.

        • @@ -543,7 +536,7 @@ public final class URI *
        • Empty relative paths are permitted; this seems to be the * intent of RFC 2396 although the grammar does not permit it. The * primary consequence of this deviation is that a standalone fragment - * such as "#foo" parses as a relative URI with an empty path + * such as {@code "#foo"} parses as a relative URI with an empty path * and the given fragment, and can be usefully resolved against a base URI. * @@ -560,12 +553,12 @@ public final class URI * href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396 * section 3.2.2 although the grammar does not permit it. The * consequence of this deviation is that the authority component of a - * hierarchical URI such as s://123, will parse as a server-based + * hierarchical URI such as {@code s://123}, will parse as a server-based * authority.

        • * *
        • IPv6 addresses are permitted for the host component. An IPv6 - * address must be enclosed in square brackets ('[' and - * ']') as specified by RFC 2732. The * IPv6 address itself must parse according to RFC 2373. IPv6 @@ -585,7 +578,7 @@ public final class URI * @param str The string to be parsed into a URI * * @throws NullPointerException - * If str is null + * If {@code str} is {@code null} * * @throws URISyntaxException * If the given string violates RFC 2396, as augmented @@ -599,10 +592,10 @@ public final class URI * Constructs a hierarchical URI from the given components. * *

          If a scheme is given then the path, if also given, must either be - * empty or begin with a slash character ('/'). Otherwise a - * component of the new URI may be left undefined by passing null - * for the corresponding parameter or, in the case of the port - * parameter, by passing -1. + * empty or begin with a slash character ({@code '/'}). Otherwise a + * component of the new URI may be left undefined by passing {@code null} + * for the corresponding parameter or, in the case of the {@code port} + * parameter, by passing {@code -1}. * *

          This constructor first builds a URI string from the given components * according to the rules specified in

          Initially, the result string is empty.

        • * *
        • If a scheme is given then it is appended to the result, - * followed by a colon character (':').

        • + * followed by a colon character ({@code ':'}).

          * *
        • If user information, a host, or a port are given then the - * string "//" is appended.

        • + * string {@code "//"} is appended.

          * *
        • If user information is given then it is appended, followed by - * a commercial-at character ('@'). Any character not in the + * a commercial-at character ({@code '@'}). Any character not in the * unreserved, punct, escaped, or other * categories is quoted.

        • * *
        • If a host is given then it is appended. If the host is a * literal IPv6 address but is not enclosed in square brackets - * ('[' and ']') then the square brackets are added. + * ({@code '['} and {@code ']'}) then the square brackets are added. *

        • * *
        • If a port number is given then a colon character - * (':') is appended, followed by the port number in decimal. + * ({@code ':'}) is appended, followed by the port number in decimal. *

        • * *
        • If a path is given then it is appended. Any character not in * the unreserved, punct, escaped, or other - * categories, and not equal to the slash character ('/') or the - * commercial-at character ('@'), is quoted.

        • + * categories, and not equal to the slash character ({@code '/'}) or the + * commercial-at character ({@code '@'}), is quoted.

          * *
        • If a query is given then a question-mark character - * ('?') is appended, followed by the query. Any character that + * ({@code '?'}) is appended, followed by the query. Any character that * is not a legal URI character is quoted. *

        • * *
        • Finally, if a fragment is given then a hash character - * ('#') is appended, followed by the fragment. Any character + * ({@code '#'}) is appended, followed by the fragment. Any character * that is not a legal URI character is quoted.

        • * * @@ -684,8 +677,8 @@ public final class URI * Constructs a hierarchical URI from the given components. * *

          If a scheme is given then the path, if also given, must either be - * empty or begin with a slash character ('/'). Otherwise a - * component of the new URI may be left undefined by passing null + * empty or begin with a slash character ({@code '/'}). Otherwise a + * component of the new URI may be left undefined by passing {@code null} * for the corresponding parameter. * *

          This constructor first builds a URI string from the given components @@ -698,28 +691,28 @@ public final class URI *

        • Initially, the result string is empty.

        • * *
        • If a scheme is given then it is appended to the result, - * followed by a colon character (':').

        • + * followed by a colon character ({@code ':'}).

          * - *
        • If an authority is given then the string "//" is + *

        • If an authority is given then the string {@code "//"} is * appended, followed by the authority. If the authority contains a * literal IPv6 address then the address must be enclosed in square - * brackets ('[' and ']'). Any character not in the + * brackets ({@code '['} and {@code ']'}). Any character not in the * unreserved, punct, escaped, or other * categories, and not equal to the commercial-at character - * ('@'), is quoted.

        • + * ({@code '@'}), is quoted.

          * *
        • If a path is given then it is appended. Any character not in * the unreserved, punct, escaped, or other - * categories, and not equal to the slash character ('/') or the - * commercial-at character ('@'), is quoted.

        • + * categories, and not equal to the slash character ({@code '/'}) or the + * commercial-at character ({@code '@'}), is quoted.

          * *
        • If a query is given then a question-mark character - * ('?') is appended, followed by the query. Any character that + * ({@code '?'}) is appended, followed by the query. Any character that * is not a legal URI character is quoted. *

        • * *
        • Finally, if a fragment is given then a hash character - * ('#') is appended, followed by the fragment. Any character + * ({@code '#'}) is appended, followed by the fragment. Any character * that is not a legal URI character is quoted.

        • * * @@ -756,15 +749,15 @@ public final class URI /** * Constructs a hierarchical URI from the given components. * - *

          A component may be left undefined by passing null. + *

          A component may be left undefined by passing {@code null}. * *

          This convenience constructor works as if by invoking the * seven-argument constructor as follows: * - *

          - * new {@link #URI(String, String, String, int, String, String, String) - * URI}(scheme, null, host, -1, path, null, fragment); - *
          + *
          + * {@code new} {@link #URI(String, String, String, int, String, String, String) + * URI}{@code (scheme, null, host, -1, path, null, fragment);} + *
          * * @param scheme Scheme name * @param host Host name @@ -784,7 +777,7 @@ public final class URI /** * Constructs a URI from the given components. * - *

          A component may be left undefined by passing null. + *

          A component may be left undefined by passing {@code null}. * *

          This constructor first builds a URI in string form using the given * components as follows:

          @@ -794,14 +787,14 @@ public final class URI *
        • Initially, the result string is empty.

        • * *
        • If a scheme is given then it is appended to the result, - * followed by a colon character (':').

        • + * followed by a colon character ({@code ':'}).

          * *
        • If a scheme-specific part is given then it is appended. Any * character that is not a legal URI character * is quoted.

        • * *
        • Finally, if a fragment is given then a hash character - * ('#') is appended to the string, followed by the fragment. + * ({@code '#'}) is appended to the string, followed by the fragment. * Any character that is not a legal URI character is quoted.

        • * * @@ -847,7 +840,7 @@ public final class URI * @return The new URI * * @throws NullPointerException - * If str is null + * If {@code str} is {@code null} * * @throws IllegalArgumentException * If the given string violates RFC 2396 @@ -882,7 +875,7 @@ public final class URI * cannot always distinguish a malformed server-based authority from a * legitimate registry-based authority. It must therefore treat some * instances of the former as instances of the latter. The authority - * component in the URI string "//foo:bar", for example, is not a + * component in the URI string {@code "//foo:bar"}, for example, is not a * legal server-based authority but it is legal as a registry-based * authority. * @@ -892,7 +885,7 @@ public final class URI * treated as an error. In these cases a statement such as * *
          - * URI u = new URI(str).parseServerAuthority(); + * {@code URI }u{@code = new URI(str).parseServerAuthority();} *
          * *

          can be used to ensure that u always refers to a URI that, if @@ -936,26 +929,26 @@ public final class URI * *

            * - *
          1. All "." segments are removed.

          2. + *
          3. All {@code "."} segments are removed.

          4. * - *
          5. If a ".." segment is preceded by a non-".." + *

          6. If a {@code ".."} segment is preceded by a non-{@code ".."} * segment then both of these segments are removed. This step is * repeated until it is no longer applicable.

          7. * *
          8. If the path is relative, and if its first segment contains a - * colon character (':'), then a "." segment is + * colon character ({@code ':'}), then a {@code "."} segment is * prepended. This prevents a relative URI with a path such as - * "a:b/c/d" from later being re-parsed as an opaque URI with a - * scheme of "a" and a scheme-specific part of "b/c/d". + * {@code "a:b/c/d"} from later being re-parsed as an opaque URI with a + * scheme of {@code "a"} and a scheme-specific part of {@code "b/c/d"}. * (Deviation from RFC 2396)

          9. * *
          * - *

          A normalized path will begin with one or more ".." segments - * if there were insufficient non-".." segments preceding them to - * allow their removal. A normalized path will begin with a "." + *

          A normalized path will begin with one or more {@code ".."} segments + * if there were insufficient non-{@code ".."} segments preceding them to + * allow their removal. A normalized path will begin with a {@code "."} * segment if one was inserted by step 3 above. Otherwise, a normalized - * path will not contain any "." or ".." segments.

          + * path will not contain any {@code "."} or {@code ".."} segments.

          * * @return A URI equivalent to this URI, * but whose path is in normal form @@ -975,7 +968,7 @@ public final class URI * query components are undefined, then a URI with the given fragment but * with all other components equal to those of this URI is returned. This * allows a URI representing a standalone fragment reference, such as - * "#foo", to be usefully resolved against a base URI. + * {@code "#foo"}, to be usefully resolved against a base URI. * *

          Otherwise this method constructs a new hierarchical URI in a manner * consistent with

          Otherwise the new URI's authority component is copied from * this URI, and its path is computed as follows:

          * - *
            + *
              * *
            1. If the given URI's path is absolute then the new URI's path * is taken from the given URI.

            2. @@ -1016,7 +1009,7 @@ public final class URI * @return The resulting URI * * @throws NullPointerException - * If uri is null + * If {@code uri} is {@code null} */ public URI resolve(URI uri) { return resolve(this, uri); @@ -1027,14 +1020,14 @@ public final class URI * against this URI. * *

              This convenience method works as if invoking it were equivalent to - * evaluating the expression {@link #resolve(java.net.URI) - * resolve}(URI.{@link #create(String) create}(str)).

              + * evaluating the expression {@link #resolve(java.net.URI) + * resolve}{@code (URI.}{@link #create(String) create}{@code (str))}.

              * * @param str The string to be parsed into a URI * @return The resulting URI * * @throws NullPointerException - * If str is null + * If {@code str} is {@code null} * * @throws IllegalArgumentException * If the given string violates RFC 2396 @@ -1067,7 +1060,7 @@ public final class URI * @return The resulting URI * * @throws NullPointerException - * If uri is null + * If {@code uri} is {@code null} */ public URI relativize(URI uri) { return relativize(this, uri); @@ -1077,7 +1070,7 @@ public final class URI * Constructs a URL from this URI. * *

              This convenience method works as if invoking it were equivalent to - * evaluating the expression new URL(this.toString()) after + * evaluating the expression {@code new URL(this.toString())} after * first checking that this URI is absolute.

              * * @return A URL constructed from this URI @@ -1102,14 +1095,14 @@ public final class URI * Returns the scheme component of this URI. * *

              The scheme component of a URI, if defined, only contains characters - * in the alphanum category and in the string "-.+". A + * in the alphanum category and in the string {@code "-.+"}. A * scheme always starts with an alpha character.

              * * The scheme component of a URI cannot contain escaped octets, hence this * method does not perform any decoding. * * @return The scheme component of this URI, - * or null if the scheme is undefined + * or {@code null} if the scheme is undefined */ public String getScheme() { return scheme; @@ -1120,7 +1113,7 @@ public final class URI * *

              A URI is absolute if, and only if, it has a scheme component.

              * - * @return true if, and only if, this URI is absolute + * @return {@code true} if, and only if, this URI is absolute */ public boolean isAbsolute() { return scheme != null; @@ -1134,7 +1127,7 @@ public final class URI * An opaque URI has a scheme, a scheme-specific part, and possibly * a fragment; all other components are undefined.

              * - * @return true if, and only if, this URI is opaque + * @return {@code true} if, and only if, this URI is opaque */ public boolean isOpaque() { return path == null; @@ -1148,7 +1141,7 @@ public final class URI * characters.

              * * @return The raw scheme-specific part of this URI - * (never null) + * (never {@code null}) */ public String getRawSchemeSpecificPart() { defineSchemeSpecificPart(); @@ -1164,7 +1157,7 @@ public final class URI * href="#decode">decoded
              .

              * * @return The decoded scheme-specific part of this URI - * (never null) + * (never {@code null}) */ public String getSchemeSpecificPart() { if (decodedSchemeSpecificPart == null) @@ -1176,14 +1169,14 @@ public final class URI * Returns the raw authority component of this URI. * *

              The authority component of a URI, if defined, only contains the - * commercial-at character ('@') and characters in the + * commercial-at character ({@code '@'}) and characters in the * unreserved, punct, escaped, and other * categories. If the authority is server-based then it is further * constrained to have valid user-information, host, and port * components.

              * * @return The raw authority component of this URI, - * or null if the authority is undefined + * or {@code null} if the authority is undefined */ public String getRawAuthority() { return authority; @@ -1197,7 +1190,7 @@ public final class URI * sequences of escaped octets are decoded.

              * * @return The decoded authority component of this URI, - * or null if the authority is undefined + * or {@code null} if the authority is undefined */ public String getAuthority() { if (decodedAuthority == null) @@ -1213,7 +1206,7 @@ public final class URI * other categories.

              * * @return The raw user-information component of this URI, - * or null if the user information is undefined + * or {@code null} if the user information is undefined */ public String getRawUserInfo() { return userInfo; @@ -1227,7 +1220,7 @@ public final class URI * sequences of escaped octets are decoded.

              * * @return The decoded user-information component of this URI, - * or null if the user information is undefined + * or {@code null} if the user information is undefined */ public String getUserInfo() { if ((decodedUserInfo == null) && (userInfo != null)) @@ -1241,24 +1234,24 @@ public final class URI *

              The host component of a URI, if defined, will have one of the * following forms:

              * - *
                + *
                  * *
                • A domain name consisting of one or more labels - * separated by period characters ('.'), optionally followed by + * separated by period characters ({@code '.'}), optionally followed by * a period character. Each label consists of alphanum characters - * as well as hyphen characters ('-'), though hyphens never + * as well as hyphen characters ({@code '-'}), though hyphens never * occur as the first or last characters in a label. The rightmost * label of a domain name consisting of two or more labels, begins * with an alpha character.

                • * *
                • A dotted-quad IPv4 address of the form - * digit+.digit+.digit+.digit+, + * digit{@code +.}digit{@code +.}digit{@code +.}digit{@code +}, * where no digit sequence is longer than three characters and no * sequence has a value larger than 255.

                • * - *
                • An IPv6 address enclosed in square brackets ('[' and - * ']') and consisting of hexadecimal digits, colon characters - * (':'), and possibly an embedded IPv4 address. The full + *

                • An IPv6 address enclosed in square brackets ({@code '['} and + * {@code ']'}) and consisting of hexadecimal digits, colon characters + * ({@code ':'}), and possibly an embedded IPv4 address. The full * syntax of IPv6 addresses is specified in RFC 2373: IPv6 * Addressing Architecture.

                • @@ -1269,7 +1262,7 @@ public final class URI * method does not perform any decoding. * * @return The host component of this URI, - * or null if the host is undefined + * or {@code null} if the host is undefined */ public String getHost() { return host; @@ -1282,7 +1275,7 @@ public final class URI * integer.

                  * * @return The port component of this URI, - * or -1 if the port is undefined + * or {@code -1} if the port is undefined */ public int getPort() { return port; @@ -1292,12 +1285,12 @@ public final class URI * Returns the raw path component of this URI. * *

                  The path component of a URI, if defined, only contains the slash - * character ('/'), the commercial-at character ('@'), + * character ({@code '/'}), the commercial-at character ({@code '@'}), * and characters in the unreserved, punct, escaped, * and other categories.

                  * * @return The path component of this URI, - * or null if the path is undefined + * or {@code null} if the path is undefined */ public String getRawPath() { return path; @@ -1311,7 +1304,7 @@ public final class URI * escaped octets are decoded.

                  * * @return The decoded path component of this URI, - * or null if the path is undefined + * or {@code null} if the path is undefined */ public String getPath() { if ((decodedPath == null) && (path != null)) @@ -1326,7 +1319,7 @@ public final class URI * characters.

                  * * @return The raw query component of this URI, - * or null if the query is undefined + * or {@code null} if the query is undefined */ public String getRawQuery() { return query; @@ -1340,7 +1333,7 @@ public final class URI * escaped octets are decoded.

                  * * @return The decoded query component of this URI, - * or null if the query is undefined + * or {@code null} if the query is undefined */ public String getQuery() { if ((decodedQuery == null) && (query != null)) @@ -1355,7 +1348,7 @@ public final class URI * characters.

                  * * @return The raw fragment component of this URI, - * or null if the fragment is undefined + * or {@code null} if the fragment is undefined */ public String getRawFragment() { return fragment; @@ -1369,7 +1362,7 @@ public final class URI * sequences of escaped octets are decoded.

                  * * @return The decoded fragment component of this URI, - * or null if the fragment is undefined + * or {@code null} if the fragment is undefined */ public String getFragment() { if ((decodedFragment == null) && (fragment != null)) @@ -1384,7 +1377,7 @@ public final class URI * Tests this URI for equality with another object. * *

                  If the given object is not a URI then this method immediately - * returns false. + * returns {@code false}. * *

                  For two URIs to be considered equal requires that either both are * opaque or both are hierarchical. Their schemes must either both be @@ -1414,7 +1407,7 @@ public final class URI * * @param ob The object to which this object is to be compared * - * @return true if, and only if, the given object is a URI that + * @return {@code true} if, and only if, the given object is a URI that * is identical to this URI */ public boolean equals(Object ob) { @@ -1495,7 +1488,7 @@ public final class URI * *

                  The ordering of URIs is defined as follows:

                  * - *
                    + *
                      * *
                    • Two URIs with different schemes are ordered according the * ordering of their schemes, without regard to case.

                    • @@ -1513,7 +1506,7 @@ public final class URI *
                    • Two hierarchical URIs with identical schemes are ordered * according to the ordering of their authority components:

                      * - *
                        + *
                          * *
                        • If both authority components are server-based then the URIs * are ordered according to their user-information components; if these @@ -1635,7 +1628,7 @@ public final class URI /** * Saves the content of this URI to the given serial stream. * - *

                          The only serializable field of a URI instance is its string + *

                          The only serializable field of a URI instance is its {@code string} * field. That field is given a value, if it does not have one already, * and then the {@link java.io.ObjectOutputStream#defaultWriteObject()} * method of the given object-output stream is invoked.

                          @@ -1654,7 +1647,7 @@ public final class URI * Reconstitutes a URI from the given serial stream. * *

                          The {@link java.io.ObjectInputStream#defaultReadObject()} method is - * invoked to read the value of the string field. The result is + * invoked to read the value of the {@code string} field. The result is * then parsed in the usual way. * * @param is The object-input stream from which this object diff --git a/jdk/src/share/classes/java/net/URISyntaxException.java b/jdk/src/share/classes/java/net/URISyntaxException.java index df4a02a5ef8..8072c37244e 100644 --- a/jdk/src/share/classes/java/net/URISyntaxException.java +++ b/jdk/src/share/classes/java/net/URISyntaxException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,13 +50,13 @@ public class URISyntaxException * @param input The input string * @param reason A string explaining why the input could not be parsed * @param index The index at which the parse error occurred, - * or -1 if the index is not known + * or {@code -1} if the index is not known * * @throws NullPointerException - * If either the input or reason strings are null + * If either the input or reason strings are {@code null} * * @throws IllegalArgumentException - * If the error index is less than -1 + * If the error index is less than {@code -1} */ public URISyntaxException(String input, String reason, int index) { super(reason); @@ -70,13 +70,13 @@ public class URISyntaxException /** * Constructs an instance from the given input string and reason. The - * resulting object will have an error index of -1. + * resulting object will have an error index of {@code -1}. * * @param input The input string * @param reason A string explaining why the input could not be parsed * * @throws NullPointerException - * If either the input or reason strings are null + * If either the input or reason strings are {@code null} */ public URISyntaxException(String input, String reason) { this(input, reason, -1); @@ -102,7 +102,7 @@ public class URISyntaxException /** * Returns an index into the input string of the position at which the - * parse error occurred, or -1 if this position is not known. + * parse error occurred, or {@code -1} if this position is not known. * * @return The error index */ @@ -113,8 +113,8 @@ public class URISyntaxException /** * Returns a string describing the parse error. The resulting string * consists of the reason string followed by a colon character - * (':'), a space, and the input string. If the error index is - * defined then the string " at index " followed by the index, in + * ({@code ':'}), a space, and the input string. If the error index is + * defined then the string {@code " at index "} followed by the index, in * decimal, is inserted after the reason string and before the colon * character. * diff --git a/jdk/src/share/classes/java/net/URL.java b/jdk/src/share/classes/java/net/URL.java index caa1d5964cb..e7946d22e89 100644 --- a/jdk/src/share/classes/java/net/URL.java +++ b/jdk/src/share/classes/java/net/URL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ import java.util.StringTokenizer; import sun.security.util.SecurityConstants; /** - * Class URL represents a Uniform Resource + * Class {@code URL} represents a Uniform Resource * Locator, a pointer to a "resource" on the World * Wide Web. A resource can be something as simple as a file or a * directory, or it can be a reference to a more complicated object, @@ -49,10 +49,10 @@ import sun.security.util.SecurityConstants; * *

                          * The URL above indicates that the protocol to use is - * http (HyperText Transfer Protocol) and that the + * {@code http} (HyperText Transfer Protocol) and that the * information resides on a host machine named - * www.example.com. The information on that host - * machine is named /docs/resource1.html. The exact + * {@code www.example.com}. The information on that host + * machine is named {@code /docs/resource1.html}. The exact * meaning of this name on the host machine is both protocol * dependent and host dependent. The information normally resides in * a file, but it could be generated on the fly. This component of @@ -62,13 +62,13 @@ import sun.security.util.SecurityConstants; * port number to which the TCP connection is made on the remote host * machine. If the port is not specified, the default port for * the protocol is used instead. For example, the default port for - * http is 80. An alternative port could be + * {@code http} is {@code 80}. An alternative port could be * specified as: *

                            *     http://www.example.com:1080/docs/resource1.html
                            * 
                          *

                          - * The syntax of URL is defined by RFC 2396: Uniform * Resource Identifiers (URI): Generic Syntax, amended by RFC 2732: Format for @@ -86,7 +86,7 @@ import sun.security.util.SecurityConstants; * This fragment is not technically part of the URL. Rather, it * indicates that after the specified resource is retrieved, the * application is specifically interested in that part of the - * document that has the tag chapter1 attached to it. The + * document that has the tag {@code chapter1} attached to it. The * meaning of a tag is resource specific. *

                          * An application can also specify a "relative URL", @@ -170,8 +170,8 @@ public final class URL implements java.io.Serializable { private int port = -1; /** - * The specified file name on that host. file is - * defined as path[?query] + * The specified file name on that host. {@code file} is + * defined as {@code path[?query]} * @serial */ private String file; @@ -220,42 +220,42 @@ public final class URL implements java.io.Serializable { private int hashCode = -1; /** - * Creates a URL object from the specified - * protocol, host, port - * number, and file.

                          + * Creates a {@code URL} object from the specified + * {@code protocol}, {@code host}, {@code port} + * number, and {@code file}.

                          * - * host can be expressed as a host name or a literal + * {@code host} can be expressed as a host name or a literal * IP address. If IPv6 literal address is used, it should be - * enclosed in square brackets ('[' and ']'), as + * enclosed in square brackets ({@code '['} and {@code ']'}), as * specified by RFC 2732; * However, the literal IPv6 address format defined in RFC 2373: IP * Version 6 Addressing Architecture is also accepted.

                          * - * Specifying a port number of -1 + * Specifying a {@code port} number of {@code -1} * indicates that the URL should use the default port for the * protocol.

                          * * If this is the first URL object being created with the specified * protocol, a stream protocol handler object, an instance of - * class URLStreamHandler, is created for that protocol: + * class {@code URLStreamHandler}, is created for that protocol: *

                            *
                          1. If the application has previously set up an instance of - * URLStreamHandlerFactory as the stream handler factory, - * then the createURLStreamHandler method of that instance + * {@code URLStreamHandlerFactory} as the stream handler factory, + * then the {@code createURLStreamHandler} method of that instance * is called with the protocol string as an argument to create the * stream protocol handler. - *
                          2. If no URLStreamHandlerFactory has yet been set up, - * or if the factory's createURLStreamHandler method - * returns null, then the constructor finds the + *
                          3. If no {@code URLStreamHandlerFactory} has yet been set up, + * or if the factory's {@code createURLStreamHandler} method + * returns {@code null}, then the constructor finds the * value of the system property: *
                                  *         java.protocol.handler.pkgs
                                  *     
                            - * If the value of that system property is not null, + * If the value of that system property is not {@code null}, * it is interpreted as a list of packages separated by a vertical - * slash character '|'. The constructor tries to load + * slash character '{@code |}'. The constructor tries to load * the class named: *
                                  *         <package>.<protocol>.Handler
                            @@ -263,7 +263,7 @@ public final class URL implements java.io.Serializable {
                                  *     where <package> is replaced by the name of the package
                                  *     and <protocol> is replaced by the name of the protocol.
                                  *     If this class does not exist, or if the class exists but it is not
                            -     *     a subclass of URLStreamHandler, then the next package
                            +     *     a subclass of {@code URLStreamHandler}, then the next package
                                  *     in the list is tried.
                                  * 
                          4. If the previous step fails to find a protocol handler, then the * constructor tries to load from a system default package. @@ -271,8 +271,8 @@ public final class URL implements java.io.Serializable { * <system default package>.<protocol>.Handler *
                          5. * If this class does not exist, or if the class exists but it is not a - * subclass of URLStreamHandler, then a - * MalformedURLException is thrown. + * subclass of {@code URLStreamHandler}, then a + * {@code MalformedURLException} is thrown. *
                          * *

                          Protocol handlers for the following protocols are guaranteed @@ -304,13 +304,13 @@ public final class URL implements java.io.Serializable { } /** - * Creates a URL from the specified protocol - * name, host name, and file name. The + * Creates a URL from the specified {@code protocol} + * name, {@code host} name, and {@code file} name. The * default port for the specified protocol is used. *

                          * This method is equivalent to calling the four-argument - * constructor with the arguments being protocol, - * host, -1, and file. + * constructor with the arguments being {@code protocol}, + * {@code host}, {@code -1}, and {@code file}. * * No validation of the inputs is performed by this constructor. * @@ -327,21 +327,21 @@ public final class URL implements java.io.Serializable { } /** - * Creates a URL object from the specified - * protocol, host, port - * number, file, and handler. Specifying - * a port number of -1 indicates that + * Creates a {@code URL} object from the specified + * {@code protocol}, {@code host}, {@code port} + * number, {@code file}, and {@code handler}. Specifying + * a {@code port} number of {@code -1} indicates that * the URL should use the default port for the protocol. Specifying - * a handler of null indicates that the URL + * a {@code handler} of {@code null} indicates that the URL * should use a default stream handler for the protocol, as outlined * for: * java.net.URL#URL(java.lang.String, java.lang.String, int, * java.lang.String) * *

                          If the handler is not null and there is a security manager, - * the security manager's checkPermission + * the security manager's {@code checkPermission} * method is called with a - * NetPermission("specifyStreamHandler") permission. + * {@code NetPermission("specifyStreamHandler")} permission. * This may result in a SecurityException. * * No validation of the inputs is performed by this constructor. @@ -354,7 +354,7 @@ public final class URL implements java.io.Serializable { * @exception MalformedURLException if an unknown protocol is specified. * @exception SecurityException * if a security manager exists and its - * checkPermission method doesn't allow + * {@code checkPermission} method doesn't allow * specifying a stream handler explicitly. * @see java.lang.System#getProperty(java.lang.String) * @see java.net.URL#setURLStreamHandlerFactory( @@ -417,15 +417,15 @@ public final class URL implements java.io.Serializable { } /** - * Creates a URL object from the String + * Creates a {@code URL} object from the {@code String} * representation. *

                          * This constructor is equivalent to a call to the two-argument - * constructor with a null first argument. + * constructor with a {@code null} first argument. * - * @param spec the String to parse as a URL. + * @param spec the {@code String} to parse as a URL. * @exception MalformedURLException if no protocol is specified, or an - * unknown protocol is found, or spec is null. + * unknown protocol is found, or {@code spec} is {@code null}. * @see java.net.URL#URL(java.net.URL, java.lang.String) */ public URL(String spec) throws MalformedURLException { @@ -470,9 +470,9 @@ public final class URL implements java.io.Serializable { * For a more detailed description of URL parsing, refer to RFC2396. * * @param context the context in which to parse the specification. - * @param spec the String to parse as a URL. + * @param spec the {@code String} to parse as a URL. * @exception MalformedURLException if no protocol is specified, or an - * unknown protocol is found, or spec is null. + * unknown protocol is found, or {@code spec} is {@code null}. * @see java.net.URL#URL(java.lang.String, java.lang.String, * int, java.lang.String) * @see java.net.URLStreamHandler @@ -489,13 +489,13 @@ public final class URL implements java.io.Serializable { * occurs as with the two argument constructor. * * @param context the context in which to parse the specification. - * @param spec the String to parse as a URL. + * @param spec the {@code String} to parse as a URL. * @param handler the stream handler for the URL. * @exception MalformedURLException if no protocol is specified, or an - * unknown protocol is found, or spec is null. + * unknown protocol is found, or {@code spec} is {@code null}. * @exception SecurityException * if a security manager exists and its - * checkPermission method doesn't allow + * {@code checkPermission} method doesn't allow * specifying a stream handler. * @see java.net.URL#URL(java.lang.String, java.lang.String, * int, java.lang.String) @@ -719,9 +719,9 @@ public final class URL implements java.io.Serializable { } /** - * Gets the query part of this URL. + * Gets the query part of this {@code URL}. * - * @return the query part of this URL, + * @return the query part of this {@code URL}, * or null if one does not exist * @since 1.3 */ @@ -730,9 +730,9 @@ public final class URL implements java.io.Serializable { } /** - * Gets the path part of this URL. + * Gets the path part of this {@code URL}. * - * @return the path part of this URL, or an + * @return the path part of this {@code URL}, or an * empty string if one does not exist * @since 1.3 */ @@ -741,9 +741,9 @@ public final class URL implements java.io.Serializable { } /** - * Gets the userInfo part of this URL. + * Gets the userInfo part of this {@code URL}. * - * @return the userInfo part of this URL, or + * @return the userInfo part of this {@code URL}, or * null if one does not exist * @since 1.3 */ @@ -752,9 +752,9 @@ public final class URL implements java.io.Serializable { } /** - * Gets the authority part of this URL. + * Gets the authority part of this {@code URL}. * - * @return the authority part of this URL + * @return the authority part of this {@code URL} * @since 1.3 */ public String getAuthority() { @@ -762,7 +762,7 @@ public final class URL implements java.io.Serializable { } /** - * Gets the port number of this URL. + * Gets the port number of this {@code URL}. * * @return the port number, or -1 if the port is not set */ @@ -772,7 +772,7 @@ public final class URL implements java.io.Serializable { /** * Gets the default port number of the protocol associated - * with this URL. If the URL scheme or the URLStreamHandler + * with this {@code URL}. If the URL scheme or the URLStreamHandler * for the URL do not define a default port number, * then -1 is returned. * @@ -784,35 +784,35 @@ public final class URL implements java.io.Serializable { } /** - * Gets the protocol name of this URL. + * Gets the protocol name of this {@code URL}. * - * @return the protocol of this URL. + * @return the protocol of this {@code URL}. */ public String getProtocol() { return protocol; } /** - * Gets the host name of this URL, if applicable. + * Gets the host name of this {@code URL}, if applicable. * The format of the host conforms to RFC 2732, i.e. for a * literal IPv6 address, this method will return the IPv6 address - * enclosed in square brackets ('[' and ']'). + * enclosed in square brackets ({@code '['} and {@code ']'}). * - * @return the host name of this URL. + * @return the host name of this {@code URL}. */ public String getHost() { return host; } /** - * Gets the file name of this URL. + * Gets the file name of this {@code URL}. * The returned file portion will be * the same as getPath(), plus the concatenation of * the value of getQuery(), if any. If there is * no query portion, this method and getPath() will * return identical results. * - * @return the file name of this URL, + * @return the file name of this {@code URL}, * or an empty string if one does not exist */ public String getFile() { @@ -821,10 +821,10 @@ public final class URL implements java.io.Serializable { /** * Gets the anchor (also known as the "reference") of this - * URL. + * {@code URL}. * * @return the anchor (also known as the "reference") of this - * URL, or null if one does not exist + * {@code URL}, or null if one does not exist */ public String getRef() { return ref; @@ -834,7 +834,7 @@ public final class URL implements java.io.Serializable { * Compares this URL for equality with another object.

                          * * If the given object is not a URL then this method immediately returns - * false.

                          + * {@code false}.

                          * * Two URL objects are equal if they have the same protocol, reference * equivalent hosts, have the same port number on the host, and the same @@ -848,12 +848,12 @@ public final class URL implements java.io.Serializable { * Since hosts comparison requires name resolution, this operation is a * blocking operation.

                          * - * Note: The defined behavior for equals is known to + * Note: The defined behavior for {@code equals} is known to * be inconsistent with virtual hosting in HTTP. * * @param obj the URL 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. */ public boolean equals(Object obj) { if (!(obj instanceof URL)) @@ -869,7 +869,7 @@ public final class URL implements java.io.Serializable { * The hash code is based upon all the URL components relevant for URL * comparison. As such, this operation is a blocking operation.

                          * - * @return a hash code for this URL. + * @return a hash code for this {@code URL}. */ public synchronized int hashCode() { if (hashCode != -1) @@ -882,21 +882,21 @@ public final class URL implements java.io.Serializable { /** * Compares two URLs, excluding the fragment component.

                          * - * Returns true if this URL and the - * other argument are equal without taking the + * Returns {@code true} if this {@code URL} and the + * {@code other} argument are equal without taking the * fragment component into consideration. * - * @param other the URL to compare against. - * @return true if they reference the same remote object; - * false otherwise. + * @param other the {@code URL} to compare against. + * @return {@code true} if they reference the same remote object; + * {@code false} otherwise. */ public boolean sameFile(URL other) { return handler.sameFile(this, other); } /** - * Constructs a string representation of this URL. The - * string is created by calling the toExternalForm + * Constructs a string representation of this {@code URL}. The + * string is created by calling the {@code toExternalForm} * method of the stream protocol handler for this object. * * @return a string representation of this object. @@ -909,8 +909,8 @@ public final class URL implements java.io.Serializable { } /** - * Constructs a string representation of this URL. The - * string is created by calling the toExternalForm + * Constructs a string representation of this {@code URL}. The + * string is created by calling the {@code toExternalForm} * method of the stream protocol handler for this object. * * @return a string representation of this object. @@ -924,7 +924,7 @@ public final class URL implements java.io.Serializable { /** * Returns a {@link java.net.URI} equivalent to this URL. - * This method functions in the same way as new URI (this.toString()). + * This method functions in the same way as {@code new URI (this.toString())}. *

                          Note, any URL instance that complies with RFC 2396 can be converted * to a URI. However, some URLs that are not strictly in compliance * can not be converted to a URI. @@ -984,7 +984,7 @@ public final class URL implements java.io.Serializable { * @param proxy the Proxy through which this connection * will be made. If direct connection is desired, * Proxy.NO_PROXY should be specified. - * @return a URLConnection to the URL. + * @return a {@code URLConnection} to the URL. * @exception IOException if an I/O exception occurs. * @exception SecurityException if a security manager is present * and the caller doesn't have permission to connect @@ -1022,8 +1022,8 @@ public final class URL implements java.io.Serializable { } /** - * Opens a connection to this URL and returns an - * InputStream for reading from that connection. This + * Opens a connection to this {@code URL} and returns an + * {@code InputStream} for reading from that connection. This * method is a shorthand for: *

                                *     openConnection().getInputStream()
                          @@ -1077,22 +1077,22 @@ public final class URL implements java.io.Serializable {
                               static URLStreamHandlerFactory factory;
                           
                               /**
                          -     * Sets an application's URLStreamHandlerFactory.
                          +     * Sets an application's {@code URLStreamHandlerFactory}.
                                * This method can be called at most once in a given Java Virtual
                                * Machine.
                                *
                          -     *

                          The URLStreamHandlerFactory instance is used to + *

                          The {@code URLStreamHandlerFactory} instance is used to *construct a stream protocol handler from a protocol name. * *

                          If there is a security manager, this method first calls - * the security manager's checkSetFactory method + * the security manager's {@code checkSetFactory} method * to ensure the operation is allowed. * This could result in a SecurityException. * * @param fac the desired factory. * @exception Error if the application has already set a factory. * @exception SecurityException if a security manager exists and its - * checkSetFactory method doesn't allow + * {@code checkSetFactory} method doesn't allow * the operation. * @see java.net.URL#URL(java.lang.String, java.lang.String, * int, java.lang.String) diff --git a/jdk/src/share/classes/java/net/URLClassLoader.java b/jdk/src/share/classes/java/net/URLClassLoader.java index ba611dd3e0b..fa371864cd4 100644 --- a/jdk/src/share/classes/java/net/URLClassLoader.java +++ b/jdk/src/share/classes/java/net/URLClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,7 +117,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { /** * Constructs a new URLClassLoader for the specified URLs using the - * default delegation parent ClassLoader. The URLs will + * default delegation parent {@code ClassLoader}. The URLs will * be searched in the order specified for classes and resources after * first searching in the parent class loader. Any URL that ends with * a '/' is assumed to refer to a directory. Otherwise, the URL is @@ -125,13 +125,13 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * as needed. * *

                          If there is a security manager, this method first - * calls the security manager's checkCreateClassLoader method + * calls the security manager's {@code checkCreateClassLoader} method * to ensure creation of a class loader is allowed. * * @param urls the URLs from which to load classes and resources * * @exception SecurityException if a security manager exists and its - * checkCreateClassLoader method doesn't allow + * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. * @see SecurityManager#checkCreateClassLoader */ @@ -165,7 +165,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * obtain protocol handlers when creating new jar URLs. * *

                          If there is a security manager, this method first - * calls the security manager's checkCreateClassLoader method + * calls the security manager's {@code checkCreateClassLoader} method * to ensure creation of a class loader is allowed. * * @param urls the URLs from which to load classes and resources @@ -173,7 +173,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * @param factory the URLStreamHandlerFactory to use when creating URLs * * @exception SecurityException if a security manager exists and its - * checkCreateClassLoader method doesn't allow + * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. * @see SecurityManager#checkCreateClassLoader */ @@ -217,7 +217,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * @param name * The resource name * - * @return An input stream for reading the resource, or null + * @return An input stream for reading the resource, or {@code null} * if the resource could not be found * * @since 1.7 @@ -273,7 +273,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * as suppressed exceptions of the first one caught, which is then re-thrown. * * @throws SecurityException if a security manager is set, and it denies - * {@link RuntimePermission}("closeClassLoader") + * {@link RuntimePermission}{@code ("closeClassLoader")} * * @since 1.7 */ @@ -316,7 +316,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * Appends the specified URL to the list of URLs to search for * classes and resources. *

                          - * If the URL specified is null or is already in the + * If the URL specified is {@code null} or is already in the * list of URLs, or if this loader is closed, then invoking this * method has no effect. * @@ -537,7 +537,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * Finds the resource with the specified name on the URL search path. * * @param name the name of the resource - * @return a URL for the resource, or null + * @return a {@code URL} for the resource, or {@code null} * if the resource could not be found, or if the loader is closed. */ public URL findResource(final String name) { @@ -560,7 +560,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * * @param name the resource name * @exception IOException if an I/O exception occurs - * @return an Enumeration of URLs + * @return an {@code Enumeration} of {@code URL}s * If the loader is closed, the Enumeration will be empty. */ public Enumeration findResources(final String name) @@ -699,9 +699,9 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { /** * Creates a new instance of URLClassLoader for the specified * URLs and parent class loader. If a security manager is - * installed, the loadClass method of the URLClassLoader + * installed, the {@code loadClass} method of the URLClassLoader * returned by this method will invoke the - * SecurityManager.checkPackageAccess method before + * {@code SecurityManager.checkPackageAccess} method before * loading the class. * * @param urls the URLs to search for classes and resources @@ -725,9 +725,9 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { /** * Creates a new instance of URLClassLoader for the specified * URLs and default parent class loader. If a security manager is - * installed, the loadClass method of the URLClassLoader + * installed, the {@code loadClass} method of the URLClassLoader * returned by this method will invoke the - * SecurityManager.checkPackageAccess before + * {@code SecurityManager.checkPackageAccess} before * loading the class. * * @param urls the URLs to search for classes and resources diff --git a/jdk/src/share/classes/java/net/URLConnection.java b/jdk/src/share/classes/java/net/URLConnection.java index b69c00f94a3..b731ac70d90 100644 --- a/jdk/src/share/classes/java/net/URLConnection.java +++ b/jdk/src/share/classes/java/net/URLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,15 +40,15 @@ import sun.security.util.SecurityConstants; import sun.net.www.MessageHeader; /** - * The abstract class URLConnection is the superclass + * The abstract class {@code URLConnection} is the superclass * of all classes that represent a communications link between the * application and a URL. Instances of this class can be used both to * read from and to write to the resource referenced by the URL. In * general, creating a connection to a URL is a multistep process: *

                          *

                          - * - * + * + * * *
                          openConnection()connect()
                          {@code openConnection()}{@code connect()}
                          Manipulate parameters that affect the connection to the remote * resource.Interact with the resource; query header fields and @@ -59,78 +59,78 @@ import sun.net.www.MessageHeader; * *
                            *
                          1. The connection object is created by invoking the - * openConnection method on a URL. + * {@code openConnection} method on a URL. *
                          2. The setup parameters and general request properties are manipulated. *
                          3. The actual connection to the remote object is made, using the - * connect method. + * {@code connect} method. *
                          4. The remote object becomes available. The header fields and the contents * of the remote object can be accessed. *
                          *

                          * The setup parameters are modified using the following methods: *

                            - *
                          • setAllowUserInteraction - *
                          • setDoInput - *
                          • setDoOutput - *
                          • setIfModifiedSince - *
                          • setUseCaches + *
                          • {@code setAllowUserInteraction} + *
                          • {@code setDoInput} + *
                          • {@code setDoOutput} + *
                          • {@code setIfModifiedSince} + *
                          • {@code setUseCaches} *
                          *

                          * and the general request properties are modified using the method: *

                            - *
                          • setRequestProperty + *
                          • {@code setRequestProperty} *
                          *

                          - * Default values for the AllowUserInteraction and - * UseCaches parameters can be set using the methods - * setDefaultAllowUserInteraction and - * setDefaultUseCaches. + * Default values for the {@code AllowUserInteraction} and + * {@code UseCaches} parameters can be set using the methods + * {@code setDefaultAllowUserInteraction} and + * {@code setDefaultUseCaches}. *

                          - * Each of the above set methods has a corresponding - * get method to retrieve the value of the parameter or + * Each of the above {@code set} methods has a corresponding + * {@code get} method to retrieve the value of the parameter or * general request property. The specific parameters and general * request properties that are applicable are protocol specific. *

                          * The following methods are used to access the header fields and * the contents after the connection is made to the remote object: *

                            - *
                          • getContent - *
                          • getHeaderField - *
                          • getInputStream - *
                          • getOutputStream + *
                          • {@code getContent} + *
                          • {@code getHeaderField} + *
                          • {@code getInputStream} + *
                          • {@code getOutputStream} *
                          *

                          * Certain header fields are accessed frequently. The methods: *

                            - *
                          • getContentEncoding - *
                          • getContentLength - *
                          • getContentType - *
                          • getDate - *
                          • getExpiration - *
                          • getLastModifed + *
                          • {@code getContentEncoding} + *
                          • {@code getContentLength} + *
                          • {@code getContentType} + *
                          • {@code getDate} + *
                          • {@code getExpiration} + *
                          • {@code getLastModifed} *
                          *

                          * provide convenient access to these fields. The - * getContentType method is used by the - * getContent method to determine the type of the remote + * {@code getContentType} method is used by the + * {@code getContent} method to determine the type of the remote * object; subclasses may find it convenient to override the - * getContentType method. + * {@code getContentType} method. *

                          * In the common case, all of the pre-connection parameters and * general request properties can be ignored: the pre-connection * parameters and request properties default to sensible values. For * most clients of this interface, there are only two interesting - * methods: getInputStream and getContent, - * which are mirrored in the URL class by convenience methods. + * methods: {@code getInputStream} and {@code getContent}, + * which are mirrored in the {@code URL} class by convenience methods. *

                          * More information on the request properties and header fields of - * an http connection can be found at: + * an {@code http} connection can be found at: *

                            * http://www.ietf.org/rfc/rfc2616.txt
                            * 
                          * - * Invoking the close() methods on the InputStream or OutputStream of an - * URLConnection after a request may free network resources associated with this + * Invoking the {@code close()} methods on the {@code InputStream} or {@code OutputStream} of an + * {@code URLConnection} after a request may free network resources associated with this * instance, unless particular protocol specifications specify different behaviours * for it. * @@ -164,10 +164,10 @@ public abstract class URLConnection { * which this connection is opened. *

                          * The value of this field can be accessed by the - * getURL method. + * {@code getURL} method. *

                          * The default value of this variable is the value of the URL - * argument in the URLConnection constructor. + * argument in the {@code URLConnection} constructor. * * @see java.net.URLConnection#getURL() * @see java.net.URLConnection#url @@ -175,14 +175,14 @@ public abstract class URLConnection { protected URL url; /** - * This variable is set by the setDoInput method. Its - * value is returned by the getDoInput method. + * This variable is set by the {@code setDoInput} method. Its + * value is returned by the {@code getDoInput} method. *

                          * A URL connection can be used for input and/or output. Setting the - * doInput flag to true indicates that + * {@code doInput} flag to {@code true} indicates that * the application intends to read data from the URL connection. *

                          - * The default value of this field is true. + * The default value of this field is {@code true}. * * @see java.net.URLConnection#getDoInput() * @see java.net.URLConnection#setDoInput(boolean) @@ -190,14 +190,14 @@ public abstract class URLConnection { protected boolean doInput = true; /** - * This variable is set by the setDoOutput method. Its - * value is returned by the getDoOutput method. + * This variable is set by the {@code setDoOutput} method. Its + * value is returned by the {@code getDoOutput} method. *

                          * A URL connection can be used for input and/or output. Setting the - * doOutput flag to true indicates + * {@code doOutput} flag to {@code true} indicates * that the application intends to write data to the URL connection. *

                          - * The default value of this field is false. + * The default value of this field is {@code false}. * * @see java.net.URLConnection#getDoOutput() * @see java.net.URLConnection#setDoOutput(boolean) @@ -207,17 +207,17 @@ public abstract class URLConnection { private static boolean defaultAllowUserInteraction = false; /** - * If true, this URL is being examined in + * If {@code true}, this {@code URL} is being examined in * a context in which it makes sense to allow user interactions such - * as popping up an authentication dialog. If false, + * as popping up an authentication dialog. If {@code false}, * then no user interaction is allowed. *

                          * The value of this field can be set by the - * setAllowUserInteraction method. + * {@code setAllowUserInteraction} method. * Its value is returned by the - * getAllowUserInteraction method. + * {@code getAllowUserInteraction} method. * Its default value is the value of the argument in the last invocation - * of the setDefaultAllowUserInteraction method. + * of the {@code setDefaultAllowUserInteraction} method. * * @see java.net.URLConnection#getAllowUserInteraction() * @see java.net.URLConnection#setAllowUserInteraction(boolean) @@ -228,15 +228,15 @@ public abstract class URLConnection { private static boolean defaultUseCaches = true; /** - * If true, the protocol is allowed to use caching - * whenever it can. If false, the protocol must always + * If {@code true}, the protocol is allowed to use caching + * whenever it can. If {@code false}, the protocol must always * try to get a fresh copy of the object. *

                          - * This field is set by the setUseCaches method. Its - * value is returned by the getUseCaches method. + * This field is set by the {@code setUseCaches} method. Its + * value is returned by the {@code getUseCaches} method. *

                          * Its default value is the value given in the last invocation of the - * setDefaultUseCaches method. + * {@code setDefaultUseCaches} method. * * @see java.net.URLConnection#setUseCaches(boolean) * @see java.net.URLConnection#getUseCaches() @@ -252,11 +252,11 @@ public abstract class URLConnection { * January 1, 1970, GMT. The object is fetched only if it has been * modified more recently than that time. *

                          - * This variable is set by the setIfModifiedSince + * This variable is set by the {@code setIfModifiedSince} * method. Its value is returned by the - * getIfModifiedSince method. + * {@code getIfModifiedSince} method. *

                          - * The default value of this field is 0, indicating + * The default value of this field is {@code 0}, indicating * that the fetching must always occur. * * @see java.net.URLConnection#getIfModifiedSince() @@ -265,8 +265,8 @@ public abstract class URLConnection { protected long ifModifiedSince = 0; /** - * If false, this connection object has not created a - * communications link to the specified URL. If true, + * If {@code false}, this connection object has not created a + * communications link to the specified URL. If {@code true}, * the communications link has been established. */ protected boolean connected = false; @@ -320,13 +320,13 @@ public abstract class URLConnection { * Sets the FileNameMap. *

                          * If there is a security manager, this method first calls - * the security manager's checkSetFactory method + * the security manager's {@code checkSetFactory} method * to ensure the operation is allowed. * This could result in a SecurityException. * * @param map the FileNameMap to be set * @exception SecurityException if a security manager exists and its - * checkSetFactory method doesn't allow the operation. + * {@code checkSetFactory} method doesn't allow the operation. * @see SecurityManager#checkSetFactory * @see #getFileNameMap() * @since 1.2 @@ -341,9 +341,9 @@ public abstract class URLConnection { * Opens a communications link to the resource referenced by this * URL, if such a connection has not already been established. *

                          - * If the connect method is called when the connection - * has already been opened (indicated by the connected - * field having the value true), the call is ignored. + * If the {@code connect} method is called when the connection + * has already been opened (indicated by the {@code connected} + * field having the value {@code true}), the call is ignored. *

                          * URLConnection objects go through two phases: first they are * created, then they are connected. After being created, and @@ -375,7 +375,7 @@ public abstract class URLConnection { * the specified timeout. To see the connect timeout set, please * call getConnectTimeout(). * - * @param timeout an int that specifies the connect + * @param timeout an {@code int} that specifies the connect * timeout value in milliseconds * @throws IllegalArgumentException if the timeout parameter is negative * @@ -396,7 +396,7 @@ public abstract class URLConnection { * 0 return implies that the option is disabled * (i.e., timeout of infinity). * - * @return an int that indicates the connect timeout + * @return an {@code int} that indicates the connect timeout * value in milliseconds * @see #setConnectTimeout(int) * @see #connect() @@ -418,7 +418,7 @@ public abstract class URLConnection { * specified timeout. To see the read timeout set, please call * getReadTimeout(). * - * @param timeout an int that specifies the timeout + * @param timeout an {@code int} that specifies the timeout * value to be used in milliseconds * @throws IllegalArgumentException if the timeout parameter is negative * @@ -437,7 +437,7 @@ public abstract class URLConnection { * Returns setting for read timeout. 0 return implies that the * option is disabled (i.e., timeout of infinity). * - * @return an int that indicates the read timeout + * @return an {@code int} that indicates the read timeout * value in milliseconds * * @see #setReadTimeout(int) @@ -459,10 +459,10 @@ public abstract class URLConnection { } /** - * Returns the value of this URLConnection's URL + * Returns the value of this {@code URLConnection}'s {@code URL} * field. * - * @return the value of this URLConnection's URL + * @return the value of this {@code URLConnection}'s {@code URL} * field. * @see java.net.URLConnection#url */ @@ -471,7 +471,7 @@ public abstract class URLConnection { } /** - * Returns the value of the content-length header field. + * Returns the value of the {@code content-length} header field. *

                          * Note: {@link #getContentLengthLong() getContentLengthLong()} * should be preferred over this method, since it returns a {@code long} @@ -489,11 +489,11 @@ public abstract class URLConnection { } /** - * Returns the value of the content-length header field as a + * Returns the value of the {@code content-length} header field as a * long. * * @return the content length of the resource that this connection's URL - * references, or -1 if the content length is + * references, or {@code -1} if the content length is * not known. * @since 7.0 */ @@ -502,10 +502,10 @@ public abstract class URLConnection { } /** - * Returns the value of the content-type header field. + * Returns the value of the {@code content-type} header field. * * @return the content type of the resource that the URL references, - * or null if not known. + * or {@code null} if not known. * @see java.net.URLConnection#getHeaderField(java.lang.String) */ public String getContentType() { @@ -513,10 +513,10 @@ public abstract class URLConnection { } /** - * Returns the value of the content-encoding header field. + * Returns the value of the {@code content-encoding} header field. * * @return the content encoding of the resource that the URL references, - * or null if not known. + * or {@code null} if not known. * @see java.net.URLConnection#getHeaderField(java.lang.String) */ public String getContentEncoding() { @@ -524,7 +524,7 @@ public abstract class URLConnection { } /** - * Returns the value of the expires header field. + * Returns the value of the {@code expires} header field. * * @return the expiration date of the resource that this URL references, * or 0 if not known. The value is the number of milliseconds since @@ -536,10 +536,10 @@ public abstract class URLConnection { } /** - * Returns the value of the date header field. + * Returns the value of the {@code date} header field. * * @return the sending date of the resource that the URL references, - * or 0 if not known. The value returned is the + * or {@code 0} if not known. The value returned is the * number of milliseconds since January 1, 1970 GMT. * @see java.net.URLConnection#getHeaderField(java.lang.String) */ @@ -548,11 +548,11 @@ public abstract class URLConnection { } /** - * Returns the value of the last-modified header field. + * Returns the value of the {@code last-modified} header field. * The result is the number of milliseconds since January 1, 1970 GMT. * * @return the date the resource referenced by this - * URLConnection was last modified, or 0 if not known. + * {@code URLConnection} was last modified, or 0 if not known. * @see java.net.URLConnection#getHeaderField(java.lang.String) */ public long getLastModified() { @@ -567,7 +567,7 @@ public abstract class URLConnection { * * * @param name the name of a header field. - * @return the value of the named header field, or null + * @return the value of the named header field, or {@code null} * if there is no such field in the header. */ public String getHeaderField(String name) { @@ -591,15 +591,15 @@ public abstract class URLConnection { /** * Returns the value of the named field parsed as a number. *

                          - * This form of getHeaderField exists because some - * connection types (e.g., http-ng) have pre-parsed + * This form of {@code getHeaderField} exists because some + * connection types (e.g., {@code http-ng}) have pre-parsed * headers. Classes for that connection type can override this method * and short-circuit the parsing. * * @param name the name of the header field. * @param Default the default value. * @return the value of the named field, parsed as an integer. The - * Default value is returned if the field is + * {@code Default} value is returned if the field is * missing or malformed. */ public int getHeaderFieldInt(String name, int Default) { @@ -613,15 +613,15 @@ public abstract class URLConnection { /** * Returns the value of the named field parsed as a number. *

                          - * This form of getHeaderField exists because some - * connection types (e.g., http-ng) have pre-parsed + * This form of {@code getHeaderField} exists because some + * connection types (e.g., {@code http-ng}) have pre-parsed * headers. Classes for that connection type can override this method * and short-circuit the parsing. * * @param name the name of the header field. * @param Default the default value. * @return the value of the named field, parsed as a long. The - * Default value is returned if the field is + * {@code Default} value is returned if the field is * missing or malformed. * @since 7.0 */ @@ -638,15 +638,15 @@ public abstract class URLConnection { * The result is the number of milliseconds since January 1, 1970 GMT * represented by the named field. *

                          - * This form of getHeaderField exists because some - * connection types (e.g., http-ng) have pre-parsed + * This form of {@code getHeaderField} exists because some + * connection types (e.g., {@code http-ng}) have pre-parsed * headers. Classes for that connection type can override this method * and short-circuit the parsing. * * @param name the name of the header field. * @param Default a default value. * @return the value of the field, parsed as a date. The value of the - * Default argument is returned if the field is + * {@code Default} argument is returned if the field is * missing or malformed. */ @SuppressWarnings("deprecation") @@ -659,12 +659,12 @@ public abstract class URLConnection { } /** - * Returns the key for the nth header field. - * It returns null if there are fewer than n+1 fields. + * Returns the key for the {@code n}th header field. + * It returns {@code null} if there are fewer than {@code n+1} fields. * * @param n an index, where {@code n>=0} - * @return the key for the nth header field, - * or null if there are fewer than n+1 + * @return the key for the {@code n}th header field, + * or {@code null} if there are fewer than {@code n+1} * fields. */ public String getHeaderFieldKey(int n) { @@ -672,17 +672,17 @@ public abstract class URLConnection { } /** - * Returns the value for the nth header field. - * It returns null if there are fewer than - * n+1fields. + * Returns the value for the {@code n}th header field. + * It returns {@code null} if there are fewer than + * {@code n+1}fields. *

                          * This method can be used in conjunction with the * {@link #getHeaderFieldKey(int) getHeaderFieldKey} method to iterate through all * the headers in the message. * * @param n an index, where {@code n>=0} - * @return the value of the nth header field - * or null if there are fewer than n+1 fields + * @return the value of the {@code n}th header field + * or {@code null} if there are fewer than {@code n+1} fields * @see java.net.URLConnection#getHeaderFieldKey(int) */ public String getHeaderField(int n) { @@ -693,35 +693,35 @@ public abstract class URLConnection { * Retrieves the contents of this URL connection. *

                          * This method first determines the content type of the object by - * calling the getContentType method. If this is + * calling the {@code getContentType} method. If this is * the first time that the application has seen that specific content * type, a content handler for that content type is created: *

                            *
                          1. If the application has set up a content handler factory instance - * using the setContentHandlerFactory method, the - * createContentHandler method of that instance is called + * using the {@code setContentHandlerFactory} method, the + * {@code createContentHandler} method of that instance is called * with the content type as an argument; the result is a content * handler for that content type. *
                          2. If no content handler factory has yet been set up, or if the - * factory's createContentHandler method returns - * null, then the application loads the class named: + * factory's {@code createContentHandler} method returns + * {@code null}, then the application loads the class named: *
                                  *         sun.net.www.content.<contentType>
                                  *     
                            * where <contentType> is formed by taking the * content-type string, replacing all slash characters with a - * period ('.'), and all other non-alphanumeric characters - * with the underscore character '_'. The alphanumeric + * {@code period} ('.'), and all other non-alphanumeric characters + * with the underscore character '{@code _}'. The alphanumeric * characters are specifically the 26 uppercase ASCII letters - * 'A' through 'Z', the 26 lowercase ASCII - * letters 'a' through 'z', and the 10 ASCII - * digits '0' through '9'. If the specified + * '{@code A}' through '{@code Z}', the 26 lowercase ASCII + * letters '{@code a}' through '{@code z}', and the 10 ASCII + * digits '{@code 0}' through '{@code 9}'. If the specified * class does not exist, or is not a subclass of - * ContentHandler, then an - * UnknownServiceException is thrown. + * {@code ContentHandler}, then an + * {@code UnknownServiceException} is thrown. *
                          * - * @return the object fetched. The instanceof operator + * @return the object fetched. The {@code instanceof} operator * should be used to determine the specific kind of object * returned. * @exception IOException if an I/O error occurs while @@ -743,12 +743,12 @@ public abstract class URLConnection { /** * Retrieves the contents of this URL connection. * - * @param classes the Class array + * @param classes the {@code Class} array * indicating the requested types * @return the object fetched that is the first match of the type * specified in the classes array. null if none of * the requested types are supported. - * The instanceof operator should be used to + * The {@code instanceof} operator should be used to * determine the specific kind of object returned. * @exception IOException if an I/O error occurs while * getting the content. @@ -773,12 +773,12 @@ public abstract class URLConnection { * necessary to make the connection represented by this * object. This method returns null if no permission is * required to make the connection. By default, this method - * returns java.security.AllPermission. Subclasses + * returns {@code java.security.AllPermission}. Subclasses * should override this method and return the permission * that best represents the permission required to make a - * a connection to the URL. For example, a URLConnection - * representing a file: URL would return a - * java.io.FilePermission object. + * a connection to the URL. For example, a {@code URLConnection} + * representing a {@code file:} URL would return a + * {@code java.io.FilePermission} object. * *

                          The permission returned may dependent upon the state of the * connection. For example, the permission before connecting may be @@ -844,17 +844,17 @@ public abstract class URLConnection { } /** - * Returns a String representation of this URL connection. + * Returns a {@code String} representation of this URL connection. * - * @return a string representation of this URLConnection. + * @return a string representation of this {@code URLConnection}. */ public String toString() { return this.getClass().getName() + ":" + url; } /** - * Sets the value of the doInput field for this - * URLConnection to the specified value. + * Sets the value of the {@code doInput} field for this + * {@code URLConnection} to the specified value. *

                          * A URL connection can be used for input and/or output. Set the DoInput * flag to true if you intend to use the URL connection for input, @@ -872,11 +872,11 @@ public abstract class URLConnection { } /** - * Returns the value of this URLConnection's - * doInput flag. + * Returns the value of this {@code URLConnection}'s + * {@code doInput} flag. * - * @return the value of this URLConnection's - * doInput flag. + * @return the value of this {@code URLConnection}'s + * {@code doInput} flag. * @see #setDoInput(boolean) */ public boolean getDoInput() { @@ -884,8 +884,8 @@ public abstract class URLConnection { } /** - * Sets the value of the doOutput field for this - * URLConnection to the specified value. + * Sets the value of the {@code doOutput} field for this + * {@code URLConnection} to the specified value. *

                          * A URL connection can be used for input and/or output. Set the DoOutput * flag to true if you intend to use the URL connection for output, @@ -902,11 +902,11 @@ public abstract class URLConnection { } /** - * Returns the value of this URLConnection's - * doOutput flag. + * Returns the value of this {@code URLConnection}'s + * {@code doOutput} flag. * - * @return the value of this URLConnection's - * doOutput flag. + * @return the value of this {@code URLConnection}'s + * {@code doOutput} flag. * @see #setDoOutput(boolean) */ public boolean getDoOutput() { @@ -914,8 +914,8 @@ public abstract class URLConnection { } /** - * Set the value of the allowUserInteraction field of - * this URLConnection. + * Set the value of the {@code allowUserInteraction} field of + * this {@code URLConnection}. * * @param allowuserinteraction the new value. * @throws IllegalStateException if already connected @@ -928,10 +928,10 @@ public abstract class URLConnection { } /** - * Returns the value of the allowUserInteraction field for + * Returns the value of the {@code allowUserInteraction} field for * this object. * - * @return the value of the allowUserInteraction field for + * @return the value of the {@code allowUserInteraction} field for * this object. * @see #setAllowUserInteraction(boolean) */ @@ -941,8 +941,8 @@ public abstract class URLConnection { /** * Sets the default value of the - * allowUserInteraction field for all future - * URLConnection objects to the specified value. + * {@code allowUserInteraction} field for all future + * {@code URLConnection} objects to the specified value. * * @param defaultallowuserinteraction the new value. * @see #getDefaultAllowUserInteraction() @@ -952,14 +952,14 @@ public abstract class URLConnection { } /** - * Returns the default value of the allowUserInteraction + * Returns the default value of the {@code allowUserInteraction} * field. *

                          * Ths default is "sticky", being a part of the static state of all * URLConnections. This flag applies to the next, and all following * URLConnections that are created. * - * @return the default value of the allowUserInteraction + * @return the default value of the {@code allowUserInteraction} * field. * @see #setDefaultAllowUserInteraction(boolean) */ @@ -968,8 +968,8 @@ public abstract class URLConnection { } /** - * Sets the value of the useCaches field of this - * URLConnection to the specified value. + * Sets the value of the {@code useCaches} field of this + * {@code URLConnection} to the specified value. *

                          * Some protocols do caching of documents. Occasionally, it is important * to be able to "tunnel through" and ignore the caches (e.g., the @@ -979,7 +979,7 @@ public abstract class URLConnection { * The default value comes from DefaultUseCaches, which defaults to * true. * - * @param usecaches a boolean indicating whether + * @param usecaches a {@code boolean} indicating whether * or not to allow caching * @throws IllegalStateException if already connected * @see #getUseCaches() @@ -991,11 +991,11 @@ public abstract class URLConnection { } /** - * Returns the value of this URLConnection's - * useCaches field. + * Returns the value of this {@code URLConnection}'s + * {@code useCaches} field. * - * @return the value of this URLConnection's - * useCaches field. + * @return the value of this {@code URLConnection}'s + * {@code useCaches} field. * @see #setUseCaches(boolean) */ public boolean getUseCaches() { @@ -1003,8 +1003,8 @@ public abstract class URLConnection { } /** - * Sets the value of the ifModifiedSince field of - * this URLConnection to the specified value. + * Sets the value of the {@code ifModifiedSince} field of + * this {@code URLConnection} to the specified value. * * @param ifmodifiedsince the new value. * @throws IllegalStateException if already connected @@ -1017,9 +1017,9 @@ public abstract class URLConnection { } /** - * Returns the value of this object's ifModifiedSince field. + * Returns the value of this object's {@code ifModifiedSince} field. * - * @return the value of this object's ifModifiedSince field. + * @return the value of this object's {@code ifModifiedSince} field. * @see #setIfModifiedSince(long) */ public long getIfModifiedSince() { @@ -1027,15 +1027,15 @@ public abstract class URLConnection { } /** - * Returns the default value of a URLConnection's - * useCaches flag. + * Returns the default value of a {@code URLConnection}'s + * {@code useCaches} flag. *

                          * Ths default is "sticky", being a part of the static state of all * URLConnections. This flag applies to the next, and all following * URLConnections that are created. * - * @return the default value of a URLConnection's - * useCaches flag. + * @return the default value of a {@code URLConnection}'s + * {@code useCaches} flag. * @see #setDefaultUseCaches(boolean) */ public boolean getDefaultUseCaches() { @@ -1043,7 +1043,7 @@ public abstract class URLConnection { } /** - * Sets the default value of the useCaches field to the + * Sets the default value of the {@code useCaches} field to the * specified value. * * @param defaultusecaches the new value. @@ -1063,7 +1063,7 @@ public abstract class URLConnection { * properties to be appended into a single property. * * @param key the keyword by which the request is known - * (e.g., "Accept"). + * (e.g., "{@code Accept}"). * @param value the value associated with it. * @throws IllegalStateException if already connected * @throws NullPointerException if key is null @@ -1087,7 +1087,7 @@ public abstract class URLConnection { * existing values associated with the same key. * * @param key the keyword by which the request is known - * (e.g., "Accept"). + * (e.g., "{@code Accept}"). * @param value the value associated with it. * @throws IllegalStateException if already connected * @throws NullPointerException if key is null @@ -1151,11 +1151,11 @@ public abstract class URLConnection { /** * Sets the default value of a general request property. When a - * URLConnection is created, it is initialized with + * {@code URLConnection} is created, it is initialized with * these properties. * * @param key the keyword by which the request is known - * (e.g., "Accept"). + * (e.g., "{@code Accept}"). * @param value the value associated with the key. * * @see java.net.URLConnection#setRequestProperty(java.lang.String,java.lang.String) @@ -1197,21 +1197,21 @@ public abstract class URLConnection { static ContentHandlerFactory factory; /** - * Sets the ContentHandlerFactory of an + * Sets the {@code ContentHandlerFactory} of an * application. It can be called at most once by an application. *

                          - * The ContentHandlerFactory instance is used to + * The {@code ContentHandlerFactory} instance is used to * construct a content handler from a content type *

                          * If there is a security manager, this method first calls - * the security manager's checkSetFactory method + * the security manager's {@code checkSetFactory} method * to ensure the operation is allowed. * This could result in a SecurityException. * * @param fac the desired factory. * @exception Error if the factory has already been defined. * @exception SecurityException if a security manager exists and its - * checkSetFactory method doesn't allow the operation. + * {@code checkSetFactory} method doesn't allow the operation. * @see java.net.ContentHandlerFactory * @see java.net.URLConnection#getContent() * @see SecurityManager#checkSetFactory @@ -1374,7 +1374,7 @@ public abstract class URLConnection { * Tries to determine the content type of an object, based * on the specified "file" component of a URL. * This is a convenience method that can be used by - * subclasses that override the getContentType method. + * subclasses that override the {@code getContentType} method. * * @param fname a filename. * @return a guess as to what the content type of the object is, @@ -1389,16 +1389,16 @@ public abstract class URLConnection { * Tries to determine the type of an input stream based on the * characters at the beginning of the input stream. This method can * be used by subclasses that override the - * getContentType method. + * {@code getContentType} method. *

                          * Ideally, this routine would not be needed. But many - * http servers return the incorrect content type; in + * {@code http} servers return the incorrect content type; in * addition, there are many nonstandard extensions. Direct inspection * of the bytes to determine the content type is often more accurate - * than believing the content type claimed by the http server. + * than believing the content type claimed by the {@code http} server. * * @param is an input stream that supports marks. - * @return a guess at the content type, or null if none + * @return a guess at the content type, or {@code null} if none * can be determined. * @exception IOException if an I/O error occurs while reading the * input stream. diff --git a/jdk/src/share/classes/java/net/URLDecoder.java b/jdk/src/share/classes/java/net/URLDecoder.java index e23f0c56af0..eb5e36e5d82 100644 --- a/jdk/src/share/classes/java/net/URLDecoder.java +++ b/jdk/src/share/classes/java/net/URLDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,27 +34,27 @@ import java.io.*; *

                          * The conversion process is the reverse of that used by the URLEncoder class. It is assumed * that all characters in the encoded string are one of the following: - * "a" through "z", - * "A" through "Z", - * "0" through "9", and - * "-", "_", - * ".", and "*". The - * character "%" is allowed but is interpreted + * "{@code a}" through "{@code z}", + * "{@code A}" through "{@code Z}", + * "{@code 0}" through "{@code 9}", and + * "{@code -}", "{@code _}", + * "{@code .}", and "{@code *}". The + * character "{@code %}" is allowed but is interpreted * as the start of a special escaped sequence. *

                          * The following rules are applied in the conversion: *

                          *

                            - *
                          • The alphanumeric characters "a" through - * "z", "A" through - * "Z" and "0" - * through "9" remain the same. - *
                          • The special characters ".", - * "-", "*", and - * "_" remain the same. - *
                          • The plus sign "+" is converted into a - * space character " " . - *
                          • A sequence of the form "%xy" will be + *
                          • The alphanumeric characters "{@code a}" through + * "{@code z}", "{@code A}" through + * "{@code Z}" and "{@code 0}" + * through "{@code 9}" remain the same. + *
                          • The special characters "{@code .}", + * "{@code -}", "{@code *}", and + * "{@code _}" remain the same. + *
                          • The plus sign "{@code +}" is converted into a + * space character "   " . + *
                          • A sequence of the form "{@code %xy}" will be * treated as representing a byte where xy is the two-digit * hexadecimal representation of the 8 bits. Then, all substrings * that contain one or more of these byte sequences consecutively @@ -66,7 +66,7 @@ import java.io.*; *

                            * There are two possible ways in which this decoder could deal with * illegal strings. It could either leave illegal characters alone or - * it could throw an {@link java.lang.IllegalArgumentException}. + * it could throw an {@link java.lang.IllegalArgumentException}. * Which approach the decoder takes is left to the * implementation. * @@ -81,15 +81,15 @@ public class URLDecoder { static String dfltEncName = URLEncoder.dfltEncName; /** - * Decodes a x-www-form-urlencoded string. + * Decodes a {@code x-www-form-urlencoded} string. * The platform's default encoding is used to determine what characters * are represented by any consecutive sequences of the form - * "%xy". - * @param s the String to decode + * "{@code %xy}". + * @param s the {@code String} to decode * @deprecated The resulting string may vary depending on the platform's * default encoding. Instead, use the decode(String,String) method * to specify the encoding. - * @return the newly decoded String + * @return the newly decoded {@code String} */ @Deprecated public static String decode(String s) { @@ -106,11 +106,11 @@ public class URLDecoder { } /** - * Decodes a application/x-www-form-urlencoded string using a specific + * Decodes a {@code application/x-www-form-urlencoded} string using a specific * encoding scheme. * The supplied encoding is used to determine * what characters are represented by any consecutive sequences of the - * form "%xy". + * form "{@code %xy}". *

                            * Note: The @@ -118,11 +118,11 @@ public class URLDecoder { * UTF-8 should be used. Not doing so may introduce * incompatibilites. * - * @param s the String to decode + * @param s the {@code String} to decode * @param enc The name of a supported * character * encoding. - * @return the newly decoded String + * @return the newly decoded {@code String} * @exception UnsupportedEncodingException * If character encoding needs to be consulted, but * named character encoding is not supported diff --git a/jdk/src/share/classes/java/net/URLEncoder.java b/jdk/src/share/classes/java/net/URLEncoder.java index 68fca8ca5c9..b5c4a8c32f9 100644 --- a/jdk/src/share/classes/java/net/URLEncoder.java +++ b/jdk/src/share/classes/java/net/URLEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,19 +51,19 @@ import sun.security.action.GetPropertyAction; * *

                            *

                              - *
                            • The alphanumeric characters "a" through - * "z", "A" through - * "Z" and "0" - * through "9" remain the same. - *
                            • The special characters ".", - * "-", "*", and - * "_" remain the same. - *
                            • The space character " " is - * converted into a plus sign "+". + *
                            • The alphanumeric characters "{@code a}" through + * "{@code z}", "{@code A}" through + * "{@code Z}" and "{@code 0}" + * through "{@code 9}" remain the same. + *
                            • The special characters "{@code .}", + * "{@code -}", "{@code *}", and + * "{@code _}" remain the same. + *
                            • The space character "   " is + * converted into a plus sign "{@code +}". *
                            • All other characters are unsafe and are first converted into * one or more bytes using some encoding scheme. Then each byte is * represented by the 3-character string - * "%xy", where xy is the + * "{@code %xy}", where xy is the * two-digit hexadecimal representation of the byte. * The recommended encoding scheme to use is UTF-8. However, * for compatibility reasons, if an encoding is not specified, @@ -152,15 +152,15 @@ public class URLEncoder { private URLEncoder() { } /** - * Translates a string into x-www-form-urlencoded + * Translates a string into {@code x-www-form-urlencoded} * format. This method uses the platform's default encoding * as the encoding scheme to obtain the bytes for unsafe characters. * - * @param s String to be translated. + * @param s {@code String} to be translated. * @deprecated The resulting string may vary depending on the platform's * default encoding. Instead, use the encode(String,String) * method to specify the encoding. - * @return the translated String. + * @return the translated {@code String}. */ @Deprecated public static String encode(String s) { @@ -177,7 +177,7 @@ public class URLEncoder { } /** - * Translates a string into application/x-www-form-urlencoded + * Translates a string into {@code application/x-www-form-urlencoded} * format using a specific encoding scheme. This method uses the * supplied encoding scheme to obtain the bytes for unsafe * characters. @@ -188,11 +188,11 @@ public class URLEncoder { * UTF-8 should be used. Not doing so may introduce * incompatibilites. * - * @param s String to be translated. + * @param s {@code String} to be translated. * @param enc The name of a supported * character * encoding. - * @return the translated String. + * @return the translated {@code String}. * @exception UnsupportedEncodingException * If the named encoding is not supported * @see URLDecoder#decode(java.lang.String, java.lang.String) diff --git a/jdk/src/share/classes/java/net/URLStreamHandler.java b/jdk/src/share/classes/java/net/URLStreamHandler.java index 0561527488d..a77c5ed2cfc 100644 --- a/jdk/src/share/classes/java/net/URLStreamHandler.java +++ b/jdk/src/share/classes/java/net/URLStreamHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,15 +34,15 @@ import sun.net.util.IPAddressUtil; import sun.net.www.ParseUtil; /** - * The abstract class URLStreamHandler is the common + * The abstract class {@code URLStreamHandler} is the common * superclass for all stream protocol handlers. A stream protocol * handler knows how to make a connection for a particular protocol - * type, such as http or https. + * type, such as {@code http} or {@code https}. *

                              - * In most cases, an instance of a URLStreamHandler + * In most cases, an instance of a {@code URLStreamHandler} * subclass is not created directly by an application. Rather, the * first time a protocol name is encountered when constructing a - * URL, the appropriate stream protocol handler is + * {@code URL}, the appropriate stream protocol handler is * automatically loaded. * * @author James Gosling @@ -52,7 +52,7 @@ import sun.net.www.ParseUtil; public abstract class URLStreamHandler { /** * Opens a connection to the object referenced by the - * URL argument. + * {@code URL} argument. * This method should be overridden by a subclass. * *

                              If for the handler's protocol (such as HTTP or JAR), there @@ -64,7 +64,7 @@ public abstract class URLStreamHandler { * JarURLConnection will be returned. * * @param u the URL that this connects to. - * @return a URLConnection object for the URL. + * @return a {@code URLConnection} object for the {@code URL}. * @exception IOException if an I/O error occurs while opening the * connection. */ @@ -83,7 +83,7 @@ public abstract class URLStreamHandler { * @param p the proxy through which the connection will be made. * If direct connection is desired, Proxy.NO_PROXY * should be specified. - * @return a URLConnection object for the URL. + * @return a {@code URLConnection} object for the {@code URL}. * @exception IOException if an I/O error occurs while opening the * connection. * @exception IllegalArgumentException if either u or p is null, @@ -97,28 +97,28 @@ public abstract class URLStreamHandler { } /** - * Parses the string representation of a URL into a - * URL object. + * Parses the string representation of a {@code URL} into a + * {@code URL} object. *

                              * If there is any inherited context, then it has already been - * copied into the URL argument. + * copied into the {@code URL} argument. *

                              - * The parseURL method of URLStreamHandler + * The {@code parseURL} method of {@code URLStreamHandler} * parses the string representation as if it were an - * http specification. Most URL protocol families have a + * {@code http} specification. Most URL protocol families have a * similar parsing. A stream protocol handler for a protocol that has * a different syntax must override this routine. * - * @param u the URL to receive the result of parsing + * @param u the {@code URL} to receive the result of parsing * the spec. - * @param spec the String representing the URL that + * @param spec the {@code String} representing the URL that * must be parsed. * @param start the character index at which to begin parsing. This is - * just past the ':' (if there is one) that + * just past the '{@code :}' (if there is one) that * specifies the determination of the protocol name. * @param limit the character position to stop parsing at. This is the * end of the string or the position of the - * "#" character, if present. All information + * "{@code #}" character, if present. All information * after the sharp sign indicates an anchor. */ protected void parseURL(URL u, String spec, int start, int limit) { @@ -307,7 +307,7 @@ public abstract class URLStreamHandler { /** * Returns the default port for a URL parsed by this handler. This method * is meant to be overidden by handlers with default port numbers. - * @return the default port for a URL parsed by this handler. + * @return the default port for a {@code URL} parsed by this handler. * @since 1.3 */ protected int getDefaultPort() { @@ -321,7 +321,7 @@ public abstract class URLStreamHandler { * guaranteed by the fact that it is only called by java.net.URL class. * @param u1 a URL object * @param u2 a URL object - * @return true if the two urls are + * @return {@code true} if the two urls are * considered equal, ie. they refer to the same * fragment in the same file. * @since 1.3 @@ -338,7 +338,7 @@ public abstract class URLStreamHandler { * other protocols that have different requirements for hashCode * calculation. * @param u a URL object - * @return an int suitable for hash table indexing + * @return an {@code int} suitable for hash table indexing * @since 1.3 */ protected int hashCode(URL u) { @@ -420,7 +420,7 @@ public abstract class URLStreamHandler { * will result in a null return. * * @param u a URL object - * @return an InetAddress representing the host + * @return an {@code InetAddress} representing the host * IP address. * @since 1.3 */ @@ -447,8 +447,8 @@ public abstract class URLStreamHandler { * Compares the host components of two URLs. * @param u1 the URL of the first host to compare * @param u2 the URL of the second host to compare - * @return true if and only if they - * are equal, false otherwise. + * @return {@code true} if and only if they + * are equal, {@code false} otherwise. * @since 1.3 */ protected boolean hostsEqual(URL u1, URL u2) { @@ -465,11 +465,11 @@ public abstract class URLStreamHandler { } /** - * Converts a URL of a specific protocol to a - * String. + * Converts a {@code URL} of a specific protocol to a + * {@code String}. * * @param u the URL. - * @return a string representation of the URL argument. + * @return a string representation of the {@code URL} argument. */ protected String toExternalForm(URL u) { @@ -508,7 +508,7 @@ public abstract class URLStreamHandler { } /** - * Sets the fields of the URL argument to the indicated values. + * Sets the fields of the {@code URL} argument to the indicated values. * Only classes derived from URLStreamHandler are able * to use this method to set the values of the URL fields. * @@ -538,7 +538,7 @@ public abstract class URLStreamHandler { } /** - * Sets the fields of the URL argument to the indicated values. + * Sets the fields of the {@code URL} argument to the indicated values. * Only classes derived from URLStreamHandler are able * to use this method to set the values of the URL fields. * diff --git a/jdk/src/share/classes/java/net/URLStreamHandlerFactory.java b/jdk/src/share/classes/java/net/URLStreamHandlerFactory.java index 1a58474d900..e46e02857e3 100644 --- a/jdk/src/share/classes/java/net/URLStreamHandlerFactory.java +++ b/jdk/src/share/classes/java/net/URLStreamHandlerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,11 +26,11 @@ package java.net; /** - * This interface defines a factory for URL stream + * This interface defines a factory for {@code URL} stream * protocol handlers. *

                              - * It is used by the URL class to create a - * URLStreamHandler for a specific protocol. + * It is used by the {@code URL} class to create a + * {@code URLStreamHandler} for a specific protocol. * * @author Arthur van Hoff * @see java.net.URL @@ -39,12 +39,12 @@ package java.net; */ public interface URLStreamHandlerFactory { /** - * Creates a new URLStreamHandler instance with the specified + * Creates a new {@code URLStreamHandler} instance with the specified * protocol. * - * @param protocol the protocol ("ftp", - * "http", "nntp", etc.). - * @return a URLStreamHandler for the specific protocol. + * @param protocol the protocol ("{@code ftp}", + * "{@code http}", "{@code nntp}", etc.). + * @return a {@code URLStreamHandler} for the specific protocol. * @see java.net.URLStreamHandler */ URLStreamHandler createURLStreamHandler(String protocol); diff --git a/jdk/src/share/classes/java/net/UnknownHostException.java b/jdk/src/share/classes/java/net/UnknownHostException.java index 0c68c78faa1..21a9d1450cb 100644 --- a/jdk/src/share/classes/java/net/UnknownHostException.java +++ b/jdk/src/share/classes/java/net/UnknownHostException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ class UnknownHostException extends IOException { private static final long serialVersionUID = -4639126076052875403L; /** - * Constructs a new UnknownHostException with the + * Constructs a new {@code UnknownHostException} with the * specified detail message. * * @param host the detail message. @@ -48,7 +48,7 @@ class UnknownHostException extends IOException { } /** - * Constructs a new UnknownHostException with no detail + * Constructs a new {@code UnknownHostException} with no detail * message. */ public UnknownHostException() { diff --git a/jdk/src/share/classes/java/net/UnknownServiceException.java b/jdk/src/share/classes/java/net/UnknownServiceException.java index e954ce9c6e1..4eea4a769db 100644 --- a/jdk/src/share/classes/java/net/UnknownServiceException.java +++ b/jdk/src/share/classes/java/net/UnknownServiceException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,14 +40,14 @@ public class UnknownServiceException extends IOException { private static final long serialVersionUID = -4169033248853639508L; /** - * Constructs a new UnknownServiceException with no + * Constructs a new {@code UnknownServiceException} with no * detail message. */ public UnknownServiceException() { } /** - * Constructs a new UnknownServiceException with the + * Constructs a new {@code UnknownServiceException} with the * specified detail message. * * @param msg the detail message. diff --git a/jdk/src/share/classes/java/net/package-info.java b/jdk/src/share/classes/java/net/package-info.java new file mode 100644 index 00000000000..6552b30b634 --- /dev/null +++ b/jdk/src/share/classes/java/net/package-info.java @@ -0,0 +1,161 @@ +/* + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Provides the classes for implementing networking applications. + * + *

                              The java.net package can be roughly divided in two sections:

                              + *
                                + *
                              • A Low Level API, which deals with the + * following abstractions:

                                + *
                                  + *
                                • Addresses, which are networking identifiers, + * like IP addresses.

                                • + *
                                • Sockets, which are basic bidirectional data communication + * mechanisms.

                                • + *
                                • Interfaces, which describe network interfaces.

                                • + *
                              • + *
                              • A High Level API, which deals with the following + * abstractions:

                                + *
                                  + *
                                • URIs, which represent + * Universal Resource Identifiers.

                                • + *
                                • URLs, which represent + * Universal Resource Locators.

                                • + *
                                • Connections, which represents connections to the resource + * pointed to by URLs.

                                • + *
                              • + *
                              + *

                              Addresses

                              + *

                              Addresses are used throughout the java.net APIs as either host + * identifiers, or socket endpoint identifiers.

                              + *

                              The {@link java.net.InetAddress} class is the abstraction representing an + * IP (Internet Protocol) address. It has two subclasses: + *

                                + *
                              • {@link java.net.Inet4Address} for IPv4 addresses.
                              • + *
                              • {@link java.net.Inet6Address} for IPv6 addresses.
                              • + *
                              + *

                              But, in most cases, there is no need to deal directly with the subclasses, + * as the InetAddress abstraction should cover most of the needed + * functionality.

                              + *

                              About IPv6

                              + *

                              Not all systems have support for the IPv6 protocol, and while the Java + * networking stack will attempt to detect it and use it transparently when + * available, it is also possible to disable its use with a system property. + * In the case where IPv6 is not available, or explicitly disabled, + * Inet6Address are not valid arguments for most networking operations any + * more. While methods like {@link java.net.InetAddress#getByName} are + * guaranteed not to return an Inet6Address when looking up host names, it + * is possible, by passing literals, to create such an object. In which + * case, most methods, when called with an Inet6Address will throw an + * Exception.

                              + *

                              Sockets

                              + *

                              Sockets are means to establish a communication link between machines over + * the network. The java.net package provides 4 kinds of Sockets:

                              + *
                                + *
                              • {@link java.net.Socket} is a TCP client API, and will typically + * be used to {@linkplain java.net.Socket#connect(SocketAddress) + * connect} to a remote host.
                              • + *
                              • {@link java.net.ServerSocket} is a TCP server API, and will + * typically {@linkplain java.net.ServerSocket#accept accept} + * connections from client sockets.
                              • + *
                              • {@link java.net.DatagramSocket} is a UDP endpoint API and is used + * to {@linkplain java.net.DatagramSocket#send send} and + * {@linkplain java.net.DatagramSocket#receive receive} + * {@linkplain java.net.DatagramPacket datagram packets}.
                              • + *
                              • {@link java.net.MulticastSocket} is a subclass of + * {@code DatagramSocket} used when dealing with multicast + * groups.
                              • + *
                              + *

                              Sending and receiving with TCP sockets is done through InputStreams and + * OutputStreams which can be obtained via the + * {@link java.net.Socket#getInputStream} and + * {@link java.net.Socket#getOutputStream} methods.

                              + *

                              Interfaces

                              + *

                              The {@link java.net.NetworkInterface} class provides APIs to browse and + * query all the networking interfaces (e.g. ethernet connection or PPP + * endpoint) of the local machine. It is through that class that you can + * check if any of the local interfaces is configured to support IPv6.

                              + *

                              Note, all conforming implementations must support at least one + * {@code NetworkInterface} object, which must either be connected to a + * network, or be a "loopback" interface that can only communicate with + * entities on the same machine.

                              + * + *

                              High level API

                              + *

                              A number of classes in the java.net package do provide for a much higher + * level of abstraction and allow for easy access to resources on the + * network. The classes are: + *

                                + *
                              • {@link java.net.URI} is the class representing a + * Universal Resource Identifier, as specified in RFC 2396. + * As the name indicates, this is just an Identifier and doesn't + * provide directly the means to access the resource.
                              • + *
                              • {@link java.net.URL} is the class representing a + * Universal Resource Locator, which is both an older concept for + * URIs and a means to access the resources.
                              • + *
                              • {@link java.net.URLConnection} is created from a URL and is the + * communication link used to access the resource pointed by the + * URL. This abstract class will delegate most of the work to the + * underlying protocol handlers like http or https.
                              • + *
                              • {@link java.net.HttpURLConnection} is a subclass of URLConnection + * and provides some additional functionalities specific to the + * HTTP protocol.
                              • + *
                              + *

                              The recommended usage is to use {@link java.net.URI} to identify + * resources, then convert it into a {@link java.net.URL} when it is time to + * access the resource. From that URL, you can either get the + * {@link java.net.URLConnection} for fine control, or get directly the + * InputStream.

                              + *

                              Here is an example:

                              + *

                              + * URI uri = new URI("http://java.sun.com/");
                              + * URL url = uri.toURL();
                              + * InputStream in = url.openStream();
                              + * 
                              + *

                              Protocol Handlers

                              + * As mentioned, URL and URLConnection rely on protocol handlers which must be + * present, otherwise an Exception is thrown. This is the major difference with + * URIs which only identify resources, and therefore don't need to have access + * to the protocol handler. So, while it is possible to create an URI with any + * kind of protocol scheme (e.g. {@code myproto://myhost.mydomain/resource/}), + * a similar URL will try to instantiate the handler for the specified protocol; + * if it doesn't exist an exception will be thrown. + *

                              By default the protocol handlers are loaded dynamically from the default + * location. It is, however, possible to add to the search path by setting + * the {@code java.protocol.handler.pkgs} system property. For instance if + * it is set to {@code myapp.protocols}, then the URL code will try, in the + * case of http, first to load {@code myapp.protocols.http.Handler}, then, + * if this fails, {@code http.Handler} from the default location.

                              + *

                              Note that the Handler class has to be a subclass of the abstract + * class {@link java.net.URLStreamHandler}.

                              + *

                              Additional Specification

                              + * + * + * @since JDK1.0 + */ +package java.net; diff --git a/jdk/src/share/classes/java/net/package.html b/jdk/src/share/classes/java/net/package.html deleted file mode 100644 index b78a704a145..00000000000 --- a/jdk/src/share/classes/java/net/package.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -Provides the classes for implementing networking applications. - -

                              The java.net package can be roughly divided in two sections:

                              -
                                -
                              • A Low Level API, which deals with the following abstractions:

                                -
                                  -
                                • Addresses, which are networking identifiers, like IP addresses.

                                • -
                                • Sockets, which are basic bidirectional data communication mechanisms.

                                • -
                                • Interfaces, which describe network interfaces.

                                • -
                              • -
                              • A High Level API, which deals with the following abstractions:

                                -
                                  -
                                • URIs, which represent Universal Resource Identifiers.

                                • -
                                • URLs, which represent Universal Resource Locators.

                                • -
                                • Connections, which represents connections to the resource pointed to by URLs.

                                • -
                              • -
                              -

                              Addresses

                              -

                              Addresses are used throughout the java.net APIs as either host identifiers, or socket endpoint identifiers.

                              -

                              The {@link java.net.InetAddress} class is the abstraction representing an IP (Internet Protocol) address. It has two subclasses: -

                                -
                              • {@link java.net.Inet4Address} for IPv4 addresses.
                              • -
                              • {@link java.net.Inet6Address} for IPv6 addresses.
                              • -
                              -

                              But, in most cases, there is no need to deal directly with the subclasses, as the InetAddress abstraction should cover most of the needed functionality.

                              -

                              About IPv6

                              -

                              Not all systems have support for the IPv6 protocol, and while the Java networking stack will attempt to detect it and use it transparently when available, it is also possible to disable its use with a system property. In the case where IPv6 is not available, or explicitly disabled, Inet6Address are not valid arguments for most networking operations any more. While methods like {@link java.net.InetAddress#getByName} are guaranteed not to return an Inet6Address when looking up host names, it is possible, by passing literals, to create such an object. In which case, most methods, when called with an Inet6Address will throw an Exception.

                              -

                              Sockets

                              -

                              Sockets are means to establish a communication link between machines over the network. The java.net package provides 4 kinds of Sockets:

                              -
                                -
                              • {@link java.net.Socket} is a TCP client API, and will typically be used to {@linkplain java.net.Socket#connect(SocketAddress) connect} to a remote host.
                              • -
                              • {@link java.net.ServerSocket} is a TCP server API, and will typically {@linkplain java.net.ServerSocket#accept accept} connections from client sockets.
                              • -
                              • {@link java.net.DatagramSocket} is a UDP endpoint API and is used to {@linkplain java.net.DatagramSocket#send send} and {@linkplain java.net.DatagramSocket#receive receive} {@linkplain java.net.DatagramPacket datagram packets}.
                              • -
                              • {@link java.net.MulticastSocket} is a subclass of {@code DatagramSocket} used when dealing with multicast groups.
                              • -
                              -

                              Sending and receiving with TCP sockets is done through InputStreams and OutputStreams which can be obtained via the {@link java.net.Socket#getInputStream} and {@link java.net.Socket#getOutputStream} methods.

                              -

                              Interfaces

                              -

                              The {@link java.net.NetworkInterface} class provides APIs to browse and query all the networking interfaces (e.g. ethernet connection or PPP endpoint) of the local machine. It is through that class that you can check if any of the local interfaces is configured to support IPv6.

                              -

                              Note, all conforming implementations must support at least one {@code NetworkInterface} object, which must either be connected to a network, or be a "loopback" interface that can only communicate with entities on the same machine.

                              - -

                              High level API

                              -

                              A number of classes in the java.net package do provide for a much higher level of abstraction and allow for easy access to resources on the network. The classes are: -

                                -
                              • {@link java.net.URI} is the class representing a Universal Resource Identifier, as specified in RFC 2396. As the name indicates, this is just an Identifier and doesn't provide directly the means to access the resource.
                              • -
                              • {@link java.net.URL} is the class representing a Universal Resource Locator, which is both an older concept for URIs and a means to access the resources.
                              • -
                              • {@link java.net.URLConnection} is created from a URL and is the communication link used to access the resource pointed by the URL. This abstract class will delegate most of the work to the underlying protocol handlers like http or https.
                              • -
                              • {@link java.net.HttpURLConnection} is a subclass of URLConnection and provides some additional functionalities specific to the HTTP protocol.
                              • -
                              -

                              The recommended usage is to use {@link java.net.URI} to identify resources, then convert it into a {@link java.net.URL} when it is time to access the resource. From that URL, you can either get the {@link java.net.URLConnection} for fine control, or get directly the InputStream.

                              -

                              Here is an example:

                              -

                              -URI uri = new URI("http://java.sun.com/");
                              -URL url = uri.toURL();
                              -InputStream in = url.openStream(); -

                              -

                              Protocol Handlers

                              -As mentioned, URL and URLConnection rely on protocol handlers which must be present, otherwise an Exception is thrown. This is the major difference with URIs which only identify resources, and therefore don't need to have access to the protocol handler. So, while it is possible to create an URI with any kind of protocol scheme (e.g. myproto://myhost.mydomain/resource/), a similar URL will try to instantiate the handler for the specified protocol; if it doesn't exist an exception will be thrown.

                              -

                              By default the protocol handlers are loaded dynamically from the default location. It is, however, possible to add to the search path by setting the java.protocol.handler.pkgs system property. For instance if it is set to myapp.protocols, then the URL code will try, in the case of http, first to load myapp.protocols.http.Handler, then, if this fails, http.Handler from the default location.

                              -

                              Note that the Handler class has to be a subclass of the abstract class {@link java.net.URLStreamHandler}.

                              -

                              Additional Specification

                              - - - -@since JDK1.0 - - diff --git a/jdk/src/share/classes/java/nio/channels/package-info.java b/jdk/src/share/classes/java/nio/channels/package-info.java index 85590dde06d..cb55f8f8da7 100644 --- a/jdk/src/share/classes/java/nio/channels/package-info.java +++ b/jdk/src/share/classes/java/nio/channels/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * * *
                              - * + * * * * @@ -110,7 +110,7 @@ * write them to a given writable byte channel. * *

                              Channels

                              Description

                              ChannelsDescription
                              {@link java.nio.channels.Channel}A nexus for I/O operations
                                {@link java.nio.channels.ReadableByteChannel}
                              - * + * * * * @@ -138,7 +138,7 @@ * * *

                              File channels

                              Description

                              File channelsDescription
                              {@link java.nio.channels.FileChannel}Reads, writes, maps, and manipulates files
                              {@link java.nio.channels.FileLock}
                              - * + * * * * @@ -225,7 +225,7 @@ * * *

                              Multiplexed, non-blocking I/O

                              Description

                              Multiplexed, non-blocking I/O

                              Description

                              {@link java.nio.channels.SelectableChannel}A channel that can be multiplexed
                                {@link java.nio.channels.DatagramChannel}
                              - * + * * * * diff --git a/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template b/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template index 335194eef52..106f7b23b87 100644 --- a/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template +++ b/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template @@ -41,7 +41,7 @@ import java.util.Arrays; * An engine that can transform a sequence of $itypesPhrase$ into a sequence of * $otypesPhrase$. * - * + * * *

                              The input $itype$ sequence is provided in a $itype$ buffer or a series * of such buffers. The output $otype$ sequence is written to a $otype$ buffer @@ -76,22 +76,22 @@ import java.util.Arrays; * examine this object and fill the input buffer, flush the output buffer, or * attempt to recover from $a$ $coding$ error, as appropriate, and try again. * - * + * * *

                              There are two general types of $coding$ errors. If the input $itype$ * sequence is $notLegal$ then the input is considered malformed. If * the input $itype$ sequence is legal but cannot be mapped to a valid * $outSequence$ then an unmappable character has been encountered. * - * + * * *

                              How $a$ $coding$ error is handled depends upon the action requested for * that type of error, which is described by an instance of the {@link - * CodingErrorAction} class. The possible error actions are to {@link - * CodingErrorAction#IGNORE ignore} the erroneous input, {@link - * CodingErrorAction#REPORT report} the error to the invoker via - * the returned {@link CoderResult} object, or {@link CodingErrorAction#REPLACE - * replace} the erroneous input with the current value of the + * CodingErrorAction} class. The possible error actions are to {@linkplain + * CodingErrorAction#IGNORE ignore} the erroneous input, {@linkplain + * CodingErrorAction#REPORT report} the error to the invoker via + * the returned {@link CoderResult} object, or {@linkplain CodingErrorAction#REPLACE + * replace} the erroneous input with the current value of the * replacement $replTypeName$. The replacement * #if[encoder] @@ -106,7 +106,7 @@ import java.util.Arrays; * replaceWith} method. * *

                              The default action for malformed-input and unmappable-character errors - * is to {@link CodingErrorAction#REPORT report} them. The + * is to {@linkplain CodingErrorAction#REPORT report} them. The * malformed-input error action may be changed via the {@link * #onMalformedInput(CodingErrorAction) onMalformedInput} method; the * unmappable-character action may be changed via the {@link @@ -177,7 +177,7 @@ public abstract class Charset$Coder$ { * @param replacement * The initial replacement; must not be null, must have * non-zero length, must not be longer than max$ItypesPerOtype$, - * and must be {@link #isLegalReplacement legal} + * and must be {@linkplain #isLegalReplacement legal} * * @throws IllegalArgumentException * If the preconditions on the parameters do not hold @@ -276,7 +276,7 @@ public abstract class Charset$Coder$ { * The new replacement; must not be null, must have * non-zero length, must not be longer than the value returned by * the {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method, and - * must be {@link #isLegalReplacement legal} + * must be {@link #isLegalReplacement legal} #end[encoder] * * @return This $coder$ @@ -495,24 +495,24 @@ public abstract class Charset$Coder$ { * typically done by draining any $code$d $otype$s from the output * buffer.

                              * - *
                            • A {@link CoderResult#malformedForLength - * malformed-input} result indicates that a malformed-input + *

                            • A {@linkplain CoderResult#malformedForLength + * malformed-input} result indicates that a malformed-input * error has been detected. The malformed $itype$s begin at the input * buffer's (possibly incremented) position; the number of malformed * $itype$s may be determined by invoking the result object's {@link * CoderResult#length() length} method. This case applies only if the - * {@link #onMalformedInput malformed action} of this $coder$ + * {@linkplain #onMalformedInput malformed action} of this $coder$ * is {@link CodingErrorAction#REPORT}; otherwise the malformed input * will be ignored or replaced, as requested.

                            • * - *
                            • An {@link CoderResult#unmappableForLength - * unmappable-character} result indicates that an + *

                            • An {@linkplain CoderResult#unmappableForLength + * unmappable-character} result indicates that an * unmappable-character error has been detected. The $itype$s that * $code$ the unmappable character begin at the input buffer's (possibly * incremented) position; the number of such $itype$s may be determined * by invoking the result object's {@link CoderResult#length() length} - * method. This case applies only if the {@link #onUnmappableCharacter - * unmappable action} of this $coder$ is {@link + * method. This case applies only if the {@linkplain #onUnmappableCharacter + * unmappable action} of this $coder$ is {@link * CodingErrorAction#REPORT}; otherwise the unmappable character will be * ignored or replaced, as requested.

                            • * diff --git a/jdk/src/share/classes/java/nio/charset/Charset.java b/jdk/src/share/classes/java/nio/charset/Charset.java index 278bacb17c5..e1a828dcb15 100644 --- a/jdk/src/share/classes/java/nio/charset/Charset.java +++ b/jdk/src/share/classes/java/nio/charset/Charset.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ import sun.security.action.GetPropertyAction; * concurrent threads. * * - * + * *

                              Charset names

                              * *

                              Charsets are named by strings composed of the following characters: @@ -111,21 +111,17 @@ import sun.security.action.GetPropertyAction; * The aliases of a charset are returned by the {@link #aliases() aliases} * method. * - * - * - *

                              Some charsets have an historical name that is defined for - * compatibility with previous versions of the Java platform. A charset's + *

                              Some charsets have an historical name that is defined for + * compatibility with previous versions of the Java platform. A charset's * historical name is either its canonical name or one of its aliases. The * historical name is returned by the getEncoding() methods of the * {@link java.io.InputStreamReader#getEncoding InputStreamReader} and {@link * java.io.OutputStreamWriter#getEncoding OutputStreamWriter} classes. * - * - * - *

                              If a charset listed in the If a charset listed in the IANA Charset * Registry is supported by an implementation of the Java platform then - * its canonical name must be the name listed in the registry. Many charsets + * its canonical name must be the name listed in the registry. Many charsets * are given more than one name in the registry, in which case the registry * identifies one of the names as MIME-preferred. If a charset has more * than one registry name then its canonical name must be the MIME-preferred @@ -142,15 +138,15 @@ import sun.security.action.GetPropertyAction; * *

                              Standard charsets

                              * - * * - *

                              Every implementation of the Java platform is required to support the - * following standard charsets. Consult the release documentation for your + * + *

                              Every implementation of the Java platform is required to support the + * following standard charsets. Consult the release documentation for your * implementation to see if any other charsets are supported. The behavior * of such optional charsets may differ between implementations. * *

                              Asynchronous I/O

                              Description

                              Asynchronous I/ODescription
                              {@link java.nio.channels.AsynchronousFileChannel}An asynchronous channel for reading, writing, and manipulating a file
                              {@link java.nio.channels.AsynchronousSocketChannel}
                              - * + * * * diff --git a/jdk/src/share/classes/java/nio/charset/MalformedInputException.java b/jdk/src/share/classes/java/nio/charset/MalformedInputException.java index ba1d1018a53..aadbadccc2a 100644 --- a/jdk/src/share/classes/java/nio/charset/MalformedInputException.java +++ b/jdk/src/share/classes/java/nio/charset/MalformedInputException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,14 +42,27 @@ public class MalformedInputException private int inputLength; + /** + * Constructs an {@code MalformedInputException} with the given + * length. + * @param inputLength the length of the input + */ public MalformedInputException(int inputLength) { this.inputLength = inputLength; } + /** + * Returns the length of the input. + * @return the length of the input + */ public int getInputLength() { return inputLength; } + /** + * Returns the message. + * @return the message + */ public String getMessage() { return "Input length = " + inputLength; } diff --git a/jdk/src/share/classes/java/nio/charset/UnmappableCharacterException.java b/jdk/src/share/classes/java/nio/charset/UnmappableCharacterException.java index 5fa12476d68..c33f0404b64 100644 --- a/jdk/src/share/classes/java/nio/charset/UnmappableCharacterException.java +++ b/jdk/src/share/classes/java/nio/charset/UnmappableCharacterException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,14 +42,27 @@ public class UnmappableCharacterException private int inputLength; + /** + * Constructs an {@code UnmappableCharacterException} with the + * given length. + * @param inputLength the length of the input + */ public UnmappableCharacterException(int inputLength) { this.inputLength = inputLength; } + /** + * Returns the length of the input. + * @return the length of the input + */ public int getInputLength() { return inputLength; } + /** + * Returns the message. + * @return the message + */ public String getMessage() { return "Input length = " + inputLength; } diff --git a/jdk/src/share/classes/java/nio/file/Files.java b/jdk/src/share/classes/java/nio/file/Files.java index 586859f17dc..721184c1533 100644 --- a/jdk/src/share/classes/java/nio/file/Files.java +++ b/jdk/src/share/classes/java/nio/file/Files.java @@ -25,10 +25,10 @@ package java.nio.file; -import java.nio.ByteBuffer; import java.nio.file.attribute.*; import java.nio.file.spi.FileSystemProvider; import java.nio.file.spi.FileTypeDetector; +import java.nio.channels.Channels; import java.nio.channels.FileChannel; import java.nio.channels.SeekableByteChannel; import java.io.Closeable; @@ -2965,7 +2965,63 @@ public final class Files { } /** - * Read all the bytes from a file. The method ensures that the file is + * The maximum size of array to allocate. + * Some VMs reserve some header words in an array. + * Attempts to allocate larger arrays may result in + * OutOfMemoryError: Requested array size exceeds VM limit + */ + private static final int MAX_BUFFER_SIZE = Integer.MAX_VALUE - 8; + + /** + * Reads all the bytes from an input stream. Uses {@code initialSize} as a hint + * about how many bytes the stream will have. + * + * @param source + * the input stream to read from + * @param initialSize + * the initial size of the byte array to allocate + * + * @return a byte array containing the bytes read from the file + * + * @throws IOException + * if an I/O error occurs reading from the stream + * @throws OutOfMemoryError + * if an array of the required size cannot be allocated + */ + private static byte[] read(InputStream source, int initialSize) + throws IOException + { + int capacity = initialSize; + byte[] buf = new byte[capacity]; + int nread = 0; + int n; + for (;;) { + // read to EOF which may read more or less than initialSize (eg: file + // is truncated while we are reading) + while ((n = source.read(buf, nread, capacity - nread)) > 0) + nread += n; + + // if last call to source.read() returned -1, we are done + // otherwise, try to read one more byte; if that failed we're done too + if (n < 0 || (n = source.read()) < 0) + break; + + // one more byte was read; need to allocate a larger buffer + if (capacity <= MAX_BUFFER_SIZE - capacity) { + capacity = Math.max(capacity << 1, BUFFER_SIZE); + } else { + if (capacity == MAX_BUFFER_SIZE) + throw new OutOfMemoryError("Required array size too large"); + capacity = MAX_BUFFER_SIZE; + } + buf = Arrays.copyOf(buf, capacity); + buf[nread++] = (byte)n; + } + return (capacity == nread) ? buf : Arrays.copyOf(buf, nread); + } + + /** + * Reads all the bytes from a file. The method ensures that the file is * closed when all bytes have been read or an I/O error, or other runtime * exception, is thrown. * @@ -2989,22 +3045,13 @@ public final class Files { * method is invoked to check read access to the file. */ public static byte[] readAllBytes(Path path) throws IOException { - try (FileChannel fc = FileChannel.open(path)) { + try (FileChannel fc = FileChannel.open(path); + InputStream is = Channels.newInputStream(fc)) { long size = fc.size(); - if (size > (long)Integer.MAX_VALUE) + if (size > (long)MAX_BUFFER_SIZE) throw new OutOfMemoryError("Required array size too large"); - byte[] arr = new byte[(int)size]; - ByteBuffer bb = ByteBuffer.wrap(arr); - while (bb.hasRemaining()) { - if (fc.read(bb) < 0) { - // truncated - break; - } - } - - int nread = bb.position(); - return (nread == size) ? arr : Arrays.copyOf(arr, nread); + return read(is, (int)size); } } diff --git a/jdk/src/share/classes/java/nio/file/attribute/package-info.java b/jdk/src/share/classes/java/nio/file/attribute/package-info.java index 222b7251f00..b0e87b64c76 100644 --- a/jdk/src/share/classes/java/nio/file/attribute/package-info.java +++ b/jdk/src/share/classes/java/nio/file/attribute/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * Interfaces and classes providing access to file and file system attributes. * *

                              Charset

                              Description

                              CharsetDescription
                              US-ASCIISeven-bit ASCII, a.k.a. ISO646-US, * a.k.a. the Basic Latin block of the Unicode character set
                              - * + * * * * @@ -38,7 +38,7 @@ * * * - * + * * * * @@ -86,14 +86,14 @@ * *
                                * - *

                              • The {@link java.nio.file.attribute.UserPrincipal} and + *
                              • The {@link java.nio.file.attribute.UserPrincipal} and * {@link java.nio.file.attribute.GroupPrincipal} interfaces represent an * identity or group identity.
                              • * - *

                              • The {@link java.nio.file.attribute.UserPrincipalLookupService} + *
                              • The {@link java.nio.file.attribute.UserPrincipalLookupService} * interface defines methods to lookup user or group principals.
                              • * - *

                              • The {@link java.nio.file.attribute.FileAttribute} interface + *
                              • The {@link java.nio.file.attribute.FileAttribute} interface * represents the value of an attribute for cases where the attribute value is * required to be set atomically when creating an object in the file system.
                              • * diff --git a/jdk/src/share/classes/java/nio/file/package-info.java b/jdk/src/share/classes/java/nio/file/package-info.java index c0cf571b555..ca3e946d567 100644 --- a/jdk/src/share/classes/java/nio/file/package-info.java +++ b/jdk/src/share/classes/java/nio/file/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,8 +33,8 @@ * package is used by service provider implementors wishing to extend the * platform default provider, or to construct other provider implementations.

                                * - *

                                Symbolic Links

                                - * Many operating systems and file systems support for symbolic links. + *

                                Symbolic Links

                                + *

                                Many operating systems and file systems support for symbolic links. * A symbolic link is a special file that serves as a reference to another file. * For the most part, symbolic links are transparent to applications and * operations on symbolic links are automatically redirected to the target @@ -45,8 +45,8 @@ * that are semantically close but support for these other types of links is * not included in this package.

                                * - *

                                Interoperability

                                - * The {@link java.io.File} class defines the {@link java.io.File#toPath + *

                                Interoperability

                                + *

                                The {@link java.io.File} class defines the {@link java.io.File#toPath * toPath} method to construct a {@link java.nio.file.Path} by converting * the abstract path represented by the {@code java.io.File} object. The resulting * {@code Path} can be used to operate on the same file as the {@code File} @@ -55,7 +55,7 @@ * and {@code java.io.File} objects.

                                * *

                                Visibility

                                - * The view of the files and file system provided by classes in this package are + *

                                The view of the files and file system provided by classes in this package are * guaranteed to be consistent with other views provided by other instances in the * same Java virtual machine. The view may or may not, however, be consistent with * the view of the file system as seen by other concurrently running programs due @@ -65,8 +65,8 @@ * or on some other machine. The exact nature of any such inconsistencies are * system-dependent and are therefore unspecified.

                                * - *

                                Synchronized I/O File Integrity

                                - * The {@link java.nio.file.StandardOpenOption#SYNC SYNC} and {@link + *

                                Synchronized I/O File Integrity

                                + *

                                The {@link java.nio.file.StandardOpenOption#SYNC SYNC} and {@link * java.nio.file.StandardOpenOption#DSYNC DSYNC} options are used when opening a file * to require that updates to the file are written synchronously to the underlying * storage device. In the case of the default provider, and the file resides on @@ -83,7 +83,7 @@ * specific.

                                * *

                                General Exceptions

                                - * Unless otherwise noted, passing a {@code null} argument to a constructor + *

                                Unless otherwise noted, passing a {@code null} argument to a constructor * or method of any class or interface in this package will cause a {@link * java.lang.NullPointerException NullPointerException} to be thrown. Additionally, * invoking a method with a collection containing a {@code null} element will diff --git a/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java b/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java index ccff225c87d..e7b7581820b 100644 --- a/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java +++ b/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,15 +33,47 @@ import java.net.*; * in order to obtain client and server sockets for RMI calls. An * application may use the setSocketFactory method to * request that the RMI runtime use its socket factory instance - * instead of the default implementation.

                                + * instead of the default implementation. * - * The default socket factory implementation used goes through a + *

                                The default socket factory implementation performs a * three-tiered approach to creating client sockets. First, a direct * socket connection to the remote VM is attempted. If that fails * (due to a firewall), the runtime uses HTTP with the explicit port * number of the server. If the firewall does not allow this type of * communication, then HTTP to a cgi-bin script on the server is used - * to POST the RMI call.

                                + * to POST the RMI call. + * + *

                                The default socket factory implementation creates server sockets that + * are bound to the wildcard address, which accepts requests from all network + * interfaces. + * + * @implNote + *

                                You can use the {@code RMISocketFactory} class to create a server socket that + * is bound to a specific address, restricting the origin of requests. For example, + * the following code implements a socket factory that binds server sockets to the + * loopback address. This restricts RMI to processing requests only from the local host. + * + *

                                {@code
                                + *     class LoopbackSocketFactory extends RMISocketFactory {
                                + *         public ServerSocket createServerSocket(int port) throws IOException {
                                + *             return new ServerSocket(port, 5, InetAddress.getLoopbackAddress());
                                + *         }
                                + *
                                + *         public Socket createSocket(String host, int port) throws IOException {
                                + *             // just call the default client socket factory
                                + *             return RMISocketFactory.getDefaultSocketFactory()
                                + *                                    .createSocket(host, port);
                                + *         }
                                + *     }
                                + *
                                + *     // ...
                                + *
                                + *     RMISocketFactory.setSocketFactory(new LoopbackSocketFactory());
                                + * }
                                + * + * Set the {@code java.rmi.server.hostname} system property + * to a host name (typically {@code localhost}) that resolves to the loopback + * interface to ensure that the generated stubs use the right network interface. * * @author Ann Wollrath * @author Peter Jones diff --git a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java index 7764627bceb..be86c275246 100644 --- a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java +++ b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,6 +100,26 @@ import sun.rmi.server.UnicastServerRef2; *
                              * * + *

                              If an object is exported with the + * {@link #exportObject(Remote) exportObject(Remote)} + * or + * {@link #exportObject(Remote, int) exportObject(Remote, port)} + * methods, or if a subclass constructor invokes one of the + * {@link #UnicastRemoteObject()} + * or + * {@link #UnicastRemoteObject(int) UnicastRemoteObject(port)} + * constructors, the object is exported with a server socket created using the + * {@link RMISocketFactory} + * class. + * + * @implNote + *

                              By default, server sockets created by the {@link RMISocketFactory} class + * listen on all network interfaces. See the + * {@link RMISocketFactory} class and the section + * RMI Socket Factories + * in the + * Java RMI Specification. + * * @author Ann Wollrath * @author Peter Jones * @since JDK1.1 diff --git a/jdk/src/share/classes/java/security/Security.java b/jdk/src/share/classes/java/security/Security.java index 98699da8149..ce99101e716 100644 --- a/jdk/src/share/classes/java/security/Security.java +++ b/jdk/src/share/classes/java/security/Security.java @@ -326,17 +326,13 @@ public final class Security { * *

                              A provider cannot be added if it is already installed. * - *

                              First, if there is a security manager, its - * {@code checkSecurityAccess} - * method is called with the string - * {@code "insertProvider."+provider.getName()} - * to see if it's ok to add a new provider. - * If the default implementation of {@code checkSecurityAccess} - * is used (i.e., that method is not overriden), then this will result in - * a call to the security manager's {@code checkPermission} method - * with a - * {@code SecurityPermission("insertProvider."+provider.getName())} - * permission. + *

                              If there is a security manager, the + * {@link java.lang.SecurityManager#checkSecurityAccess} method is called + * with the {@code "insertProvider"} permission target name to see if + * it's ok to add a new provider. If this permission check is denied, + * {@code checkSecurityAccess} is called again with the + * {@code "insertProvider."+provider.getName()} permission target name. If + * both checks are denied, a {@code SecurityException} is thrown. * * @param provider the provider to be added. * @@ -360,7 +356,7 @@ public final class Security { public static synchronized int insertProviderAt(Provider provider, int position) { String providerName = provider.getName(); - check("insertProvider." + providerName); + checkInsertProvider(providerName); ProviderList list = Providers.getFullProviderList(); ProviderList newList = ProviderList.insertAt(list, provider, position - 1); if (list == newList) { @@ -373,17 +369,13 @@ public final class Security { /** * Adds a provider to the next position available. * - *

                              First, if there is a security manager, its - * {@code checkSecurityAccess} - * method is called with the string - * {@code "insertProvider."+provider.getName()} - * to see if it's ok to add a new provider. - * If the default implementation of {@code checkSecurityAccess} - * is used (i.e., that method is not overriden), then this will result in - * a call to the security manager's {@code checkPermission} method - * with a - * {@code SecurityPermission("insertProvider."+provider.getName())} - * permission. + *

                              If there is a security manager, the + * {@link java.lang.SecurityManager#checkSecurityAccess} method is called + * with the {@code "insertProvider"} permission target name to see if + * it's ok to add a new provider. If this permission check is denied, + * {@code checkSecurityAccess} is called again with the + * {@code "insertProvider."+provider.getName()} permission target name. If + * both checks are denied, a {@code SecurityException} is thrown. * * @param provider the provider to be added. * @@ -863,6 +855,23 @@ public final class Security { } } + private static void checkInsertProvider(String name) { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + try { + security.checkSecurityAccess("insertProvider"); + } catch (SecurityException se1) { + try { + security.checkSecurityAccess("insertProvider." + name); + } catch (SecurityException se2) { + // throw first exception, but add second to suppressed + se1.addSuppressed(se2); + throw se1; + } + } + } + } + /* * Returns all providers who satisfy the specified * criterion. diff --git a/jdk/src/share/classes/java/security/SecurityPermission.java b/jdk/src/share/classes/java/security/SecurityPermission.java index e0f0f92b40c..bbdccaeffe3 100644 --- a/jdk/src/share/classes/java/security/SecurityPermission.java +++ b/jdk/src/share/classes/java/security/SecurityPermission.java @@ -130,14 +130,17 @@ import java.util.StringTokenizer; * * *

                              - * - * + * + * * + * before attaching it. The "insertProvider" permission subsumes the + * "insertProvider.{provider name}" permission (see the section below for + * more information). + * * * * @@ -186,9 +189,10 @@ import java.util.StringTokenizer; *

                              Attribute views

                              Description

                              Attribute viewsDescription
                              {@link java.nio.file.attribute.AttributeView}Can read or update non-opaque values associated with objects in a file system
                                {@link java.nio.file.attribute.FileAttributeView}Can read or update POSIX defined file attributes
                                    {@link java.nio.file.attribute.DosFileAttributeView}  Can read or update FAT file attributes
                                  {@link java.nio.file.attribute.FileOwnerAttributeView}  
                                  {@link java.nio.file.attribute.FileOwnerAttributeView}  Can read or update the owner of a file
                                   {@link java.nio.file.attribute.AclFileAttributeView}  Can read or update Access Control Lists
                              insertProvider.{provider name}Addition of a new provider, with the specified nameinsertProviderAddition of a new providerThis would allow somebody to introduce a possibly * malicious provider (e.g., one that discloses the private keys passed * to it) as the highest-priority provider. This would be possible * because the Security object (which manages the installed providers) * currently does not check the integrity or authenticity of a provider - * before attaching it.
                              * *

                              - * The following permissions are associated with classes that have been - * deprecated: {@link Identity}, {@link IdentityScope}, {@link Signer}. Use of - * them is discouraged. See the applicable classes for more information. + * The following permissions have been superseded by newer permissions or are + * associated with classes that have been deprecated: {@link Identity}, + * {@link IdentityScope}, {@link Signer}. Use of them is discouraged. See the + * applicable classes for more information. *

                              * * @@ -199,6 +203,23 @@ import java.util.StringTokenizer; * * * + * + * + * + * + * + * * * *
                              insertProvider.{provider name}Addition of a new provider, with the specified nameUse of this permission is discouraged from further use because it is + * possible to circumvent the name restrictions by overriding the + * {@link java.security.Provider#getName} method. Also, there is an equivalent + * level of risk associated with granting code permission to insert a provider + * with a specific name, or any name it chooses. Users should use the + * "insertProvider" permission instead. + *

                              This would allow somebody to introduce a possibly + * malicious provider (e.g., one that discloses the private keys passed + * to it) as the highest-priority provider. This would be possible + * because the Security object (which manages the installed providers) + * currently does not check the integrity or authenticity of a provider + * before attaching it.

                              setSystemScopeSetting of the system identity scopeThis would allow an attacker to configure the system identity scope with @@ -306,7 +327,6 @@ public final class SecurityPermission extends BasicPermission { * @throws NullPointerException if {@code name} is {@code null}. * @throws IllegalArgumentException if {@code name} is empty. */ - public SecurityPermission(String name) { super(name); @@ -323,7 +343,6 @@ public final class SecurityPermission extends BasicPermission { * @throws NullPointerException if {@code name} is {@code null}. * @throws IllegalArgumentException if {@code name} is empty. */ - public SecurityPermission(String name, String actions) { super(name, actions); diff --git a/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java b/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java index 2446c821df6..d0e2ee02986 100644 --- a/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java +++ b/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,21 +50,26 @@ import java.util.Set; * status of certificates with OCSP and CRLs. By default, OCSP is the * preferred mechanism for checking revocation status, with CRLs as the * fallback mechanism. However, this preference can be switched to CRLs with - * the {@link Option#PREFER_CRLS PREFER_CRLS} option. + * the {@link Option#PREFER_CRLS PREFER_CRLS} option. In addition, the fallback + * mechanism can be disabled with the {@link Option#NO_FALLBACK NO_FALLBACK} + * option. * *

                              A {@code PKIXRevocationChecker} is obtained by calling the * {@link CertPathValidator#getRevocationChecker getRevocationChecker} method * of a PKIX {@code CertPathValidator}. Additional parameters and options - * specific to revocation can be set (by calling {@link #setOCSPResponder} - * method for instance). The {@code PKIXRevocationChecker} is added to - * a {@code PKIXParameters} object using the - * {@link PKIXParameters#addCertPathChecker addCertPathChecker} + * specific to revocation can be set (by calling the + * {@link #setOcspResponder setOcspResponder} method for instance). The + * {@code PKIXRevocationChecker} is added to a {@code PKIXParameters} object + * using the {@link PKIXParameters#addCertPathChecker addCertPathChecker} * or {@link PKIXParameters#setCertPathCheckers setCertPathCheckers} method, * and then the {@code PKIXParameters} is passed along with the {@code CertPath} * to be validated to the {@link CertPathValidator#validate validate} method * of a PKIX {@code CertPathValidator}. When supplying a revocation checker in * this manner, it will be used to check revocation irrespective of the setting * of the {@link PKIXParameters#isRevocationEnabled RevocationEnabled} flag. + * Similarly, a {@code PKIXRevocationChecker} may be added to a + * {@code PKIXBuilderParameters} object for use with a PKIX + * {@code CertPathBuilder}. * *

                              Note that when a {@code PKIXRevocationChecker} is added to * {@code PKIXParameters}, it clones the {@code PKIXRevocationChecker}; @@ -83,6 +88,13 @@ import java.util.Set; * need not synchronize. * * @since 1.8 + * + * @see RFC 2560: X.509 + * Internet Public Key Infrastructure Online Certificate Status Protocol - + * OCSP,
                              RFC 5280: Internet X.509 + * Public Key Infrastructure Certificate and Certificate Revocation List (CRL) + * Profile */ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { private URI ocspResponder; @@ -101,7 +113,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { * * @param uri the responder URI */ - public void setOCSPResponder(URI uri) { + public void setOcspResponder(URI uri) { this.ocspResponder = uri; } @@ -114,7 +126,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { * * @return the responder URI, or {@code null} if not set */ - public URI getOCSPResponder() { + public URI getOcspResponder() { return ocspResponder; } @@ -126,7 +138,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { * * @param cert the responder's certificate */ - public void setOCSPResponderCert(X509Certificate cert) { + public void setOcspResponderCert(X509Certificate cert) { this.ocspResponderCert = cert; } @@ -140,7 +152,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { * * @return the responder's certificate, or {@code null} if not set */ - public X509Certificate getOCSPResponderCert() { + public X509Certificate getOcspResponderCert() { return ocspResponderCert; } @@ -151,7 +163,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { * @param extensions a list of extensions. The list is copied to protect * against subsequent modification. */ - public void setOCSPExtensions(List extensions) + public void setOcspExtensions(List extensions) { this.ocspExtensions = (extensions == null) ? Collections.emptyList() @@ -161,10 +173,10 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { /** * Gets the optional OCSP request extensions. * - * @return an unmodifiable list of extensions. Returns an empty list if no + * @return an unmodifiable list of extensions. The list is empty if no * extensions have been specified. */ - public List getOCSPExtensions() { + public List getOcspExtensions() { return Collections.unmodifiableList(ocspExtensions); } @@ -177,7 +189,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { * DER-encoded OCSP response for that certificate. A deep copy of * the map is performed to protect against subsequent modification. */ - public void setOCSPResponses(Map responses) + public void setOcspResponses(Map responses) { if (responses == null) { this.ocspResponses = Collections.emptyMap(); @@ -200,7 +212,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { * the map is returned to protect against subsequent modification. * Returns an empty map if no responses have been specified. */ - public Map getOCSPResponses() { + public Map getOcspResponses() { Map copy = new HashMap<>(ocspResponses.size()); for (Map.Entry e : ocspResponses.entrySet()) { copy.put(e.getKey(), e.getValue().clone()); @@ -223,15 +235,31 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { /** * Gets the revocation options. * - * @return an unmodifiable set of revocation options, or an empty set if - * none are specified + * @return an unmodifiable set of revocation options. The set is empty if + * no options have been specified. */ public Set

                              + * An implementation of {@code PKIXRevocationChecker} is responsible for + * adding the ignored exceptions to the list. + * + * @return an unmodifiable list containing the ignored exceptions. The list + * is empty if no exceptions have been ignored. + */ + public abstract List getSoftFailExceptions(); + @Override - public Object clone() { + public PKIXRevocationChecker clone() { PKIXRevocationChecker copy = (PKIXRevocationChecker)super.clone(); copy.ocspExtensions = new ArrayList<>(ocspExtensions); copy.ocspResponses = new HashMap<>(ocspResponses); @@ -262,9 +290,26 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker { */ PREFER_CRLS, /** - * Ignore network failures. The default behavior is to consider it a - * failure if the revocation status of a certificate cannot be obtained - * due to a network error. This option applies to both OCSP and CRLs. + * Disable the fallback mechanism. + */ + NO_FALLBACK, + /** + * Allow revocation check to succeed if the revocation status cannot be + * determined for one of the following reasons: + *

                                + *
                              • The CRL or OCSP response cannot be obtained because of a + * network error. + *
                              • The OCSP responder returns one of the following errors + * specified in section 2.3 of RFC 2560: internalError, tryLater, + * or unauthorized. + *

                              + * Note that these conditions apply to both OCSP and CRLs, and unless + * the {@code NO_FALLBACK} option is set, the revocation check is + * allowed to succeed only if both mechanisms fail under one of the + * conditions as stated above. + * Exceptions that cause the network errors are ignored but can be + * later retrieved by calling the + * {@link #getSoftFailExceptions getSoftFailExceptions} method. */ SOFT_FAIL } diff --git a/jdk/src/share/classes/java/text/Annotation.java b/jdk/src/share/classes/java/text/Annotation.java index c3ca5fc79a2..1f5577cec19 100644 --- a/jdk/src/share/classes/java/text/Annotation.java +++ b/jdk/src/share/classes/java/text/Annotation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,8 @@ public class Annotation { /** * Constructs an annotation record with the given value, which * may be null. - * @param value The value of the attribute + * + * @param value the value of the attribute */ public Annotation(Object value) { this.value = value; @@ -67,6 +68,8 @@ public class Annotation { /** * Returns the value of the attribute, which may be null. + * + * @return the value of the attribute */ public Object getValue() { return value; @@ -74,6 +77,8 @@ public class Annotation { /** * Returns the String representation of this Annotation. + * + * @return the {@code String} representation of this {@code Annotation} */ public String toString() { return getClass().getName() + "[value=" + value + "]"; diff --git a/jdk/src/share/classes/java/text/AttributedCharacterIterator.java b/jdk/src/share/classes/java/text/AttributedCharacterIterator.java index 5e3c2755f24..26a7e88c685 100644 --- a/jdk/src/share/classes/java/text/AttributedCharacterIterator.java +++ b/jdk/src/share/classes/java/text/AttributedCharacterIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,6 +101,8 @@ public interface AttributedCharacterIterator extends CharacterIterator { /** * Constructs an {@code Attribute} with the given name. + * + * @param name the name of {@code Attribute} */ protected Attribute(String name) { this.name = name; @@ -111,7 +113,7 @@ public interface AttributedCharacterIterator extends CharacterIterator { /** * Compares two objects for equality. This version only returns true - * for x.equals(y) if x and y refer + * for {@code x.equals(y)} if {@code x} and {@code y} refer * to the same object, and guarantees this for all subclasses. */ public final boolean equals(Object obj) { @@ -137,6 +139,8 @@ public interface AttributedCharacterIterator extends CharacterIterator { /** * Returns the name of the attribute. + * + * @return the name of {@code Attribute} */ protected String getName() { return name; @@ -144,6 +148,10 @@ public interface AttributedCharacterIterator extends CharacterIterator { /** * Resolves instances being deserialized to the predefined constants. + * + * @return the resolved {@code Attribute} object + * @throws InvalidObjectException if the object to resolve is not + * an instance of {@code Attribute} */ protected Object readResolve() throws InvalidObjectException { if (this.getClass() != Attribute.class) { @@ -171,6 +179,7 @@ public interface AttributedCharacterIterator extends CharacterIterator { * it is often necessary to store the reading (pronunciation) along with the * written form. *

                              Values are instances of {@link Annotation} holding instances of {@link String}. + * * @see Annotation * @see java.lang.String */ @@ -196,18 +205,26 @@ public interface AttributedCharacterIterator extends CharacterIterator { *

                              Any contiguous text segments having the same attributes (the * same set of attribute/value pairs) are treated as separate runs * if the attributes have been given to those text segments separately. + * + * @return the index of the first character of the run */ public int getRunStart(); /** * Returns the index of the first character of the run * with respect to the given {@code attribute} containing the current character. + * + * @param attribute the desired attribute. + * @return the index of the first character of the run */ public int getRunStart(Attribute attribute); /** * Returns the index of the first character of the run * with respect to the given {@code attributes} containing the current character. + * + * @param attributes a set of the desired attributes. + * @return the index of the first character of the run */ public int getRunStart(Set attributes); @@ -218,30 +235,43 @@ public interface AttributedCharacterIterator extends CharacterIterator { *

                              Any contiguous text segments having the same attributes (the * same set of attribute/value pairs) are treated as separate runs * if the attributes have been given to those text segments separately. + * + * @return the index of the first character following the run */ public int getRunLimit(); /** * Returns the index of the first character following the run * with respect to the given {@code attribute} containing the current character. + * + * @param attribute the desired attribute + * @return the index of the first character following the run */ public int getRunLimit(Attribute attribute); /** * Returns the index of the first character following the run * with respect to the given {@code attributes} containing the current character. + * + * @param attributes a set of the desired attributes + * @return the index of the first character following the run */ public int getRunLimit(Set attributes); /** * Returns a map with the attributes defined on the current * character. + * + * @return a map with the attributes defined on the current character */ public Map getAttributes(); /** * Returns the value of the named {@code attribute} for the current character. * Returns {@code null} if the {@code attribute} is not defined. + * + * @param attribute the desired attribute + * @return the value of the named {@code attribute} or {@code null} */ public Object getAttribute(Attribute attribute); @@ -249,6 +279,8 @@ public interface AttributedCharacterIterator extends CharacterIterator { * Returns the keys of all attributes defined on the * iterator's text range. The set is empty if no * attributes are defined. + * + * @return the keys of all attributes */ public Set getAllAttributeKeys(); }; diff --git a/jdk/src/share/classes/java/text/Bidi.java b/jdk/src/share/classes/java/text/Bidi.java index 8bd1dedae24..3d0e1381adb 100644 --- a/jdk/src/share/classes/java/text/Bidi.java +++ b/jdk/src/share/classes/java/text/Bidi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -176,8 +176,10 @@ public final class Bidi { * Create a Bidi object representing the bidi information on a line of text within * the paragraph represented by the current Bidi. This call is not required if the * entire paragraph fits on one line. + * * @param lineStart the offset from the start of the paragraph to the start of the line. * @param lineLimit the offset from the start of the paragraph to the limit of the line. + * @return a {@code Bidi} object */ public Bidi createLineBidi(int lineStart, int lineLimit) { AttributedString astr = new AttributedString(""); @@ -189,6 +191,7 @@ public final class Bidi { /** * Return true if the line is not left-to-right or right-to-left. This means it either has mixed runs of left-to-right * and right-to-left text, or the base direction differs from the direction of the only run of text. + * * @return true if the line is not left-to-right or right-to-left. */ public boolean isMixed() { @@ -197,6 +200,7 @@ public final class Bidi { /** * Return true if the line is all left-to-right text and the base direction is left-to-right. + * * @return true if the line is all left-to-right text and the base direction is left-to-right */ public boolean isLeftToRight() { @@ -236,8 +240,10 @@ public final class Bidi { } /** - * Return the resolved level of the character at offset. If offset is <0 or >= - * the length of the line, return the base direction level. + * Return the resolved level of the character at offset. If offset is + * {@literal <} 0 or ≥ the length of the line, return the base direction + * level. + * * @param offset the index of the character for which to return the level * @return the resolved level of the character at offset */ diff --git a/jdk/src/share/classes/java/text/BreakIterator.java b/jdk/src/share/classes/java/text/BreakIterator.java index bf9be5013e9..7c1f4524b8e 100644 --- a/jdk/src/share/classes/java/text/BreakIterator.java +++ b/jdk/src/share/classes/java/text/BreakIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -191,7 +191,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * * Find the next word: *

                              - *
                              + * 
                              {@code
                                * public static int nextWordStartAfter(int pos, String text) {
                                *     BreakIterator wb = BreakIterator.getWordInstance();
                                *     wb.setText(text);
                              @@ -207,7 +207,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
                                *     }
                                *     return BreakIterator.DONE;
                                * }
                              - * 
                              + * }
                              * (The iterator returned by BreakIterator.getWordInstance() is unique in that * the break positions it returns don't represent both the start and end of the * thing being iterated over. That is, a sentence-break iterator returns breaks diff --git a/jdk/src/share/classes/java/text/ChoiceFormat.java b/jdk/src/share/classes/java/text/ChoiceFormat.java index 7814f0ef2c5..8fcba9a92a9 100644 --- a/jdk/src/share/classes/java/text/ChoiceFormat.java +++ b/jdk/src/share/classes/java/text/ChoiceFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ import java.util.Arrays; * specifies a half-open interval up to the next item: *
                              *
                              - * X matches j if and only if limit[j] <= X < limit[j+1]
                              + * X matches j if and only if limit[j] ≤ X < limit[j+1]
                                * 
                              *
                              * If there is no match, then either the first or last index is used, depending @@ -85,21 +85,21 @@ import java.util.Arrays; *

                              * Here is a simple example that shows formatting and parsing: *

                              - *
                              + * 
                              {@code
                                * double[] limits = {1,2,3,4,5,6,7};
                                * String[] dayOfWeekNames = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
                                * ChoiceFormat form = new ChoiceFormat(limits, dayOfWeekNames);
                                * ParsePosition status = new ParsePosition(0);
                              - * for (double i = 0.0; i <= 8.0; ++i) {
                              + * for (double i = 0.0; i <= 8.0; ++i) {
                                *     status.setIndex(0);
                              - *     System.out.println(i + " -> " + form.format(i) + " -> "
                              + *     System.out.println(i + " -> " + form.format(i) + " -> "
                                *                              + form.parse(form.format(i),status));
                                * }
                              - * 
                              + * }
                              *
                              * Here is a more complex example, with a pattern format: *
                              - *
                              + * 
                              {@code
                                * double[] filelimits = {0,1,2};
                                * String[] filepart = {"are no files","is one file","are {2} files"};
                                * ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
                              @@ -107,20 +107,20 @@ import java.util.Arrays;
                                * MessageFormat pattform = new MessageFormat("There {0} on {1}");
                                * pattform.setFormats(testFormats);
                                * Object[] testArgs = {null, "ADisk", null};
                              - * for (int i = 0; i < 4; ++i) {
                              + * for (int i = 0; i < 4; ++i) {
                                *     testArgs[0] = new Integer(i);
                                *     testArgs[2] = testArgs[0];
                                *     System.out.println(pattform.format(testArgs));
                                * }
                              - * 
                              + * }
                              *
                              *

                              * Specifying a pattern for ChoiceFormat objects is fairly straightforward. * For example: *

                              - *
                              + * 
                              {@code
                                * ChoiceFormat fmt = new ChoiceFormat(
                              - *      "-1#is negative| 0#is zero or fraction | 1#is one |1.0<is 1+ |2#is two |2<is more than 2.");
                              + *      "-1#is negative| 0#is zero or fraction | 1#is one |1.0
                              + * }
                              *
                              * And the output result would be like the following: *
                              - *
                              - *   Format with -INF : is negative
                              - *   Format with -1.0 : is negative
                              - *   Format with 0 : is zero or fraction
                              - *   Format with 0.9 : is zero or fraction
                              - *   Format with 1.0 : is one
                              - *   Format with 1.5 : is 1+
                              - *   Format with 2 : is two
                              - *   Format with 2.1 : is more than 2.
                              - *   Format with NaN : is negative
                              - *   Format with +INF : is more than 2.
                              - * 
                              + *
                              {@code
                              + * Format with -INF : is negative
                              + * Format with -1.0 : is negative
                              + * Format with 0 : is zero or fraction
                              + * Format with 0.9 : is zero or fraction
                              + * Format with 1.0 : is one
                              + * Format with 1.5 : is 1+
                              + * Format with 2 : is two
                              + * Format with 2.1 : is more than 2.
                              + * Format with NaN : is negative
                              + * Format with +INF : is more than 2.
                              + * }
                              *
                              * - *

                              Synchronization

                              + *

                              Synchronization

                              * *

                              * Choice formats are not synchronized. @@ -255,6 +255,8 @@ public class ChoiceFormat extends NumberFormat { /** * Gets the pattern. + * + * @return the pattern string */ public String toPattern() { StringBuffer result = new StringBuffer(); @@ -305,6 +307,8 @@ public class ChoiceFormat extends NumberFormat { /** * Constructs with limits and corresponding formats based on the pattern. + * + * @param newPattern the new pattern string * @see #applyPattern */ public ChoiceFormat(String newPattern) { @@ -313,6 +317,9 @@ public class ChoiceFormat extends NumberFormat { /** * Constructs with the limits and the corresponding formats. + * + * @param limits limits in ascending order + * @param formats corresponding format strings * @see #setChoices */ public ChoiceFormat(double[] limits, String[] formats) { @@ -322,9 +329,9 @@ public class ChoiceFormat extends NumberFormat { /** * Set the choices to be used in formatting. * @param limits contains the top value that you want - * parsed with that format,and should be in ascending sorted order. When + * parsed with that format, and should be in ascending sorted order. When * formatting X, the choice will be the i, where - * limit[i] <= X < limit[i+1]. + * limit[i] ≤ X {@literal <} limit[i+1]. * If the limit array is not in ascending order, the results of formatting * will be incorrect. * @param formats are the formats you want to use for each limit. @@ -434,9 +441,12 @@ public class ChoiceFormat extends NumberFormat { } /** - * Finds the least double greater than d. - * If NaN, returns same value. + * Finds the least double greater than {@code d}. + * If {@code NaN}, returns same value. *

                              Used to make half-open intervals. + * + * @param d the reference value + * @return the least double value greather than {@code d} * @see #previousDouble */ public static final double nextDouble (double d) { @@ -444,8 +454,11 @@ public class ChoiceFormat extends NumberFormat { } /** - * Finds the greatest double less than d. - * If NaN, returns same value. + * Finds the greatest double less than {@code d}. + * If {@code NaN}, returns same value. + * + * @param d the reference value + * @return the greatest double value less than {@code d} * @see #nextDouble */ public static final double previousDouble (double d) { @@ -553,15 +566,21 @@ public class ChoiceFormat extends NumberFormat { static final long POSITIVEINFINITY = 0x7FF0000000000000L; /** - * Finds the least double greater than d (if positive == true), - * or the greatest double less than d (if positive == false). - * If NaN, returns same value. + * Finds the least double greater than {@code d} (if {@code positive} is + * {@code true}), or the greatest double less than {@code d} (if + * {@code positive} is {@code false}). + * If {@code NaN}, returns same value. * * Does not affect floating-point flags, * provided these member functions do not: * Double.longBitsToDouble(long) * Double.doubleToLongBits(double) * Double.isNaN(double) + * + * @param d the reference value + * @param positive {@code true} if the least double is desired; + * {@code false} otherwise + * @return the least or greater double value */ public static double nextDouble (double d, boolean positive) { diff --git a/jdk/src/share/classes/java/text/CollationElementIterator.java b/jdk/src/share/classes/java/text/CollationElementIterator.java index daa26028f82..7468cb5232d 100644 --- a/jdk/src/share/classes/java/text/CollationElementIterator.java +++ b/jdk/src/share/classes/java/text/CollationElementIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,14 +54,14 @@ import sun.text.normalizer.NormalizerBase; * For example, consider the following in Spanish: *

                              *
                              - * "ca" -> the first key is key('c') and second key is key('a').
                              - * "cha" -> the first key is key('ch') and second key is key('a').
                              + * "ca" → the first key is key('c') and second key is key('a').
                              + * "cha" → the first key is key('ch') and second key is key('a').
                                * 
                              *
                              * And in German, *
                              *
                              - * "\u00e4b"-> the first key is key('a'), the second key is key('e'), and
                              + * "\u00e4b" → the first key is key('a'), the second key is key('e'), and
                                * the third key is key('b').
                                * 
                              *
                              @@ -177,6 +177,8 @@ public final class CollationElementIterator * means that when you change direction while iterating (i.e., call next() and * then call previous(), or call previous() and then call next()), you'll get * back the same element twice.

                              + * + * @return the next collation element */ public int next() { @@ -272,6 +274,8 @@ public final class CollationElementIterator * updates the pointer. This means that when you change direction while * iterating (i.e., call next() and then call previous(), or call previous() * and then call next()), you'll get back the same element twice.

                              + * + * @return the previous collation element * @since 1.2 */ public int previous() diff --git a/jdk/src/share/classes/java/text/CollationKey.java b/jdk/src/share/classes/java/text/CollationKey.java index 9c71e2f44ec..d4c7751a913 100644 --- a/jdk/src/share/classes/java/text/CollationKey.java +++ b/jdk/src/share/classes/java/text/CollationKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,28 +68,28 @@ package java.text; * The following example shows how CollationKeys might be used * to sort a list of Strings. *
                              - *
                              + * 
                              {@code
                                * // Create an array of CollationKeys for the Strings to be sorted.
                                * Collator myCollator = Collator.getInstance();
                                * CollationKey[] keys = new CollationKey[3];
                                * keys[0] = myCollator.getCollationKey("Tom");
                                * keys[1] = myCollator.getCollationKey("Dick");
                                * keys[2] = myCollator.getCollationKey("Harry");
                              - * sort( keys );
                              - * 
                              + * sort(keys); + * * //... - *
                              + * * // Inside body of sort routine, compare keys this way - * if( keys[i].compareTo( keys[j] ) > 0 ) + * if (keys[i].compareTo(keys[j]) > 0) * // swap keys[i] and keys[j] - *
                              + * * //... - *
                              + * * // Finally, when we've returned from sort. - * System.out.println( keys[0].getSourceString() ); - * System.out.println( keys[1].getSourceString() ); - * System.out.println( keys[2].getSourceString() ); - *
                              + * System.out.println(keys[0].getSourceString()); + * System.out.println(keys[1].getSourceString()); + * System.out.println(keys[2].getSourceString()); + * }
                              *
                              * * @see Collator @@ -112,6 +112,8 @@ public abstract class CollationKey implements Comparable { /** * Returns the String that this CollationKey represents. + * + * @return the source string of this CollationKey */ public String getSourceString() { return source; @@ -123,6 +125,8 @@ public abstract class CollationKey implements Comparable { * could be legitimately compared, then one could compare the byte arrays * for each of those keys to obtain the same result. Byte arrays are * organized most significant byte first. + * + * @return a byte array representation of the CollationKey */ abstract public byte[] toByteArray(); @@ -130,8 +134,8 @@ public abstract class CollationKey implements Comparable { /** * CollationKey constructor. * - * @param source - the source string. - * @exception NullPointerException if source is null. + * @param source the source string + * @exception NullPointerException if {@code source} is null * @since 1.6 */ protected CollationKey(String source) { diff --git a/jdk/src/share/classes/java/text/DateFormat.java b/jdk/src/share/classes/java/text/DateFormat.java index fcb21e6928c..5e70d674db9 100644 --- a/jdk/src/share/classes/java/text/DateFormat.java +++ b/jdk/src/share/classes/java/text/DateFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * {@code DateFormat} is an abstract class for date/time formatting subclasses which * formats and parses dates or time in a language-independent manner. * The date/time formatting subclass, such as {@link SimpleDateFormat}, allows for - * formatting (i.e., date -> text), parsing (text -> date), and + * formatting (i.e., date → text), parsing (text → date), and * normalization. The date is represented as a Date object or * as the milliseconds since January 1, 1970, 00:00:00 GMT. * @@ -73,28 +73,36 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * *

                              To format a date for the current Locale, use one of the * static factory methods: - *

                              - *  myString = DateFormat.getDateInstance().format(myDate);
                              - * 
                              + *
                              + *
                              {@code
                              + * myString = DateFormat.getDateInstance().format(myDate);
                              + * }
                              + *
                              *

                              If you are formatting multiple dates, it is * more efficient to get the format and use it multiple times so that * the system doesn't have to fetch the information about the local * language and country conventions multiple times. - *

                              - *  DateFormat df = DateFormat.getDateInstance();
                              - *  for (int i = 0; i < myDate.length; ++i) {
                              - *    output.println(df.format(myDate[i]) + "; ");
                              - *  }
                              - * 
                              + *
                              + *
                              {@code
                              + * DateFormat df = DateFormat.getDateInstance();
                              + * for (int i = 0; i < myDate.length; ++i) {
                              + *     output.println(df.format(myDate[i]) + "; ");
                              + * }
                              + * }
                              + *
                              *

                              To format a date for a different Locale, specify it in the * call to {@link #getDateInstance(int, Locale) getDateInstance()}. - *

                              - *  DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
                              - * 
                              + *
                              + *
                              {@code
                              + * DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
                              + * }
                              + *
                              *

                              You can use a DateFormat to parse also. - *

                              - *  myDate = df.parse(myString);
                              - * 
                              + *
                              + *
                              {@code
                              + * myDate = df.parse(myString);
                              + * }
                              + *
                              *

                              Use {@code getDateInstance} to get the normal date format for that country. * There are other static factory methods available. * Use {@code getTimeInstance} to get the time format for that country. @@ -125,7 +133,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * on the screen. * * - *

                              Synchronization

                              + *

                              Synchronization

                              * *

                              * Date formats are not synchronized. @@ -581,6 +589,8 @@ public abstract class DateFormat extends Format { /** * Get a default date/time formatter that uses the SHORT style for both the * date and the time. + * + * @return a date/time formatter */ public final static DateFormat getInstance() { return getDateTimeInstance(SHORT, SHORT); @@ -653,9 +663,9 @@ public abstract class DateFormat extends Format { /** * Sets the time zone for the calendar of this {@code DateFormat} object. * This method is equivalent to the following call. - *

                              -     *  getCalendar().setTimeZone(zone)
                              -     * 
                              + *
                              {@code
                              +     * getCalendar().setTimeZone(zone)
                              +     * }
                              * *

                              The {@code TimeZone} set by this method is overwritten by a * {@link #setCalendar(java.util.Calendar) setCalendar} call. @@ -673,9 +683,9 @@ public abstract class DateFormat extends Format { /** * Gets the time zone. * This method is equivalent to the following call. - *

                              -     *  getCalendar().getTimeZone()
                              -     * 
                              + *
                              {@code
                              +     * getCalendar().getTimeZone()
                              +     * }
                              * * @return the time zone associated with the calendar of DateFormat. */ @@ -691,9 +701,9 @@ public abstract class DateFormat extends Format { * inputs must match this object's format. * *

                              This method is equivalent to the following call. - *

                              -     *  getCalendar().setLenient(lenient)
                              -     * 
                              + *
                              {@code
                              +     * getCalendar().setLenient(lenient)
                              +     * }
                              * *

                              This leniency value is overwritten by a call to {@link * #setCalendar(java.util.Calendar) setCalendar()}. @@ -709,9 +719,9 @@ public abstract class DateFormat extends Format { /** * Tell whether date/time parsing is to be lenient. * This method is equivalent to the following call. - *

                              -     *  getCalendar().isLenient()
                              -     * 
                              + *
                              {@code
                              +     * getCalendar().isLenient()
                              +     * }
                              * * @return {@code true} if the {@link #calendar} is lenient; * {@code false} otherwise. diff --git a/jdk/src/share/classes/java/text/DateFormatSymbols.java b/jdk/src/share/classes/java/text/DateFormatSymbols.java index 3357b49d774..c1f951d5bf8 100644 --- a/jdk/src/share/classes/java/text/DateFormatSymbols.java +++ b/jdk/src/share/classes/java/text/DateFormatSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -135,6 +135,7 @@ public class DateFormatSymbols implements Serializable, Cloneable { * implementations. For full locale coverage, use the * {@link #getInstance(Locale) getInstance} method. * + * @param locale the desired locale * @see #getInstance(Locale) * @exception java.util.MissingResourceException * if the resources for the specified locale cannot be diff --git a/jdk/src/share/classes/java/text/DecimalFormat.java b/jdk/src/share/classes/java/text/DecimalFormat.java index bd37b2ed471..c22e47212bb 100644 --- a/jdk/src/share/classes/java/text/DecimalFormat.java +++ b/jdk/src/share/classes/java/text/DecimalFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * the NumberFormat factory methods, the pattern and symbols are * read from localized ResourceBundles. * - *

                              Patterns

                              + *

                              Patterns

                              * * DecimalFormat patterns have the following syntax: *
                              @@ -174,7 +174,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
                                * 
                              * - * + * * + * * + * * + * * + * * + * * * @@ -811,6 +811,8 @@ public class MessageFormat extends Format { * @param result where text is appended. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. + * @return the string buffer passed in as {@code result}, with formatted + * text appended * @exception IllegalArgumentException if an argument in the * arguments array is not of the type * expected by the format element(s) that use it. @@ -828,6 +830,9 @@ public class MessageFormat extends Format { * (new {@link #MessageFormat(String) MessageFormat}(pattern)).{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}(arguments, new StringBuffer(), null).toString() * * + * @param pattern the pattern string + * @param arguments object(s) to format + * @return the formatted string * @exception IllegalArgumentException if the pattern is invalid, * or if an argument in the arguments array * is not of the type expected by the format element(s) @@ -940,6 +945,10 @@ public class MessageFormat extends Format { * is comparing against the pattern "AAD {0} BBB", the error index is * 0. When an error occurs, the call to this method will return null. * If the source is null, return an empty array. + * + * @param source the string to parse + * @param pos the parse position + * @return an array of parsed objects */ public Object[] parse(String source, ParsePosition pos) { if (source == null) { diff --git a/jdk/src/share/classes/java/text/Normalizer.java b/jdk/src/share/classes/java/text/Normalizer.java index 01e923c1a85..88fdf2b29da 100644 --- a/jdk/src/share/classes/java/text/Normalizer.java +++ b/jdk/src/share/classes/java/text/Normalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,14 +55,12 @@ import sun.text.normalizer.NormalizerImpl; * *

                                *      U+00C1    LATIN CAPITAL LETTER A WITH ACUTE
                              - *

                              * * or as two separate characters (the "decomposed" form): * *

                                *      U+0041    LATIN CAPITAL LETTER A
                                *      U+0301    COMBINING ACUTE ACCENT
                              - *

                              * * To a user of your program, however, both of these sequences should be * treated as the same "user-level" character "A with acute accent". When you @@ -78,13 +76,11 @@ import sun.text.normalizer.NormalizerImpl; * U+0066 LATIN SMALL LETTER F * U+0066 LATIN SMALL LETTER F * U+0069 LATIN SMALL LETTER I - *

                              * * or as the single character * *

                                *      U+FB03    LATIN SMALL LIGATURE FFI
                              - *

                              * * The ffi ligature is not a distinct semantic character, and strictly speaking * it shouldn't be in Unicode at all, but it was included for compatibility diff --git a/jdk/src/share/classes/java/text/NumberFormat.java b/jdk/src/share/classes/java/text/NumberFormat.java index c1b8310096b..2fdcad62166 100644 --- a/jdk/src/share/classes/java/text/NumberFormat.java +++ b/jdk/src/share/classes/java/text/NumberFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,34 +73,34 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * To format a number for the current Locale, use one of the factory * class methods: *
                              - *
                              - *  myString = NumberFormat.getInstance().format(myNumber);
                              - * 
                              + *
                              {@code
                              + * myString = NumberFormat.getInstance().format(myNumber);
                              + * }
                              *
                              * If you are formatting multiple numbers, it is * more efficient to get the format and use it multiple times so that * the system doesn't have to fetch the information about the local * language and country conventions multiple times. *
                              - *
                              + * 
                              {@code
                                * NumberFormat nf = NumberFormat.getInstance();
                                * for (int i = 0; i < myNumber.length; ++i) {
                                *     output.println(nf.format(myNumber[i]) + "; ");
                                * }
                              - * 
                              + * }
                              *
                              * To format a number for a different Locale, specify it in the * call to getInstance. *
                              - *
                              + * 
                              {@code
                                * NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
                              - * 
                              + * }
                              *
                              * You can also use a NumberFormat to parse numbers: *
                              - *
                              + * 
                              {@code
                                * myNumber = nf.parse(myString);
                              - * 
                              + * }
                              *
                              * Use getInstance or getNumberInstance to get the * normal number format. Use getIntegerInstance to get an @@ -125,8 +125,8 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * the detailed description for each these control methods, *

                              * setParseIntegerOnly : only affects parsing, e.g. - * if true, "3456.78" -> 3456 (and leaves the parse position just after index 6) - * if false, "3456.78" -> 3456.78 (and leaves the parse position just after index 8) + * if true, "3456.78" → 3456 (and leaves the parse position just after index 6) + * if false, "3456.78" → 3456.78 (and leaves the parse position just after index 8) * This is independent of formatting. If you want to not show a decimal point * where there might be no digits after the decimal point, use * setDecimalSeparatorAlwaysShown. @@ -134,8 +134,8 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * setDecimalSeparatorAlwaysShown : only affects formatting, and only where * there might be no digits after the decimal point, such as with a pattern * like "#,##0.##", e.g., - * if true, 3456.00 -> "3,456." - * if false, 3456.00 -> "3456" + * if true, 3456.00 → "3,456." + * if false, 3456.00 → "3456" * This is independent of parsing. If you want parsing to stop at the decimal * point, use setParseIntegerOnly. * @@ -166,7 +166,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * numbers: "(12)" for -12. * * - *

                              Synchronization

                              + *

                              Synchronization

                              * *

                              * Number formats are generally not synchronized. @@ -280,6 +280,9 @@ public abstract class NumberFormat extends Format { /** * Specialization of format. + * + * @param number the double number to format + * @return the formatted String * @exception ArithmeticException if rounding is needed with rounding * mode being set to RoundingMode.UNNECESSARY * @see java.text.Format#format @@ -302,6 +305,9 @@ public abstract class NumberFormat extends Format { /** * Specialization of format. + * + * @param number the long number to format + * @return the formatted String * @exception ArithmeticException if rounding is needed with rounding * mode being set to RoundingMode.UNNECESSARY * @see java.text.Format#format @@ -313,6 +319,12 @@ public abstract class NumberFormat extends Format { /** * Specialization of format. + * + * @param number the double number to format + * @param toAppendTo the StringBuffer to which the formatted text is to be + * appended + * @param pos the field position + * @return the formatted StringBuffer * @exception ArithmeticException if rounding is needed with rounding * mode being set to RoundingMode.UNNECESSARY * @see java.text.Format#format @@ -323,6 +335,12 @@ public abstract class NumberFormat extends Format { /** * Specialization of format. + * + * @param number the long number to format + * @param toAppendTo the StringBuffer to which the formatted text is to be + * appended + * @param pos the field position + * @return the formatted StringBuffer * @exception ArithmeticException if rounding is needed with rounding * mode being set to RoundingMode.UNNECESSARY * @see java.text.Format#format @@ -339,6 +357,10 @@ public abstract class NumberFormat extends Format { * after the 1). * Does not throw an exception; if no object can be parsed, index is * unchanged! + * + * @param source the String to parse + * @param parsePosition the parse position + * @return the parsed value * @see java.text.NumberFormat#isParseIntegerOnly * @see java.text.Format#parseObject */ @@ -373,6 +395,9 @@ public abstract class NumberFormat extends Format { * would stop at the "." character. Of course, the exact format accepted * by the parse operation is locale dependant and determined by sub-classes * of NumberFormat. + * + * @return {@code true} if numbers should be parsed as integers only; + * {@code false} otherwise */ public boolean isParseIntegerOnly() { return parseIntegerOnly; @@ -380,6 +405,9 @@ public abstract class NumberFormat extends Format { /** * Sets whether or not numbers should be parsed as integers only. + * + * @param value {@code true} if numbers should be parsed as integers only; + * {@code false} otherwise * @see #isParseIntegerOnly */ public void setParseIntegerOnly(boolean value) { @@ -393,6 +421,9 @@ public abstract class NumberFormat extends Format { * {@link java.util.Locale.Category#FORMAT FORMAT} locale. * This is the same as calling * {@link #getNumberInstance() getNumberInstance()}. + * + * @return the {@code NumberFormat} instance for general-purpose number + * formatting */ public final static NumberFormat getInstance() { return getInstance(Locale.getDefault(Locale.Category.FORMAT), NUMBERSTYLE); @@ -402,6 +433,10 @@ public abstract class NumberFormat extends Format { * Returns a general-purpose number format for the specified locale. * This is the same as calling * {@link #getNumberInstance(java.util.Locale) getNumberInstance(inLocale)}. + * + * @param inLocale the desired locale + * @return the {@code NumberFormat} instance for general-purpose number + * formatting */ public static NumberFormat getInstance(Locale inLocale) { return getInstance(inLocale, NUMBERSTYLE); @@ -413,6 +448,9 @@ public abstract class NumberFormat extends Format { *

                              This is equivalent to calling * {@link #getNumberInstance(Locale) * getNumberInstance(Locale.getDefault(Locale.Category.FORMAT))}. + * + * @return the {@code NumberFormat} instance for general-purpose number + * formatting * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT */ @@ -422,6 +460,10 @@ public abstract class NumberFormat extends Format { /** * Returns a general-purpose number format for the specified locale. + * + * @param inLocale the desired locale + * @return the {@code NumberFormat} instance for general-purpose number + * formatting */ public static NumberFormat getNumberInstance(Locale inLocale) { return getInstance(inLocale, NUMBERSTYLE); @@ -457,6 +499,7 @@ public abstract class NumberFormat extends Format { * and to parse only the integer part of an input string (see {@link * #isParseIntegerOnly isParseIntegerOnly}). * + * @param inLocale the desired locale * @see #getRoundingMode() * @return a number format for integer values * @since 1.4 @@ -472,6 +515,7 @@ public abstract class NumberFormat extends Format { * {@link #getCurrencyInstance(Locale) * getCurrencyInstance(Locale.getDefault(Locale.Category.FORMAT))}. * + * @return the {@code NumberFormat} instance for currency formatting * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT */ @@ -481,6 +525,9 @@ public abstract class NumberFormat extends Format { /** * Returns a currency format for the specified locale. + * + * @param inLocale the desired locale + * @return the {@code NumberFormat} instance for currency formatting */ public static NumberFormat getCurrencyInstance(Locale inLocale) { return getInstance(inLocale, CURRENCYSTYLE); @@ -493,6 +540,7 @@ public abstract class NumberFormat extends Format { * {@link #getPercentInstance(Locale) * getPercentInstance(Locale.getDefault(Locale.Category.FORMAT))}. * + * @return the {@code NumberFormat} instance for percentage formatting * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT */ @@ -502,6 +550,9 @@ public abstract class NumberFormat extends Format { /** * Returns a percentage format for the specified locale. + * + * @param inLocale the desired locale + * @return the {@code NumberFormat} instance for percentage formatting */ public static NumberFormat getPercentInstance(Locale inLocale) { return getInstance(inLocale, PERCENTSTYLE); @@ -516,6 +567,8 @@ public abstract class NumberFormat extends Format { /** * Returns a scientific format for the specified locale. + * + * @param inLocale the desired locale */ /*public*/ static NumberFormat getScientificInstance(Locale inLocale) { return getInstance(inLocale, SCIENTIFICSTYLE); @@ -586,6 +639,9 @@ public abstract class NumberFormat extends Format { * English locale, with grouping on, the number 1234567 might be formatted * as "1,234,567". The grouping separator as well as the size of each group * is locale dependant and is determined by sub-classes of NumberFormat. + * + * @return {@code true} if grouping is used; + * {@code false} otherwise * @see #setGroupingUsed */ public boolean isGroupingUsed() { @@ -594,6 +650,9 @@ public abstract class NumberFormat extends Format { /** * Set whether or not grouping will be used in this format. + * + * @param newValue {@code true} if grouping is used; + * {@code false} otherwise * @see #isGroupingUsed */ public void setGroupingUsed(boolean newValue) { @@ -603,6 +662,8 @@ public abstract class NumberFormat extends Format { /** * Returns the maximum number of digits allowed in the integer portion of a * number. + * + * @return the maximum number of digits * @see #setMaximumIntegerDigits */ public int getMaximumIntegerDigits() { @@ -611,10 +672,11 @@ public abstract class NumberFormat extends Format { /** * Sets the maximum number of digits allowed in the integer portion of a - * number. maximumIntegerDigits must be >= minimumIntegerDigits. If the + * number. maximumIntegerDigits must be ≥ minimumIntegerDigits. If the * new value for maximumIntegerDigits is less than the current value * of minimumIntegerDigits, then minimumIntegerDigits will also be set to * the new value. + * * @param newValue the maximum number of integer digits to be shown; if * less than zero, then zero is used. The concrete subclass may enforce an * upper limit to this value appropriate to the numeric type being formatted. @@ -630,6 +692,8 @@ public abstract class NumberFormat extends Format { /** * Returns the minimum number of digits allowed in the integer portion of a * number. + * + * @return the minimum number of digits * @see #setMinimumIntegerDigits */ public int getMinimumIntegerDigits() { @@ -638,10 +702,11 @@ public abstract class NumberFormat extends Format { /** * Sets the minimum number of digits allowed in the integer portion of a - * number. minimumIntegerDigits must be <= maximumIntegerDigits. If the + * number. minimumIntegerDigits must be ≤ maximumIntegerDigits. If the * new value for minimumIntegerDigits exceeds the current value * of maximumIntegerDigits, then maximumIntegerDigits will also be set to * the new value + * * @param newValue the minimum number of integer digits to be shown; if * less than zero, then zero is used. The concrete subclass may enforce an * upper limit to this value appropriate to the numeric type being formatted. @@ -657,6 +722,8 @@ public abstract class NumberFormat extends Format { /** * Returns the maximum number of digits allowed in the fraction portion of a * number. + * + * @return the maximum number of digits. * @see #setMaximumFractionDigits */ public int getMaximumFractionDigits() { @@ -665,10 +732,11 @@ public abstract class NumberFormat extends Format { /** * Sets the maximum number of digits allowed in the fraction portion of a - * number. maximumFractionDigits must be >= minimumFractionDigits. If the + * number. maximumFractionDigits must be ≥ minimumFractionDigits. If the * new value for maximumFractionDigits is less than the current value * of minimumFractionDigits, then minimumFractionDigits will also be set to * the new value. + * * @param newValue the maximum number of fraction digits to be shown; if * less than zero, then zero is used. The concrete subclass may enforce an * upper limit to this value appropriate to the numeric type being formatted. @@ -684,6 +752,8 @@ public abstract class NumberFormat extends Format { /** * Returns the minimum number of digits allowed in the fraction portion of a * number. + * + * @return the minimum number of digits * @see #setMinimumFractionDigits */ public int getMinimumFractionDigits() { @@ -692,10 +762,11 @@ public abstract class NumberFormat extends Format { /** * Sets the minimum number of digits allowed in the fraction portion of a - * number. minimumFractionDigits must be <= maximumFractionDigits. If the + * number. minimumFractionDigits must be ≤ maximumFractionDigits. If the * new value for minimumFractionDigits exceeds the current value * of maximumFractionDigits, then maximumIntegerDigits will also be set to * the new value + * * @param newValue the minimum number of fraction digits to be shown; if * less than zero, then zero is used. The concrete subclass may enforce an * upper limit to this value appropriate to the numeric type being formatted. diff --git a/jdk/src/share/classes/java/text/ParseException.java b/jdk/src/share/classes/java/text/ParseException.java index a274e7e69fd..f9ad001fa52 100644 --- a/jdk/src/share/classes/java/text/ParseException.java +++ b/jdk/src/share/classes/java/text/ParseException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,6 +55,7 @@ class ParseException extends Exception { * Constructs a ParseException with the specified detail message and * offset. * A detail message is a String that describes this particular exception. + * * @param s the detail message * @param errorOffset the position where the error is found while parsing. */ @@ -65,6 +66,8 @@ class ParseException extends Exception { /** * Returns the position where the error was found. + * + * @return the position where the error was found */ public int getErrorOffset () { return errorOffset; diff --git a/jdk/src/share/classes/java/text/ParsePosition.java b/jdk/src/share/classes/java/text/ParsePosition.java index a187bb8a73a..be3ffce61eb 100644 --- a/jdk/src/share/classes/java/text/ParsePosition.java +++ b/jdk/src/share/classes/java/text/ParsePosition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,6 +69,8 @@ public class ParsePosition { * Retrieve the current parse position. On input to a parse method, this * is the index of the character at which parsing will begin; on output, it * is the index of the character following the last character parsed. + * + * @return the current parse position */ public int getIndex() { return index; @@ -76,6 +78,8 @@ public class ParsePosition { /** * Set the current parse position. + * + * @param index the current parse position */ public void setIndex(int index) { this.index = index; @@ -83,6 +87,8 @@ public class ParsePosition { /** * Create a new ParsePosition with the given initial index. + * + * @param index initial index */ public ParsePosition(int index) { this.index = index; @@ -91,6 +97,8 @@ public class ParsePosition { * Set the index at which a parse error occurred. Formatters * should set this before returning an error code from their * parseObject method. The default value is -1 if this is not set. + * + * @param ei the index at which an error occurred * @since 1.2 */ public void setErrorIndex(int ei) @@ -101,12 +109,15 @@ public class ParsePosition { /** * Retrieve the index at which an error occurred, or -1 if the * error index has not been set. + * + * @return the index at which an error occurred * @since 1.2 */ public int getErrorIndex() { return errorIndex; } + /** * Overrides equals */ diff --git a/jdk/src/share/classes/java/text/RuleBasedCollator.java b/jdk/src/share/classes/java/text/RuleBasedCollator.java index ef32cc64ef2..a99c0f757eb 100644 --- a/jdk/src/share/classes/java/text/RuleBasedCollator.java +++ b/jdk/src/share/classes/java/text/RuleBasedCollator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,17 +68,17 @@ import java.util.Locale; * <reset> <text-argument> * * The definitions of the rule elements is as follows: - *

                                + *
                                  *
                                • Text-Argument: A text-argument is any sequence of * characters, excluding special characters (that is, common * whitespace characters [0009-000D, 0020] and rule syntax characters * [0021-002F, 003A-0040, 005B-0060, 007B-007E]). If those * characters are desired, you can put them in single quotes - * (e.g. ampersand => '&'). Note that unquoted white space characters + * (e.g. ampersand => '&'). Note that unquoted white space characters * are ignored; e.g. b c is treated as bc. *
                                • Modifier: There are currently two modifiers that * turn on special collation rules. - *
                                    + *
                                      *
                                    • '@' : Turns on backwards sorting of accents (secondary * differences), as in French. *
                                    • '!' : Turns on Thai/Lao vowel-consonant swapping. If this @@ -91,7 +91,7 @@ import java.util.Locale; *
                                    *

                                    '@' : Indicates that accents are sorted backwards, as in French. *

                                  • Relation: The relations are the following: - *
                                      + *
                                        *
                                      • '<' : Greater, as a letter difference (primary) *
                                      • ';' : Greater, as an accent difference (secondary) *
                                      • ',' : Greater, as a case difference (tertiary) @@ -100,7 +100,7 @@ import java.util.Locale; *
                                      • Reset: There is a single reset * which is used primarily for contractions and expansions, but which * can also be used to add a modification at the end of a set of rules. - *

                                        '&' : Indicates that the next rule follows the position to where + *

                                        '&' : Indicates that the next rule follows the position to where * the reset text-argument would be sorted. *

                                      * @@ -166,7 +166,7 @@ import java.util.Locale; *

                                      Errors *

                                      * The following are errors: - *

                                        + *
                                          *
                                        • A text-argument contains unquoted punctuation symbols * (e.g. "a < b-c < d"). *
                                        • A relation or reset character not followed by a text-argument @@ -206,8 +206,8 @@ import java.util.Locale; * String Norwegian = "< a, A < b, B < c, C < d, D < e, E < f, F < g, G < h, H < i, I" + * "< j, J < k, K < l, L < m, M < n, N < o, O < p, P < q, Q < r, R" + * "< s, S < t, T < u, U < v, V < w, W < x, X < y, Y < z, Z" + - * "< \u00E6, \u00C6" + // Latin letter ae & AE - * "< \u00F8, \u00D8" + // Latin letter o & O with stroke + * "< \u00E6, \u00C6" + // Latin letter ae & AE + * "< \u00F8, \u00D8" + // Latin letter o & O with stroke * "< \u00E5 = a\u030A," + // Latin letter a with ring above * " \u00C5 = A\u030A;" + // Latin letter A with ring above * " aa, AA"; @@ -232,9 +232,9 @@ import java.util.Locale; * + ";\u030B;\u030C;\u030D;\u030E" // main accents * + ";\u030F;\u0310;\u0311;\u0312" // main accents * + "< a , A ; ae, AE ; \u00e6 , \u00c6" - * + "< b , B < c, C < e, E & C < d, D"; + * + "< b , B < c, C < e, E & C < d, D"; * // change the order of accent characters - * String addOn = "& \u0300 ; \u0308 ; \u0302"; + * String addOn = "& \u0300 ; \u0308 ; \u0302"; * RuleBasedCollator myCollator = new RuleBasedCollator(oldRules + addOn); * * @@ -274,7 +274,7 @@ public class RuleBasedCollator extends Collator{ * @param rules the collation rules to build the collation table from. * @exception ParseException A format exception * will be thrown if the build process of the rules fails. For - * example, build rule "a < ? < d" will cause the constructor to + * example, build rule "a < ? < d" will cause the constructor to * throw the ParseException because the '?' is not quoted. */ public RuleBasedCollator(String rules) throws ParseException { @@ -320,7 +320,10 @@ public class RuleBasedCollator extends Collator{ } /** - * Return a CollationElementIterator for the given String. + * Returns a CollationElementIterator for the given String. + * + * @param source the string to be collated + * @return a {@code CollationElementIterator} object * @see java.text.CollationElementIterator */ public CollationElementIterator getCollationElementIterator(String source) { @@ -328,7 +331,10 @@ public class RuleBasedCollator extends Collator{ } /** - * Return a CollationElementIterator for the given String. + * Returns a CollationElementIterator for the given CharacterIterator. + * + * @param source the character iterator to be collated + * @return a {@code CollationElementIterator} object * @see java.text.CollationElementIterator * @since 1.2 */ diff --git a/jdk/src/share/classes/java/text/SimpleDateFormat.java b/jdk/src/share/classes/java/text/SimpleDateFormat.java index 9c5aaa35561..5472b0a70d3 100644 --- a/jdk/src/share/classes/java/text/SimpleDateFormat.java +++ b/jdk/src/share/classes/java/text/SimpleDateFormat.java @@ -59,7 +59,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; /** * SimpleDateFormat is a concrete class for formatting and * parsing dates in a locale-sensitive manner. It allows for formatting - * (date -> text), parsing (text -> date), and normalization. + * (date → text), parsing (text → date), and normalization. * *

                                          * SimpleDateFormat allows you to start by choosing @@ -73,7 +73,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * For more information on using these methods, see * {@link DateFormat}. * - *

                                          Date and Time Patterns

                                          + *

                                          Date and Time Patterns

                                          *

                                          * Date and time formats are specified by date and time pattern * strings. @@ -93,7 +93,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * 'z' are reserved): *

                                          *
                              Symbol * Location * Localized? @@ -184,7 +184,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Number * Yes * Digit - *
                              # * Number * Yes @@ -194,7 +194,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Number * Yes * Decimal separator or monetary decimal separator - *
                              - * Number * Yes @@ -204,7 +204,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Number * Yes * Grouping separator - *
                              E * Number * Yes @@ -215,7 +215,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Subpattern boundary * Yes * Separates positive and negative subpatterns - *
                              % * Prefix or suffix * Yes @@ -225,7 +225,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Prefix or suffix * Yes * Multiply by 1000 and show as per mille value - *
                              ¤ (\u00A4) * Prefix or suffix * No @@ -248,7 +248,8 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * *

                              Numbers in scientific notation are expressed as the product of a mantissa * and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3. The - * mantissa is often in the range 1.0 <= x < 10.0, but it need not be. + * mantissa is often in the range 1.0 ≤ x {@literal <} 10.0, but it need not + * be. * DecimalFormat can be instructed to format and parse scientific * notation only via a pattern; there is currently no factory method * that creates a scientific notation format. In a pattern, the exponent @@ -336,13 +337,13 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * *

                              Example

                              * - *
                              + * 
                              {@code
                                * // Print out a number using the localized number, integer, currency,
                                * // and percent format for each locale
                                * Locale[] locales = NumberFormat.getAvailableLocales();
                                * double myNumber = -1234.56;
                                * NumberFormat form;
                              - * for (int j=0; j<4; ++j) {
                              + * for (int j = 0; j < 4; ++j) {
                                *     System.out.println("FORMAT");
                                *     for (int i = 0; i < locales.length; ++i) {
                                *         if (locales[i].getCountry().length() == 0) {
                              @@ -368,7 +369,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
                                *         } catch (ParseException e) {}
                                *     }
                                * }
                              - * 
                              + * }
                              * * @see Java Tutorial * @see NumberFormat @@ -421,7 +422,7 @@ public class DecimalFormat extends NumberFormat { * return the most appropriate sub-class of NumberFormat for a given * locale. * - * @param pattern A non-localized pattern string. + * @param pattern a non-localized pattern string. * @exception NullPointerException if pattern is null * @exception IllegalArgumentException if the given pattern is invalid. * @see java.text.NumberFormat#getInstance @@ -2382,6 +2383,8 @@ public class DecimalFormat extends NumberFormat { /** * Get the positive prefix. *

                              Examples: +123, $123, sFr123 + * + * @return the positive prefix */ public String getPositivePrefix () { return positivePrefix; @@ -2390,6 +2393,8 @@ public class DecimalFormat extends NumberFormat { /** * Set the positive prefix. *

                              Examples: +123, $123, sFr123 + * + * @param newValue the new positive prefix */ public void setPositivePrefix (String newValue) { positivePrefix = newValue; @@ -2420,6 +2425,8 @@ public class DecimalFormat extends NumberFormat { /** * Get the negative prefix. *

                              Examples: -123, ($123) (with negative suffix), sFr-123 + * + * @return the negative prefix */ public String getNegativePrefix () { return negativePrefix; @@ -2428,6 +2435,8 @@ public class DecimalFormat extends NumberFormat { /** * Set the negative prefix. *

                              Examples: -123, ($123) (with negative suffix), sFr-123 + * + * @param newValue the new negative prefix */ public void setNegativePrefix (String newValue) { negativePrefix = newValue; @@ -2457,6 +2466,8 @@ public class DecimalFormat extends NumberFormat { /** * Get the positive suffix. *

                              Example: 123% + * + * @return the positive suffix */ public String getPositiveSuffix () { return positiveSuffix; @@ -2465,6 +2476,8 @@ public class DecimalFormat extends NumberFormat { /** * Set the positive suffix. *

                              Example: 123% + * + * @param newValue the new positive suffix */ public void setPositiveSuffix (String newValue) { positiveSuffix = newValue; @@ -2494,6 +2507,8 @@ public class DecimalFormat extends NumberFormat { /** * Get the negative suffix. *

                              Examples: -123%, ($123) (with positive suffixes) + * + * @return the negative suffix */ public String getNegativeSuffix () { return negativeSuffix; @@ -2502,6 +2517,8 @@ public class DecimalFormat extends NumberFormat { /** * Set the negative suffix. *

                              Examples: 123% + * + * @param newValue the new negative suffix */ public void setNegativeSuffix (String newValue) { negativeSuffix = newValue; @@ -2532,6 +2549,7 @@ public class DecimalFormat extends NumberFormat { * Gets the multiplier for use in percent, per mille, and similar * formats. * + * @return the multiplier * @see #setMultiplier(int) */ public int getMultiplier () { @@ -2549,6 +2567,7 @@ public class DecimalFormat extends NumberFormat { *

                              Example: with multiplier 100, 1.23 is formatted as "123", and * "123" is parsed into 1.23. * + * @param newValue the new multiplier * @see #getMultiplier */ public void setMultiplier (int newValue) { @@ -2571,6 +2590,8 @@ public class DecimalFormat extends NumberFormat { * Return the grouping size. Grouping size is the number of digits between * grouping separators in the integer portion of a number. For example, * in the number "123,456.78", the grouping size is 3. + * + * @return the grouping size * @see #setGroupingSize * @see java.text.NumberFormat#isGroupingUsed * @see java.text.DecimalFormatSymbols#getGroupingSeparator @@ -2585,6 +2606,8 @@ public class DecimalFormat extends NumberFormat { * in the number "123,456.78", the grouping size is 3. *
                              * The value passed in is converted to a byte, which may lose information. + * + * @param newValue the new grouping size * @see #getGroupingSize * @see java.text.NumberFormat#setGroupingUsed * @see java.text.DecimalFormatSymbols#setGroupingSeparator @@ -2597,7 +2620,10 @@ public class DecimalFormat extends NumberFormat { /** * Allows you to get the behavior of the decimal separator with integers. * (The decimal separator will always appear with decimals.) - *

                              Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 + *

                              Example: Decimal ON: 12345 → 12345.; OFF: 12345 → 12345 + * + * @return {@code true} if the decimal separator is always shown; + * {@code false} otherwise */ public boolean isDecimalSeparatorAlwaysShown() { return decimalSeparatorAlwaysShown; @@ -2606,7 +2632,10 @@ public class DecimalFormat extends NumberFormat { /** * Allows you to set the behavior of the decimal separator with integers. * (The decimal separator will always appear with decimals.) - *

                              Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 + *

                              Example: Decimal ON: 12345 → 12345.; OFF: 12345 → 12345 + * + * @param newValue {@code true} if the decimal separator is always shown; + * {@code false} otherwise */ public void setDecimalSeparatorAlwaysShown(boolean newValue) { decimalSeparatorAlwaysShown = newValue; @@ -2616,6 +2645,9 @@ public class DecimalFormat extends NumberFormat { /** * Returns whether the {@link #parse(java.lang.String, java.text.ParsePosition)} * method returns BigDecimal. The default value is false. + * + * @return {@code true} if the parse method returns BigDecimal; + * {@code false} otherwise * @see #setParseBigDecimal * @since 1.5 */ @@ -2626,6 +2658,9 @@ public class DecimalFormat extends NumberFormat { /** * Sets whether the {@link #parse(java.lang.String, java.text.ParsePosition)} * method returns BigDecimal. + * + * @param newValue {@code true} if the parse method returns BigDecimal; + * {@code false} otherwise * @see #isParseBigDecimal * @since 1.5 */ @@ -2712,6 +2747,8 @@ public class DecimalFormat extends NumberFormat { /** * Synthesizes a pattern string that represents the current state * of this Format object. + * + * @return a pattern string * @see #applyPattern */ public String toPattern() { @@ -2721,6 +2758,8 @@ public class DecimalFormat extends NumberFormat { /** * Synthesizes a localized pattern string that represents the current * state of this Format object. + * + * @return a localized pattern string * @see #applyPattern */ public String toLocalizedPattern() { @@ -3049,7 +3088,7 @@ public class DecimalFormat extends NumberFormat { * by this routine, since that is the typical end-user desire; * use setMaximumInteger if you want to set a real value. * For negative numbers, use a second pattern, separated by a semicolon - *

                              Example "#,#00.0#" -> 1,234.56 + *

                              Example "#,#00.0#" → 1,234.56 *

                              This means a minimum of 2 integer digits, 1 fraction digit, and * a maximum of 2 fraction digits. *

                              Example: "#,#00.0#;(#,#00.0#)" for negatives in @@ -3057,6 +3096,7 @@ public class DecimalFormat extends NumberFormat { *

                              In negative patterns, the minimum and maximum counts are ignored; * these are presumed to be set in the positive pattern. * + * @param pattern a new pattern * @exception NullPointerException if pattern is null * @exception IllegalArgumentException if the given pattern is invalid. */ @@ -3075,7 +3115,7 @@ public class DecimalFormat extends NumberFormat { * by this routine, since that is the typical end-user desire; * use setMaximumInteger if you want to set a real value. * For negative numbers, use a second pattern, separated by a semicolon - *

                              Example "#,#00.0#" -> 1,234.56 + *

                              Example "#,#00.0#" → 1,234.56 *

                              This means a minimum of 2 integer digits, 1 fraction digit, and * a maximum of 2 fraction digits. *

                              Example: "#,#00.0#;(#,#00.0#)" for negatives in @@ -3083,6 +3123,7 @@ public class DecimalFormat extends NumberFormat { *

                              In negative patterns, the minimum and maximum counts are ignored; * these are presumed to be set in the positive pattern. * + * @param pattern a new pattern * @exception NullPointerException if pattern is null * @exception IllegalArgumentException if the given pattern is invalid. */ diff --git a/jdk/src/share/classes/java/text/DecimalFormatSymbols.java b/jdk/src/share/classes/java/text/DecimalFormatSymbols.java index f0b2212eaf5..55a344fb0b4 100644 --- a/jdk/src/share/classes/java/text/DecimalFormatSymbols.java +++ b/jdk/src/share/classes/java/text/DecimalFormatSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -106,6 +106,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { * This may return a {@code NumberFormat} instance with the Thai numbering system, * instead of the Latin numbering system. * + * @param locale the desired locale * @exception NullPointerException if locale is null */ public DecimalFormatSymbols( Locale locale ) { @@ -122,7 +123,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { * implementations. It must contain at least a Locale * instance equal to {@link java.util.Locale#US Locale.US}. * - * @return An array of locales for which localized + * @return an array of locales for which localized * DecimalFormatSymbols instances are available. * @since 1.6 */ @@ -166,6 +167,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { * * This may return a {@code NumberFormat} instance with the Thai numbering system, * instead of the Latin numbering system. + * * @param locale the desired locale. * @return a DecimalFormatSymbols instance. * @exception NullPointerException if locale is null @@ -185,6 +187,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the character used for zero. Different for Arabic, etc. + * + * @return the character used for zero */ public char getZeroDigit() { return zeroDigit; @@ -192,6 +196,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the character used for zero. Different for Arabic, etc. + * + * @param zeroDigit the character used for zero */ public void setZeroDigit(char zeroDigit) { this.zeroDigit = zeroDigit; @@ -199,6 +205,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the character used for thousands separator. Different for French, etc. + * + * @return the grouping separator */ public char getGroupingSeparator() { return groupingSeparator; @@ -206,6 +214,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the character used for thousands separator. Different for French, etc. + * + * @param groupingSeparator the grouping separator */ public void setGroupingSeparator(char groupingSeparator) { this.groupingSeparator = groupingSeparator; @@ -213,6 +223,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the character used for decimal sign. Different for French, etc. + * + * @return the character used for decimal sign */ public char getDecimalSeparator() { return decimalSeparator; @@ -220,6 +232,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the character used for decimal sign. Different for French, etc. + * + * @param decimalSeparator the character used for decimal sign */ public void setDecimalSeparator(char decimalSeparator) { this.decimalSeparator = decimalSeparator; @@ -227,6 +241,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the character used for per mille sign. Different for Arabic, etc. + * + * @return the character used for per mille sign */ public char getPerMill() { return perMill; @@ -234,6 +250,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the character used for per mille sign. Different for Arabic, etc. + * + * @param perMill the character used for per mille sign */ public void setPerMill(char perMill) { this.perMill = perMill; @@ -241,6 +259,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the character used for percent sign. Different for Arabic, etc. + * + * @return the character used for percent sign */ public char getPercent() { return percent; @@ -248,6 +268,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the character used for percent sign. Different for Arabic, etc. + * + * @param percent the character used for percent sign */ public void setPercent(char percent) { this.percent = percent; @@ -255,6 +277,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the character used for a digit in a pattern. + * + * @return the character used for a digit in a pattern */ public char getDigit() { return digit; @@ -262,6 +286,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the character used for a digit in a pattern. + * + * @param digit the character used for a digit in a pattern */ public void setDigit(char digit) { this.digit = digit; @@ -270,6 +296,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the character used to separate positive and negative subpatterns * in a pattern. + * + * @return the pattern separator */ public char getPatternSeparator() { return patternSeparator; @@ -278,6 +306,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the character used to separate positive and negative subpatterns * in a pattern. + * + * @param patternSeparator the pattern separator */ public void setPatternSeparator(char patternSeparator) { this.patternSeparator = patternSeparator; @@ -286,6 +316,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the string used to represent infinity. Almost always left * unchanged. + * + * @return the string representing infinity */ public String getInfinity() { return infinity; @@ -294,6 +326,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the string used to represent infinity. Almost always left * unchanged. + * + * @param infinity the string representing infinity */ public void setInfinity(String infinity) { this.infinity = infinity; @@ -302,6 +336,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Gets the string used to represent "not a number". Almost always left * unchanged. + * + * @return the string representing "not a number" */ public String getNaN() { return NaN; @@ -310,6 +346,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the string used to represent "not a number". Almost always left * unchanged. + * + * @param NaN the string representing "not a number" */ public void setNaN(String NaN) { this.NaN = NaN; @@ -319,6 +357,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { * Gets the character used to represent minus sign. If no explicit * negative format is specified, one is formed by prefixing * minusSign to the positive format. + * + * @return the character representing minus sign */ public char getMinusSign() { return minusSign; @@ -328,6 +368,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { * Sets the character used to represent minus sign. If no explicit * negative format is specified, one is formed by prefixing * minusSign to the positive format. + * + * @param minusSign the character representing minus sign */ public void setMinusSign(char minusSign) { this.minusSign = minusSign; @@ -336,6 +378,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Returns the currency symbol for the currency of these * DecimalFormatSymbols in their locale. + * + * @return the currency symbol * @since 1.2 */ public String getCurrencySymbol() @@ -346,6 +390,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the currency symbol for the currency of these * DecimalFormatSymbols in their locale. + * + * @param currency the currency symbol * @since 1.2 */ public void setCurrencySymbol(String currency) @@ -356,6 +402,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Returns the ISO 4217 currency code of the currency of these * DecimalFormatSymbols. + * + * @return the currency code * @since 1.2 */ public String getInternationalCurrencySymbol() @@ -374,6 +422,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { * then the currency attribute is set to null and the currency symbol * attribute is not modified. * + * @param currencyCode the currency code * @see #setCurrency * @see #setCurrencySymbol * @since 1.2 @@ -427,6 +476,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Returns the monetary decimal separator. + * + * @return the monetary decimal separator * @since 1.2 */ public char getMonetaryDecimalSeparator() @@ -436,6 +487,8 @@ public class DecimalFormatSymbols implements Cloneable, Serializable { /** * Sets the monetary decimal separator. + * + * @param sep the monetary decimal separator * @since 1.2 */ public void setMonetaryDecimalSeparator(char sep) diff --git a/jdk/src/share/classes/java/text/FieldPosition.java b/jdk/src/share/classes/java/text/FieldPosition.java index 15a935378c6..300c7e89822 100644 --- a/jdk/src/share/classes/java/text/FieldPosition.java +++ b/jdk/src/share/classes/java/text/FieldPosition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,6 +100,7 @@ public class FieldPosition { * identified by constants, whose names typically end with _FIELD, * in the various subclasses of Format. * + * @param field the field identifier * @see java.text.NumberFormat#INTEGER_FIELD * @see java.text.NumberFormat#FRACTION_FIELD * @see java.text.DateFormat#YEAR_FIELD @@ -157,6 +158,8 @@ public class FieldPosition { /** * Retrieves the field identifier. + * + * @return the field identifier */ public int getField() { return field; @@ -164,6 +167,8 @@ public class FieldPosition { /** * Retrieves the index of the first character in the requested field. + * + * @return the begin index */ public int getBeginIndex() { return beginIndex; @@ -172,6 +177,8 @@ public class FieldPosition { /** * Retrieves the index of the character following the last character in the * requested field. + * + * @return the end index */ public int getEndIndex() { return endIndex; @@ -179,6 +186,8 @@ public class FieldPosition { /** * Sets the begin index. For use by subclasses of Format. + * + * @param bi the begin index * @since 1.2 */ public void setBeginIndex(int bi) { @@ -187,6 +196,8 @@ public class FieldPosition { /** * Sets the end index. For use by subclasses of Format. + * + * @param ei the end index * @since 1.2 */ public void setEndIndex(int ei) { diff --git a/jdk/src/share/classes/java/text/Format.java b/jdk/src/share/classes/java/text/Format.java index eac0f47986f..7a9c2ec4ddf 100644 --- a/jdk/src/share/classes/java/text/Format.java +++ b/jdk/src/share/classes/java/text/Format.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ import java.io.Serializable; * no separator in between, and in this case the parseObject could * not tell which digits belong to which number. * - *

                              Subclassing

                              + *

                              Subclassing

                              * *

                              * The Java Platform provides three specialized subclasses of Format-- diff --git a/jdk/src/share/classes/java/text/MessageFormat.java b/jdk/src/share/classes/java/text/MessageFormat.java index e5c8c811f04..402a7fa52d9 100644 --- a/jdk/src/share/classes/java/text/MessageFormat.java +++ b/jdk/src/share/classes/java/text/MessageFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,7 +68,7 @@ import java.util.Locale; * behavior is defined by the pattern that you provide as well as the * subformats used for inserted arguments. * - *

                              Patterns and Their Interpretation

                              + *

                              Patterns and Their Interpretation

                              * * MessageFormat uses patterns of the following form: *
                              @@ -287,10 +287,10 @@ import java.util.Locale;
                                * You can create the ChoiceFormat programmatically, as in the
                                * above example, or by using a pattern. See {@link ChoiceFormat}
                                * for more information.
                              - * 
                              + * 
                              {@code
                                * form.applyPattern(
                              - *    "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.");
                              - * 
                              + * "There {0,choice,0#are no files|1#is one file|1
                              * *

                              * Note: As we see above, the string produced @@ -778,7 +778,7 @@ public class MessageFormat extends Format { *

                              instanceof ChoiceFormat * any - * subformat.format(argument).indexOf('{') >= 0 ?
                              + *
                              subformat.format(argument).indexOf('{') >= 0 ?
                              * (new MessageFormat(subformat.format(argument), getLocale())).format(argument) : * subformat.format(argument)
                              *
                              - * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * *
                              Letter * Date or Time Component * Presentation @@ -103,7 +103,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Era designator * Text * AD - *
                              y * Year * Year @@ -113,7 +113,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Week year * Year * 2009; 09 - *
                              M * Month in year (context sensitive) * Month @@ -123,7 +123,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Month in year (standalone form) * Month * July; Jul; 07 - *
                              w * Week in year * Number @@ -133,7 +133,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Week in month * Number * 2 - *
                              D * Day in year * Number @@ -143,7 +143,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Day in month * Number * 10 - *
                              F * Day of week in month * Number @@ -153,7 +153,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Day name in week * Text * Tuesday; Tue - *
                              u * Day number of week (1 = Monday, ..., 7 = Sunday) * Number @@ -163,7 +163,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Am/pm marker * Text * PM - *
                              H * Hour in day (0-23) * Number @@ -173,7 +173,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Hour in day (1-24) * Number * 24 - *
                              K * Hour in am/pm (0-11) * Number @@ -183,7 +183,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Hour in am/pm (1-12) * Number * 12 - *
                              m * Minute in hour * Number @@ -193,7 +193,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Second in minute * Number * 55 - *
                              S * Millisecond * Number @@ -203,7 +203,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Time zone * General time zone * Pacific Standard Time; PST; GMT-08:00 - *
                              Z * Time zone * RFC 822 time zone @@ -365,37 +365,37 @@ import sun.util.locale.provider.LocaleProviderAdapter; * in the U.S. Pacific Time time zone. *
                              * - * + * * * + * * * + * * * + * * * + * * * + * * diff --git a/jdk/src/share/classes/java/text/StringCharacterIterator.java b/jdk/src/share/classes/java/text/StringCharacterIterator.java index a9254ecfc08..66b5be65157 100644 --- a/jdk/src/share/classes/java/text/StringCharacterIterator.java +++ b/jdk/src/share/classes/java/text/StringCharacterIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,6 +59,8 @@ public final class StringCharacterIterator implements CharacterIterator /** * Constructs an iterator with an initial index of 0. + * + * @param text the {@code String} to be iterated over */ public StringCharacterIterator(String text) { diff --git a/jdk/src/share/classes/java/time/DayOfWeek.java b/jdk/src/share/classes/java/time/DayOfWeek.java index d2a6f5aa541..b48482241df 100644 --- a/jdk/src/share/classes/java/time/DayOfWeek.java +++ b/jdk/src/share/classes/java/time/DayOfWeek.java @@ -61,7 +61,6 @@ */ package java.time; -import java.time.temporal.UnsupportedTemporalTypeException; import static java.time.temporal.ChronoField.DAY_OF_WEEK; import static java.time.temporal.ChronoUnit.DAYS; @@ -73,6 +72,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; import java.time.temporal.TemporalQuery; +import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; import java.time.temporal.WeekFields; import java.util.Locale; @@ -339,7 +339,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster { if (field == DAY_OF_WEEK) { return getValue(); } else if (field instanceof ChronoField) { - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } diff --git a/jdk/src/share/classes/java/time/Duration.java b/jdk/src/share/classes/java/time/Duration.java index 52b225e6e69..ab7da66f83a 100644 --- a/jdk/src/share/classes/java/time/Duration.java +++ b/jdk/src/share/classes/java/time/Duration.java @@ -459,9 +459,9 @@ public final class Duration */ public static Duration between(Temporal startInclusive, Temporal endExclusive) { try { - return ofNanos(startInclusive.periodUntil(endExclusive, NANOS)); + return ofNanos(startInclusive.until(endExclusive, NANOS)); } catch (DateTimeException | ArithmeticException ex) { - long secs = startInclusive.periodUntil(endExclusive, SECONDS); + long secs = startInclusive.until(endExclusive, SECONDS); long nanos; try { nanos = endExclusive.getLong(NANO_OF_SECOND) - startInclusive.getLong(NANO_OF_SECOND); @@ -523,7 +523,7 @@ public final class Duration } else if (unit == NANOS) { return nanos; } else { - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } } diff --git a/jdk/src/share/classes/java/time/Instant.java b/jdk/src/share/classes/java/time/Instant.java index 6dc24646945..aeecdbed524 100644 --- a/jdk/src/share/classes/java/time/Instant.java +++ b/jdk/src/share/classes/java/time/Instant.java @@ -69,6 +69,7 @@ import static java.time.temporal.ChronoField.INSTANT_SECONDS; import static java.time.temporal.ChronoField.MICRO_OF_SECOND; import static java.time.temporal.ChronoField.MILLI_OF_SECOND; import static java.time.temporal.ChronoField.NANO_OF_SECOND; +import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.NANOS; import java.io.DataInput; @@ -418,8 +419,9 @@ public final class Instant * Checks if the specified field is supported. *

                              * This checks if this instant can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -447,6 +449,44 @@ public final class Instant return field != null && field.isSupportedBy(this); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code NANOS} + *
                              • {@code MICROS} + *
                              • {@code MILLIS} + *
                              • {@code SECONDS} + *
                              • {@code MINUTES} + *
                              • {@code HOURS} + *
                              • {@code HALF_DAYS} + *
                              • {@code DAYS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override + public boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit.isTimeBased() || unit == DAYS; + } + return unit != null && unit.isSupportedBy(this); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -511,7 +551,7 @@ public final class Instant case MILLI_OF_SECOND: return nanos / 1000_000; case INSTANT_SECONDS: INSTANT_SECONDS.checkValidIntValue(seconds); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return range(field).checkValidIntValue(field.getFrom(this), field); } @@ -548,7 +588,7 @@ public final class Instant case MILLI_OF_SECOND: return nanos / 1000_000; case INSTANT_SECONDS: return seconds; } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } @@ -665,7 +705,7 @@ public final class Instant case NANO_OF_SECOND: return (newValue != nanos ? create(seconds, (int) newValue) : this); case INSTANT_SECONDS: return (newValue != seconds ? create(newValue, nanos) : this); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.adjustInto(this, newValue); } @@ -807,7 +847,7 @@ public final class Instant case HALF_DAYS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY / 2)); case DAYS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY)); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.addTo(this, amountToAdd); } @@ -1053,14 +1093,14 @@ public final class Instant * complete units between the two instants. * The {@code Temporal} passed to this method must be an {@code Instant}. * For example, the amount in days between two dates can be calculated - * using {@code startInstant.periodUntil(endInstant, SECONDS)}. + * using {@code startInstant.until(endInstant, SECONDS)}. *

                              * There are two equivalent ways of using this method. * The first is to invoke this method. * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, SECONDS);
                              +     *   amount = start.until(end, SECONDS);
                                    *   amount = SECONDS.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -1085,7 +1125,7 @@ public final class Instant * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endInstant, TemporalUnit unit) { + public long until(Temporal endInstant, TemporalUnit unit) { if (endInstant instanceof Instant == false) { Objects.requireNonNull(endInstant, "endInstant"); throw new DateTimeException("Unable to calculate amount as objects are of two different types"); @@ -1103,7 +1143,7 @@ public final class Instant case HALF_DAYS: return secondsUntil(end) / (12 * SECONDS_PER_HOUR); case DAYS: return secondsUntil(end) / (SECONDS_PER_DAY); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, endInstant); } diff --git a/jdk/src/share/classes/java/time/LocalDate.java b/jdk/src/share/classes/java/time/LocalDate.java index ede6d8326b9..d96f5b1fd1e 100644 --- a/jdk/src/share/classes/java/time/LocalDate.java +++ b/jdk/src/share/classes/java/time/LocalDate.java @@ -127,7 +127,7 @@ import java.util.Objects; * @since 1.8 */ public final class LocalDate - implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable { + implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable { /** * The minimum supported {@code LocalDate}, '-999999999-01-01'. @@ -466,8 +466,9 @@ public final class LocalDate * Checks if the specified field is supported. *

                              * This checks if this date can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -501,6 +502,41 @@ public final class LocalDate return ChronoLocalDate.super.isSupported(field); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code DAYS} + *
                              • {@code WEEKS} + *
                              • {@code MONTHS} + *
                              • {@code YEARS} + *
                              • {@code DECADES} + *
                              • {@code CENTURIES} + *
                              • {@code MILLENNIA} + *
                              • {@code ERAS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override // override for Javadoc + public boolean isSupported(TemporalUnit unit) { + return ChronoLocalDate.super.isSupported(unit); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -538,7 +574,7 @@ public final class LocalDate } return field.range(); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.rangeRefinedBy(this); } @@ -631,7 +667,7 @@ public final class LocalDate case YEAR: return year; case ERA: return (year >= 1 ? 1 : 0); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } private long getProlepticMonth() { @@ -988,7 +1024,7 @@ public final class LocalDate case YEAR: return withYear((int) newValue); case ERA: return (getLong(ERA) == newValue ? this : withYear(1 - year)); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.adjustInto(this, newValue); } @@ -1187,7 +1223,7 @@ public final class LocalDate case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000)); case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd)); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.addTo(this, amountToAdd); } @@ -1497,7 +1533,7 @@ public final class LocalDate * The result will be negative if the end is before the start. * The {@code Temporal} passed to this method must be a {@code LocalDate}. * For example, the amount in days between two dates can be calculated - * using {@code startDate.periodUntil(endDate, DAYS)}. + * using {@code startDate.until(endDate, DAYS)}. *

                              * The calculation returns a whole number, representing the number of * complete units between the two dates. @@ -1509,7 +1545,7 @@ public final class LocalDate * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, MONTHS);
                              +     *   amount = start.until(end, MONTHS);
                                    *   amount = MONTHS.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -1534,7 +1570,7 @@ public final class LocalDate * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endDate, TemporalUnit unit) { + public long until(Temporal endDate, TemporalUnit unit) { Objects.requireNonNull(unit, "unit"); if (endDate instanceof LocalDate == false) { Objects.requireNonNull(endDate, "endDate"); @@ -1552,7 +1588,7 @@ public final class LocalDate case MILLENNIA: return monthsUntil(end) / 12000; case ERAS: return end.getLong(ERA) - getLong(ERA); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, endDate); } @@ -1591,7 +1627,7 @@ public final class LocalDate * The second is to use {@link Period#between(LocalDate, LocalDate)}: *
                                    *   // these two lines are equivalent
                              -     *   period = start.periodUntil(end);
                              +     *   period = start.until(end);
                                    *   period = Period.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -1600,7 +1636,7 @@ public final class LocalDate * @return the period between this date and the end date, not null */ @Override - public Period periodUntil(ChronoLocalDate endDate) { + public Period until(ChronoLocalDate endDate) { LocalDate end = LocalDate.from(endDate); long totalMonths = end.getProlepticMonth() - this.getProlepticMonth(); // safe int days = end.day - this.day; @@ -1803,7 +1839,7 @@ public final class LocalDate * @return the comparator value, negative if less, positive if greater */ @Override // override for Javadoc and performance - public int compareTo(ChronoLocalDate other) { + public int compareTo(ChronoLocalDate other) { if (other instanceof LocalDate) { return compareTo0((LocalDate) other); } @@ -1843,7 +1879,7 @@ public final class LocalDate * @return true if this date is after the specified date */ @Override // override for Javadoc and performance - public boolean isAfter(ChronoLocalDate other) { + public boolean isAfter(ChronoLocalDate other) { if (other instanceof LocalDate) { return compareTo0((LocalDate) other) > 0; } @@ -1872,7 +1908,7 @@ public final class LocalDate * @return true if this date is before the specified date */ @Override // override for Javadoc and performance - public boolean isBefore(ChronoLocalDate other) { + public boolean isBefore(ChronoLocalDate other) { if (other instanceof LocalDate) { return compareTo0((LocalDate) other) < 0; } @@ -1901,7 +1937,7 @@ public final class LocalDate * @return true if this date is equal to the specified date */ @Override // override for Javadoc and performance - public boolean isEqual(ChronoLocalDate other) { + public boolean isEqual(ChronoLocalDate other) { if (other instanceof LocalDate) { return compareTo0((LocalDate) other) == 0; } diff --git a/jdk/src/share/classes/java/time/LocalDateTime.java b/jdk/src/share/classes/java/time/LocalDateTime.java index 6e6c87bc2ff..d68d6f52537 100644 --- a/jdk/src/share/classes/java/time/LocalDateTime.java +++ b/jdk/src/share/classes/java/time/LocalDateTime.java @@ -515,8 +515,9 @@ public final class LocalDateTime * Checks if the specified field is supported. *

                              * This checks if this date-time can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -569,6 +570,48 @@ public final class LocalDateTime return field != null && field.isSupportedBy(this); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code NANOS} + *
                              • {@code MICROS} + *
                              • {@code MILLIS} + *
                              • {@code SECONDS} + *
                              • {@code MINUTES} + *
                              • {@code HOURS} + *
                              • {@code HALF_DAYS} + *
                              • {@code DAYS} + *
                              • {@code WEEKS} + *
                              • {@code MONTHS} + *
                              • {@code YEARS} + *
                              • {@code DECADES} + *
                              • {@code CENTURIES} + *
                              • {@code MILLENNIA} + *
                              • {@code ERAS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override // override for Javadoc + public boolean isSupported(TemporalUnit unit) { + return ChronoLocalDateTime.super.isSupported(unit); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -1570,7 +1613,7 @@ public final class LocalDateTime * The result will be negative if the end is before the start. * The {@code Temporal} passed to this method must be a {@code LocalDateTime}. * For example, the amount in days between two date-times can be calculated - * using {@code startDateTime.periodUntil(endDateTime, DAYS)}. + * using {@code startDateTime.until(endDateTime, DAYS)}. *

                              * The calculation returns a whole number, representing the number of * complete units between the two date-times. @@ -1582,7 +1625,7 @@ public final class LocalDateTime * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, MONTHS);
                              +     *   amount = start.until(end, MONTHS);
                                    *   amount = MONTHS.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -1609,18 +1652,17 @@ public final class LocalDateTime * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endDateTime, TemporalUnit unit) { + public long until(Temporal endDateTime, TemporalUnit unit) { if (endDateTime instanceof LocalDateTime == false) { Objects.requireNonNull(endDateTime, "endDateTime"); throw new DateTimeException("Unable to calculate amount as objects are of two different types"); } LocalDateTime end = (LocalDateTime) endDateTime; if (unit instanceof ChronoUnit) { - ChronoUnit f = (ChronoUnit) unit; - if (f.isTimeUnit()) { + if (unit.isTimeBased()) { long amount = date.daysUntil(end.date); if (amount == 0) { - return time.periodUntil(end.time, unit); + return time.until(end.time, unit); } long timePart = end.time.toNanoOfDay() - time.toNanoOfDay(); if (amount > 0) { @@ -1630,7 +1672,7 @@ public final class LocalDateTime amount++; // safe timePart -= NANOS_PER_DAY; // safe } - switch (f) { + switch ((ChronoUnit) unit) { case NANOS: amount = Math.multiplyExact(amount, NANOS_PER_DAY); break; @@ -1667,7 +1709,7 @@ public final class LocalDateTime } else if (endDate.isBefore(date) && end.time.isAfter(time)) { endDate = endDate.plusDays(1); } - return date.periodUntil(endDate, unit); + return date.until(endDate, unit); } return unit.between(this, endDateTime); } diff --git a/jdk/src/share/classes/java/time/LocalTime.java b/jdk/src/share/classes/java/time/LocalTime.java index 41b1a927560..2bace6e7bc9 100644 --- a/jdk/src/share/classes/java/time/LocalTime.java +++ b/jdk/src/share/classes/java/time/LocalTime.java @@ -470,8 +470,9 @@ public final class LocalTime * Checks if the specified field is supported. *

                              * This checks if this time can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -510,6 +511,43 @@ public final class LocalTime return field != null && field.isSupportedBy(this); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code NANOS} + *
                              • {@code MICROS} + *
                              • {@code MILLIS} + *
                              • {@code SECONDS} + *
                              • {@code MINUTES} + *
                              • {@code HOURS} + *
                              • {@code HALF_DAYS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override // override for Javadoc + public boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit.isTimeBased(); + } + return unit != null && unit.isSupportedBy(this); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -628,7 +666,7 @@ public final class LocalTime case CLOCK_HOUR_OF_DAY: return (hour == 0 ? 24 : hour); case AMPM_OF_DAY: return hour / 12; } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } //----------------------------------------------------------------------- @@ -803,7 +841,7 @@ public final class LocalTime case CLOCK_HOUR_OF_DAY: return withHour((int) (newValue == 24 ? 0 : newValue)); case AMPM_OF_DAY: return plusHours((newValue - (hour / 12)) * 12); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.adjustInto(this, newValue); } @@ -995,8 +1033,7 @@ public final class LocalTime @Override public LocalTime plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { - ChronoUnit f = (ChronoUnit) unit; - switch (f) { + switch ((ChronoUnit) unit) { case NANOS: return plusNanos(amountToAdd); case MICROS: return plusNanos((amountToAdd % MICROS_PER_DAY) * 1000); case MILLIS: return plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000_000); @@ -1005,7 +1042,7 @@ public final class LocalTime case HOURS: return plusHours(amountToAdd); case HALF_DAYS: return plusHours((amountToAdd % 2) * 12); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.addTo(this, amountToAdd); } @@ -1295,7 +1332,7 @@ public final class LocalTime * The result will be negative if the end is before the start. * The {@code Temporal} passed to this method must be a {@code LocalTime}. * For example, the amount in hours between two times can be calculated - * using {@code startTime.periodUntil(endTime, HOURS)}. + * using {@code startTime.until(endTime, HOURS)}. *

                              * The calculation returns a whole number, representing the number of * complete units between the two times. @@ -1307,7 +1344,7 @@ public final class LocalTime * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, MINUTES);
                              +     *   amount = start.until(end, MINUTES);
                                    *   amount = MINUTES.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -1332,7 +1369,7 @@ public final class LocalTime * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endTime, TemporalUnit unit) { + public long until(Temporal endTime, TemporalUnit unit) { if (endTime instanceof LocalTime == false) { Objects.requireNonNull(endTime, "endTime"); throw new DateTimeException("Unable to calculate amount as objects are of two different types"); @@ -1349,7 +1386,7 @@ public final class LocalTime case HOURS: return nanosUntil / NANOS_PER_HOUR; case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, endTime); } diff --git a/jdk/src/share/classes/java/time/Month.java b/jdk/src/share/classes/java/time/Month.java index 272e8f96b36..85d12d8f136 100644 --- a/jdk/src/share/classes/java/time/Month.java +++ b/jdk/src/share/classes/java/time/Month.java @@ -61,7 +61,6 @@ */ package java.time; -import java.time.temporal.UnsupportedTemporalTypeException; import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import static java.time.temporal.ChronoUnit.MONTHS; @@ -75,6 +74,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; import java.time.temporal.TemporalQuery; +import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; import java.util.Locale; @@ -370,7 +370,7 @@ public enum Month implements TemporalAccessor, TemporalAdjuster { if (field == MONTH_OF_YEAR) { return getValue(); } else if (field instanceof ChronoField) { - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } diff --git a/jdk/src/share/classes/java/time/MonthDay.java b/jdk/src/share/classes/java/time/MonthDay.java index 4204ef74a7d..06aa0437af8 100644 --- a/jdk/src/share/classes/java/time/MonthDay.java +++ b/jdk/src/share/classes/java/time/MonthDay.java @@ -438,7 +438,7 @@ public final class MonthDay case DAY_OF_MONTH: return day; case MONTH_OF_YEAR: return month; } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } diff --git a/jdk/src/share/classes/java/time/OffsetDateTime.java b/jdk/src/share/classes/java/time/OffsetDateTime.java index b053085a9f5..5641154cf3e 100644 --- a/jdk/src/share/classes/java/time/OffsetDateTime.java +++ b/jdk/src/share/classes/java/time/OffsetDateTime.java @@ -65,6 +65,7 @@ import static java.time.temporal.ChronoField.EPOCH_DAY; import static java.time.temporal.ChronoField.INSTANT_SECONDS; import static java.time.temporal.ChronoField.NANO_OF_DAY; import static java.time.temporal.ChronoField.OFFSET_SECONDS; +import static java.time.temporal.ChronoUnit.FOREVER; import static java.time.temporal.ChronoUnit.NANOS; import java.io.IOException; @@ -137,25 +138,40 @@ public final class OffsetDateTime public static final OffsetDateTime MAX = LocalDateTime.MAX.atOffset(ZoneOffset.MIN); /** - * Comparator for two {@code OffsetDateTime} instances based solely on the instant. + * Gets a comparator that compares two {@code OffsetDateTime} instances + * based solely on the instant. *

                              * This method differs from the comparison in {@link #compareTo} in that it * only compares the underlying instant. * + * @return a comparator that compares in time-line order + * * @see #isAfter * @see #isBefore * @see #isEqual */ - public static final Comparator INSTANT_COMPARATOR = new Comparator() { - @Override - public int compare(OffsetDateTime datetime1, OffsetDateTime datetime2) { - int cmp = Long.compare(datetime1.toEpochSecond(), datetime2.toEpochSecond()); - if (cmp == 0) { - cmp = Long.compare(datetime1.toLocalTime().toNanoOfDay(), datetime2.toLocalTime().toNanoOfDay()); - } - return cmp; + public static Comparator timeLineOrder() { + return OffsetDateTime::compareInstant; + } + + /** + * Compares this {@code OffsetDateTime} to another date-time. + * The comparison is based on the instant. + * + * @param datetime1 the first date-time to compare, not null + * @param datetime2 the other date-time to compare to, not null + * @return the comparator value, negative if less, positive if greater + */ + private static int compareInstant(OffsetDateTime datetime1, OffsetDateTime datetime2) { + if (datetime1.getOffset().equals(datetime2.getOffset())) { + return datetime1.toLocalDateTime().compareTo(datetime2.toLocalDateTime()); } - }; + int cmp = Long.compare(datetime1.toEpochSecond(), datetime2.toEpochSecond()); + if (cmp == 0) { + cmp = datetime1.toLocalTime().getNano() - datetime2.toLocalTime().getNano(); + } + return cmp; + } /** * Serialization version. @@ -406,8 +422,9 @@ public final class OffsetDateTime * Checks if the specified field is supported. *

                              * This checks if this date-time can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -458,6 +475,51 @@ public final class OffsetDateTime return field instanceof ChronoField || (field != null && field.isSupportedBy(this)); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code NANOS} + *
                              • {@code MICROS} + *
                              • {@code MILLIS} + *
                              • {@code SECONDS} + *
                              • {@code MINUTES} + *
                              • {@code HOURS} + *
                              • {@code HALF_DAYS} + *
                              • {@code DAYS} + *
                              • {@code WEEKS} + *
                              • {@code MONTHS} + *
                              • {@code YEARS} + *
                              • {@code DECADES} + *
                              • {@code CENTURIES} + *
                              • {@code MILLENNIA} + *
                              • {@code ERAS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override // override for Javadoc + public boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit != FOREVER; + } + return unit != null && unit.isSupportedBy(this); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -1528,7 +1590,7 @@ public final class OffsetDateTime * The start and end points are {@code this} and the specified date-time. * The result will be negative if the end is before the start. * For example, the period in days between two date-times can be calculated - * using {@code startDateTime.periodUntil(endDateTime, DAYS)}. + * using {@code startDateTime.until(endDateTime, DAYS)}. *

                              * The {@code Temporal} passed to this method must be an {@code OffsetDateTime}. * If the offset differs between the two date-times, the specified @@ -1544,7 +1606,7 @@ public final class OffsetDateTime * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, MONTHS);
                              +     *   amount = start.until(end, MONTHS);
                                    *   amount = MONTHS.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -1571,7 +1633,7 @@ public final class OffsetDateTime * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endDateTime, TemporalUnit unit) { + public long until(Temporal endDateTime, TemporalUnit unit) { if (endDateTime instanceof OffsetDateTime == false) { Objects.requireNonNull(endDateTime, "endDateTime"); throw new DateTimeException("Unable to calculate amount as objects are of two different types"); @@ -1579,7 +1641,7 @@ public final class OffsetDateTime if (unit instanceof ChronoUnit) { OffsetDateTime end = (OffsetDateTime) endDateTime; end = end.withOffsetSameInstant(offset); - return dateTime.periodUntil(end.dateTime, unit); + return dateTime.until(end.dateTime, unit); } return unit.between(this, endDateTime); } @@ -1724,15 +1786,9 @@ public final class OffsetDateTime */ @Override public int compareTo(OffsetDateTime other) { - if (getOffset().equals(other.getOffset())) { - return toLocalDateTime().compareTo(other.toLocalDateTime()); - } - int cmp = Long.compare(toEpochSecond(), other.toEpochSecond()); + int cmp = compareInstant(this, other); if (cmp == 0) { - cmp = toLocalTime().getNano() - other.toLocalTime().getNano(); - if (cmp == 0) { - cmp = toLocalDateTime().compareTo(other.toLocalDateTime()); - } + cmp = toLocalDateTime().compareTo(other.toLocalDateTime()); } return cmp; } diff --git a/jdk/src/share/classes/java/time/OffsetTime.java b/jdk/src/share/classes/java/time/OffsetTime.java index ff990696942..2872cff4b26 100644 --- a/jdk/src/share/classes/java/time/OffsetTime.java +++ b/jdk/src/share/classes/java/time/OffsetTime.java @@ -348,8 +348,9 @@ public final class OffsetTime * Checks if the specified field is supported. *

                              * This checks if this time can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -389,6 +390,43 @@ public final class OffsetTime return field != null && field.isSupportedBy(this); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code NANOS} + *
                              • {@code MICROS} + *
                              • {@code MILLIS} + *
                              • {@code SECONDS} + *
                              • {@code MINUTES} + *
                              • {@code HOURS} + *
                              • {@code HALF_DAYS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override // override for Javadoc + public boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit.isTimeBased(); + } + return unit != null && unit.isSupportedBy(this); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -1084,7 +1122,7 @@ public final class OffsetTime * The start and end points are {@code this} and the specified time. * The result will be negative if the end is before the start. * For example, the period in hours between two times can be calculated - * using {@code startTime.periodUntil(endTime, HOURS)}. + * using {@code startTime.until(endTime, HOURS)}. *

                              * The {@code Temporal} passed to this method must be an {@code OffsetTime}. * If the offset differs between the two times, then the specified @@ -1100,7 +1138,7 @@ public final class OffsetTime * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, MINUTES);
                              +     *   amount = start.until(end, MINUTES);
                                    *   amount = MINUTES.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -1125,7 +1163,7 @@ public final class OffsetTime * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endTime, TemporalUnit unit) { + public long until(Temporal endTime, TemporalUnit unit) { if (endTime instanceof OffsetTime == false) { Objects.requireNonNull(endTime, "endTime"); throw new DateTimeException("Unable to calculate amount as objects are of two different types"); @@ -1142,7 +1180,7 @@ public final class OffsetTime case HOURS: return nanosUntil / NANOS_PER_HOUR; case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, endTime); } diff --git a/jdk/src/share/classes/java/time/Period.java b/jdk/src/share/classes/java/time/Period.java index b2748f089ce..45980d08740 100644 --- a/jdk/src/share/classes/java/time/Period.java +++ b/jdk/src/share/classes/java/time/Period.java @@ -139,7 +139,7 @@ public final class Period * The pattern for parsing. */ private final static Pattern PATTERN = - Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE); + Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)W)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE); /** * The set of supported units. */ @@ -186,6 +186,20 @@ public final class Period return create(0, months, 0); } + /** + * Obtains a {@code Period} representing a number of weeks. + *

                              + * The resulting period will be day-based, with the amount of days + * equal to the number of weeks multiplied by 7. + * The years and months units will be zero. + * + * @param weeks the number of weeks, positive or negative + * @return the period, with the input weeks converted to days, not null + */ + public static Period ofWeeks(int weeks) { + return create(0, 0, Math.multiplyExact(weeks, 7)); + } + /** * Obtains a {@code Period} representing a number of days. *

                              @@ -257,22 +271,36 @@ public final class Period * Obtains a {@code Period} from a text string such as {@code PnYnMnD}. *

                              * This will parse the string produced by {@code toString()} which is - * based on the ISO-8601 period format {@code PnYnMnD}. + * based on the ISO-8601 period formats {@code PnYnMnD} and {@code PnW}. *

                              * The string starts with an optional sign, denoted by the ASCII negative * or positive symbol. If negative, the whole period is negated. * The ASCII letter "P" is next in upper or lower case. - * There are then three sections, each consisting of a number and a suffix. - * At least one of the three sections must be present. - * The sections have suffixes in ASCII of "Y", "M" and "D" for - * years, months and days, accepted in upper or lower case. + * There are then four sections, each consisting of a number and a suffix. + * At least one of the four sections must be present. + * The sections have suffixes in ASCII of "Y", "M", "W" and "D" for + * years, months, weeks and days, accepted in upper or lower case. * The suffixes must occur in order. * The number part of each section must consist of ASCII digits. * The number may be prefixed by the ASCII negative or positive symbol. * The number must parse to an {@code int}. *

                              * The leading plus/minus sign, and negative values for other units are - * not part of the ISO-8601 standard. + * not part of the ISO-8601 standard. In addition, ISO-8601 does not + * permit mixing between the {@code PnYnMnD} and {@code PnW} formats. + * Any week-based input is multiplied by 7 and treated as a number of days. + *

                              + * For example, the following are valid inputs: + *

                              +     *   "P2Y"             -- Period.ofYears(2)
                              +     *   "P3M"             -- Period.ofMonths(3)
                              +     *   "P4W"             -- Period.ofWeeks(4)
                              +     *   "P5D"             -- Period.ofDays(5)
                              +     *   "P1Y2M3D"         -- Period.of(1, 2, 3)
                              +     *   "P1Y2M3W4D"       -- Period.of(1, 2, 25)
                              +     *   "P-1Y2M"          -- Period.of(-1, 2, 0)
                              +     *   "-P1Y2M"          -- Period.of(-1, -2, 0)
                              +     * 
                              * * @param text the text to parse, not null * @return the parsed period, not null @@ -285,14 +313,18 @@ public final class Period int negate = ("-".equals(matcher.group(1)) ? -1 : 1); String yearMatch = matcher.group(2); String monthMatch = matcher.group(3); - String dayMatch = matcher.group(4); - if (yearMatch != null || monthMatch != null || dayMatch != null) { + String weekMatch = matcher.group(4); + String dayMatch = matcher.group(5); + if (yearMatch != null || monthMatch != null || dayMatch != null || weekMatch != null) { try { - return create(parseNumber(text, yearMatch, negate), - parseNumber(text, monthMatch, negate), - parseNumber(text, dayMatch, negate)); + int years = parseNumber(text, yearMatch, negate); + int months = parseNumber(text, monthMatch, negate); + int weeks = parseNumber(text, weekMatch, negate); + int days = parseNumber(text, dayMatch, negate); + days = Math.addExact(days, Math.multiplyExact(weeks, 7)); + return create(years, months, days); } catch (NumberFormatException ex) { - throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Period", text, 0).initCause(ex); + throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex); } } } @@ -307,7 +339,7 @@ public final class Period try { return Math.multiplyExact(val, negate); } catch (ArithmeticException ex) { - throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Period", text, 0).initCause(ex); + throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex); } } @@ -329,10 +361,10 @@ public final class Period * @param startDate the start date, inclusive, not null * @param endDate the end date, exclusive, not null * @return the period between this date and the end date, not null - * @see ChronoLocalDate#periodUntil(ChronoLocalDate) + * @see ChronoLocalDate#until(ChronoLocalDate) */ public static Period between(LocalDate startDate, LocalDate endDate) { - return startDate.periodUntil(endDate); + return startDate.until(endDate); } //----------------------------------------------------------------------- @@ -386,7 +418,7 @@ public final class Period } else if (unit == ChronoUnit.DAYS) { return getDays(); } else { - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } } diff --git a/jdk/src/share/classes/java/time/Year.java b/jdk/src/share/classes/java/time/Year.java index c2d9974d79a..fb180d859cb 100644 --- a/jdk/src/share/classes/java/time/Year.java +++ b/jdk/src/share/classes/java/time/Year.java @@ -64,6 +64,10 @@ package java.time; import static java.time.temporal.ChronoField.ERA; import static java.time.temporal.ChronoField.YEAR; import static java.time.temporal.ChronoField.YEAR_OF_ERA; +import static java.time.temporal.ChronoUnit.CENTURIES; +import static java.time.temporal.ChronoUnit.DECADES; +import static java.time.temporal.ChronoUnit.ERAS; +import static java.time.temporal.ChronoUnit.MILLENNIA; import static java.time.temporal.ChronoUnit.YEARS; import java.io.DataInput; @@ -329,8 +333,9 @@ public final class Year * Checks if the specified field is supported. *

                              * This checks if this year can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -357,6 +362,41 @@ public final class Year return field != null && field.isSupportedBy(this); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code YEARS} + *
                              • {@code DECADES} + *
                              • {@code CENTURIES} + *
                              • {@code MILLENNIA} + *
                              • {@code ERAS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override + public boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS; + } + return unit != null && unit.isSupportedBy(this); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -450,7 +490,7 @@ public final class Year case YEAR: return year; case ERA: return (year < 1 ? 0 : 1); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } @@ -575,7 +615,7 @@ public final class Year case YEAR: return Year.of((int) newValue); case ERA: return (getLong(ERA) == newValue ? this : Year.of(1 - year)); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.adjustInto(this, newValue); } @@ -664,7 +704,7 @@ public final class Year case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000)); case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd)); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.addTo(this, amountToAdd); } @@ -821,7 +861,7 @@ public final class Year * The result will be negative if the end is before the start. * The {@code Temporal} passed to this method must be a {@code Year}. * For example, the period in decades between two year can be calculated - * using {@code startYear.periodUntil(endYear, DECADES)}. + * using {@code startYear.until(endYear, DECADES)}. *

                              * The calculation returns a whole number, representing the number of * complete units between the two years. @@ -833,7 +873,7 @@ public final class Year * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, YEARS);
                              +     *   amount = start.until(end, YEARS);
                                    *   amount = YEARS.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -858,7 +898,7 @@ public final class Year * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endYear, TemporalUnit unit) { + public long until(Temporal endYear, TemporalUnit unit) { if (endYear instanceof Year == false) { Objects.requireNonNull(endYear, "endYear"); throw new DateTimeException("Unable to calculate amount as objects are of two different types"); @@ -873,7 +913,7 @@ public final class Year case MILLENNIA: return yearsUntil / 1000; case ERAS: return end.getLong(ERA) - getLong(ERA); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, endYear); } diff --git a/jdk/src/share/classes/java/time/YearMonth.java b/jdk/src/share/classes/java/time/YearMonth.java index 855774eed1a..1d974095336 100644 --- a/jdk/src/share/classes/java/time/YearMonth.java +++ b/jdk/src/share/classes/java/time/YearMonth.java @@ -66,7 +66,12 @@ import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import static java.time.temporal.ChronoField.PROLEPTIC_MONTH; import static java.time.temporal.ChronoField.YEAR; import static java.time.temporal.ChronoField.YEAR_OF_ERA; +import static java.time.temporal.ChronoUnit.CENTURIES; +import static java.time.temporal.ChronoUnit.DECADES; +import static java.time.temporal.ChronoUnit.ERAS; +import static java.time.temporal.ChronoUnit.MILLENNIA; import static java.time.temporal.ChronoUnit.MONTHS; +import static java.time.temporal.ChronoUnit.YEARS; import java.io.DataInput; import java.io.DataOutput; @@ -313,8 +318,9 @@ public final class YearMonth * Checks if the specified field is supported. *

                              * This checks if this year-month can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -344,6 +350,42 @@ public final class YearMonth return field != null && field.isSupportedBy(this); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code MONTHS} + *
                              • {@code YEARS} + *
                              • {@code DECADES} + *
                              • {@code CENTURIES} + *
                              • {@code MILLENNIA} + *
                              • {@code ERAS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override + public boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit == MONTHS || unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS; + } + return unit != null && unit.isSupportedBy(this); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -440,7 +482,7 @@ public final class YearMonth case YEAR: return year; case ERA: return (year < 1 ? 0 : 1); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } @@ -639,7 +681,7 @@ public final class YearMonth case YEAR: return withYear((int) newValue); case ERA: return (getLong(ERA) == newValue ? this : withYear(1 - year)); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.adjustInto(this, newValue); } @@ -761,7 +803,7 @@ public final class YearMonth case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000)); case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd)); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.addTo(this, amountToAdd); } @@ -952,7 +994,7 @@ public final class YearMonth * The result will be negative if the end is before the start. * The {@code Temporal} passed to this method must be a {@code YearMonth}. * For example, the period in years between two year-months can be calculated - * using {@code startYearMonth.periodUntil(endYearMonth, YEARS)}. + * using {@code startYearMonth.until(endYearMonth, YEARS)}. *

                              * The calculation returns a whole number, representing the number of * complete units between the two year-months. @@ -964,7 +1006,7 @@ public final class YearMonth * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, MONTHS);
                              +     *   amount = start.until(end, MONTHS);
                                    *   amount = MONTHS.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -989,7 +1031,7 @@ public final class YearMonth * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endYearMonth, TemporalUnit unit) { + public long until(Temporal endYearMonth, TemporalUnit unit) { if (endYearMonth instanceof YearMonth == false) { Objects.requireNonNull(endYearMonth, "endYearMonth"); throw new DateTimeException("Unable to calculate amount as objects are of two different types"); @@ -1005,7 +1047,7 @@ public final class YearMonth case MILLENNIA: return monthsUntil / 12000; case ERAS: return end.getLong(ERA) - getLong(ERA); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, endYearMonth); } diff --git a/jdk/src/share/classes/java/time/ZoneId.java b/jdk/src/share/classes/java/time/ZoneId.java index 026f73ef512..dcde85ae884 100644 --- a/jdk/src/share/classes/java/time/ZoneId.java +++ b/jdk/src/share/classes/java/time/ZoneId.java @@ -400,6 +400,36 @@ public abstract class ZoneId implements Serializable { return of(zoneId, true); } + /** + * Obtains an instance of {@code ZoneId} wrapping an offset. + *

                              + * If the prefix is "GMT", "UTC", or "UT" a {@code ZoneId} + * with the prefix and the non-zero offset is returned. + * If the prefix is empty {@code ""} the {@code ZoneOffset} is returned. + * + * @param prefix the time-zone ID, not null + * @param offset the offset, not null + * @return the zone ID, not null + * @throws IllegalArgumentException if the prefix is not one of + * "GMT", "UTC", or "UT", or "" + */ + public static ZoneId ofOffset(String prefix, ZoneOffset offset) { + Objects.requireNonNull(prefix, "prefix"); + Objects.requireNonNull(offset, "offset"); + if (prefix.length() == 0) { + return offset; + } + + if (!prefix.equals("GMT") && !prefix.equals("UTC") && !prefix.equals("UT")) { + throw new IllegalArgumentException("prefix should be GMT, UTC or UT, is: " + prefix); + } + + if (offset.getTotalSeconds() != 0) { + prefix = prefix.concat(offset.getId()); + } + return new ZoneRegion(prefix, offset.getRules()); + } + /** * Parses the ID, taking a flag to indicate whether {@code ZoneRulesException} * should be thrown or not, used in deserialization. @@ -433,7 +463,7 @@ public abstract class ZoneId implements Serializable { private static ZoneId ofWithPrefix(String zoneId, int prefixLength, boolean checkAvailable) { String prefix = zoneId.substring(0, prefixLength); if (zoneId.length() == prefixLength) { - return ZoneRegion.ofPrefixedOffset(prefix, ZoneOffset.UTC); + return ofOffset(prefix, ZoneOffset.UTC); } if (zoneId.charAt(prefixLength) != '+' && zoneId.charAt(prefixLength) != '-') { return ZoneRegion.ofId(zoneId, checkAvailable); // drop through to ZoneRulesProvider @@ -441,9 +471,9 @@ public abstract class ZoneId implements Serializable { try { ZoneOffset offset = ZoneOffset.of(zoneId.substring(prefixLength)); if (offset == ZoneOffset.UTC) { - return ZoneRegion.ofPrefixedOffset(prefix, offset); + return ofOffset(prefix, offset); } - return ZoneRegion.ofPrefixedOffset(prefix + offset.toString(), offset); + return ofOffset(prefix, offset); } catch (DateTimeException ex) { throw new DateTimeException("Invalid ID for offset-based ZoneId: " + zoneId, ex); } diff --git a/jdk/src/share/classes/java/time/ZoneOffset.java b/jdk/src/share/classes/java/time/ZoneOffset.java index 4bbc4e4fa84..c5e4d056ee8 100644 --- a/jdk/src/share/classes/java/time/ZoneOffset.java +++ b/jdk/src/share/classes/java/time/ZoneOffset.java @@ -61,7 +61,6 @@ */ package java.time; -import java.time.temporal.UnsupportedTemporalTypeException; import static java.time.LocalTime.MINUTES_PER_HOUR; import static java.time.LocalTime.SECONDS_PER_HOUR; import static java.time.LocalTime.SECONDS_PER_MINUTE; @@ -79,6 +78,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; import java.time.temporal.TemporalQuery; +import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; import java.time.zone.ZoneRules; import java.util.Objects; @@ -581,7 +581,7 @@ public final class ZoneOffset if (field == OFFSET_SECONDS) { return totalSeconds; } else if (field instanceof ChronoField) { - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return range(field).checkValidIntValue(getLong(field), field); } @@ -613,7 +613,7 @@ public final class ZoneOffset if (field == OFFSET_SECONDS) { return totalSeconds; } else if (field instanceof ChronoField) { - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } diff --git a/jdk/src/share/classes/java/time/ZoneRegion.java b/jdk/src/share/classes/java/time/ZoneRegion.java index af6a5405a69..66d30709d98 100644 --- a/jdk/src/share/classes/java/time/ZoneRegion.java +++ b/jdk/src/share/classes/java/time/ZoneRegion.java @@ -66,7 +66,6 @@ import java.time.zone.ZoneRules; import java.time.zone.ZoneRulesException; import java.time.zone.ZoneRulesProvider; import java.util.Objects; -import java.util.regex.Pattern; /** * A geographical region where the same time-zone rules apply. @@ -153,19 +152,6 @@ final class ZoneRegion extends ZoneId implements Serializable { } } - /** - * Obtains an instance of {@code ZoneId} wrapping an offset. - *

                              - * For example, zone IDs like 'UTC', 'GMT', 'UT' and 'UTC+01:30' will be setup here. - * - * @param zoneId the time-zone ID, not null - * @param offset the offset, not null - * @return the zone ID, not null - */ - static ZoneRegion ofPrefixedOffset(String zoneId, ZoneOffset offset) { - return new ZoneRegion(zoneId, offset.getRules()); - } - //------------------------------------------------------------------------- /** * Constructor. diff --git a/jdk/src/share/classes/java/time/ZonedDateTime.java b/jdk/src/share/classes/java/time/ZonedDateTime.java index e7ed5551d33..151470ecf93 100644 --- a/jdk/src/share/classes/java/time/ZonedDateTime.java +++ b/jdk/src/share/classes/java/time/ZonedDateTime.java @@ -642,8 +642,9 @@ public final class ZonedDateTime * Checks if the specified field is supported. *

                              * This checks if this date-time can be queried for the specified field. - * If false, then calling the {@link #range(TemporalField) range} and - * {@link #get(TemporalField) get} methods will throw an exception. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. *

                              * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: @@ -694,6 +695,48 @@ public final class ZonedDateTime return field instanceof ChronoField || (field != null && field.isSupportedBy(this)); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * If the unit is a {@link ChronoUnit} then the query is implemented here. + * The supported units are: + *

                                + *
                              • {@code NANOS} + *
                              • {@code MICROS} + *
                              • {@code MILLIS} + *
                              • {@code SECONDS} + *
                              • {@code MINUTES} + *
                              • {@code HOURS} + *
                              • {@code HALF_DAYS} + *
                              • {@code DAYS} + *
                              • {@code WEEKS} + *
                              • {@code MONTHS} + *
                              • {@code YEARS} + *
                              • {@code DECADES} + *
                              • {@code CENTURIES} + *
                              • {@code MILLENNIA} + *
                              • {@code ERAS} + *
                              + * All other {@code ChronoUnit} instances will return false. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override // override for Javadoc + public boolean isSupported(TemporalUnit unit) { + return ChronoZonedDateTime.super.isSupported(unit); + } + + //----------------------------------------------------------------------- /** * Gets the range of valid values for the specified field. *

                              @@ -1540,8 +1583,7 @@ public final class ZonedDateTime @Override public ZonedDateTime plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { - ChronoUnit u = (ChronoUnit) unit; - if (u.isDateUnit()) { + if (unit.isDateBased()) { return resolveLocal(dateTime.plus(amountToAdd, unit)); } else { return resolveInstant(dateTime.plus(amountToAdd, unit)); @@ -1990,7 +2032,7 @@ public final class ZonedDateTime * The start and end points are {@code this} and the specified date-time. * The result will be negative if the end is before the start. * For example, the period in days between two date-times can be calculated - * using {@code startDateTime.periodUntil(endDateTime, DAYS)}. + * using {@code startDateTime.until(endDateTime, DAYS)}. *

                              * The {@code Temporal} passed to this method must be a {@code ZonedDateTime}. * If the time-zone differs between the two zoned date-times, the specified @@ -2006,7 +2048,7 @@ public final class ZonedDateTime * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, MONTHS);
                              +     *   amount = start.until(end, MONTHS);
                                    *   amount = MONTHS.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -2047,7 +2089,7 @@ public final class ZonedDateTime * @throws ArithmeticException if numeric overflow occurs */ @Override - public long periodUntil(Temporal endDateTime, TemporalUnit unit) { + public long until(Temporal endDateTime, TemporalUnit unit) { if (endDateTime instanceof ZonedDateTime == false) { Objects.requireNonNull(endDateTime, "endDateTime"); throw new DateTimeException("Unable to calculate amount as objects are of two different types"); @@ -2055,11 +2097,10 @@ public final class ZonedDateTime if (unit instanceof ChronoUnit) { ZonedDateTime end = (ZonedDateTime) endDateTime; end = end.withZoneSameInstant(zone); - ChronoUnit u = (ChronoUnit) unit; - if (u.isDateUnit()) { - return dateTime.periodUntil(end.dateTime, unit); + if (unit.isDateBased()) { + return dateTime.until(end.dateTime, unit); } else { - return toOffsetDateTime().periodUntil(end.toOffsetDateTime(), unit); + return toOffsetDateTime().until(end.toOffsetDateTime(), unit); } } return unit.between(this, endDateTime); diff --git a/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java index 14e2bf58f2a..99ba58f05b9 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java @@ -67,6 +67,8 @@ import java.time.DateTimeException; import java.time.temporal.ChronoUnit; import java.time.temporal.Temporal; import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAmount; +import java.time.temporal.TemporalField; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; @@ -96,12 +98,12 @@ import java.util.Objects; * // Enumerate the list of available calendars and print today for each * Set<Chronology> chronos = Chronology.getAvailableChronologies(); * for (Chronology chrono : chronos) { - * ChronoLocalDate<?> date = chrono.dateNow(); + * ChronoLocalDate date = chrono.dateNow(); * System.out.printf(" %20s: %s%n", chrono.getID(), date.toString()); * } * * // Print the Hijrah date and calendar - * ChronoLocalDate<?> date = Chronology.of("Hijrah").dateNow(); + * ChronoLocalDate date = Chronology.of("Hijrah").dateNow(); * int day = date.get(ChronoField.DAY_OF_MONTH); * int dow = date.get(ChronoField.DAY_OF_WEEK); * int month = date.get(ChronoField.MONTH_OF_YEAR); @@ -110,10 +112,10 @@ import java.util.Objects; * dow, day, month, year); * // Print today's date and the last day of the year - * ChronoLocalDate<?> now1 = Chronology.of("Hijrah").dateNow(); - * ChronoLocalDate<?> first = now1.with(ChronoField.DAY_OF_MONTH, 1) + * ChronoLocalDate now1 = Chronology.of("Hijrah").dateNow(); + * ChronoLocalDate first = now1.with(ChronoField.DAY_OF_MONTH, 1) * .with(ChronoField.MONTH_OF_YEAR, 1); - * ChronoLocalDate<?> last = first.plus(1, ChronoUnit.YEARS) + * ChronoLocalDate last = first.plus(1, ChronoUnit.YEARS) * .minus(1, ChronoUnit.DAYS); * System.out.printf(" Today is %s: start: %s; end: %s%n", last.getChronology().getID(), * first, last); @@ -138,22 +140,61 @@ import java.util.Objects; * @param the ChronoLocalDate of this date-time * @since 1.8 */ -abstract class ChronoDateImpl> - implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable { +abstract class ChronoDateImpl + implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable { /** * Serialization version. */ private static final long serialVersionUID = 6282433883239719096L; + /** + * Casts the {@code Temporal} to {@code ChronoLocalDate} ensuring it bas the specified chronology. + * + * @param chrono the chronology to check for, not null + * @param temporal a date-time to cast, not null + * @return the date-time checked and cast to {@code ChronoLocalDate}, not null + * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDate + * or the chronology is not equal this Chronology + */ + static D ensureValid(Chronology chrono, Temporal temporal) { + @SuppressWarnings("unchecked") + D other = (D) temporal; + if (chrono.equals(other.getChronology()) == false) { + throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + other.getChronology().getId()); + } + return other; + } + + //----------------------------------------------------------------------- /** * Creates an instance. */ ChronoDateImpl() { } + @Override + @SuppressWarnings("unchecked") + public D with(TemporalAdjuster adjuster) { + return (D) ChronoLocalDate.super.with(adjuster); + } + + @Override + @SuppressWarnings("unchecked") + public D with(TemporalField field, long value) { + return (D) ChronoLocalDate.super.with(field, value); + } + //----------------------------------------------------------------------- @Override + @SuppressWarnings("unchecked") + public D plus(TemporalAmount amount) { + return (D) ChronoLocalDate.super.plus(amount); + } + + //----------------------------------------------------------------------- + @Override + @SuppressWarnings("unchecked") public D plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { ChronoUnit f = (ChronoUnit) unit; @@ -167,9 +208,21 @@ abstract class ChronoDateImpl> case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000)); case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd)); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return ChronoLocalDate.super.plus(amountToAdd, unit); + return (D) ChronoLocalDate.super.plus(amountToAdd, unit); + } + + @Override + @SuppressWarnings("unchecked") + public D minus(TemporalAmount amount) { + return (D) ChronoLocalDate.super.minus(amount); + } + + @Override + @SuppressWarnings("unchecked") + public D minus(long amountToSubtract, TemporalUnit unit) { + return (D) ChronoLocalDate.super.minus(amountToSubtract, unit); } //----------------------------------------------------------------------- @@ -254,6 +307,7 @@ abstract class ChronoDateImpl> * @return a date based on this one with the years subtracted, not null * @throws DateTimeException if the result exceeds the supported date range */ + @SuppressWarnings("unchecked") D minusYears(long yearsToSubtract) { return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract)); } @@ -274,6 +328,7 @@ abstract class ChronoDateImpl> * @return a date based on this one with the months subtracted, not null * @throws DateTimeException if the result exceeds the supported date range */ + @SuppressWarnings("unchecked") D minusMonths(long monthsToSubtract) { return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract)); } @@ -293,6 +348,7 @@ abstract class ChronoDateImpl> * @return a date based on this one with the weeks subtracted, not null * @throws DateTimeException if the result exceeds the supported date range */ + @SuppressWarnings("unchecked") D minusWeeks(long weeksToSubtract) { return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract)); } @@ -310,6 +366,7 @@ abstract class ChronoDateImpl> * @return a date based on this one with the days subtracted, not null * @throws DateTimeException if the result exceeds the supported date range */ + @SuppressWarnings("unchecked") D minusDays(long daysToSubtract) { return (daysToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract)); } @@ -321,13 +378,13 @@ abstract class ChronoDateImpl> * @throws ArithmeticException {@inheritDoc} */ @Override - public long periodUntil(Temporal endDateTime, TemporalUnit unit) { + public long until(Temporal endDateTime, TemporalUnit unit) { Objects.requireNonNull(endDateTime, "endDateTime"); Objects.requireNonNull(unit, "unit"); if (endDateTime instanceof ChronoLocalDate == false) { throw new DateTimeException("Unable to calculate amount as objects are of two different types"); } - ChronoLocalDate end = (ChronoLocalDate) endDateTime; + ChronoLocalDate end = (ChronoLocalDate) endDateTime; if (getChronology().equals(end.getChronology()) == false) { throw new DateTimeException("Unable to calculate amount as objects have different chronologies"); } @@ -342,16 +399,16 @@ abstract class ChronoDateImpl> case MILLENNIA: return monthsUntil(end) / 12000; case ERAS: return end.getLong(ERA) - getLong(ERA); } - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, endDateTime); } - private long daysUntil(ChronoLocalDate end) { + private long daysUntil(ChronoLocalDate end) { return end.toEpochDay() - toEpochDay(); // no overflow } - private long monthsUntil(ChronoLocalDate end) { + private long monthsUntil(ChronoLocalDate end) { ValueRange range = getChronology().range(MONTH_OF_YEAR); if (range.getMaximum() != 12) { throw new IllegalStateException("ChronoDateImpl only supports Chronologies with 12 months per year"); @@ -367,7 +424,7 @@ abstract class ChronoDateImpl> return true; } if (obj instanceof ChronoLocalDate) { - return compareTo((ChronoLocalDate) obj) == 0; + return compareTo((ChronoLocalDate) obj) == 0; } return false; } diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java index 31c08260d6e..923e8960b0f 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java @@ -242,11 +242,10 @@ import java.util.Objects; * Additional calendar systems may be added to the system. * See {@link Chronology} for more details. * - * @param the concrete type for the date * @since 1.8 */ -public interface ChronoLocalDate> - extends Temporal, TemporalAdjuster, Comparable> { +public interface ChronoLocalDate + extends Temporal, TemporalAdjuster, Comparable { /** * Gets a comparator that compares {@code ChronoLocalDate} in @@ -263,7 +262,7 @@ public interface ChronoLocalDate> * @see #isBefore * @see #isEqual */ - static Comparator> timeLineOrder() { + static Comparator timeLineOrder() { return Chronology.DATE_ORDER; } @@ -289,9 +288,9 @@ public interface ChronoLocalDate> * @throws DateTimeException if unable to convert to a {@code ChronoLocalDate} * @see Chronology#date(TemporalAccessor) */ - static ChronoLocalDate from(TemporalAccessor temporal) { + static ChronoLocalDate from(TemporalAccessor temporal) { if (temporal instanceof ChronoLocalDate) { - return (ChronoLocalDate) temporal; + return (ChronoLocalDate) temporal; } Chronology chrono = temporal.query(TemporalQuery.chronology()); if (chrono == null) { @@ -367,6 +366,25 @@ public interface ChronoLocalDate> return (isLeapYear() ? 366 : 365); } + /** + * Checks if the specified field is supported. + *

                              + * This checks if the specified field can be queried on this date. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. + *

                              + * The set of supported fields is defined by the chronology and normally includes + * all {@code ChronoField} date fields. + *

                              + * If the field is not a {@code ChronoField}, then the result of this method + * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + * passing {@code this} as the argument. + * Whether the field is supported is determined by the field. + * + * @param field the field to check, null returns false + * @return true if the field can be queried, false if not + */ @Override default boolean isSupported(TemporalField field) { if (field instanceof ChronoField) { @@ -375,6 +393,32 @@ public interface ChronoLocalDate> return field != null && field.isSupportedBy(this); } + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to or subtracted from this date. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * The set of supported units is defined by the chronology and normally includes + * all {@code ChronoUnit} date units except {@code FOREVER}. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override + default boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit.isDateBased(); + } + return unit != null && unit.isSupportedBy(this); + } + //----------------------------------------------------------------------- // override for covariant return type /** @@ -383,8 +427,8 @@ public interface ChronoLocalDate> * @throws ArithmeticException {@inheritDoc} */ @Override - default D with(TemporalAdjuster adjuster) { - return (D) getChronology().ensureChronoLocalDate(Temporal.super.with(adjuster)); + default ChronoLocalDate with(TemporalAdjuster adjuster) { + return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.with(adjuster)); } /** @@ -394,11 +438,11 @@ public interface ChronoLocalDate> * @throws ArithmeticException {@inheritDoc} */ @Override - default D with(TemporalField field, long newValue) { + default ChronoLocalDate with(TemporalField field, long newValue) { if (field instanceof ChronoField) { - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } - return (D) getChronology().ensureChronoLocalDate(field.adjustInto(this, newValue)); + return ChronoDateImpl.ensureValid(getChronology(), field.adjustInto(this, newValue)); } /** @@ -407,8 +451,8 @@ public interface ChronoLocalDate> * @throws ArithmeticException {@inheritDoc} */ @Override - default D plus(TemporalAmount amount) { - return (D) getChronology().ensureChronoLocalDate(Temporal.super.plus(amount)); + default ChronoLocalDate plus(TemporalAmount amount) { + return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount)); } /** @@ -417,11 +461,11 @@ public interface ChronoLocalDate> * @throws ArithmeticException {@inheritDoc} */ @Override - default D plus(long amountToAdd, TemporalUnit unit) { + default ChronoLocalDate plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { - throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName()); + throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } - return (D) getChronology().ensureChronoLocalDate(unit.addTo(this, amountToAdd)); + return ChronoDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd)); } /** @@ -430,8 +474,8 @@ public interface ChronoLocalDate> * @throws ArithmeticException {@inheritDoc} */ @Override - default D minus(TemporalAmount amount) { - return (D) getChronology().ensureChronoLocalDate(Temporal.super.minus(amount)); + default ChronoLocalDate minus(TemporalAmount amount) { + return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount)); } /** @@ -441,8 +485,8 @@ public interface ChronoLocalDate> * @throws ArithmeticException {@inheritDoc} */ @Override - default D minus(long amountToSubtract, TemporalUnit unit) { - return (D) getChronology().ensureChronoLocalDate(Temporal.super.minus(amountToSubtract, unit)); + default ChronoLocalDate minus(long amountToSubtract, TemporalUnit unit) { + return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit)); } //----------------------------------------------------------------------- @@ -522,14 +566,14 @@ public interface ChronoLocalDate> * The calculation returns a whole number, representing the number of * complete units between the two dates. * For example, the amount in days between two dates can be calculated - * using {@code startDate.periodUntil(endDate, DAYS)}. + * using {@code startDate.until(endDate, DAYS)}. *

                              * There are two equivalent ways of using this method. * The first is to invoke this method. * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                    *   // these two lines are equivalent
                              -     *   amount = start.periodUntil(end, MONTHS);
                              +     *   amount = start.until(end, MONTHS);
                                    *   amount = MONTHS.between(start, end);
                                    * 
                              * The choice should be made based on which makes the code more readable. @@ -555,7 +599,7 @@ public interface ChronoLocalDate> * @throws ArithmeticException if numeric overflow occurs */ @Override // override for Javadoc - long periodUntil(Temporal endDate, TemporalUnit unit); + long until(Temporal endDate, TemporalUnit unit); /** * Calculates the period between this date and another date as a {@code Period}. @@ -575,7 +619,7 @@ public interface ChronoLocalDate> * @throws DateTimeException if the period cannot be calculated * @throws ArithmeticException if numeric overflow occurs */ - Period periodUntil(ChronoLocalDate endDate); + Period until(ChronoLocalDate endDate); /** * Formats this date using the specified formatter. @@ -606,8 +650,9 @@ public interface ChronoLocalDate> * @param localTime the local time to use, not null * @return the local date-time formed from this date and the specified time, not null */ - default ChronoLocalDateTime atTime(LocalTime localTime) { - return (ChronoLocalDateTime)ChronoLocalDateTimeImpl.of(this, localTime); + @SuppressWarnings("unchecked") + default ChronoLocalDateTime atTime(LocalTime localTime) { + return ChronoLocalDateTimeImpl.of(this, localTime); } //----------------------------------------------------------------------- @@ -656,7 +701,7 @@ public interface ChronoLocalDate> * @return the comparator value, negative if less, positive if greater */ @Override - default int compareTo(ChronoLocalDate other) { + default int compareTo(ChronoLocalDate other) { int cmp = Long.compare(toEpochDay(), other.toEpochDay()); if (cmp == 0) { cmp = getChronology().compareTo(other.getChronology()); @@ -678,7 +723,7 @@ public interface ChronoLocalDate> * @param other the other date to compare to, not null * @return true if this is after the specified date */ - default boolean isAfter(ChronoLocalDate other) { + default boolean isAfter(ChronoLocalDate other) { return this.toEpochDay() > other.toEpochDay(); } @@ -696,7 +741,7 @@ public interface ChronoLocalDate> * @param other the other date to compare to, not null * @return true if this is before the specified date */ - default boolean isBefore(ChronoLocalDate other) { + default boolean isBefore(ChronoLocalDate other) { return this.toEpochDay() < other.toEpochDay(); } @@ -714,7 +759,7 @@ public interface ChronoLocalDate> * @param other the other date to compare to, not null * @return true if the underlying date is equal to the specified date */ - default boolean isEqual(ChronoLocalDate other) { + default boolean isEqual(ChronoLocalDate other) { return this.toEpochDay() == other.toEpochDay(); } diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java index f0a893a4c95..be93f0e036a 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java @@ -63,6 +63,7 @@ package java.time.chrono; import static java.time.temporal.ChronoField.EPOCH_DAY; import static java.time.temporal.ChronoField.NANO_OF_DAY; +import static java.time.temporal.ChronoUnit.FOREVER; import static java.time.temporal.ChronoUnit.NANOS; import java.time.DateTimeException; @@ -73,6 +74,7 @@ import java.time.ZoneId; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoField; +import java.time.temporal.ChronoUnit; import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; @@ -114,7 +116,7 @@ import java.util.Objects; * @param the concrete type for the date of this date-time * @since 1.8 */ -public interface ChronoLocalDateTime> +public interface ChronoLocalDateTime extends Temporal, TemporalAdjuster, Comparable> { /** @@ -191,9 +193,54 @@ public interface ChronoLocalDateTime> */ LocalTime toLocalTime(); - @Override // Override to provide javadoc + /** + * Checks if the specified field is supported. + *

                              + * This checks if the specified field can be queried on this date-time. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. + *

                              + * The set of supported fields is defined by the chronology and normally includes + * all {@code ChronoField} date and time fields. + *

                              + * If the field is not a {@code ChronoField}, then the result of this method + * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + * passing {@code this} as the argument. + * Whether the field is supported is determined by the field. + * + * @param field the field to check, null returns false + * @return true if the field can be queried, false if not + */ + @Override boolean isSupported(TemporalField field); + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to or subtracted from this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * The set of supported units is defined by the chronology and normally includes + * all {@code ChronoUnit} units except {@code FOREVER}. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override + default boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit != FOREVER; + } + return unit != null && unit.isSupportedBy(this); + } + //----------------------------------------------------------------------- // override for covariant return type /** @@ -203,7 +250,7 @@ public interface ChronoLocalDateTime> */ @Override default ChronoLocalDateTime with(TemporalAdjuster adjuster) { - return (ChronoLocalDateTime)(toLocalDate().getChronology().ensureChronoLocalDateTime(Temporal.super.with(adjuster))); + return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.with(adjuster)); } /** @@ -221,7 +268,7 @@ public interface ChronoLocalDateTime> */ @Override default ChronoLocalDateTime plus(TemporalAmount amount) { - return (ChronoLocalDateTime)(toLocalDate().getChronology().ensureChronoLocalDateTime(Temporal.super.plus(amount))); + return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.plus(amount)); } /** @@ -239,7 +286,7 @@ public interface ChronoLocalDateTime> */ @Override default ChronoLocalDateTime minus(TemporalAmount amount) { - return (ChronoLocalDateTime)(toLocalDate().getChronology().ensureChronoLocalDateTime(Temporal.super.minus(amount))); + return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amount)); } /** @@ -249,7 +296,7 @@ public interface ChronoLocalDateTime> */ @Override default ChronoLocalDateTime minus(long amountToSubtract, TemporalUnit unit) { - return (ChronoLocalDateTime)(toLocalDate().getChronology().ensureChronoLocalDateTime(Temporal.super.minus(amountToSubtract, unit))); + return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amountToSubtract, unit)); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java index 1f7195bc6f7..14f7bd927c2 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java @@ -98,7 +98,7 @@ import java.util.Objects; * @param the concrete type for the date of this date-time * @since 1.8 */ -final class ChronoLocalDateTimeImpl> +final class ChronoLocalDateTimeImpl implements ChronoLocalDateTime, Temporal, TemporalAdjuster, Serializable { /** @@ -171,9 +171,27 @@ final class ChronoLocalDateTimeImpl> * @param time the local time, not null * @return the local date-time, not null */ - @SuppressWarnings("rawtypes") - static ChronoLocalDateTimeImpl of(ChronoLocalDate date, LocalTime time) { - return new ChronoLocalDateTimeImpl(date, time); + static ChronoLocalDateTimeImpl of(R date, LocalTime time) { + return new ChronoLocalDateTimeImpl<>(date, time); + } + + /** + * Casts the {@code Temporal} to {@code ChronoLocalDateTime} ensuring it bas the specified chronology. + * + * @param chrono the chronology to check for, not null + * @param temporal a date-time to cast, not null + * @return the date-time checked and cast to {@code ChronoLocalDateTime}, not null + * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDateTimeImpl + * or the chronology is not equal this Chronology + */ + static ChronoLocalDateTimeImpl ensureValid(Chronology chrono, Temporal temporal) { + @SuppressWarnings("unchecked") + ChronoLocalDateTimeImpl other = (ChronoLocalDateTimeImpl) temporal; + if (chrono.equals(other.toLocalDate().getChronology()) == false) { + throw new ClassCastException("Chronology mismatch, required: " + chrono.getId() + + ", actual: " + other.toLocalDate().getChronology().getId()); + } + return other; } /** @@ -202,7 +220,7 @@ final class ChronoLocalDateTimeImpl> return this; } // Validate that the new Temporal is a ChronoLocalDate (and not something else) - D cd = (D) date.getChronology().ensureChronoLocalDate(newDate); + D cd = ChronoDateImpl.ensureValid(date.getChronology(), newDate); return new ChronoLocalDateTimeImpl<>(cd, newTime); } @@ -260,13 +278,13 @@ final class ChronoLocalDateTimeImpl> public ChronoLocalDateTimeImpl with(TemporalAdjuster adjuster) { if (adjuster instanceof ChronoLocalDate) { // The Chronology is checked in with(date,time) - return with((ChronoLocalDate) adjuster, time); + return with((ChronoLocalDate) adjuster, time); } else if (adjuster instanceof LocalTime) { return with(date, (LocalTime) adjuster); } else if (adjuster instanceof ChronoLocalDateTimeImpl) { - return (ChronoLocalDateTimeImpl)(date.getChronology().ensureChronoLocalDateTime((ChronoLocalDateTimeImpl) adjuster)); + return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), (ChronoLocalDateTimeImpl) adjuster); } - return (ChronoLocalDateTimeImpl)(date.getChronology().ensureChronoLocalDateTime((ChronoLocalDateTimeImpl) adjuster.adjustInto(this))); + return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), (ChronoLocalDateTimeImpl) adjuster.adjustInto(this)); } @Override @@ -279,7 +297,7 @@ final class ChronoLocalDateTimeImpl> return with(date.with(field, newValue), time); } } - return (ChronoLocalDateTimeImpl)(date.getChronology().ensureChronoLocalDateTime(field.adjustInto(this, newValue))); + return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), field.adjustInto(this, newValue)); } //----------------------------------------------------------------------- @@ -298,7 +316,7 @@ final class ChronoLocalDateTimeImpl> } return with(date.plus(amountToAdd, unit), time); } - return (ChronoLocalDateTimeImpl)(date.getChronology().ensureChronoLocalDateTime(unit.addTo(this, amountToAdd))); + return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), unit.addTo(this, amountToAdd)); } private ChronoLocalDateTimeImpl plusDays(long days) { @@ -322,7 +340,7 @@ final class ChronoLocalDateTimeImpl> } //----------------------------------------------------------------------- - private ChronoLocalDateTimeImpl plusWithOverflow(ChronoLocalDate newDate, long hours, long minutes, long seconds, long nanos) { + private ChronoLocalDateTimeImpl plusWithOverflow(D newDate, long hours, long minutes, long seconds, long nanos) { // 9223372036854775808 long, 2147483648 int if ((hours | minutes | seconds | nanos) == 0) { return with(newDate, time); @@ -351,7 +369,7 @@ final class ChronoLocalDateTimeImpl> //----------------------------------------------------------------------- @Override - public long periodUntil(Temporal endDateTime, TemporalUnit unit) { + public long until(Temporal endDateTime, TemporalUnit unit) { if (endDateTime instanceof ChronoLocalDateTime == false) { throw new DateTimeException("Unable to calculate amount as objects are of two different types"); } @@ -361,10 +379,9 @@ final class ChronoLocalDateTimeImpl> throw new DateTimeException("Unable to calculate amount as objects have different chronologies"); } if (unit instanceof ChronoUnit) { - ChronoUnit f = (ChronoUnit) unit; - if (f.isTimeUnit()) { + if (unit.isTimeBased()) { long amount = end.getLong(EPOCH_DAY) - date.getLong(EPOCH_DAY); - switch (f) { + switch ((ChronoUnit) unit) { case NANOS: amount = Math.multiplyExact(amount, NANOS_PER_DAY); break; case MICROS: amount = Math.multiplyExact(amount, MICROS_PER_DAY); break; case MILLIS: amount = Math.multiplyExact(amount, MILLIS_PER_DAY); break; @@ -373,13 +390,13 @@ final class ChronoLocalDateTimeImpl> case HOURS: amount = Math.multiplyExact(amount, HOURS_PER_DAY); break; case HALF_DAYS: amount = Math.multiplyExact(amount, 2); break; } - return Math.addExact(amount, time.periodUntil(end.toLocalTime(), unit)); + return Math.addExact(amount, time.until(end.toLocalTime(), unit)); } - D endDate = end.toLocalDate(); + ChronoLocalDate endDate = end.toLocalDate(); if (end.toLocalTime().isBefore(time)) { endDate = endDate.minus(1, ChronoUnit.DAYS); } - return date.periodUntil(endDate, unit); + return date.until(endDate, unit); } return unit.between(this, endDateTime); } @@ -404,7 +421,7 @@ final class ChronoLocalDateTimeImpl> } static ChronoLocalDateTime readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - ChronoLocalDate date = (ChronoLocalDate) in.readObject(); + ChronoLocalDate date = (ChronoLocalDate) in.readObject(); LocalTime time = (LocalTime) in.readObject(); return date.atTime(time); } diff --git a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java index d838a36ec29..dd911fcd789 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java @@ -63,6 +63,7 @@ package java.time.chrono; import static java.time.temporal.ChronoField.INSTANT_SECONDS; import static java.time.temporal.ChronoField.OFFSET_SECONDS; +import static java.time.temporal.ChronoUnit.FOREVER; import static java.time.temporal.ChronoUnit.NANOS; import java.time.DateTimeException; @@ -73,6 +74,7 @@ import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoField; +import java.time.temporal.ChronoUnit; import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; @@ -115,7 +117,7 @@ import java.util.Objects; * @param the concrete type for the date of this date-time * @since 1.8 */ -public interface ChronoZonedDateTime> +public interface ChronoZonedDateTime extends Temporal, Comparable> { /** @@ -338,9 +340,54 @@ public interface ChronoZonedDateTime> */ ChronoZonedDateTime withZoneSameInstant(ZoneId zone); - @Override // Override to provide javadoc + /** + * Checks if the specified field is supported. + *

                              + * This checks if the specified field can be queried on this date-time. + * If false, then calling the {@link #range(TemporalField) range}, + * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} + * methods will throw an exception. + *

                              + * The set of supported fields is defined by the chronology and normally includes + * all {@code ChronoField} fields. + *

                              + * If the field is not a {@code ChronoField}, then the result of this method + * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + * passing {@code this} as the argument. + * Whether the field is supported is determined by the field. + * + * @param field the field to check, null returns false + * @return true if the field can be queried, false if not + */ + @Override boolean isSupported(TemporalField field); + /** + * Checks if the specified unit is supported. + *

                              + * This checks if the specified unit can be added to or subtracted from this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + *

                              + * The set of supported units is defined by the chronology and normally includes + * all {@code ChronoUnit} units except {@code FOREVER}. + *

                              + * If the unit is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + * Whether the unit is supported is determined by the unit. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + @Override + default boolean isSupported(TemporalUnit unit) { + if (unit instanceof ChronoUnit) { + return unit != FOREVER; + } + return unit != null && unit.isSupportedBy(this); + } + //----------------------------------------------------------------------- // override for covariant return type /** @@ -350,7 +397,7 @@ public interface ChronoZonedDateTime> */ @Override default ChronoZonedDateTime with(TemporalAdjuster adjuster) { - return (ChronoZonedDateTime)(toLocalDate().getChronology().ensureChronoZonedDateTime(Temporal.super.with(adjuster))); + return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.with(adjuster)); } /** @@ -368,7 +415,7 @@ public interface ChronoZonedDateTime> */ @Override default ChronoZonedDateTime plus(TemporalAmount amount) { - return (ChronoZonedDateTime)(toLocalDate().getChronology().ensureChronoZonedDateTime(Temporal.super.plus(amount))); + return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.plus(amount)); } /** @@ -386,7 +433,7 @@ public interface ChronoZonedDateTime> */ @Override default ChronoZonedDateTime minus(TemporalAmount amount) { - return (ChronoZonedDateTime)(toLocalDate().getChronology().ensureChronoZonedDateTime(Temporal.super.minus(amount))); + return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amount)); } /** @@ -396,7 +443,7 @@ public interface ChronoZonedDateTime> */ @Override default ChronoZonedDateTime minus(long amountToSubtract, TemporalUnit unit) { - return (ChronoZonedDateTime)(toLocalDate().getChronology().ensureChronoZonedDateTime(Temporal.super.minus(amountToSubtract, unit))); + return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amountToSubtract, unit)); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java index 835ec932184..a39ed298d37 100644 --- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java +++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java @@ -101,7 +101,7 @@ import java.util.Objects; * @param the concrete type for the date of this date-time * @since 1.8 */ -final class ChronoZonedDateTimeImpl> +final class ChronoZonedDateTimeImpl implements ChronoZonedDateTime, Serializable { /** @@ -131,7 +131,7 @@ final class ChronoZonedDateTimeImpl> * @param preferredOffset the zone offset, null if no preference * @return the zoned date-time, not null */ - static > ChronoZonedDateTime ofBest( + static ChronoZonedDateTime ofBest( ChronoLocalDateTimeImpl localDateTime, ZoneId zone, ZoneOffset preferredOffset) { Objects.requireNonNull(localDateTime, "localDateTime"); Objects.requireNonNull(zone, "zone"); @@ -167,14 +167,13 @@ final class ChronoZonedDateTimeImpl> * @param zone the zone identifier, not null * @return the zoned date-time, not null */ - @SuppressWarnings("rawtypes") static ChronoZonedDateTimeImpl ofInstant(Chronology chrono, Instant instant, ZoneId zone) { ZoneRules rules = zone.getRules(); ZoneOffset offset = rules.getOffset(instant); Objects.requireNonNull(offset, "offset"); // protect against bad ZoneRules LocalDateTime ldt = LocalDateTime.ofEpochSecond(instant.getEpochSecond(), instant.getNano(), offset); - ChronoLocalDateTimeImpl cldt = (ChronoLocalDateTimeImpl) chrono.localDateTime(ldt); - return new ChronoZonedDateTimeImpl(cldt, offset, zone); + ChronoLocalDateTimeImpl cldt = (ChronoLocalDateTimeImpl)chrono.localDateTime(ldt); + return new ChronoZonedDateTimeImpl<>(cldt, offset, zone); } /** @@ -184,10 +183,30 @@ final class ChronoZonedDateTimeImpl> * @param zone the time-zone to use, validated not null * @return the zoned date-time, validated not null */ + @SuppressWarnings("unchecked") private ChronoZonedDateTimeImpl create(Instant instant, ZoneId zone) { return (ChronoZonedDateTimeImpl)ofInstant(toLocalDate().getChronology(), instant, zone); } + /** + * Casts the {@code Temporal} to {@code ChronoZonedDateTimeImpl} ensuring it bas the specified chronology. + * + * @param chrono the chronology to check for, not null + * @param temporal a date-time to cast, not null + * @return the date-time checked and cast to {@code ChronoZonedDateTimeImpl}, not null + * @throws ClassCastException if the date-time cannot be cast to ChronoZonedDateTimeImpl + * or the chronology is not equal this Chronology + */ + static ChronoZonedDateTimeImpl ensureValid(Chronology chrono, Temporal temporal) { + @SuppressWarnings("unchecked") + ChronoZonedDateTimeImpl other = (ChronoZonedDateTimeImpl) temporal; + if (chrono.equals(other.toLocalDate().getChronology()) == false) { + throw new ClassCastException("Chronology mismatch, required: " + chrono.getId() + + ", actual: " + other.toLocalDate().getChronology().getId()); + } + return other; + } + //----------------------------------------------------------------------- /** * Constructor. @@ -271,7 +290,7 @@ final class ChronoZonedDateTimeImpl> } return ofBest(dateTime.with(field, newValue), zone, offset); } - return (ChronoZonedDateTime)(toLocalDate().getChronology().ensureChronoZonedDateTime(field.adjustInto(this, newValue))); + return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), field.adjustInto(this, newValue)); } //----------------------------------------------------------------------- @@ -280,12 +299,12 @@ final class ChronoZonedDateTimeImpl> if (unit instanceof ChronoUnit) { return with(dateTime.plus(amountToAdd, unit)); } - return (ChronoZonedDateTime)(toLocalDate().getChronology().ensureChronoZonedDateTime(unit.addTo(this, amountToAdd))); /// TODO: Generics replacement Risk! + return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), unit.addTo(this, amountToAdd)); /// TODO: Generics replacement Risk! } //----------------------------------------------------------------------- @Override - public long periodUntil(Temporal endDateTime, TemporalUnit unit) { + public long until(Temporal endDateTime, TemporalUnit unit) { if (endDateTime instanceof ChronoZonedDateTime == false) { throw new DateTimeException("Unable to calculate amount as objects are of two different types"); } @@ -296,7 +315,7 @@ final class ChronoZonedDateTimeImpl> } if (unit instanceof ChronoUnit) { end = end.withZoneSameInstant(offset); - return dateTime.periodUntil(end.toLocalDateTime(), unit); + return dateTime.until(end.toLocalDateTime(), unit); } return unit.between(this, endDateTime); } diff --git a/jdk/src/share/classes/java/time/chrono/Chronology.java b/jdk/src/share/classes/java/time/chrono/Chronology.java index e5daae76464..561e2f794fa 100644 --- a/jdk/src/share/classes/java/time/chrono/Chronology.java +++ b/jdk/src/share/classes/java/time/chrono/Chronology.java @@ -74,6 +74,9 @@ import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import static java.time.temporal.ChronoField.PROLEPTIC_MONTH; import static java.time.temporal.ChronoField.YEAR; import static java.time.temporal.ChronoField.YEAR_OF_ERA; +import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.MONTHS; +import static java.time.temporal.ChronoUnit.WEEKS; import static java.time.temporal.TemporalAdjuster.nextOrSame; import java.io.DataInput; @@ -88,14 +91,16 @@ import java.time.DayOfWeek; import java.time.Instant; import java.time.LocalDate; import java.time.LocalTime; +import java.time.Month; +import java.time.Year; import java.time.ZoneId; import java.time.format.DateTimeFormatterBuilder; import java.time.format.ResolverStyle; import java.time.format.TextStyle; import java.time.temporal.ChronoField; -import java.time.temporal.ChronoUnit; import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; @@ -188,8 +193,8 @@ public abstract class Chronology implements Comparable { /** * ChronoLocalDate order constant. */ - static final Comparator> DATE_ORDER = - (Comparator> & Serializable) (date1, date2) -> { + static final Comparator DATE_ORDER = + (Comparator & Serializable) (date1, date2) -> { return Long.compare(date1.toEpochDay(), date2.toEpochDay()); }; /** @@ -480,60 +485,6 @@ public abstract class Chronology implements Comparable { protected Chronology() { } - //----------------------------------------------------------------------- - /** - * Casts the {@code Temporal} to {@code ChronoLocalDate} with the same chronology. - * - * @param temporal a date-time to cast, not null - * @return the date-time checked and cast to {@code ChronoLocalDate}, not null - * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDate - * or the chronology is not equal this Chronology - */ - ChronoLocalDate ensureChronoLocalDate(Temporal temporal) { - @SuppressWarnings("unchecked") - ChronoLocalDate other = (ChronoLocalDate) temporal; - if (this.equals(other.getChronology()) == false) { - throw new ClassCastException("Chronology mismatch, expected: " + getId() + ", actual: " + other.getChronology().getId()); - } - return other; - } - - /** - * Casts the {@code Temporal} to {@code ChronoLocalDateTime} with the same chronology. - * - * @param temporal a date-time to cast, not null - * @return the date-time checked and cast to {@code ChronoLocalDateTime}, not null - * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDateTimeImpl - * or the chronology is not equal this Chronology - */ - ChronoLocalDateTimeImpl ensureChronoLocalDateTime(Temporal temporal) { - @SuppressWarnings("unchecked") - ChronoLocalDateTimeImpl other = (ChronoLocalDateTimeImpl) temporal; - if (this.equals(other.toLocalDate().getChronology()) == false) { - throw new ClassCastException("Chronology mismatch, required: " + getId() - + ", supplied: " + other.toLocalDate().getChronology().getId()); - } - return other; - } - - /** - * Casts the {@code Temporal} to {@code ChronoZonedDateTimeImpl} with the same chronology. - * - * @param temporal a date-time to cast, not null - * @return the date-time checked and cast to {@code ChronoZonedDateTimeImpl}, not null - * @throws ClassCastException if the date-time cannot be cast to ChronoZonedDateTimeImpl - * or the chronology is not equal this Chronology - */ - ChronoZonedDateTimeImpl ensureChronoZonedDateTime(Temporal temporal) { - @SuppressWarnings("unchecked") - ChronoZonedDateTimeImpl other = (ChronoZonedDateTimeImpl) temporal; - if (this.equals(other.toLocalDate().getChronology()) == false) { - throw new ClassCastException("Chronology mismatch, required: " + getId() - + ", supplied: " + other.toLocalDate().getChronology().getId()); - } - return other; - } - //----------------------------------------------------------------------- /** * Gets the ID of the chronology. @@ -574,7 +525,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date * @throws ClassCastException if the {@code era} is not of the correct type for the chronology */ - public ChronoLocalDate date(Era era, int yearOfEra, int month, int dayOfMonth) { + public ChronoLocalDate date(Era era, int yearOfEra, int month, int dayOfMonth) { return date(prolepticYear(era, yearOfEra), month, dayOfMonth); } @@ -588,7 +539,7 @@ public abstract class Chronology implements Comparable { * @return the local date in this chronology, not null * @throws DateTimeException if unable to create the date */ - public abstract ChronoLocalDate date(int prolepticYear, int month, int dayOfMonth); + public abstract ChronoLocalDate date(int prolepticYear, int month, int dayOfMonth); /** * Obtains a local date in this chronology from the era, year-of-era and @@ -601,7 +552,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date * @throws ClassCastException if the {@code era} is not of the correct type for the chronology */ - public ChronoLocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { + public ChronoLocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); } @@ -614,7 +565,7 @@ public abstract class Chronology implements Comparable { * @return the local date in this chronology, not null * @throws DateTimeException if unable to create the date */ - public abstract ChronoLocalDate dateYearDay(int prolepticYear, int dayOfYear); + public abstract ChronoLocalDate dateYearDay(int prolepticYear, int dayOfYear); /** * Obtains a local date in this chronology from the epoch-day. @@ -626,7 +577,7 @@ public abstract class Chronology implements Comparable { * @return the local date in this chronology, not null * @throws DateTimeException if unable to create the date */ - public abstract ChronoLocalDate dateEpochDay(long epochDay); + public abstract ChronoLocalDate dateEpochDay(long epochDay); //----------------------------------------------------------------------- /** @@ -643,7 +594,7 @@ public abstract class Chronology implements Comparable { * @return the current local date using the system clock and default time-zone, not null * @throws DateTimeException if unable to create the date */ - public ChronoLocalDate dateNow() { + public ChronoLocalDate dateNow() { return dateNow(Clock.systemDefaultZone()); } @@ -660,7 +611,7 @@ public abstract class Chronology implements Comparable { * @return the current local date using the system clock, not null * @throws DateTimeException if unable to create the date */ - public ChronoLocalDate dateNow(ZoneId zone) { + public ChronoLocalDate dateNow(ZoneId zone) { return dateNow(Clock.system(zone)); } @@ -675,7 +626,7 @@ public abstract class Chronology implements Comparable { * @return the current local date, not null * @throws DateTimeException if unable to create the date */ - public ChronoLocalDate dateNow(Clock clock) { + public ChronoLocalDate dateNow(Clock clock) { Objects.requireNonNull(clock, "clock"); return date(LocalDate.now(clock)); } @@ -699,7 +650,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date * @see ChronoLocalDate#from(TemporalAccessor) */ - public abstract ChronoLocalDate date(TemporalAccessor temporal); + public abstract ChronoLocalDate date(TemporalAccessor temporal); /** * Obtains a local date-time in this chronology from another temporal object. @@ -722,7 +673,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date-time * @see ChronoLocalDateTime#from(TemporalAccessor) */ - public ChronoLocalDateTime localDateTime(TemporalAccessor temporal) { + public ChronoLocalDateTime localDateTime(TemporalAccessor temporal) { try { return date(temporal).atTime(LocalTime.from(temporal)); } catch (DateTimeException ex) { @@ -754,7 +705,7 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if unable to create the date-time * @see ChronoZonedDateTime#from(TemporalAccessor) */ - public ChronoZonedDateTime zonedDateTime(TemporalAccessor temporal) { + public ChronoZonedDateTime zonedDateTime(TemporalAccessor temporal) { try { ZoneId zone = ZoneId.from(temporal); try { @@ -762,8 +713,7 @@ public abstract class Chronology implements Comparable { return zonedDateTime(instant, zone); } catch (DateTimeException ex1) { - @SuppressWarnings("rawtypes") - ChronoLocalDateTimeImpl cldt = ensureChronoLocalDateTime(localDateTime(temporal)); + ChronoLocalDateTimeImpl cldt = ChronoLocalDateTimeImpl.ensureValid(this, localDateTime(temporal)); return ChronoZonedDateTimeImpl.ofBest(cldt, zone, null); } } catch (DateTimeException ex) { @@ -781,7 +731,7 @@ public abstract class Chronology implements Comparable { * @return the zoned date-time, not null * @throws DateTimeException if the result exceeds the supported range */ - public ChronoZonedDateTime zonedDateTime(Instant instant, ZoneId zone) { + public ChronoZonedDateTime zonedDateTime(Instant instant, ZoneId zone) { return ChronoZonedDateTimeImpl.ofInstant(this, instant, zone); } @@ -929,11 +879,82 @@ public abstract class Chronology implements Comparable { * As such, {@code ChronoField} date fields are resolved here in the * context of a specific chronology. *

                              + * {@code ChronoField} instances are resolved by this method, which may + * be overridden in subclasses. + *

                                + *
                              • {@code EPOCH_DAY} - If present, this is converted to a date and + * all other date fields are then cross-checked against the date. + *
                              • {@code PROLEPTIC_MONTH} - If present, then it is split into the + * {@code YEAR} and {@code MONTH_OF_YEAR}. If the mode is strict or smart + * then the field is validated. + *
                              • {@code YEAR_OF_ERA} and {@code ERA} - If both are present, then they + * are combined to form a {@code YEAR}. In lenient mode, the {@code YEAR_OF_ERA} + * range is not validated, in smart and strict mode it is. The {@code ERA} is + * validated for range in all three modes. If only the {@code YEAR_OF_ERA} is + * present, and the mode is smart or lenient, then the last available era + * is assumed. In strict mode, no era is assumed and the {@code YEAR_OF_ERA} is + * left untouched. If only the {@code ERA} is present, then it is left untouched. + *
                              • {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} - + * If all three are present, then they are combined to form a date. + * In all three modes, the {@code YEAR} is validated. + * If the mode is smart or strict, then the month and day are validated. + * If the mode is lenient, then the date is combined in a manner equivalent to + * creating a date on the first day of the first month in the requested year, + * then adding the difference in months, then the difference in days. + * If the mode is smart, and the day-of-month is greater than the maximum for + * the year-month, then the day-of-month is adjusted to the last day-of-month. + * If the mode is strict, then the three fields must form a valid date. + *
                              • {@code YEAR} and {@code DAY_OF_YEAR} - + * If both are present, then they are combined to form a date. + * In all three modes, the {@code YEAR} is validated. + * If the mode is lenient, then the date is combined in a manner equivalent to + * creating a date on the first day of the requested year, then adding + * the difference in days. + * If the mode is smart or strict, then the two fields must form a valid date. + *
                              • {@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and + * {@code ALIGNED_DAY_OF_WEEK_IN_MONTH} - + * If all four are present, then they are combined to form a date. + * In all three modes, the {@code YEAR} is validated. + * If the mode is lenient, then the date is combined in a manner equivalent to + * creating a date on the first day of the first month in the requested year, then adding + * the difference in months, then the difference in weeks, then in days. + * If the mode is smart or strict, then the all four fields are validated to + * their outer ranges. The date is then combined in a manner equivalent to + * creating a date on the first day of the requested year and month, then adding + * the amount in weeks and days to reach their values. If the mode is strict, + * the date is additionally validated to check that the day and week adjustment + * did not change the month. + *
                              • {@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and + * {@code DAY_OF_WEEK} - If all four are present, then they are combined to + * form a date. The approach is the same as described above for + * years, months and weeks in {@code ALIGNED_DAY_OF_WEEK_IN_MONTH}. + * The day-of-week is adjusted as the next or same matching day-of-week once + * the years, months and weeks have been handled. + *
                              • {@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code ALIGNED_DAY_OF_WEEK_IN_YEAR} - + * If all three are present, then they are combined to form a date. + * In all three modes, the {@code YEAR} is validated. + * If the mode is lenient, then the date is combined in a manner equivalent to + * creating a date on the first day of the requested year, then adding + * the difference in weeks, then in days. + * If the mode is smart or strict, then the all three fields are validated to + * their outer ranges. The date is then combined in a manner equivalent to + * creating a date on the first day of the requested year, then adding + * the amount in weeks and days to reach their values. If the mode is strict, + * the date is additionally validated to check that the day and week adjustment + * did not change the year. + *
                              • {@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code DAY_OF_WEEK} - + * If all three are present, then they are combined to form a date. + * The approach is the same as described above for years and weeks in + * {@code ALIGNED_DAY_OF_WEEK_IN_YEAR}. The day-of-week is adjusted as the + * next or same matching day-of-week once the years and weeks have been handled. + *
                              + *

                              * The default implementation is suitable for most calendar systems. * If {@link ChronoField#YEAR_OF_ERA} is found without an {@link ChronoField#ERA} * then the last era in {@link #eras()} is used. * The implementation assumes a 7 day week, that the first day-of-month - * has the value 1, and that first day-of-year has the value 1. + * has the value 1, that first day-of-year has the value 1, and that the + * first of the month and year always exists. * * @param fieldValues the map of fields to values, which can be updated, not null * @param resolverStyle the requested type of resolve, not null @@ -941,99 +962,214 @@ public abstract class Chronology implements Comparable { * @throws DateTimeException if the date cannot be resolved, typically * because of a conflict in the input data */ - public ChronoLocalDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { + public ChronoLocalDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { // check epoch-day before inventing era if (fieldValues.containsKey(EPOCH_DAY)) { return dateEpochDay(fieldValues.remove(EPOCH_DAY)); } // fix proleptic month before inventing era - Long pMonth = fieldValues.remove(PROLEPTIC_MONTH); - if (pMonth != null) { - // first day-of-month is likely to be safest for setting proleptic-month - // cannot add to year zero, as not all chronologies have a year zero - ChronoLocalDate chronoDate = dateNow() - .with(DAY_OF_MONTH, 1).with(PROLEPTIC_MONTH, pMonth); - addFieldValue(fieldValues, MONTH_OF_YEAR, chronoDate.get(MONTH_OF_YEAR)); - addFieldValue(fieldValues, YEAR, chronoDate.get(YEAR)); - } + resolveProlepticMonth(fieldValues, resolverStyle); // invent era if necessary to resolve year-of-era - Long yoeLong = fieldValues.remove(YEAR_OF_ERA); - if (yoeLong != null) { - Long eraLong = fieldValues.remove(ERA); - int yoe = range(YEAR_OF_ERA).checkValidIntValue(yoeLong, YEAR_OF_ERA); - if (eraLong != null) { - Era eraObj = eraOf(Math.toIntExact(eraLong)); - addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe)); - } else if (fieldValues.containsKey(YEAR)) { - int year = range(YEAR).checkValidIntValue(fieldValues.get(YEAR), YEAR); - ChronoLocalDate chronoDate = dateYearDay(year, 1); - addFieldValue(fieldValues, YEAR, prolepticYear(chronoDate.getEra(), yoe)); - } else { - List eras = eras(); - if (eras.isEmpty()) { - addFieldValue(fieldValues, YEAR, yoe); - } else { - Era eraObj = eras.get(eras.size() - 1); - addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe)); - } - } + ChronoLocalDate resolved = resolveYearOfEra(fieldValues, resolverStyle); + if (resolved != null) { + return resolved; } // build date if (fieldValues.containsKey(YEAR)) { if (fieldValues.containsKey(MONTH_OF_YEAR)) { if (fieldValues.containsKey(DAY_OF_MONTH)) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); - int dom = range(DAY_OF_MONTH).checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH); - return date(y, moy, dom); + return resolveYMD(fieldValues, resolverStyle); } if (fieldValues.containsKey(ALIGNED_WEEK_OF_MONTH)) { if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_MONTH)) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); - int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH); - int ad = range(ALIGNED_DAY_OF_WEEK_IN_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), ALIGNED_DAY_OF_WEEK_IN_MONTH); - ChronoLocalDate chronoDate = date(y, moy, 1); - return chronoDate.plus((aw - 1) * 7 + (ad - 1), ChronoUnit.DAYS); + return resolveYMAA(fieldValues, resolverStyle); } if (fieldValues.containsKey(DAY_OF_WEEK)) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); - int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH); - int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK); - ChronoLocalDate chronoDate = date(y, moy, 1); - return chronoDate.plus((aw - 1) * 7, ChronoUnit.DAYS).with(nextOrSame(DayOfWeek.of(dow))); + return resolveYMAD(fieldValues, resolverStyle); } } } if (fieldValues.containsKey(DAY_OF_YEAR)) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - int doy = range(DAY_OF_YEAR).checkValidIntValue(fieldValues.remove(DAY_OF_YEAR), DAY_OF_YEAR); - return dateYearDay(y, doy); + return resolveYD(fieldValues, resolverStyle); } if (fieldValues.containsKey(ALIGNED_WEEK_OF_YEAR)) { if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_YEAR)) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR); - int ad = range(ALIGNED_DAY_OF_WEEK_IN_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), ALIGNED_DAY_OF_WEEK_IN_YEAR); - ChronoLocalDate chronoDate = dateYearDay(y, 1); - return chronoDate.plus((aw - 1) * 7 + (ad - 1), ChronoUnit.DAYS); + return resolveYAA(fieldValues, resolverStyle); } if (fieldValues.containsKey(DAY_OF_WEEK)) { - int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); - int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR); - int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK); - ChronoLocalDate chronoDate = dateYearDay(y, 1); - return chronoDate.plus((aw - 1) * 7, ChronoUnit.DAYS).with(nextOrSame(DayOfWeek.of(dow))); + return resolveYAD(fieldValues, resolverStyle); } } } return null; } + void resolveProlepticMonth(Map fieldValues, ResolverStyle resolverStyle) { + Long pMonth = fieldValues.remove(PROLEPTIC_MONTH); + if (pMonth != null) { + if (resolverStyle != ResolverStyle.LENIENT) { + PROLEPTIC_MONTH.checkValidValue(pMonth); + } + // first day-of-month is likely to be safest for setting proleptic-month + // cannot add to year zero, as not all chronologies have a year zero + ChronoLocalDate chronoDate = dateNow() + .with(DAY_OF_MONTH, 1).with(PROLEPTIC_MONTH, pMonth); + addFieldValue(fieldValues, MONTH_OF_YEAR, chronoDate.get(MONTH_OF_YEAR)); + addFieldValue(fieldValues, YEAR, chronoDate.get(YEAR)); + } + } + + ChronoLocalDate resolveYearOfEra(Map fieldValues, ResolverStyle resolverStyle) { + Long yoeLong = fieldValues.remove(YEAR_OF_ERA); + if (yoeLong != null) { + Long eraLong = fieldValues.remove(ERA); + int yoe; + if (resolverStyle != ResolverStyle.LENIENT) { + yoe = range(YEAR_OF_ERA).checkValidIntValue(yoeLong, YEAR_OF_ERA); + } else { + yoe = Math.toIntExact(yoeLong); + } + if (eraLong != null) { + Era eraObj = eraOf(range(ERA).checkValidIntValue(eraLong, ERA)); + addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe)); + } else { + if (fieldValues.containsKey(YEAR)) { + int year = range(YEAR).checkValidIntValue(fieldValues.get(YEAR), YEAR); + ChronoLocalDate chronoDate = dateYearDay(year, 1); + addFieldValue(fieldValues, YEAR, prolepticYear(chronoDate.getEra(), yoe)); + } else if (resolverStyle == ResolverStyle.STRICT) { + // do not invent era if strict + // reinstate the field removed earlier, no cross-check issues + fieldValues.put(YEAR_OF_ERA, yoeLong); + } else { + List eras = eras(); + if (eras.isEmpty()) { + addFieldValue(fieldValues, YEAR, yoe); + } else { + Era eraObj = eras.get(eras.size() - 1); + addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe)); + } + } + } + } else if (fieldValues.containsKey(ERA)) { + range(ERA).checkValidValue(fieldValues.get(ERA), ERA); // always validated + } + return null; + } + + ChronoLocalDate resolveYMD(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); + long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1); + return date(y, 1, 1).plus(months, MONTHS).plus(days, DAYS); + } + int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); + ValueRange domRange = range(DAY_OF_MONTH); + int dom = domRange.checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH); + if (resolverStyle == ResolverStyle.SMART) { // previous valid + try { + return date(y, moy, dom); + } catch (DateTimeException ex) { + return date(y, moy, 1).with(TemporalAdjuster.lastDayOfMonth()); + } + } + return date(y, moy, dom); + } + + ChronoLocalDate resolveYD(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1); + return dateYearDay(y, 1).plus(days, DAYS); + } + int doy = range(DAY_OF_YEAR).checkValidIntValue(fieldValues.remove(DAY_OF_YEAR), DAY_OF_YEAR); + return dateYearDay(y, doy); // smart is same as strict + } + + ChronoLocalDate resolveYMAA(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); + long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); + long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), 1); + return date(y, 1, 1).plus(months, MONTHS).plus(weeks, WEEKS).plus(days, DAYS); + } + int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); + int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH); + int ad = range(ALIGNED_DAY_OF_WEEK_IN_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), ALIGNED_DAY_OF_WEEK_IN_MONTH); + ChronoLocalDate date = date(y, moy, 1).plus((aw - 1) * 7 + (ad - 1), DAYS); + if (resolverStyle == ResolverStyle.STRICT && date.get(MONTH_OF_YEAR) != moy) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); + } + return date; + } + + ChronoLocalDate resolveYMAD(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); + long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); + long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); + return resolveAligned(date(y, 1, 1), months, weeks, dow); + } + int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); + int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH); + int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK); + ChronoLocalDate date = date(y, moy, 1).plus((aw - 1) * 7, DAYS).with(nextOrSame(DayOfWeek.of(dow))); + if (resolverStyle == ResolverStyle.STRICT && date.get(MONTH_OF_YEAR) != moy) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); + } + return date; + } + + ChronoLocalDate resolveYAA(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1); + long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), 1); + return dateYearDay(y, 1).plus(weeks, WEEKS).plus(days, DAYS); + } + int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR); + int ad = range(ALIGNED_DAY_OF_WEEK_IN_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), ALIGNED_DAY_OF_WEEK_IN_YEAR); + ChronoLocalDate date = dateYearDay(y, 1).plus((aw - 1) * 7 + (ad - 1), DAYS); + if (resolverStyle == ResolverStyle.STRICT && date.get(YEAR) != y) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); + } + return date; + } + + ChronoLocalDate resolveYAD(Map fieldValues, ResolverStyle resolverStyle) { + int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR); + if (resolverStyle == ResolverStyle.LENIENT) { + long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1); + long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); + return resolveAligned(dateYearDay(y, 1), 0, weeks, dow); + } + int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR); + int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK); + ChronoLocalDate date = dateYearDay(y, 1).plus((aw - 1) * 7, DAYS).with(nextOrSame(DayOfWeek.of(dow))); + if (resolverStyle == ResolverStyle.STRICT && date.get(YEAR) != y) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); + } + return date; + } + + ChronoLocalDate resolveAligned(ChronoLocalDate base, long months, long weeks, long dow) { + ChronoLocalDate date = base.plus(months, MONTHS).plus(weeks, WEEKS); + if (dow > 7) { + date = date.plus((dow - 1) / 7, WEEKS); + dow = ((dow - 1) % 7) + 1; + } else if (dow < 1) { + date = date.plus(Math.subtractExact(dow, 7) / 7, WEEKS); + dow = ((dow + 6) % 7) + 1; + } + return date.with(nextOrSame(DayOfWeek.of((int) dow))); + } + /** * Adds a field-value pair to the map, checking for conflicts. *

                              diff --git a/jdk/src/share/classes/java/time/chrono/Era.java b/jdk/src/share/classes/java/time/chrono/Era.java index 330346dcc36..0fd31c9887d 100644 --- a/jdk/src/share/classes/java/time/chrono/Era.java +++ b/jdk/src/share/classes/java/time/chrono/Era.java @@ -238,7 +238,7 @@ public interface Era extends TemporalAccessor, TemporalAdjuster { if (field == ERA) { return getValue(); } else if (field instanceof ChronoField) { - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } diff --git a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java index 63dfc1c213b..c5061b05a32 100644 --- a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java +++ b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java @@ -71,8 +71,10 @@ import java.time.DateTimeException; import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; +import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalField; import java.time.temporal.ValueRange; import java.util.Arrays; import java.util.HashMap; @@ -115,7 +117,7 @@ import sun.util.logging.PlatformLogger; *

                              * * - * + * * * * @@ -126,10 +128,10 @@ import sun.util.logging.PlatformLogger; *

                              * Selecting the chronology from the locale uses {@link Chronology#ofLocale} * to find the Chronology based on Locale supported BCP 47 extension mechanism - * to request a specific calendar ("ca") and variant ("cv"). For example, + * to request a specific calendar ("ca"). For example, *

                              *
                              - *      Locale locale = Locale.forLanguageTag("en-US-u-ca-islamic-cv-umalqura");
                              + *      Locale locale = Locale.forLanguageTag("en-US-u-ca-islamic-umalqura");
                                *      Chronology chrono = Chronology.ofLocale(locale);
                                * 
                              * @@ -472,11 +474,16 @@ public final class HijrahChronology extends Chronology implements Serializable { * @param prolepticYear the proleptic-year * @param dayOfYear the day-of-year * @return the Hijrah local date, not null - * @throws DateTimeException if unable to create the date + * @throws DateTimeException if the value of the year is out of range, + * or if the day-of-year is invalid for the year */ @Override public HijrahDate dateYearDay(int prolepticYear, int dayOfYear) { - return HijrahDate.of(this, prolepticYear, 1, 1).plusDays(dayOfYear - 1); // TODO better + HijrahDate date = HijrahDate.of(this, prolepticYear, 1, 1); + if (dayOfYear > date.lengthOfYear()) { + throw new DateTimeException("Invalid dayOfYear: " + dayOfYear); + } + return date.plusDays(dayOfYear - 1); } /** @@ -515,16 +522,19 @@ public final class HijrahChronology extends Chronology implements Serializable { } @Override + @SuppressWarnings("unchecked") public ChronoLocalDateTime localDateTime(TemporalAccessor temporal) { return (ChronoLocalDateTime) super.localDateTime(temporal); } @Override + @SuppressWarnings("unchecked") public ChronoZonedDateTime zonedDateTime(TemporalAccessor temporal) { return (ChronoZonedDateTime) super.zonedDateTime(temporal); } @Override + @SuppressWarnings("unchecked") public ChronoZonedDateTime zonedDateTime(Instant instant, ZoneId zone) { return (ChronoZonedDateTime) super.zonedDateTime(instant, zone); } @@ -550,7 +560,7 @@ public final class HijrahChronology extends Chronology implements Serializable { } @Override - public Era eraOf(int eraValue) { + public HijrahEra eraOf(int eraValue) { switch (eraValue) { case 1: return HijrahEra.AH; @@ -580,6 +590,8 @@ public final class HijrahChronology extends Chronology implements Serializable { case YEAR: case YEAR_OF_ERA: return ValueRange.of(getMinimumYear(), getMaximumYear()); + case ERA: + return ValueRange.of(1, 1); default: return field.range(); } @@ -587,6 +599,13 @@ public final class HijrahChronology extends Chronology implements Serializable { return field.range(); } + //----------------------------------------------------------------------- + @Override // override for return type + public HijrahDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { + return (HijrahDate) super.resolveDate(fieldValues, resolverStyle); + } + + //----------------------------------------------------------------------- /** * Check the validity of a year. * diff --git a/jdk/src/share/classes/java/time/chrono/HijrahDate.java b/jdk/src/share/classes/java/time/chrono/HijrahDate.java index 3c01e94b980..ef40b6dc948 100644 --- a/jdk/src/share/classes/java/time/chrono/HijrahDate.java +++ b/jdk/src/share/classes/java/time/chrono/HijrahDate.java @@ -109,7 +109,7 @@ import java.time.temporal.ValueRange; */ public final class HijrahDate extends ChronoDateImpl - implements ChronoLocalDate, Serializable { + implements ChronoLocalDate, Serializable { /** * Serialization version. @@ -204,7 +204,7 @@ public final class HijrahDate * @throws DateTimeException if the current date cannot be obtained */ public static HijrahDate now(Clock clock) { - return HijrahChronology.INSTANCE.date(LocalDate.now(clock)); + return HijrahDate.ofEpochDay(HijrahChronology.INSTANCE, LocalDate.now(clock).toEpochDay()); } /** @@ -349,7 +349,7 @@ public final class HijrahDate } return getChronology().range(f); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.rangeRefinedBy(this); } @@ -372,7 +372,7 @@ public final class HijrahDate case YEAR: return prolepticYear; case ERA: return getEraValue(); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } @@ -393,7 +393,7 @@ public final class HijrahDate case ALIGNED_DAY_OF_WEEK_IN_MONTH: return plusDays(newValue - getLong(ALIGNED_DAY_OF_WEEK_IN_MONTH)); case ALIGNED_DAY_OF_WEEK_IN_YEAR: return plusDays(newValue - getLong(ALIGNED_DAY_OF_WEEK_IN_YEAR)); case DAY_OF_MONTH: return resolvePreviousValid(prolepticYear, monthOfYear, nvalue); - case DAY_OF_YEAR: return resolvePreviousValid(prolepticYear, ((nvalue - 1) / 30) + 1, ((nvalue - 1) % 30) + 1); + case DAY_OF_YEAR: return plusDays(Math.min(nvalue, lengthOfYear()) - getDayOfYear()); case EPOCH_DAY: return new HijrahDate(chrono, newValue); case ALIGNED_WEEK_OF_MONTH: return plusDays((newValue - getLong(ALIGNED_WEEK_OF_MONTH)) * 7); case ALIGNED_WEEK_OF_YEAR: return plusDays((newValue - getLong(ALIGNED_WEEK_OF_YEAR)) * 7); @@ -403,9 +403,9 @@ public final class HijrahDate case YEAR: return resolvePreviousValid(nvalue, monthOfYear, dayOfMonth); case ERA: return resolvePreviousValid(1 - prolepticYear, monthOfYear, dayOfMonth); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } - return ChronoLocalDate.super.with(field, newValue); + return super.with(field, newValue); } private HijrahDate resolvePreviousValid(int prolepticYear, int month, int day) { @@ -479,7 +479,7 @@ public final class HijrahDate * @return the day-of-year */ private int getDayOfYear() { - return chrono.getDayOfYear(prolepticYear, monthOfYear); + return chrono.getDayOfYear(prolepticYear, monthOfYear) + dayOfMonth; } /** @@ -575,12 +575,13 @@ public final class HijrahDate } @Override // for javadoc and covariant return type + @SuppressWarnings("unchecked") public final ChronoLocalDateTime atTime(LocalTime localTime) { - return super.atTime(localTime); + return (ChronoLocalDateTime)super.atTime(localTime); } @Override - public Period periodUntil(ChronoLocalDate endDate) { + public Period until(ChronoLocalDate endDate) { // TODO: untested HijrahDate end = getChronology().date(endDate); long totalMonths = (end.prolepticYear - this.prolepticYear) * 12 + (end.monthOfYear - this.monthOfYear); // safe @@ -622,7 +623,7 @@ public final class HijrahDate return this; } - static ChronoLocalDate readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + static HijrahDate readExternal(ObjectInput in) throws IOException, ClassNotFoundException { HijrahChronology chrono = (HijrahChronology) in.readObject(); int year = in.readInt(); int month = in.readByte(); diff --git a/jdk/src/share/classes/java/time/chrono/IsoChronology.java b/jdk/src/share/classes/java/time/chrono/IsoChronology.java index 66b0dc10d23..a2f6badeaa5 100644 --- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java +++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java @@ -61,25 +61,16 @@ */ package java.time.chrono; -import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH; -import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR; -import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH; -import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR; import static java.time.temporal.ChronoField.DAY_OF_MONTH; -import static java.time.temporal.ChronoField.DAY_OF_WEEK; -import static java.time.temporal.ChronoField.DAY_OF_YEAR; -import static java.time.temporal.ChronoField.EPOCH_DAY; import static java.time.temporal.ChronoField.ERA; import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import static java.time.temporal.ChronoField.PROLEPTIC_MONTH; import static java.time.temporal.ChronoField.YEAR; import static java.time.temporal.ChronoField.YEAR_OF_ERA; -import static java.time.temporal.TemporalAdjuster.nextOrSame; import java.io.Serializable; import java.time.Clock; import java.time.DateTimeException; -import java.time.DayOfWeek; import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; @@ -398,7 +389,7 @@ public final class IsoChronology extends Chronology implements Serializable { } @Override - public Era eraOf(int eraValue) { + public IsoEra eraOf(int eraValue) { return IsoEra.of(eraValue); } @@ -421,7 +412,7 @@ public final class IsoChronology extends Chronology implements Serializable { * as follows. *
                                *
                              • {@code EPOCH_DAY} - If present, this is converted to a {@code LocalDate} - * all other date fields are then cross-checked against the date + * and all other date fields are then cross-checked against the date. *
                              • {@code PROLEPTIC_MONTH} - If present, then it is split into the * {@code YEAR} and {@code MONTH_OF_YEAR}. If the mode is strict or smart * then the field is validated. @@ -430,7 +421,7 @@ public final class IsoChronology extends Chronology implements Serializable { * range is not validated, in smart and strict mode it is. The {@code ERA} is * validated for range in all three modes. If only the {@code YEAR_OF_ERA} is * present, and the mode is smart or lenient, then the current era (CE/AD) - * is assumed. In strict mode, no ers is assumed and the {@code YEAR_OF_ERA} is + * is assumed. In strict mode, no era is assumed and the {@code YEAR_OF_ERA} is * left untouched. If only the {@code ERA} is present, then it is left untouched. *
                              • {@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} - * If all three are present, then they are combined to form a {@code LocalDate}. @@ -495,48 +486,11 @@ public final class IsoChronology extends Chronology implements Serializable { */ @Override // override for performance public LocalDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { - // check epoch-day before inventing era - if (fieldValues.containsKey(EPOCH_DAY)) { - return LocalDate.ofEpochDay(fieldValues.remove(EPOCH_DAY)); - } - - // fix proleptic month before inventing era - resolveProlepticMonth(fieldValues, resolverStyle); - - // invent era if necessary to resolve year-of-era - resolveYearOfEra(fieldValues, resolverStyle); - - // build date - if (fieldValues.containsKey(YEAR)) { - if (fieldValues.containsKey(MONTH_OF_YEAR)) { - if (fieldValues.containsKey(DAY_OF_MONTH)) { - return resolveYMD(fieldValues, resolverStyle); - } - if (fieldValues.containsKey(ALIGNED_WEEK_OF_MONTH)) { - if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_MONTH)) { - return resolveYMAA(fieldValues, resolverStyle); - } - if (fieldValues.containsKey(DAY_OF_WEEK)) { - return resolveYMAD(fieldValues, resolverStyle); - } - } - } - if (fieldValues.containsKey(DAY_OF_YEAR)) { - return resolveYD(fieldValues, resolverStyle); - } - if (fieldValues.containsKey(ALIGNED_WEEK_OF_YEAR)) { - if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_YEAR)) { - return resolveYAA(fieldValues, resolverStyle); - } - if (fieldValues.containsKey(DAY_OF_WEEK)) { - return resolveYAD(fieldValues, resolverStyle); - } - } - } - return null; + return (LocalDate) super.resolveDate(fieldValues, resolverStyle); } - private void resolveProlepticMonth(Map fieldValues, ResolverStyle resolverStyle) { + @Override // override for better proleptic algorithm + void resolveProlepticMonth(Map fieldValues, ResolverStyle resolverStyle) { Long pMonth = fieldValues.remove(PROLEPTIC_MONTH); if (pMonth != null) { if (resolverStyle != ResolverStyle.LENIENT) { @@ -547,7 +501,8 @@ public final class IsoChronology extends Chronology implements Serializable { } } - private void resolveYearOfEra(Map fieldValues, ResolverStyle resolverStyle) { + @Override // override for enhanced behaviour + LocalDate resolveYearOfEra(Map fieldValues, ResolverStyle resolverStyle) { Long yoeLong = fieldValues.remove(YEAR_OF_ERA); if (yoeLong != null) { if (resolverStyle != ResolverStyle.LENIENT) { @@ -575,10 +530,14 @@ public final class IsoChronology extends Chronology implements Serializable { } else { throw new DateTimeException("Invalid value for era: " + era); } + } else if (fieldValues.containsKey(ERA)) { + ERA.checkValidValue(fieldValues.get(ERA)); // always validated } + return null; } - private LocalDate resolveYMD(Map fieldValues, ResolverStyle resolverStyle) { + @Override // override for performance + LocalDate resolveYMD(Map fieldValues, ResolverStyle resolverStyle) { int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR)); if (resolverStyle == ResolverStyle.LENIENT) { long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); @@ -598,96 +557,6 @@ public final class IsoChronology extends Chronology implements Serializable { return LocalDate.of(y, moy, dom); } - private LocalDate resolveYD(Map fieldValues, ResolverStyle resolverStyle) { - int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR)); - if (resolverStyle == ResolverStyle.LENIENT) { - long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1); - return LocalDate.of(y, 1, 1).plusDays(days); - } - int doy = DAY_OF_YEAR.checkValidIntValue(fieldValues.remove(DAY_OF_YEAR)); - return LocalDate.ofYearDay(y, doy); // smart is same as strict - } - - private LocalDate resolveYMAA(Map fieldValues, ResolverStyle resolverStyle) { - int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR)); - if (resolverStyle == ResolverStyle.LENIENT) { - long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); - long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); - long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), 1); - return LocalDate.of(y, 1, 1).plusMonths(months).plusWeeks(weeks).plusDays(days); - } - int moy = MONTH_OF_YEAR.checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR)); - int aw = ALIGNED_WEEK_OF_MONTH.checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH)); - int ad = ALIGNED_DAY_OF_WEEK_IN_MONTH.checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH)); - LocalDate date = LocalDate.of(y, moy, 1).plusDays((aw - 1) * 7 + (ad - 1)); - if (resolverStyle == ResolverStyle.STRICT && date.getMonthValue() != moy) { - throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); - } - return date; - } - - private LocalDate resolveYMAD(Map fieldValues, ResolverStyle resolverStyle) { - int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR)); - if (resolverStyle == ResolverStyle.LENIENT) { - long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); - long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); - long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); - return resolveAligned(y, months, weeks, dow); - } - int moy = MONTH_OF_YEAR.checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR)); - int aw = ALIGNED_WEEK_OF_MONTH.checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH)); - int dow = DAY_OF_WEEK.checkValidIntValue(fieldValues.remove(DAY_OF_WEEK)); - LocalDate date = LocalDate.of(y, moy, 1).plusDays((aw - 1) * 7).with(nextOrSame(DayOfWeek.of(dow))); - if (resolverStyle == ResolverStyle.STRICT && date.getMonthValue() != moy) { - throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); - } - return date; - } - - private LocalDate resolveYAA(Map fieldValues, ResolverStyle resolverStyle) { - int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR)); - if (resolverStyle == ResolverStyle.LENIENT) { - long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1); - long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), 1); - return LocalDate.of(y, 1, 1).plusWeeks(weeks).plusDays(days); - } - int aw = ALIGNED_WEEK_OF_YEAR.checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR)); - int ad = ALIGNED_DAY_OF_WEEK_IN_YEAR.checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR)); - LocalDate date = LocalDate.of(y, 1, 1).plusDays((aw - 1) * 7 + (ad - 1)); - if (resolverStyle == ResolverStyle.STRICT && date.getYear() != y) { - throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); - } - return date; - } - - private LocalDate resolveYAD(Map fieldValues, ResolverStyle resolverStyle) { - int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR)); - if (resolverStyle == ResolverStyle.LENIENT) { - long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1); - long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); - return resolveAligned(y, 0, weeks, dow); - } - int aw = ALIGNED_WEEK_OF_YEAR.checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR)); - int dow = DAY_OF_WEEK.checkValidIntValue(fieldValues.remove(DAY_OF_WEEK)); - LocalDate date = LocalDate.of(y, 1, 1).plusDays((aw - 1) * 7).with(nextOrSame(DayOfWeek.of(dow))); - if (resolverStyle == ResolverStyle.STRICT && date.getYear() != y) { - throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); - } - return date; - } - - private LocalDate resolveAligned(int y, long months, long weeks, long dow) { - LocalDate date = LocalDate.of(y, 1, 1).plusMonths(months).plusWeeks(weeks); - if (dow > 7) { - date = date.plusWeeks((dow - 1) / 7); - dow = ((dow - 1) % 7) + 1; - } else if (dow < 1) { - date = date.plusWeeks(Math.subtractExact(dow, 7) / 7); - dow = ((dow + 6) % 7) + 1; - } - return date.with(nextOrSame(DayOfWeek.of((int) dow))); - } - //----------------------------------------------------------------------- @Override public ValueRange range(ChronoField field) { diff --git a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java index 1aead71b8ad..68a12755ea3 100644 --- a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java +++ b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java @@ -56,6 +56,15 @@ */ package java.time.chrono; +import static java.time.temporal.ChronoField.DAY_OF_MONTH; +import static java.time.temporal.ChronoField.DAY_OF_YEAR; +import static java.time.temporal.ChronoField.ERA; +import static java.time.temporal.ChronoField.MONTH_OF_YEAR; +import static java.time.temporal.ChronoField.YEAR; +import static java.time.temporal.ChronoField.YEAR_OF_ERA; +import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.MONTHS; + import java.io.Serializable; import java.time.Clock; import java.time.DateTimeException; @@ -63,13 +72,18 @@ import java.time.Instant; import java.time.LocalDate; import java.time.Year; import java.time.ZoneId; +import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalField; +import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; import java.util.Arrays; import java.util.Calendar; import java.util.List; import java.util.Locale; +import java.util.Map; import sun.util.calendar.CalendarSystem; import sun.util.calendar.LocalGregorianCalendar; @@ -82,8 +96,22 @@ import sun.util.calendar.LocalGregorianCalendar; * The Japanese Imperial calendar system is the same as the ISO calendar system * apart from the era-based year numbering. *

                                - * Only Meiji (1865-04-07 - 1868-09-07) and later eras are supported. - * Older eras are handled as an unknown era where the year-of-era is the ISO year. + * Japan introduced the Gregorian calendar starting with Meiji 6. + * Only Meiji and later eras are supported; + * dates before Meiji 6, January 1 are not supported. + *

                                + * The supported {@code ChronoField} instances are: + *

                                  + *
                                • {@code DAY_OF_WEEK} + *
                                • {@code DAY_OF_MONTH} + *
                                • {@code DAY_OF_YEAR} + *
                                • {@code EPOCH_DAY} + *
                                • {@code MONTH_OF_YEAR} + *
                                • {@code PROLEPTIC_MONTH} + *
                                • {@code YEAR_OF_ERA} + *
                                • {@code YEAR} + *
                                • {@code ERA} + *
                                * * @implSpec * This class is immutable and thread-safe. @@ -91,7 +119,6 @@ import sun.util.calendar.LocalGregorianCalendar; * @since 1.8 */ public final class JapaneseChronology extends Chronology implements Serializable { - // TODO: definition for unknown era may break requirement that year-of-era >= 1 static final LocalGregorianCalendar JCAL = (LocalGregorianCalendar) CalendarSystem.forName("japanese"); @@ -152,6 +179,16 @@ public final class JapaneseChronology extends Chronology implements Serializable /** * Obtains a local date in Japanese calendar system from the * era, year-of-era, month-of-year and day-of-month fields. + *

                                + * The Japanese month and day-of-month are the same as those in the + * ISO calendar system. They are not reset when the era changes. + * For example: + *

                                +     *  6th Jan Showa 64 = ISO 1989-01-06
                                +     *  7th Jan Showa 64 = ISO 1989-01-07
                                +     *  8th Jan Heisei 1 = ISO 1989-01-08
                                +     *  9th Jan Heisei 1 = ISO 1989-01-09
                                +     * 
                                * * @param era the Japanese era, not null * @param yearOfEra the year-of-era @@ -172,6 +209,9 @@ public final class JapaneseChronology extends Chronology implements Serializable /** * Obtains a local date in Japanese calendar system from the * proleptic-year, month-of-year and day-of-month fields. + *

                                + * The Japanese proleptic year, month and day-of-month are the same as those + * in the ISO calendar system. They are not reset when the era changes. * * @param prolepticYear the proleptic-year * @param month the month-of-year @@ -187,6 +227,17 @@ public final class JapaneseChronology extends Chronology implements Serializable /** * Obtains a local date in Japanese calendar system from the * era, year-of-era and day-of-year fields. + *

                                + * The day-of-year in this factory is expressed relative to the start of the year-of-era. + * This definition changes the normal meaning of day-of-year only in those years + * where the year-of-era is reset to one due to a change in the era. + * For example: + *

                                +     *  6th Jan Showa 64 = day-of-year 6
                                +     *  7th Jan Showa 64 = day-of-year 7
                                +     *  8th Jan Heisei 1 = day-of-year 1
                                +     *  9th Jan Heisei 1 = day-of-year 2
                                +     * 
                                * * @param era the Japanese era, not null * @param yearOfEra the year-of-era @@ -203,6 +254,10 @@ public final class JapaneseChronology extends Chronology implements Serializable /** * Obtains a local date in Japanese calendar system from the * proleptic-year and day-of-year fields. + *

                                + * The day-of-year in this factory is expressed relative to the start of the proleptic year. + * The Japanese proleptic year and day-of-year are the same as those in the ISO calendar system. + * They are not reset when the era changes. * * @param prolepticYear the proleptic-year * @param dayOfYear the day-of-year @@ -211,8 +266,7 @@ public final class JapaneseChronology extends Chronology implements Serializable */ @Override public JapaneseDate dateYearDay(int prolepticYear, int dayOfYear) { - LocalDate date = LocalDate.ofYearDay(prolepticYear, dayOfYear); - return date(prolepticYear, date.getMonthValue(), date.getDayOfMonth()); + return new JapaneseDate(LocalDate.ofYearDay(prolepticYear, dayOfYear)); } /** @@ -290,15 +344,6 @@ public final class JapaneseChronology extends Chronology implements Serializable throw new ClassCastException("Era must be JapaneseEra"); } - if (era == JapaneseEra.SEIREKI) { - JapaneseEra nextEra = JapaneseEra.values()[1]; - int nextEraYear = nextEra.getPrivateEra().getSinceDate().getYear(); - if (yearOfEra >= nextEraYear || yearOfEra < Year.MIN_VALUE) { - throw new DateTimeException("Invalid yearOfEra value"); - } - return yearOfEra; - } - JapaneseEra jera = (JapaneseEra) era; int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1; if (yearOfEra == 1) { @@ -320,14 +365,13 @@ public final class JapaneseChronology extends Chronology implements Serializable * See the description of each Era for the numeric values of: * {@link JapaneseEra#HEISEI}, {@link JapaneseEra#SHOWA},{@link JapaneseEra#TAISHO}, * {@link JapaneseEra#MEIJI}), only Meiji and later eras are supported. - * Prior to Meiji {@link JapaneseEra#SEIREKI} is used. * * @param eraValue the era value * @return the Japanese {@code Era} for the given numeric era value * @throws DateTimeException if {@code eraValue} is invalid */ @Override - public Era eraOf(int eraValue) { + public JapaneseEra eraOf(int eraValue) { return JapaneseEra.of(eraValue); } @@ -346,49 +390,117 @@ public final class JapaneseChronology extends Chronology implements Serializable @Override public ValueRange range(ChronoField field) { switch (field) { - case YEAR: - case DAY_OF_MONTH: - case DAY_OF_WEEK: - case MICRO_OF_DAY: - case MICRO_OF_SECOND: - case HOUR_OF_DAY: - case HOUR_OF_AMPM: - case MINUTE_OF_DAY: - case MINUTE_OF_HOUR: - case SECOND_OF_DAY: - case SECOND_OF_MINUTE: - case MILLI_OF_DAY: - case MILLI_OF_SECOND: - case NANO_OF_DAY: - case NANO_OF_SECOND: - case CLOCK_HOUR_OF_DAY: - case CLOCK_HOUR_OF_AMPM: - case EPOCH_DAY: - case PROLEPTIC_MONTH: - case MONTH_OF_YEAR: - return field.range(); - case ERA: - return ValueRange.of(JapaneseEra.SEIREKI.getValue(), - getCurrentEra().getValue()); - } - Calendar jcal = Calendar.getInstance(LOCALE); - int fieldIndex; - switch (field) { + case ALIGNED_DAY_OF_WEEK_IN_MONTH: + case ALIGNED_DAY_OF_WEEK_IN_YEAR: + case ALIGNED_WEEK_OF_MONTH: + case ALIGNED_WEEK_OF_YEAR: + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); case YEAR_OF_ERA: { + Calendar jcal = Calendar.getInstance(LOCALE); int startYear = getCurrentEra().getPrivateEra().getSinceDate().getYear(); - return ValueRange.of(Year.MIN_VALUE, jcal.getGreatestMinimum(Calendar.YEAR), + return ValueRange.of(1, jcal.getGreatestMinimum(Calendar.YEAR), jcal.getLeastMaximum(Calendar.YEAR) + 1, // +1 due to the different definitions Year.MAX_VALUE - startYear); } - case DAY_OF_YEAR: - fieldIndex = Calendar.DAY_OF_YEAR; - break; + case DAY_OF_YEAR: { + Calendar jcal = Calendar.getInstance(LOCALE); + int fieldIndex = Calendar.DAY_OF_YEAR; + return ValueRange.of(jcal.getMinimum(fieldIndex), jcal.getGreatestMinimum(fieldIndex), + jcal.getLeastMaximum(fieldIndex), jcal.getMaximum(fieldIndex)); + } + case YEAR: + return ValueRange.of(JapaneseDate.MEIJI_6_ISODATE.getYear(), Year.MAX_VALUE); + case ERA: + return ValueRange.of(JapaneseEra.MEIJI.getValue(), getCurrentEra().getValue()); default: - // TODO: review the remaining fields - throw new UnsupportedOperationException("Unimplementable field: " + field); + return field.range(); } - return ValueRange.of(jcal.getMinimum(fieldIndex), jcal.getGreatestMinimum(fieldIndex), - jcal.getLeastMaximum(fieldIndex), jcal.getMaximum(fieldIndex)); + } + + //----------------------------------------------------------------------- + @Override // override for return type + public JapaneseDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { + return (JapaneseDate) super.resolveDate(fieldValues, resolverStyle); + } + + @Override // override for special Japanese behavior + ChronoLocalDate resolveYearOfEra(Map fieldValues, ResolverStyle resolverStyle) { + // validate era and year-of-era + Long eraLong = fieldValues.get(ERA); + JapaneseEra era = null; + if (eraLong != null) { + era = eraOf(range(ERA).checkValidIntValue(eraLong, ERA)); // always validated + } + Long yoeLong = fieldValues.get(YEAR_OF_ERA); + int yoe = 0; + if (yoeLong != null) { + yoe = range(YEAR_OF_ERA).checkValidIntValue(yoeLong, YEAR_OF_ERA); // always validated + } + // if only year-of-era and no year then invent era unless strict + if (era == null && yoeLong != null && fieldValues.containsKey(YEAR) == false && resolverStyle != ResolverStyle.STRICT) { + era = JapaneseEra.values()[JapaneseEra.values().length - 1]; + } + // if both present, then try to create date + if (yoeLong != null && era != null) { + if (fieldValues.containsKey(MONTH_OF_YEAR)) { + if (fieldValues.containsKey(DAY_OF_MONTH)) { + return resolveYMD(era, yoe, fieldValues, resolverStyle); + } + } + if (fieldValues.containsKey(DAY_OF_YEAR)) { + return resolveYD(era, yoe, fieldValues, resolverStyle); + } + } + return null; + } + + private int prolepticYearLenient(JapaneseEra era, int yearOfEra) { + return era.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1; + } + + private ChronoLocalDate resolveYMD(JapaneseEra era, int yoe, Map fieldValues, ResolverStyle resolverStyle) { + fieldValues.remove(ERA); + fieldValues.remove(YEAR_OF_ERA); + if (resolverStyle == ResolverStyle.LENIENT) { + int y = prolepticYearLenient(era, yoe); + long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); + long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1); + return date(y, 1, 1).plus(months, MONTHS).plus(days, DAYS); + } + int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR); + int dom = range(DAY_OF_MONTH).checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH); + if (resolverStyle == ResolverStyle.SMART) { // previous valid + if (yoe < 1) { + throw new DateTimeException("Invalid YearOfEra: " + yoe); + } + int y = prolepticYearLenient(era, yoe); + JapaneseDate result; + try { + result = date(y, moy, dom); + } catch (DateTimeException ex) { + result = date(y, moy, 1).with(TemporalAdjuster.lastDayOfMonth()); + } + // handle the era being changed + // only allow if the new date is in the same Jan-Dec as the era change + // determine by ensuring either original yoe or result yoe is 1 + if (result.getEra() != era && result.get(YEAR_OF_ERA) > 1 && yoe > 1) { + throw new DateTimeException("Invalid YearOfEra for Era: " + era + " " + yoe); + } + return result; + } + return date(era, yoe, moy, dom); + } + + private ChronoLocalDate resolveYD(JapaneseEra era, int yoe, Map fieldValues, ResolverStyle resolverStyle) { + fieldValues.remove(ERA); + fieldValues.remove(YEAR_OF_ERA); + if (resolverStyle == ResolverStyle.LENIENT) { + int y = prolepticYearLenient(era, yoe); + long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1); + return dateYearDay(y, 1).plus(days, DAYS); + } + int doy = range(DAY_OF_YEAR).checkValidIntValue(fieldValues.remove(DAY_OF_YEAR), DAY_OF_YEAR); + return dateYearDay(era, yoe, doy); // smart is same as strict } } diff --git a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java index 646315b3d80..e49a8f33c75 100644 --- a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java +++ b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java @@ -56,9 +56,15 @@ */ package java.time.chrono; +import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH; +import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR; +import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH; +import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR; import static java.time.temporal.ChronoField.DAY_OF_MONTH; +import static java.time.temporal.ChronoField.DAY_OF_YEAR; import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import static java.time.temporal.ChronoField.YEAR; +import static java.time.temporal.ChronoField.YEAR_OF_ERA; import java.io.DataInput; import java.io.DataOutput; @@ -96,6 +102,10 @@ import sun.util.calendar.LocalGregorianCalendar; * apart from the era-based year numbering. The proleptic-year is defined to be * equal to the ISO proleptic-year. *

                                + * Japan introduced the Gregorian calendar starting with Meiji 6. + * Only Meiji and later eras are supported; + * dates before Meiji 6, January 1 are not supported. + *

                                * For example, the Japanese year "Heisei 24" corresponds to ISO year "2012".
                                * Calling {@code japaneseDate.get(YEAR_OF_ERA)} will return 24.
                                * Calling {@code japaneseDate.get(YEAR)} will return 2012.
                                @@ -109,7 +119,7 @@ import sun.util.calendar.LocalGregorianCalendar; */ public final class JapaneseDate extends ChronoDateImpl - implements ChronoLocalDate, Serializable { + implements ChronoLocalDate, Serializable { /** * Serialization version. @@ -129,6 +139,11 @@ public final class JapaneseDate */ private transient int yearOfEra; + /** + * The first day supported by the JapaneseChronology is Meiji 6, January 1st. + */ + final static LocalDate MEIJI_6_ISODATE = LocalDate.of(1873, 1, 1); + //----------------------------------------------------------------------- /** * Obtains the current {@code JapaneseDate} from the system clock in the default time-zone. @@ -173,7 +188,7 @@ public final class JapaneseDate * @throws DateTimeException if the current date cannot be obtained */ public static JapaneseDate now(Clock clock) { - return JapaneseChronology.INSTANCE.date(LocalDate.now(clock)); + return new JapaneseDate(LocalDate.now(clock)); } /** @@ -182,6 +197,16 @@ public final class JapaneseDate *

                                * This returns a {@code JapaneseDate} with the specified fields. * The day must be valid for the year and month, otherwise an exception will be thrown. + *

                                + * The Japanese month and day-of-month are the same as those in the + * ISO calendar system. They are not reset when the era changes. + * For example: + *

                                +     *  6th Jan Showa 64 = ISO 1989-01-06
                                +     *  7th Jan Showa 64 = ISO 1989-01-07
                                +     *  8th Jan Heisei 1 = ISO 1989-01-08
                                +     *  9th Jan Heisei 1 = ISO 1989-01-09
                                +     * 
                                * * @param era the Japanese era, not null * @param yearOfEra the Japanese year-of-era @@ -192,11 +217,15 @@ public final class JapaneseDate * or if the day-of-month is invalid for the month-year, * or if the date is not a Japanese era */ - public static JapaneseDate of(Era era, int yearOfEra, int month, int dayOfMonth) { - if (era instanceof JapaneseEra == false) { - throw new ClassCastException("Era must be JapaneseEra"); + public static JapaneseDate of(JapaneseEra era, int yearOfEra, int month, int dayOfMonth) { + Objects.requireNonNull(era, "era"); + LocalGregorianCalendar.Date jdate = JapaneseChronology.JCAL.newCalendarDate(null); + jdate.setEra(era.getPrivateEra()).setDate(yearOfEra, month, dayOfMonth); + if (!JapaneseChronology.JCAL.validate(jdate)) { + throw new DateTimeException("year, month, and day not valid for Era"); } - return JapaneseDate.of((JapaneseEra) era, yearOfEra, month, dayOfMonth); + LocalDate date = LocalDate.of(jdate.getNormalizedYear(), month, dayOfMonth); + return new JapaneseDate(era, yearOfEra, date); } /** @@ -205,6 +234,9 @@ public final class JapaneseDate *

                                * This returns a {@code JapaneseDate} with the specified fields. * The day must be valid for the year and month, otherwise an exception will be thrown. + *

                                + * The Japanese proleptic year, month and day-of-month are the same as those + * in the ISO calendar system. They are not reset when the era changes. * * @param prolepticYear the Japanese proleptic-year * @param month the Japanese month-of-year, from 1 to 12 @@ -219,23 +251,31 @@ public final class JapaneseDate /** * Obtains a {@code JapaneseDate} representing a date in the Japanese calendar - * system from the proleptic-year and day-of-year fields. + * system from the era, year-of-era and day-of-year fields. *

                                * This returns a {@code JapaneseDate} with the specified fields. * The day must be valid for the year, otherwise an exception will be thrown. + *

                                + * The day-of-year in this factory is expressed relative to the start of the year-of-era. + * This definition changes the normal meaning of day-of-year only in those years + * where the year-of-era is reset to one due to a change in the era. + * For example: + *

                                +     *  6th Jan Showa 64 = day-of-year 6
                                +     *  7th Jan Showa 64 = day-of-year 7
                                +     *  8th Jan Heisei 1 = day-of-year 1
                                +     *  9th Jan Heisei 1 = day-of-year 2
                                +     * 
                                * - * @param prolepticYear the chronology proleptic-year + * @param era the Japanese era, not null + * @param yearOfEra the Japanese year-of-era * @param dayOfYear the chronology day-of-year, from 1 to 366 * @return the date in Japanese calendar system, not null * @throws DateTimeException if the value of any field is out of range, * or if the day-of-year is invalid for the year */ - public static JapaneseDate ofYearDay(int prolepticYear, int dayOfYear) { - LocalDate date = LocalDate.ofYearDay(prolepticYear, dayOfYear); - return of(prolepticYear, date.getMonthValue(), date.getDayOfMonth()); - } - static JapaneseDate ofYearDay(JapaneseEra era, int yearOfEra, int dayOfYear) { + Objects.requireNonNull(era, "era"); CalendarDate firstDay = era.getPrivateEra().getSinceDate(); LocalGregorianCalendar.Date jdate = JapaneseChronology.JCAL.newCalendarDate(null); jdate.setEra(era.getPrivateEra()); @@ -253,32 +293,6 @@ public final class JapaneseDate return new JapaneseDate(era, yearOfEra, localdate); } - /** - * Obtains a {@code JapaneseDate} representing a date in the Japanese calendar - * system from the era, year-of-era, month-of-year and day-of-month fields. - *

                                - * This returns a {@code JapaneseDate} with the specified fields. - * The day must be valid for the year and month, otherwise an exception will be thrown. - * - * @param era the Japanese era, not null - * @param yearOfEra the Japanese year-of-era - * @param month the Japanese month-of-year, from 1 to 12 - * @param dayOfMonth the Japanese day-of-month, from 1 to 31 - * @return the date in Japanese calendar system, not null - * @throws DateTimeException if the value of any field is out of range, - * or if the day-of-month is invalid for the month-year - */ - static JapaneseDate of(JapaneseEra era, int yearOfEra, int month, int dayOfMonth) { - Objects.requireNonNull(era, "era"); - LocalGregorianCalendar.Date jdate = JapaneseChronology.JCAL.newCalendarDate(null); - jdate.setEra(era.getPrivateEra()).setDate(yearOfEra, month, dayOfMonth); - if (!JapaneseChronology.JCAL.validate(jdate)) { - throw new DateTimeException("year, month, and day not valid for Era"); - } - LocalDate date = LocalDate.of(jdate.getNormalizedYear(), month, dayOfMonth); - return new JapaneseDate(era, yearOfEra, date); - } - /** * Obtains a {@code JapaneseDate} from a temporal object. *

                                @@ -307,6 +321,9 @@ public final class JapaneseDate * @param isoDate the standard local date, validated not null */ JapaneseDate(LocalDate isoDate) { + if (isoDate.isBefore(MEIJI_6_ISODATE)) { + throw new DateTimeException("JapaneseDate before Meiji 6 is not supported"); + } LocalGregorianCalendar.Date jdate = toPrivateJapaneseDate(isoDate); this.era = JapaneseEra.toJapaneseEra(jdate.getEra()); this.yearOfEra = jdate.getYear(); @@ -322,6 +339,9 @@ public final class JapaneseDate * @param isoDate the standard local date, validated not null */ JapaneseDate(JapaneseEra era, int year, LocalDate isoDate) { + if (isoDate.isBefore(MEIJI_6_ISODATE)) { + throw new DateTimeException("JapaneseDate before Meiji 6 is not supported"); + } this.era = era; this.yearOfEra = year; this.isoDate = isoDate; @@ -366,55 +386,99 @@ public final class JapaneseDate return isoDate.lengthOfMonth(); } + @Override + public int lengthOfYear() { + Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE); + jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET); + jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth()); + return jcal.getActualMaximum(Calendar.DAY_OF_YEAR); + } + //----------------------------------------------------------------------- + /** + * Checks if the specified field is supported. + *

                                + * This checks if this date can be queried for the specified field. + * If false, then calling the {@link #range(TemporalField) range} and + * {@link #get(TemporalField) get} methods will throw an exception. + *

                                + * If the field is a {@link ChronoField} then the query is implemented here. + * The supported fields are: + *

                                  + *
                                • {@code DAY_OF_WEEK} + *
                                • {@code DAY_OF_MONTH} + *
                                • {@code DAY_OF_YEAR} + *
                                • {@code EPOCH_DAY} + *
                                • {@code MONTH_OF_YEAR} + *
                                • {@code PROLEPTIC_MONTH} + *
                                • {@code YEAR_OF_ERA} + *
                                • {@code YEAR} + *
                                • {@code ERA} + *
                                + * All other {@code ChronoField} instances will return false. + *

                                + * If the field is not a {@code ChronoField}, then the result of this method + * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} + * passing {@code this} as the argument. + * Whether the field is supported is determined by the field. + * + * @param field the field to check, null returns false + * @return true if the field is supported on this date, false if not + */ + @Override + public boolean isSupported(TemporalField field) { + if (field == ALIGNED_DAY_OF_WEEK_IN_MONTH || field == ALIGNED_DAY_OF_WEEK_IN_YEAR || + field == ALIGNED_WEEK_OF_MONTH || field == ALIGNED_WEEK_OF_YEAR) { + return false; + } + return ChronoLocalDate.super.isSupported(field); + } + @Override public ValueRange range(TemporalField field) { if (field instanceof ChronoField) { if (isSupported(field)) { ChronoField f = (ChronoField) field; switch (f) { - case DAY_OF_MONTH: - case ALIGNED_WEEK_OF_MONTH: - return isoDate.range(field); - case DAY_OF_YEAR: - return actualRange(Calendar.DAY_OF_YEAR); - case YEAR_OF_ERA: - return actualRange(Calendar.YEAR); + case DAY_OF_MONTH: return ValueRange.of(1, lengthOfMonth()); + case DAY_OF_YEAR: return ValueRange.of(1, lengthOfYear()); + case YEAR_OF_ERA: { + Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE); + jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET); + jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth()); + return ValueRange.of(1, jcal.getActualMaximum(Calendar.YEAR)); + } } return getChronology().range(f); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.rangeRefinedBy(this); } - private ValueRange actualRange(int calendarField) { - Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE); - jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET); // TODO: cannot calculate this way for SEIREKI - jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth()); - return ValueRange.of(jcal.getActualMinimum(calendarField), - jcal.getActualMaximum(calendarField)); - } - @Override public long getLong(TemporalField field) { if (field instanceof ChronoField) { // same as ISO: - // DAY_OF_WEEK, ALIGNED_DAY_OF_WEEK_IN_MONTH, DAY_OF_MONTH, EPOCH_DAY, - // ALIGNED_WEEK_OF_MONTH, MONTH_OF_YEAR, PROLEPTIC_MONTH, YEAR + // DAY_OF_WEEK, DAY_OF_MONTH, EPOCH_DAY, MONTH_OF_YEAR, PROLEPTIC_MONTH, YEAR // // calendar specific fields - // ALIGNED_DAY_OF_WEEK_IN_YEAR, DAY_OF_YEAR, ALIGNED_WEEK_OF_YEAR, YEAR_OF_ERA, ERA + // DAY_OF_YEAR, YEAR_OF_ERA, ERA switch ((ChronoField) field) { + case ALIGNED_DAY_OF_WEEK_IN_MONTH: + case ALIGNED_DAY_OF_WEEK_IN_YEAR: + case ALIGNED_WEEK_OF_MONTH: + case ALIGNED_WEEK_OF_YEAR: + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); case YEAR_OF_ERA: return yearOfEra; case ERA: return era.getValue(); - case DAY_OF_YEAR: { - LocalGregorianCalendar.Date jdate = toPrivateJapaneseDate(isoDate); - return JapaneseChronology.JCAL.getDayOfYear(jdate); - } - // TODO: ALIGNED_DAY_OF_WEEK_IN_YEAR and ALIGNED_WEEK_OF_YEAR ??? + case DAY_OF_YEAR: + Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE); + jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET); + jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth()); + return jcal.get(Calendar.DAY_OF_YEAR); } return isoDate.getLong(field); } @@ -444,7 +508,7 @@ public final class JapaneseDate public JapaneseDate with(TemporalField field, long newValue) { if (field instanceof ChronoField) { ChronoField f = (ChronoField) field; - if (getLong(f) == newValue) { + if (getLong(f) == newValue) { // getLong() validates for supported fields return this; } switch (f) { @@ -464,10 +528,9 @@ public final class JapaneseDate } } // YEAR, PROLEPTIC_MONTH and others are same as ISO - // TODO: review other fields, such as WEEK_OF_YEAR return with(isoDate.with(field, newValue)); } - return ChronoLocalDate.super.with(field, newValue); + return super.with(field, newValue); } /** @@ -592,13 +655,14 @@ public final class JapaneseDate } @Override // for javadoc and covariant return type + @SuppressWarnings("unchecked") public final ChronoLocalDateTime atTime(LocalTime localTime) { - return super.atTime(localTime); + return (ChronoLocalDateTime)super.atTime(localTime); } @Override - public Period periodUntil(ChronoLocalDate endDate) { - return isoDate.periodUntil(endDate); + public Period until(ChronoLocalDate endDate) { + return isoDate.until(endDate); } @Override // override for performance @@ -624,14 +688,6 @@ public final class JapaneseDate return getChronology().getId().hashCode() ^ isoDate.hashCode(); } - @Override - public String toString() { - if (era == JapaneseEra.SEIREKI) { - return getChronology().getId() + " " + isoDate.toString(); - } - return super.toString(); - } - //----------------------------------------------------------------------- private Object writeReplace() { return new Ser(Ser.JAPANESE_DATE_TYPE, this); diff --git a/jdk/src/share/classes/java/time/chrono/JapaneseEra.java b/jdk/src/share/classes/java/time/chrono/JapaneseEra.java index 17635793b08..ba9fb434bf9 100644 --- a/jdk/src/share/classes/java/time/chrono/JapaneseEra.java +++ b/jdk/src/share/classes/java/time/chrono/JapaneseEra.java @@ -61,6 +61,7 @@ */ package java.time.chrono; +import static java.time.chrono.JapaneseDate.MEIJI_6_ISODATE; import static java.time.temporal.ChronoField.ERA; import java.io.DataInput; @@ -84,12 +85,9 @@ import sun.util.calendar.CalendarDate; * An era in the Japanese Imperial calendar system. *

                                * This class defines the valid eras for the Japanese chronology. - * Only Meiji (1868-09-08 - 1912-07-29) and later eras are supported. - * Japan introduced the Gregorian calendar since Meiji 6. The dates - * between Meiji 1 - 5 are not historically correct. - * The older eras are recognized as Seireki (Western calendar) era, - * and the year of era of Seireki is proleptic Gregorian year. - * (The Julian to Gregorian transition is not supported.) + * Japan introduced the Gregorian calendar starting with Meiji 6. + * Only Meiji and later eras are supported; + * dates before Meiji 6, January 1 are not supported. * * @implSpec * This class is immutable and thread-safe. @@ -100,16 +98,11 @@ public final class JapaneseEra implements Era, Serializable { // The offset value to 0-based index from the era value. - // i.e., getValue() + ERA_OFFSET == 0-based index; except that -999 is mapped to zero + // i.e., getValue() + ERA_OFFSET == 0-based index static final int ERA_OFFSET = 2; static final sun.util.calendar.Era[] ERA_CONFIG; - /** - * The singleton instance for the before Meiji era ( - 1868-09-07) - * which has the value -999. - */ - public static final JapaneseEra SEIREKI = new JapaneseEra(-999, LocalDate.MIN); /** * The singleton instance for the 'Meiji' era (1868-09-08 - 1912-07-29) * which has the value -1. @@ -144,17 +137,13 @@ public final class JapaneseEra private static final JapaneseEra[] KNOWN_ERAS; static { - sun.util.calendar.Era[] sunEras = JapaneseChronology.JCAL.getEras(); - ERA_CONFIG = new sun.util.calendar.Era[sunEras.length + 1]; - for (int i = 1; i < ERA_CONFIG.length; i++) { - ERA_CONFIG[i] = sunEras[i - 1]; - } + ERA_CONFIG = JapaneseChronology.JCAL.getEras(); + KNOWN_ERAS = new JapaneseEra[ERA_CONFIG.length]; - KNOWN_ERAS[0] = SEIREKI; - KNOWN_ERAS[1] = MEIJI; - KNOWN_ERAS[2] = TAISHO; - KNOWN_ERAS[3] = SHOWA; - KNOWN_ERAS[4] = HEISEI; + KNOWN_ERAS[0] = MEIJI; + KNOWN_ERAS[1] = TAISHO; + KNOWN_ERAS[2] = SHOWA; + KNOWN_ERAS[3] = HEISEI; for (int i = N_ERA_CONSTANTS; i < ERA_CONFIG.length; i++) { CalendarDate date = ERA_CONFIG[i].getSinceDate(); LocalDate isoDate = LocalDate.of(date.getYear(), date.getMonth(), date.getDayOfMonth()); @@ -203,10 +192,8 @@ public final class JapaneseEra //----------------------------------------------------------------------- /** * Returns the Sun private Era instance corresponding to this {@code JapaneseEra}. - * SEIREKI doesn't have its corresponding one. * - * @return the Sun private Era instance for this {@code JapaneseEra}, - * or null for SEIREKI. + * @return the Sun private Era instance for this {@code JapaneseEra}. */ sun.util.calendar.Era getPrivateEra() { return ERA_CONFIG[ordinal(eraValue)]; @@ -218,16 +205,14 @@ public final class JapaneseEra *

                                * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1 * Later era is numbered 2 ({@link #HEISEI}). Earlier eras are numbered 0 ({@link #TAISHO}), - * -1 ({@link #MEIJI}), only Meiji and later eras are supported. The prior to Meiji, - * {@link #SEIREKI} is used. + * -1 ({@link #MEIJI}), only Meiji and later eras are supported. * * @param japaneseEra the era to represent * @return the {@code JapaneseEra} singleton, not null * @throws DateTimeException if the value is invalid */ public static JapaneseEra of(int japaneseEra) { - if (japaneseEra != SEIREKI.eraValue && - (japaneseEra < MEIJI.eraValue || japaneseEra > HEISEI.eraValue)) { + if (japaneseEra < MEIJI.eraValue || japaneseEra > HEISEI.eraValue) { throw new DateTimeException("Invalid era: " + japaneseEra); } return KNOWN_ERAS[ordinal(japaneseEra)]; @@ -276,22 +261,25 @@ public final class JapaneseEra * @return the Era singleton, never null */ static JapaneseEra from(LocalDate date) { + if (date.isBefore(MEIJI_6_ISODATE)) { + throw new DateTimeException("JapaneseDate before Meiji 6 are not supported"); + } for (int i = KNOWN_ERAS.length - 1; i > 0; i--) { JapaneseEra era = KNOWN_ERAS[i]; if (date.compareTo(era.since) >= 0) { return era; } } - return SEIREKI; + return null; } static JapaneseEra toJapaneseEra(sun.util.calendar.Era privateEra) { - for (int i = ERA_CONFIG.length - 1; i > 0; i--) { + for (int i = ERA_CONFIG.length - 1; i >= 0; i--) { if (ERA_CONFIG[i].equals(privateEra)) { return KNOWN_ERAS[i]; } } - return SEIREKI; + return null; } static sun.util.calendar.Era privateEraFrom(LocalDate isoDate) { @@ -306,13 +294,13 @@ public final class JapaneseEra /** * Returns the index into the arrays from the Era value. - * the eraValue is a valid Era number, -999, -1..2. + * the eraValue is a valid Era number, -1..2. * * @param eraValue the era value to convert to the index * @return the index of the current Era */ private static int ordinal(int eraValue) { - return (eraValue == SEIREKI.eraValue) ? 0 : eraValue + ERA_OFFSET; + return eraValue + ERA_OFFSET - 1; } //----------------------------------------------------------------------- @@ -321,7 +309,7 @@ public final class JapaneseEra *

                                * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1. * Later eras are numbered from 2 ({@link #HEISEI}). - * Earlier eras are numbered 0 ({@link #TAISHO}), -1 ({@link #MEIJI}), and -999 ({@link #SEIREKI}). + * Earlier eras are numbered 0 ({@link #TAISHO}), -1 ({@link #MEIJI})). * * @return the era value */ @@ -374,11 +362,7 @@ public final class JapaneseEra } String getName() { - int index = ordinal(getValue()); - if (index == 0) { - return "Seireki"; - } - return ERA_CONFIG[index].getName(); + return ERA_CONFIG[ordinal(getValue())].getName(); } @Override diff --git a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java index 1c9c2e34c16..088588004c3 100644 --- a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java +++ b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java @@ -65,12 +65,15 @@ import java.time.DateTimeException; import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; +import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalField; import java.time.temporal.ValueRange; import java.util.Arrays; import java.util.List; import java.util.Locale; +import java.util.Map; /** * The Minguo calendar system. @@ -253,16 +256,19 @@ public final class MinguoChronology extends Chronology implements Serializable { } @Override + @SuppressWarnings("unchecked") public ChronoLocalDateTime localDateTime(TemporalAccessor temporal) { return (ChronoLocalDateTime)super.localDateTime(temporal); } @Override + @SuppressWarnings("unchecked") public ChronoZonedDateTime zonedDateTime(TemporalAccessor temporal) { return (ChronoZonedDateTime)super.zonedDateTime(temporal); } @Override + @SuppressWarnings("unchecked") public ChronoZonedDateTime zonedDateTime(Instant instant, ZoneId zone) { return (ChronoZonedDateTime)super.zonedDateTime(instant, zone); } @@ -292,7 +298,7 @@ public final class MinguoChronology extends Chronology implements Serializable { } @Override - public Era eraOf(int eraValue) { + public MinguoEra eraOf(int eraValue) { return MinguoEra.of(eraValue); } @@ -321,4 +327,10 @@ public final class MinguoChronology extends Chronology implements Serializable { return field.range(); } + //----------------------------------------------------------------------- + @Override // override for return type + public MinguoDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { + return (MinguoDate) super.resolveDate(fieldValues, resolverStyle); + } + } diff --git a/jdk/src/share/classes/java/time/chrono/MinguoDate.java b/jdk/src/share/classes/java/time/chrono/MinguoDate.java index b6a5582ef98..e15b0e90a15 100644 --- a/jdk/src/share/classes/java/time/chrono/MinguoDate.java +++ b/jdk/src/share/classes/java/time/chrono/MinguoDate.java @@ -96,7 +96,7 @@ import java.util.Objects; */ public final class MinguoDate extends ChronoDateImpl - implements ChronoLocalDate, Serializable { + implements ChronoLocalDate, Serializable { /** * Serialization version. @@ -152,7 +152,7 @@ public final class MinguoDate * @throws DateTimeException if the current date cannot be obtained */ public static MinguoDate now(Clock clock) { - return MinguoChronology.INSTANCE.date(LocalDate.now(clock)); + return new MinguoDate(LocalDate.now(clock)); } /** @@ -264,7 +264,7 @@ public final class MinguoDate } return getChronology().range(f); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.rangeRefinedBy(this); } @@ -325,7 +325,7 @@ public final class MinguoDate } return with(isoDate.with(field, newValue)); } - return ChronoLocalDate.super.with(field, newValue); + return super.with(field, newValue); } /** @@ -369,6 +369,11 @@ public final class MinguoDate return with(isoDate.plusMonths(months)); } + @Override + MinguoDate plusWeeks(long weeksToAdd) { + return super.plusWeeks(weeksToAdd); + } + @Override MinguoDate plusDays(long days) { return with(isoDate.plusDays(days)); @@ -384,11 +389,6 @@ public final class MinguoDate return super.minus(amountToAdd, unit); } - @Override - MinguoDate plusWeeks(long weeksToAdd) { - return super.plusWeeks(weeksToAdd); - } - @Override MinguoDate minusYears(long yearsToSubtract) { return super.minusYears(yearsToSubtract); @@ -414,13 +414,14 @@ public final class MinguoDate } @Override // for javadoc and covariant return type + @SuppressWarnings("unchecked") public final ChronoLocalDateTime atTime(LocalTime localTime) { - return super.atTime(localTime); + return (ChronoLocalDateTime)super.atTime(localTime); } @Override - public Period periodUntil(ChronoLocalDate endDate) { - return isoDate.periodUntil(endDate); + public Period until(ChronoLocalDate endDate) { + return isoDate.until(endDate); } @Override // override for performance @@ -458,7 +459,7 @@ public final class MinguoDate out.writeByte(get(DAY_OF_MONTH)); } - static ChronoLocalDate readExternal(DataInput in) throws IOException { + static MinguoDate readExternal(DataInput in) throws IOException { int year = in.readInt(); int month = in.readByte(); int dayOfMonth = in.readByte(); diff --git a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java index 27c98a6f079..04f59ceb93c 100644 --- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java +++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java @@ -65,13 +65,16 @@ import java.time.DateTimeException; import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; +import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalField; import java.time.temporal.ValueRange; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.Map; /** * The Thai Buddhist calendar system. @@ -289,16 +292,19 @@ public final class ThaiBuddhistChronology extends Chronology implements Serializ } @Override + @SuppressWarnings("unchecked") public ChronoLocalDateTime localDateTime(TemporalAccessor temporal) { return (ChronoLocalDateTime)super.localDateTime(temporal); } @Override + @SuppressWarnings("unchecked") public ChronoZonedDateTime zonedDateTime(TemporalAccessor temporal) { return (ChronoZonedDateTime)super.zonedDateTime(temporal); } @Override + @SuppressWarnings("unchecked") public ChronoZonedDateTime zonedDateTime(Instant instant, ZoneId zone) { return (ChronoZonedDateTime)super.zonedDateTime(instant, zone); } @@ -328,7 +334,7 @@ public final class ThaiBuddhistChronology extends Chronology implements Serializ } @Override - public Era eraOf(int eraValue) { + public ThaiBuddhistEra eraOf(int eraValue) { return ThaiBuddhistEra.of(eraValue); } @@ -357,4 +363,10 @@ public final class ThaiBuddhistChronology extends Chronology implements Serializ return field.range(); } + //----------------------------------------------------------------------- + @Override // override for return type + public ThaiBuddhistDate resolveDate(Map fieldValues, ResolverStyle resolverStyle) { + return (ThaiBuddhistDate) super.resolveDate(fieldValues, resolverStyle); + } + } diff --git a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java index 973c7b8ab0f..67799ad5af8 100644 --- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java +++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java @@ -96,7 +96,7 @@ import java.util.Objects; */ public final class ThaiBuddhistDate extends ChronoDateImpl - implements ChronoLocalDate, Serializable { + implements ChronoLocalDate, Serializable { /** * Serialization version. @@ -152,7 +152,7 @@ public final class ThaiBuddhistDate * @throws DateTimeException if the current date cannot be obtained */ public static ThaiBuddhistDate now(Clock clock) { - return ThaiBuddhistChronology.INSTANCE.date(LocalDate.now(clock)); + return new ThaiBuddhistDate(LocalDate.now(clock)); } /** @@ -264,7 +264,7 @@ public final class ThaiBuddhistDate } return getChronology().range(f); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.rangeRefinedBy(this); } @@ -325,7 +325,7 @@ public final class ThaiBuddhistDate } return with(isoDate.with(field, newValue)); } - return ChronoLocalDate.super.with(field, newValue); + return super.with(field, newValue); } /** @@ -414,13 +414,14 @@ public final class ThaiBuddhistDate } @Override // for javadoc and covariant return type + @SuppressWarnings("unchecked") public final ChronoLocalDateTime atTime(LocalTime localTime) { - return super.atTime(localTime); + return (ChronoLocalDateTime) super.atTime(localTime); } @Override - public Period periodUntil(ChronoLocalDate endDate) { - return isoDate.periodUntil(endDate); + public Period until(ChronoLocalDate endDate) { + return isoDate.until(endDate); } @Override // override for performance diff --git a/jdk/src/share/classes/java/time/chrono/package-info.java b/jdk/src/share/classes/java/time/chrono/package-info.java index 4f2a3f6e78c..9273a770f82 100644 --- a/jdk/src/share/classes/java/time/chrono/package-info.java +++ b/jdk/src/share/classes/java/time/chrono/package-info.java @@ -103,7 +103,7 @@ * // Enumerate the list of available calendars and print todays date for each. * Set<Chronology> chronos = Chronology.getAvailableChronologies(); * for (Chronology chrono : chronos) { - * ChronoLocalDate<?> date = chrono.dateNow(); + * ChronoLocalDate date = chrono.dateNow(); * System.out.printf(" %20s: %s%n", chrono.getId(), date.toString()); * } * @@ -113,7 +113,7 @@ *

                                *
                                  *   // Print the Thai Buddhist date
                                - *       ChronoLocalDate<?> now1 = Chronology.of("ThaiBuddhist").dateNow();
                                + *       ChronoLocalDate now1 = Chronology.of("ThaiBuddhist").dateNow();
                                  *       int day = now1.get(ChronoField.DAY_OF_MONTH);
                                  *       int dow = now1.get(ChronoField.DAY_OF_WEEK);
                                  *       int month = now1.get(ChronoField.MONTH_OF_YEAR);
                                @@ -121,10 +121,10 @@
                                  *       System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
                                  *                 dow, day, month, year);
                                  *   // Print today's date and the last day of the year for the Thai Buddhist Calendar.
                                - *       ChronoLocalDate<?> first = now1
                                + *       ChronoLocalDate first = now1
                                  *                 .with(ChronoField.DAY_OF_MONTH, 1)
                                  *                 .with(ChronoField.MONTH_OF_YEAR, 1);
                                - *       ChronoLocalDate<?> last = first
                                + *       ChronoLocalDate last = first
                                  *                 .plus(1, ChronoUnit.YEARS)
                                  *                 .minus(1, ChronoUnit.DAYS);
                                  *       System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
                                diff --git a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java
                                index 2552f96e5ad..0c0a5979b14 100644
                                --- a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java
                                +++ b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java
                                @@ -265,7 +265,7 @@ import java.util.Set;
                                  * 

                                * For example: *

                                - *  DateTimeFormatter formatter = DateTimeFormatter.pattern("yyyy MM dd");
                                + *  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd");
                                  *  String text = date.toString(formatter);
                                  *  LocalDate date = LocalDate.parse(text, formatter);
                                  * 
                                @@ -460,7 +460,7 @@ import java.util.Set; *
                              • The {@code ChronoField} time fields are resolved. * This is documented on {@link ChronoField} and is the same for all chronologies. *
                              • Any fields that are not {@code ChronoField} are processed. - * This is achieved using {@link TemporalField#resolve(TemporalAccessor, long, ResolverStyle)}. + * This is achieved using {@link TemporalField#resolve(Map, Chronology, ZoneId, ResolverStyle)}. * Documentation about field resolution is located in the implementation * of {@code TemporalField}. *
                              • The {@code ChronoField} date and time fields are re-resolved. diff --git a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java index cec07840439..f4983b48861 100644 --- a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java +++ b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java @@ -77,7 +77,6 @@ import java.math.BigInteger; import java.math.RoundingMode; import java.text.ParsePosition; import java.time.DateTimeException; -import java.time.Duration; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; @@ -962,12 +961,9 @@ public final class DateTimeFormatterBuilder { *
                                      *   "Europe/London"           -- ZoneId.of("Europe/London")
                                      *   "Z"                       -- ZoneOffset.UTC
                                -     *   "UT"                      -- ZoneOffset.UTC
                                -     *   "UTC"                     -- ZoneOffset.UTC
                                -     *   "GMT"                     -- ZoneOffset.UTC
                                -     *   "UT0"                     -- ZoneOffset.UTC
                                -     *   "UTC0"                    -- ZoneOffset.UTC
                                -     *   "GMT0"                    -- ZoneOffset.UTC
                                +     *   "UT"                      -- ZoneId.of("UT")
                                +     *   "UTC"                     -- ZoneId.of("UTC")
                                +     *   "GMT"                     -- ZoneId.of("GMT")
                                      *   "+01:30"                  -- ZoneOffset.of("+01:30")
                                      *   "UT+01:30"                -- ZoneOffset.of("+01:30")
                                      *   "UTC+01:30"               -- ZoneOffset.of("+01:30")
                                @@ -1016,12 +1012,9 @@ public final class DateTimeFormatterBuilder {
                                      * 
                                      *   "Europe/London"           -- ZoneId.of("Europe/London")
                                      *   "Z"                       -- ZoneOffset.UTC
                                -     *   "UT"                      -- ZoneOffset.UTC
                                -     *   "UTC"                     -- ZoneOffset.UTC
                                -     *   "GMT"                     -- ZoneOffset.UTC
                                -     *   "UT0"                     -- ZoneOffset.UTC
                                -     *   "UTC0"                    -- ZoneOffset.UTC
                                -     *   "GMT0"                    -- ZoneOffset.UTC
                                +     *   "UT"                      -- ZoneId.of("UT")
                                +     *   "UTC"                     -- ZoneId.of("UTC")
                                +     *   "GMT"                     -- ZoneId.of("GMT")
                                      *   "+01:30"                  -- ZoneOffset.of("+01:30")
                                      *   "UT+01:30"                -- ZoneOffset.of("+01:30")
                                      *   "UTC+01:30"               -- ZoneOffset.of("+01:30")
                                @@ -1077,16 +1070,13 @@ public final class DateTimeFormatterBuilder {
                                      * 
                                      *   "Europe/London"           -- ZoneId.of("Europe/London")
                                      *   "Z"                       -- ZoneOffset.UTC
                                -     *   "UT"                      -- ZoneOffset.UTC
                                -     *   "UTC"                     -- ZoneOffset.UTC
                                -     *   "GMT"                     -- ZoneOffset.UTC
                                -     *   "UT0"                     -- ZoneOffset.UTC
                                -     *   "UTC0"                    -- ZoneOffset.UTC
                                -     *   "GMT0"                    -- ZoneOffset.UTC
                                +     *   "UT"                      -- ZoneId.of("UT")
                                +     *   "UTC"                     -- ZoneId.of("UTC")
                                +     *   "GMT"                     -- ZoneId.of("GMT")
                                      *   "+01:30"                  -- ZoneOffset.of("+01:30")
                                -     *   "UT+01:30"                -- ZoneOffset.of("+01:30")
                                -     *   "UTC+01:30"               -- ZoneOffset.of("+01:30")
                                -     *   "GMT+01:30"               -- ZoneOffset.of("+01:30")
                                +     *   "UT+01:30"                -- ZoneOffset.of("UT+01:30")
                                +     *   "UTC+01:30"               -- ZoneOffset.of("UTC+01:30")
                                +     *   "GMT+01:30"               -- ZoneOffset.of("GMT+01:30")
                                      * 
                                *

                                * Note that this method is is identical to {@code appendZoneId()} except @@ -2530,7 +2520,7 @@ public final class DateTimeFormatterBuilder { DecimalStyle decimalStyle = context.getDecimalStyle(); String str = (value == Long.MIN_VALUE ? "9223372036854775808" : Long.toString(Math.abs(value))); if (str.length() > maxWidth) { - throw new DateTimeException("Field " + field.getName() + + throw new DateTimeException("Field " + field + " cannot be printed as the value " + value + " exceeds the maximum print width of " + maxWidth); } @@ -2555,7 +2545,7 @@ public final class DateTimeFormatterBuilder { buf.append(decimalStyle.getNegativeSign()); break; case NOT_NEGATIVE: - throw new DateTimeException("Field " + field.getName() + + throw new DateTimeException("Field " + field + " cannot be printed as the value " + value + " cannot be negative according to the SignStyle"); } @@ -2699,12 +2689,12 @@ public final class DateTimeFormatterBuilder { @Override public String toString() { if (minWidth == 1 && maxWidth == 19 && signStyle == SignStyle.NORMAL) { - return "Value(" + field.getName() + ")"; + return "Value(" + field + ")"; } if (minWidth == maxWidth && signStyle == SignStyle.NOT_NEGATIVE) { - return "Value(" + field.getName() + "," + minWidth + ")"; + return "Value(" + field + "," + minWidth + ")"; } - return "Value(" + field.getName() + "," + minWidth + "," + maxWidth + "," + signStyle + ")"; + return "Value(" + field + "," + minWidth + "," + maxWidth + "," + signStyle + ")"; } } @@ -2817,7 +2807,7 @@ public final class DateTimeFormatterBuilder { @Override public String toString() { - return "ReducedValue(" + field.getName() + "," + minWidth + "," + maxWidth + "," + baseValue + ")"; + return "ReducedValue(" + field + "," + minWidth + "," + maxWidth + "," + baseValue + ")"; } } @@ -2842,7 +2832,7 @@ public final class DateTimeFormatterBuilder { FractionPrinterParser(TemporalField field, int minWidth, int maxWidth, boolean decimalPoint) { Objects.requireNonNull(field, "field"); if (field.range().isFixed() == false) { - throw new IllegalArgumentException("Field must have a fixed set of values: " + field.getName()); + throw new IllegalArgumentException("Field must have a fixed set of values: " + field); } if (minWidth < 0 || minWidth > 9) { throw new IllegalArgumentException("Minimum width must be from 0 to 9 inclusive but was " + minWidth); @@ -2984,7 +2974,7 @@ public final class DateTimeFormatterBuilder { @Override public String toString() { String decimal = (decimalPoint ? ",DecimalPoint" : ""); - return "Fraction(" + field.getName() + "," + minWidth + "," + maxWidth + decimal + ")"; + return "Fraction(" + field + "," + minWidth + "," + maxWidth + decimal + ")"; } } @@ -3079,9 +3069,9 @@ public final class DateTimeFormatterBuilder { @Override public String toString() { if (textStyle == TextStyle.FULL) { - return "Text(" + field.getName() + ")"; + return "Text(" + field + ")"; } - return "Text(" + field.getName() + "," + textStyle + ")"; + return "Text(" + field + "," + textStyle + ")"; } } @@ -3756,17 +3746,17 @@ public final class DateTimeFormatterBuilder { // handle fixed time-zone IDs char nextChar = text.charAt(position); if (nextChar == '+' || nextChar == '-') { - return parseOffsetBased(context, text, position, OffsetIdPrinterParser.INSTANCE_ID_Z); + return parseOffsetBased(context, text, position, position, OffsetIdPrinterParser.INSTANCE_ID_Z); } else if (length >= position + 2) { char nextNextChar = text.charAt(position + 1); if (context.charEquals(nextChar, 'U') && context.charEquals(nextNextChar, 'T')) { if (length >= position + 3 && context.charEquals(text.charAt(position + 2), 'C')) { - return parseOffsetBased(context, text, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO); + return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO); } - return parseOffsetBased(context, text, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO); + return parseOffsetBased(context, text, position, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO); } else if (context.charEquals(nextChar, 'G') && length >= position + 3 && context.charEquals(nextNextChar, 'M') && context.charEquals(text.charAt(position + 2), 'T')) { - return parseOffsetBased(context, text, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO); + return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO); } } @@ -3785,20 +3775,49 @@ public final class DateTimeFormatterBuilder { return ppos.getIndex(); } - private int parseOffsetBased(DateTimeParseContext context, CharSequence text, int position, OffsetIdPrinterParser parser) { - DateTimeParseContext newContext = context.copy(); - int endPos = parser.parse(newContext, text, position); - if (endPos < 0) { - if (parser == OffsetIdPrinterParser.INSTANCE_ID_Z) { - return ~position; - } - context.setParsed(ZoneOffset.UTC); + /** + * Parse an offset following a prefix and set the ZoneId if it is valid. + * To matching the parsing of ZoneId.of the values are not normalized + * to ZoneOffsets. + * + * @param context the parse context + * @param text the input text + * @param prefixPos start of the prefix + * @param position start of text after the prefix + * @param parser parser for the value after the prefix + * @return the position after the parse + */ + private int parseOffsetBased(DateTimeParseContext context, CharSequence text, int prefixPos, int position, OffsetIdPrinterParser parser) { + String prefix = text.toString().substring(prefixPos, position).toUpperCase(); + if (position >= text.length()) { + context.setParsed(ZoneId.of(prefix)); return position; } - int offset = (int) newContext.getParsed(OFFSET_SECONDS).longValue(); - ZoneId zone = ZoneOffset.ofTotalSeconds(offset); - context.setParsed(zone); - return endPos; + + // '0' or 'Z' after prefix is not part of a valid ZoneId; use bare prefix + if (text.charAt(position) == '0' || + context.charEquals(text.charAt(position), 'Z')) { + context.setParsed(ZoneId.of(prefix)); + return position; + } + + DateTimeParseContext newContext = context.copy(); + int endPos = parser.parse(newContext, text, position); + try { + if (endPos < 0) { + if (parser == OffsetIdPrinterParser.INSTANCE_ID_Z) { + return ~prefixPos; + } + context.setParsed(ZoneId.of(prefix)); + return position; + } + int offset = (int) newContext.getParsed(OFFSET_SECONDS).longValue(); + ZoneOffset zoneOffset = ZoneOffset.ofTotalSeconds(offset); + context.setParsed(ZoneId.ofOffset(prefix, zoneOffset)); + return endPos; + } catch (DateTimeException dte) { + return ~prefixPos; + } } @Override diff --git a/jdk/src/share/classes/java/time/format/DateTimePrintContext.java b/jdk/src/share/classes/java/time/format/DateTimePrintContext.java index 3e3f90fb5eb..e744bb7d946 100644 --- a/jdk/src/share/classes/java/time/format/DateTimePrintContext.java +++ b/jdk/src/share/classes/java/time/format/DateTimePrintContext.java @@ -157,7 +157,7 @@ final class DateTimePrintContext { } } final ZoneId effectiveZone = (overrideZone != null ? overrideZone : temporalZone); - final ChronoLocalDate effectiveDate; + final ChronoLocalDate effectiveDate; if (overrideChrono != null) { if (temporal.isSupported(EPOCH_DAY)) { effectiveDate = effectiveChrono.date(temporal); diff --git a/jdk/src/share/classes/java/time/format/Parsed.java b/jdk/src/share/classes/java/time/format/Parsed.java index b0a7fe810d9..42223d6c1d9 100644 --- a/jdk/src/share/classes/java/time/format/Parsed.java +++ b/jdk/src/share/classes/java/time/format/Parsed.java @@ -143,7 +143,7 @@ final class Parsed implements TemporalAccessor { /** * The resolved date. */ - private ChronoLocalDate date; + private ChronoLocalDate date; /** * The resolved time. */ @@ -197,7 +197,7 @@ final class Parsed implements TemporalAccessor { return time.getLong(field); } if (field instanceof ChronoField) { - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.getFrom(this); } @@ -255,42 +255,34 @@ final class Parsed implements TemporalAccessor { // if any other fields, handle them // any lenient date resolution should return epoch-day if (fieldValues.size() > 0) { - boolean changed = false; + int changedCount = 0; outer: - while (true) { + while (changedCount < 50) { for (Map.Entry entry : fieldValues.entrySet()) { TemporalField targetField = entry.getKey(); - Map changes = targetField.resolve(this, entry.getValue(), resolverStyle); - if (changes != null) { - changed = true; - resolveFieldsMakeChanges(targetField, changes); - fieldValues.remove(targetField); // helps avoid infinite loops + ChronoLocalDate resolvedDate = targetField.resolve(fieldValues, chrono, zone, resolverStyle); + if (resolvedDate != null) { + updateCheckConflict(resolvedDate); + changedCount++; + continue outer; // have to restart to avoid concurrent modification + } else if (fieldValues.containsKey(targetField) == false) { + changedCount++; continue outer; // have to restart to avoid concurrent modification } } break; } + if (changedCount == 50) { // catch infinite loops + throw new DateTimeException("One of the parsed fields has an incorrectly implemented resolve method"); + } // if something changed then have to redo ChronoField resolve - if (changed) { + if (changedCount > 0) { resolveDateFields(); resolveTimeFields(); } } } - private void resolveFieldsMakeChanges(TemporalField targetField, Map changes) { - for (Map.Entry change : changes.entrySet()) { - TemporalField changeField = change.getKey(); - Long changeValue = change.getValue(); - Objects.requireNonNull(changeField, "changeField"); - if (changeValue != null) { - updateCheckConflict(targetField, changeField, changeValue); - } else { - fieldValues.remove(changeField); - } - } - } - private void updateCheckConflict(TemporalField targetField, TemporalField changeField, Long changeValue) { Long old = fieldValues.put(changeField, changeValue); if (old != null && old.longValue() != changeValue.longValue()) { @@ -305,7 +297,7 @@ final class Parsed implements TemporalAccessor { updateCheckConflict(chrono.resolveDate(fieldValues, resolverStyle)); } - private void updateCheckConflict(ChronoLocalDate cld) { + private void updateCheckConflict(ChronoLocalDate cld) { if (date != null) { if (cld != null && date.equals(cld) == false) { throw new DateTimeException("Conflict found: Fields resolved to two different dates: " + date + " " + cld); diff --git a/jdk/src/share/classes/java/time/temporal/ChronoField.java b/jdk/src/share/classes/java/time/temporal/ChronoField.java index ac4522bb60b..fe3254e60ab 100644 --- a/jdk/src/share/classes/java/time/temporal/ChronoField.java +++ b/jdk/src/share/classes/java/time/temporal/ChronoField.java @@ -403,6 +403,12 @@ public enum ChronoField implements TemporalField { * Non-ISO calendar systems should implement this field using the most recognized * day-of-year values for users of the calendar system. * Normally, this is a count of days from 1 to the length of the year. + *

                                + * Note that a non-ISO calendar system may have year numbering system that changes + * at a different point to the natural reset in the month numbering. An example + * of this is the Japanese calendar system where a change of era, which resets + * the year number to 1, can happen on any date. The era and year reset also cause + * the day-of-year to be reset to 1, but not the month-of-year or day-of-month. */ DAY_OF_YEAR("DayOfYear", DAYS, YEARS, ValueRange.of(1, 365, 366)), /** @@ -559,12 +565,11 @@ public enum ChronoField implements TemporalField { *

                                * This represents the concept of the sequential count of seconds where * 1970-01-01T00:00Z (ISO) is zero. - * This field may be used with {@link #NANO_OF_DAY} to represent the fraction of the day. + * This field may be used with {@link #NANO_OF_SECOND} to represent the fraction of the second. *

                                * An {@link Instant} represents an instantaneous point on the time-line. - * On their own they have no elements which allow a local date-time to be obtained. - * Only when paired with an offset or time-zone can the local date or time be found. - * This field allows the seconds part of the instant to be queried. + * On their own, an instant has insufficient information to allow a local date-time to be obtained. + * Only when paired with an offset or time-zone can the local date or time be calculated. *

                                * This field is strictly defined to have the same meaning in all calendar systems. * This is necessary to ensure interoperation between calendars. @@ -608,24 +613,18 @@ public enum ChronoField implements TemporalField { this.displayNameKey = displayNameKey; } - //----------------------------------------------------------------------- - @Override - public String getName() { - return name; - } - @Override public String getDisplayName(Locale locale) { Objects.requireNonNull(locale, "locale"); if (displayNameKey == null) { - return getName(); + return name; } LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased() .getLocaleResources(locale); ResourceBundle rb = lr.getJavaTimeFormatData(); String key = "field." + displayNameKey; - return rb.containsKey(key) ? rb.getString(key) : getName(); + return rb.containsKey(key) ? rb.getString(key) : name; } @Override @@ -748,7 +747,7 @@ public enum ChronoField implements TemporalField { //----------------------------------------------------------------------- @Override public String toString() { - return getName(); + return name; } } diff --git a/jdk/src/share/classes/java/time/temporal/ChronoUnit.java b/jdk/src/share/classes/java/time/temporal/ChronoUnit.java index 661960c28fb..19a37e46f4c 100644 --- a/jdk/src/share/classes/java/time/temporal/ChronoUnit.java +++ b/jdk/src/share/classes/java/time/temporal/ChronoUnit.java @@ -57,9 +57,6 @@ package java.time.temporal; import java.time.Duration; -import java.time.chrono.ChronoLocalDate; -import java.time.chrono.ChronoLocalDateTime; -import java.time.chrono.ChronoZonedDateTime; /** * A standard set of date periods units. @@ -200,12 +197,6 @@ public enum ChronoUnit implements TemporalUnit { this.duration = estimatedDuration; } - //----------------------------------------------------------------------- - @Override - public String getName() { - return name; - } - //----------------------------------------------------------------------- /** * Gets the estimated duration of this unit in the ISO calendar system. @@ -233,41 +224,40 @@ public enum ChronoUnit implements TemporalUnit { */ @Override public boolean isDurationEstimated() { - return isDateUnit(); + return this.compareTo(DAYS) >= 0; } //----------------------------------------------------------------------- /** * Checks if this unit is a date unit. + *

                                + * All units from days to eras inclusive are date-based. + * Time-based units and {@code FOREVER} return false. * * @return true if a date unit, false if a time unit */ - public boolean isDateUnit() { - return this.compareTo(DAYS) >= 0; + @Override + public boolean isDateBased() { + return this.compareTo(DAYS) >= 0 && this != FOREVER; } /** * Checks if this unit is a time unit. + *

                                + * All units from nanos to half-days inclusive are time-based. + * Date-based units and {@code FOREVER} return false. * * @return true if a time unit, false if a date unit */ - public boolean isTimeUnit() { + @Override + public boolean isTimeBased() { return this.compareTo(DAYS) < 0; } //----------------------------------------------------------------------- @Override public boolean isSupportedBy(Temporal temporal) { - if (this == FOREVER) { - return false; - } - if (temporal instanceof ChronoLocalDate) { - return isDateUnit(); - } - if (temporal instanceof ChronoLocalDateTime || temporal instanceof ChronoZonedDateTime) { - return true; - } - return TemporalUnit.super.isSupportedBy(temporal); + return temporal.isSupported(this); } @SuppressWarnings("unchecked") @@ -279,13 +269,13 @@ public enum ChronoUnit implements TemporalUnit { //----------------------------------------------------------------------- @Override public long between(Temporal temporal1, Temporal temporal2) { - return temporal1.periodUntil(temporal2, this); + return temporal1.until(temporal2, this); } //----------------------------------------------------------------------- @Override public String toString() { - return getName(); + return name; } } diff --git a/jdk/src/share/classes/java/time/temporal/IsoFields.java b/jdk/src/share/classes/java/time/temporal/IsoFields.java index e335c434d23..eae057afb2a 100644 --- a/jdk/src/share/classes/java/time/temporal/IsoFields.java +++ b/jdk/src/share/classes/java/time/temporal/IsoFields.java @@ -71,6 +71,8 @@ import static java.time.temporal.ChronoUnit.YEARS; import java.time.Duration; import java.time.LocalDate; +import java.time.ZoneId; +import java.time.chrono.ChronoLocalDate; import java.time.chrono.Chronology; import java.time.chrono.IsoChronology; import java.time.format.ResolverStyle; @@ -288,10 +290,6 @@ public final class IsoFields { */ private static enum Field implements TemporalField { DAY_OF_QUARTER { - @Override - public String getName() { - return "DayOfQuarter"; - } @Override public TemporalUnit getBaseUnit() { return DAYS; @@ -344,17 +342,21 @@ public final class IsoFields { return (R) temporal.with(DAY_OF_YEAR, temporal.getLong(DAY_OF_YEAR) + (newValue - curValue)); } @Override - public Map resolve(TemporalAccessor temporal, long doq, ResolverStyle resolverStyle) { - if ((temporal.isSupported(YEAR) && temporal.isSupported(QUARTER_OF_YEAR)) == false) { + public ChronoLocalDate resolve( + Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { + Long yearLong = fieldValues.get(YEAR); + Long qoyLong = fieldValues.get(QUARTER_OF_YEAR); + if (yearLong == null || qoyLong == null) { return null; } - int y = temporal.get(YEAR); // validated + int y = YEAR.checkValidIntValue(yearLong); // always validate + long doq = fieldValues.get(DAY_OF_QUARTER); LocalDate date; if (resolverStyle == ResolverStyle.LENIENT) { - long qoy = temporal.getLong(QUARTER_OF_YEAR); // unvalidated - date = LocalDate.of(y, 1, 1).plusMonths(Math.multiplyExact(Math.subtractExact(qoy, 1), 3)); + date = LocalDate.of(y, 1, 1).plusMonths(Math.multiplyExact(Math.subtractExact(qoyLong, 1), 3)); + doq = Math.subtractExact(doq, 1); } else { - int qoy = temporal.get(QUARTER_OF_YEAR); // validated + int qoy = QUARTER_OF_YEAR.range().checkValidIntValue(qoyLong, QUARTER_OF_YEAR); // validated date = LocalDate.of(y, ((qoy - 1) * 3) + 1, 1); if (doq < 1 || doq > 90) { if (resolverStyle == ResolverStyle.STRICT) { @@ -363,20 +365,19 @@ public final class IsoFields { range().checkValidValue(doq, this); // allow 1-92 rolling into next quarter } } + doq--; } - long epochDay = Math.addExact(date.toEpochDay(), Math.subtractExact(doq, 1)); - Map result = new HashMap<>(4, 1.0f); - result.put(EPOCH_DAY, epochDay); - result.put(YEAR, null); - result.put(QUARTER_OF_YEAR, null); - return result; + fieldValues.remove(this); + fieldValues.remove(YEAR); + fieldValues.remove(QUARTER_OF_YEAR); + return date.plusDays(doq); + } + @Override + public String toString() { + return "DayOfQuarter"; } }, QUARTER_OF_YEAR { - @Override - public String getName() { - return "QuarterOfYear"; - } @Override public TemporalUnit getBaseUnit() { return QUARTER_YEARS; @@ -409,20 +410,19 @@ public final class IsoFields { range().checkValidValue(newValue, this); // strictly check from 1 to 4 return (R) temporal.with(MONTH_OF_YEAR, temporal.getLong(MONTH_OF_YEAR) + (newValue - curValue) * 3); } + @Override + public String toString() { + return "QuarterOfYear"; + } }, WEEK_OF_WEEK_BASED_YEAR { - @Override - public String getName() { - return "WeekOfWeekBasedYear"; - } - @Override public String getDisplayName(Locale locale) { Objects.requireNonNull(locale, "locale"); LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased() .getLocaleResources(locale); ResourceBundle rb = lr.getJavaTimeFormatData(); - return rb.containsKey("field.week") ? rb.getString("field.week") : getName(); + return rb.containsKey("field.week") ? rb.getString("field.week") : toString(); } @Override @@ -463,14 +463,18 @@ public final class IsoFields { return (R) temporal.plus(Math.subtractExact(newValue, getFrom(temporal)), WEEKS); } @Override - public Map resolve(TemporalAccessor temporal, long wowby, ResolverStyle resolverStyle) { - if ((temporal.isSupported(WEEK_BASED_YEAR) && temporal.isSupported(DAY_OF_WEEK)) == false) { + public ChronoLocalDate resolve( + Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { + Long wbyLong = fieldValues.get(WEEK_BASED_YEAR); + Long dowLong = fieldValues.get(DAY_OF_WEEK); + if (wbyLong == null || dowLong == null) { return null; } - int wby = temporal.get(WEEK_BASED_YEAR); // validated + int wby = WEEK_BASED_YEAR.range().checkValidIntValue(wbyLong, WEEK_BASED_YEAR); // always validate + long wowby = fieldValues.get(WEEK_OF_WEEK_BASED_YEAR); LocalDate date = LocalDate.of(wby, 1, 4); if (resolverStyle == ResolverStyle.LENIENT) { - long dow = temporal.getLong(DAY_OF_WEEK); // unvalidated + long dow = dowLong; // unvalidated if (dow > 7) { date = date.plusWeeks((dow - 1) / 7); dow = ((dow - 1) % 7) + 1; @@ -480,7 +484,7 @@ public final class IsoFields { } date = date.plusWeeks(Math.subtractExact(wowby, 1)).with(DAY_OF_WEEK, dow); } else { - int dow = temporal.get(DAY_OF_WEEK); // validated + int dow = DAY_OF_WEEK.checkValidIntValue(dowLong); // validated if (wowby < 1 || wowby > 52) { if (resolverStyle == ResolverStyle.STRICT) { getWeekRange(date).checkValidValue(wowby, this); // only allow exact range @@ -490,18 +494,17 @@ public final class IsoFields { } date = date.plusWeeks(wowby - 1).with(DAY_OF_WEEK, dow); } - Map result = new HashMap<>(2, 1.0f); - result.put(EPOCH_DAY, date.toEpochDay()); - result.put(WEEK_BASED_YEAR, null); - result.put(DAY_OF_WEEK, null); - return result; + fieldValues.remove(this); + fieldValues.remove(WEEK_BASED_YEAR); + fieldValues.remove(DAY_OF_WEEK); + return date; + } + @Override + public String toString() { + return "WeekOfWeekBasedYear"; } }, WEEK_BASED_YEAR { - @Override - public String getName() { - return "WeekBasedYear"; - } @Override public TemporalUnit getBaseUnit() { return WEEK_BASED_YEARS; @@ -537,6 +540,10 @@ public final class IsoFields { date = date.withDayOfYear(180).withYear(newVal).with(WEEK_OF_WEEK_BASED_YEAR, week); return (R) date.with(date); } + @Override + public String toString() { + return "WeekBasedYear"; + } }; @Override @@ -545,13 +552,13 @@ public final class IsoFields { } @Override - public ValueRange rangeRefinedBy(TemporalAccessor temporal) { - return range(); + public boolean isTimeBased() { + return false; } @Override - public String toString() { - return getName(); + public ValueRange rangeRefinedBy(TemporalAccessor temporal) { + return range(); } //------------------------------------------------------------------------- @@ -635,11 +642,6 @@ public final class IsoFields { this.duration = estimatedDuration; } - @Override - public String getName() { - return name; - } - @Override public Duration getDuration() { return duration; @@ -650,6 +652,16 @@ public final class IsoFields { return true; } + @Override + public boolean isDateBased() { + return true; + } + + @Override + public boolean isTimeBased() { + return false; + } + @Override public boolean isSupportedBy(Temporal temporal) { return temporal.isSupported(EPOCH_DAY); @@ -658,7 +670,7 @@ public final class IsoFields { @SuppressWarnings("unchecked") @Override public R addTo(R temporal, long amount) { - switch(this) { + switch (this) { case WEEK_BASED_YEARS: return (R) temporal.with(WEEK_BASED_YEAR, Math.addExact(temporal.get(WEEK_BASED_YEAR), amount)); @@ -678,7 +690,7 @@ public final class IsoFields { return Math.subtractExact(temporal2.getLong(WEEK_BASED_YEAR), temporal1.getLong(WEEK_BASED_YEAR)); case QUARTER_YEARS: - return temporal1.periodUntil(temporal2, MONTHS) / 3; + return temporal1.until(temporal2, MONTHS) / 3; default: throw new IllegalStateException("Unreachable"); } @@ -686,8 +698,7 @@ public final class IsoFields { @Override public String toString() { - return getName(); - + return name; } } } diff --git a/jdk/src/share/classes/java/time/temporal/JulianFields.java b/jdk/src/share/classes/java/time/temporal/JulianFields.java index 95400addcaa..326f20d222f 100644 --- a/jdk/src/share/classes/java/time/temporal/JulianFields.java +++ b/jdk/src/share/classes/java/time/temporal/JulianFields.java @@ -66,6 +66,9 @@ import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.FOREVER; import java.time.DateTimeException; +import java.time.ZoneId; +import java.time.chrono.ChronoLocalDate; +import java.time.chrono.Chronology; import java.time.format.ResolverStyle; import java.util.Collections; import java.util.Map; @@ -232,11 +235,6 @@ public final class JulianFields { } //----------------------------------------------------------------------- - @Override - public String getName() { - return name; - } - @Override public TemporalUnit getBaseUnit() { return baseUnit; @@ -252,6 +250,11 @@ public final class JulianFields { return true; } + @Override + public boolean isTimeBased() { + return false; + } + @Override public ValueRange range() { return range; @@ -287,15 +290,14 @@ public final class JulianFields { //----------------------------------------------------------------------- @Override - public Map resolve(TemporalAccessor temporal, long value, ResolverStyle resolverStyle) { - long epochDay; + public ChronoLocalDate resolve( + Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { + long value = fieldValues.remove(this); if (resolverStyle == ResolverStyle.LENIENT) { - epochDay = Math.subtractExact(value, offset); - } else { - range().checkValidValue(value, this); - epochDay = value - offset; + return chronology.dateEpochDay(Math.subtractExact(value, offset)); } - return Collections.singletonMap(EPOCH_DAY, epochDay); + range().checkValidValue(value, this); + return chronology.dateEpochDay(value - offset); } //----------------------------------------------------------------------- diff --git a/jdk/src/share/classes/java/time/temporal/Temporal.java b/jdk/src/share/classes/java/time/temporal/Temporal.java index 1928186b285..af8424c1560 100644 --- a/jdk/src/share/classes/java/time/temporal/Temporal.java +++ b/jdk/src/share/classes/java/time/temporal/Temporal.java @@ -62,7 +62,6 @@ package java.time.temporal; import java.time.DateTimeException; -import java.time.ZoneId; /** * Framework-level interface defining read-write access to a temporal object, @@ -81,7 +80,8 @@ import java.time.ZoneId; * See {@link ChronoField} for the standard set of fields. *

                                * Two pieces of date/time information cannot be represented by numbers, - * the {@linkplain java.time.chrono.Chronology chronology} and the {@linkplain ZoneId time-zone}. + * the {@linkplain java.time.chrono.Chronology chronology} and the + * {@linkplain java.time.ZoneId time-zone}. * These can be accessed via {@link #query(TemporalQuery) queries} using * the static methods defined on {@link TemporalQuery}. *

                                @@ -128,6 +128,29 @@ import java.time.ZoneId; */ public interface Temporal extends TemporalAccessor { + /** + * Checks if the specified unit is supported. + *

                                + * This checks if the specified unit can be added to, or subtracted from, this date-time. + * If false, then calling the {@link #plus(long, TemporalUnit)} and + * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. + * + * @implSpec + * Implementations must check and handle all units defined in {@link ChronoUnit}. + * If the unit is supported, then true must be returned, otherwise false must be returned. + *

                                + * If the field is not a {@code ChronoUnit}, then the result of this method + * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} + * passing {@code this} as the argument. + *

                                + * Implementations must ensure that no observable state is altered when this + * read-only method is invoked. + * + * @param unit the unit to check, null returns false + * @return true if the unit can be added/subtracted, false if not + */ + boolean isSupported(TemporalUnit unit); + /** * Returns an adjusted object of the same type as this object with the adjustment made. *

                                @@ -352,7 +375,7 @@ public interface Temporal extends TemporalAccessor { * The start and end points are {@code this} and the specified temporal. * The result will be negative if the end is before the start. * For example, the period in hours between two temporal objects can be - * calculated using {@code startTime.periodUntil(endTime, HOURS)}. + * calculated using {@code startTime.until(endTime, HOURS)}. *

                                * The calculation returns a whole number, representing the number of * complete units between the two temporals. @@ -364,7 +387,7 @@ public interface Temporal extends TemporalAccessor { * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: *

                                      *   // these two lines are equivalent
                                -     *   temporal = start.periodUntil(end, unit);
                                +     *   temporal = start.until(end, unit);
                                      *   temporal = unit.between(start, end);
                                      * 
                                * The choice should be made based on which makes the code more readable. @@ -372,7 +395,7 @@ public interface Temporal extends TemporalAccessor { * For example, this method allows the number of days between two dates to * be calculated: *
                                -     *  long daysBetween = start.periodUntil(end, DAYS);
                                +     *  long daysBetween = start.until(end, DAYS);
                                      *  // or alternatively
                                      *  long daysBetween = DAYS.between(start, end);
                                      * 
                                @@ -399,7 +422,8 @@ public interface Temporal extends TemporalAccessor { * return unit.between(this, endTemporal); *
                                *

                                - * Neither this object, nor the specified temporal, may be altered. + * Implementations must ensure that no observable state is altered when this + * read-only method is invoked. * * @param endTemporal the end temporal, of the same type as this object, not null * @param unit the unit to measure the amount in, not null @@ -410,6 +434,6 @@ public interface Temporal extends TemporalAccessor { * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ - long periodUntil(Temporal endTemporal, TemporalUnit unit); + long until(Temporal endTemporal, TemporalUnit unit); } diff --git a/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java b/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java index a212be85981..343447e36b9 100644 --- a/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java +++ b/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java @@ -62,7 +62,6 @@ package java.time.temporal; import java.time.DateTimeException; -import java.time.ZoneId; import java.util.Objects; /** @@ -80,7 +79,8 @@ import java.util.Objects; * See {@link ChronoField} for the standard set of fields. *

                                * Two pieces of date/time information cannot be represented by numbers, - * the {@linkplain java.time.chrono.Chronology chronology} and the {@linkplain ZoneId time-zone}. + * the {@linkplain java.time.chrono.Chronology chronology} and the + * {@linkplain java.time.ZoneId time-zone}. * These can be accessed via {@linkplain #query(TemporalQuery) queries} using * the static methods defined on {@link TemporalQuery}. *

                                @@ -111,13 +111,14 @@ public interface TemporalAccessor { * * @implSpec * Implementations must check and handle all fields defined in {@link ChronoField}. - * If the field is supported, then true is returned, otherwise false + * If the field is supported, then true must be returned, otherwise false must be returned. *

                                * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} * passing {@code this} as the argument. *

                                - * Implementations must not alter either this object. + * Implementations must ensure that no observable state is altered when this + * read-only method is invoked. * * @param field the field to check, null returns false * @return true if this date-time can be queried for the field, false if not @@ -146,7 +147,8 @@ public interface TemporalAccessor { * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessorl)} * passing {@code this} as the argument. *

                                - * Implementations must not alter either this object. + * Implementations must ensure that no observable state is altered when this + * read-only method is invoked. *

                                * The default implementation must behave equivalent to this code: *

                                @@ -154,7 +156,7 @@ public interface TemporalAccessor {
                                      *    if (isSupported(field)) {
                                      *      return field.range();
                                      *    }
                                -     *    throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
                                +     *    throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
                                      *  }
                                      *  return field.rangeRefinedBy(this);
                                      * 
                                @@ -169,7 +171,7 @@ public interface TemporalAccessor { if (isSupported(field)) { return field.range(); } - throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName()); + throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } Objects.requireNonNull(field, "field"); return field.rangeRefinedBy(this); @@ -193,7 +195,8 @@ public interface TemporalAccessor { * is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} * passing {@code this} as the argument. *

                                - * Implementations must not alter this object. + * Implementations must ensure that no observable state is altered when this + * read-only method is invoked. *

                                * The default implementation must behave equivalent to this code: *

                                @@ -240,7 +243,8 @@ public interface TemporalAccessor {
                                      * is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)}
                                      * passing {@code this} as the argument.
                                      * 

                                - * Implementations must not alter either this object. + * Implementations must ensure that no observable state is altered when this + * read-only method is invoked. * * @param field the field to get, not null * @return the value for the field @@ -291,6 +295,9 @@ public interface TemporalAccessor { * } * return TemporalAccessor.super.query(query); *

                                + *

                                + * Implementations must ensure that no observable state is altered when this + * read-only method is invoked. * * @param the type of the result * @param query the query to invoke, not null diff --git a/jdk/src/share/classes/java/time/temporal/TemporalField.java b/jdk/src/share/classes/java/time/temporal/TemporalField.java index cce2dfbd4de..e4d6b407783 100644 --- a/jdk/src/share/classes/java/time/temporal/TemporalField.java +++ b/jdk/src/share/classes/java/time/temporal/TemporalField.java @@ -62,6 +62,9 @@ package java.time.temporal; import java.time.DateTimeException; +import java.time.ZoneId; +import java.time.chrono.ChronoLocalDate; +import java.time.chrono.Chronology; import java.time.format.ResolverStyle; import java.util.Locale; import java.util.Map; @@ -92,30 +95,20 @@ import java.util.Objects; */ public interface TemporalField { - /** - * Gets a descriptive name for the field. - *

                                - * The should be of the format 'BaseOfRange', such as 'MonthOfYear', - * unless the field has a range of {@code FOREVER}, when only - * the base unit is mentioned, such as 'Year' or 'Era'. - * - * @return the name, not null - */ - String getName(); - /** * Gets the display name for the field in the requested locale. *

                                - * If there is no display name for the locale the value of {@code getName} - * is returned. + * If there is no display name for the locale then a suitable default must be returned. + *

                                + * The default implementation must check the locale is not null + * and return {@code toString()}. * * @param locale the locale to use, not null - * @return the display name for the locale or the value of {@code getName}, - * not null + * @return the display name for the locale or a suitable default, not null */ default String getDisplayName(Locale locale) { - Objects.requireNonNull(locale, "local"); - return getName(); + Objects.requireNonNull(locale, "locale"); + return toString(); } /** @@ -164,28 +157,24 @@ public interface TemporalField { *

                                * A field is date-based if it can be derived from * {@link ChronoField#EPOCH_DAY EPOCH_DAY}. - *

                                - * The default implementation must return false. + * Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + * to return false, such as when representing a field like minute-of-week. * * @return true if this field is a component of a date */ - default boolean isDateBased() { - return false; - } + boolean isDateBased(); /** * Checks if this field represents a component of a time. *

                                * A field is time-based if it can be derived from * {@link ChronoField#NANO_OF_DAY NANO_OF_DAY}. - *

                                - * The default implementation must return false. + * Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + * to return false, such as when representing a field like minute-of-week. * * @return true if this field is a component of a time */ - default boolean isTimeBased() { - return false; - } + boolean isTimeBased(); //----------------------------------------------------------------------- /** @@ -319,45 +308,79 @@ public interface TemporalField { R adjustInto(R temporal, long newValue); /** - * Resolves this field to provide a simpler alternative. + * Resolves this field to provide a simpler alternative or a date. *

                                * This method is invoked during the resolve phase of parsing. * It is designed to allow application defined fields to be simplified into - * more standard fields, such as those on {@code ChronoField}. + * more standard fields, such as those on {@code ChronoField}, or into a date. *

                                - * The method will only be invoked if the specified temporal supports this field. - * The value of this field is provided. + * Applications should not normally invoke this method directly. + * + * @implSpec + * If an implementation represents a field that can be simplified, or + * combined with others, then this method must be implemented. *

                                - * The temporal must be queried using the methods of {@code TemporalAccessor}, - * not using {@code getFrom}, {@code isSupportedBy} or {@code rangeRefinedBy}. - * Before querying any field, implementations must ensure it is supported, as - * exceptions of this type would negatively affect the calculation of a parsed result. + * The specified map contains the current state of the parse. + * The map is mutable and must be mutated to resolve the field and + * any related fields. This method will only be invoked during parsing + * if the map contains this field, and implementations should therefore + * assume this field is present. *

                                - * If this field can resolve, it must return a map, if not it must return null. - * The returned map contains the changes to be made to the temporal, expressed - * as field-value pairs. If the value for a field is null, the field is to be - * removed from the temporal. A null key must not be added to the result map. + * Resolving a field will consist of looking at the value of this field, + * and potentially other fields, and either updating the map with a + * simpler value, such as a {@code ChronoField}, or returning a + * complete {@code ChronoLocalDate}. If a resolve is successful, + * the code must remove all the fields that were resolved from the map, + * including this field. *

                                - * If the result is non-null, this field will be removed from the temporal. - * This field should not be added to the result map. + * For example, the {@code IsoFields} class contains the quarter-of-year + * and day-of-quarter fields. The implementation of this method in that class + * resolves the two fields plus the {@link ChronoField#YEAR YEAR} into a + * complete {@code LocalDate}. The resolve method will remove all three + * fields from the map before returning the {@code LocalDate}. *

                                - * The {@link ResolverStyle} should be used by implementations to determine - * how to perform the resolve. + * If resolution should be possible, but the data is invalid, the resolver + * style should be used to determine an appropriate level of leniency, which + * may require throwing a {@code DateTimeException} or {@code ArithmeticException}. + * If no resolution is possible, the resolve method must return null. + *

                                + * When resolving time fields, the map will be altered and null returned. + * When resolving date fields, the date is normally returned from the method, + * with the map altered to remove the resolved fields. However, it would also + * be acceptable for the date fields to be resolved into other {@code ChronoField} + * instances that can produce a date, such as {@code EPOCH_DAY}. + *

                                + * The zone is not normally required for resolution, but is provided for completeness. *

                                * The default implementation must return null. * - * @param temporal the temporal to resolve, not null - * @param value the value of this field + * @param fieldValues the map of fields to values, which can be updated, not null + * @param chronology the effective chronology, not null + * @param zone the effective zone, not null * @param resolverStyle the requested type of resolve, not null - * @return a map of fields to update in the temporal, with a mapping to null - * indicating a deletion. The whole map must be null if no resolving occurred + * @return the resolved date; null if resolving only changed the map, + * or no resolve occurred + * @throws ArithmeticException if numeric overflow occurs * @throws DateTimeException if resolving results in an error. This must not be thrown * by querying a field on the temporal without first checking if it is supported - * @throws ArithmeticException if numeric overflow occurs */ - default Map resolve( - TemporalAccessor temporal, long value, ResolverStyle resolverStyle) { + default ChronoLocalDate resolve( + Map fieldValues, Chronology chronology, + ZoneId zone, ResolverStyle resolverStyle) { return null; } + /** + * Gets a descriptive name for the field. + *

                                + * The should be of the format 'BaseOfRange', such as 'MonthOfYear', + * unless the field has a range of {@code FOREVER}, when only + * the base unit is mentioned, such as 'Year' or 'Era'. + * + * @return the name of the field, not null + */ + @Override + String toString(); + + } diff --git a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java index 01ab406f85a..05577d713f8 100644 --- a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java +++ b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java @@ -63,7 +63,11 @@ package java.time.temporal; import java.time.DateTimeException; import java.time.Duration; +import java.time.LocalTime; import java.time.Period; +import java.time.chrono.ChronoLocalDate; +import java.time.chrono.ChronoLocalDateTime; +import java.time.chrono.ChronoZonedDateTime; /** * A unit of date-time, such as Days or Hours. @@ -92,15 +96,6 @@ import java.time.Period; */ public interface TemporalUnit { - /** - * Gets a descriptive name for the unit. - *

                                - * This should be in the plural and upper-first camel case, such as 'Days' or 'Minutes'. - * - * @return the name, not null - */ - String getName(); - /** * Gets the duration of this unit, which may be an estimate. *

                                @@ -130,6 +125,33 @@ public interface TemporalUnit { */ boolean isDurationEstimated(); + //----------------------------------------------------------------------- + /** + * Checks if this unit represents a component of a date. + *

                                + * A date is time-based if it can be used to imply meaning from a date. + * It must have a {@linkplain #getDuration() duration} that is an integral + * multiple of the length of a standard day. + * Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + * to return false, such as when representing a unit like 36 hours. + * + * @return true if this unit is a component of a date + */ + boolean isDateBased(); + + /** + * Checks if this unit represents a component of a time. + *

                                + * A unit is time-based if it can be used to imply meaning from a time. + * It must have a {@linkplain #getDuration() duration} that divides into + * the length of a standard day without remainder. + * Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()} + * to return false, such as when representing a unit like 36 hours. + * + * @return true if this unit is a component of a time + */ + boolean isTimeBased(); + //----------------------------------------------------------------------- /** * Checks if this unit is supported by the specified temporal object. @@ -144,6 +166,15 @@ public interface TemporalUnit { * @return true if the unit is supported */ default boolean isSupportedBy(Temporal temporal) { + if (temporal instanceof LocalTime) { + return isTimeBased(); + } + if (temporal instanceof ChronoLocalDate) { + return isDateBased(); + } + if (temporal instanceof ChronoLocalDateTime || temporal instanceof ChronoZonedDateTime) { + return true; + } try { temporal.plus(1, this); return true; @@ -212,11 +243,11 @@ public interface TemporalUnit { *

                                * There are two equivalent ways of using this method. * The first is to invoke this method directly. - * The second is to use {@link Temporal#periodUntil(Temporal, TemporalUnit)}: + * The second is to use {@link Temporal#until(Temporal, TemporalUnit)}: *

                                      *   // these two lines are equivalent
                                      *   between = thisUnit.between(start, end);
                                -     *   between = start.periodUntil(end, thisUnit);
                                +     *   between = start.until(end, thisUnit);
                                      * 
                                * The choice should be made based on which makes the code more readable. *

                                @@ -225,7 +256,7 @@ public interface TemporalUnit { *

                                      *  long daysBetween = DAYS.between(start, end);
                                      *  // or alternatively
                                -     *  long daysBetween = start.periodUntil(end, DAYS);
                                +     *  long daysBetween = start.until(end, DAYS);
                                      * 
                                *

                                * Implementations should perform any queries or calculations using the units @@ -245,7 +276,9 @@ public interface TemporalUnit { //----------------------------------------------------------------------- /** - * Outputs this unit as a {@code String} using the name. + * Gets a descriptive name for the unit. + *

                                + * This should be in the plural and upper-first camel case, such as 'Days' or 'Minutes'. * * @return the name of this unit, not null */ diff --git a/jdk/src/share/classes/java/time/temporal/ValueRange.java b/jdk/src/share/classes/java/time/temporal/ValueRange.java index 4ac8e74402a..e003f114adc 100644 --- a/jdk/src/share/classes/java/time/temporal/ValueRange.java +++ b/jdk/src/share/classes/java/time/temporal/ValueRange.java @@ -331,7 +331,7 @@ public final class ValueRange implements Serializable { private String genInvalidFieldMessage(TemporalField field, long value) { if (field != null) { - return "Invalid value for " + field.getName() + " (valid values " + this + "): " + value; + return "Invalid value for " + field + " (valid values " + this + "): " + value; } else { return "Invalid value (valid values " + this + "): " + value; } diff --git a/jdk/src/share/classes/java/time/temporal/WeekFields.java b/jdk/src/share/classes/java/time/temporal/WeekFields.java index 07ffa91d2a3..b3eb1383450 100644 --- a/jdk/src/share/classes/java/time/temporal/WeekFields.java +++ b/jdk/src/share/classes/java/time/temporal/WeekFields.java @@ -75,7 +75,9 @@ import static java.time.temporal.ChronoUnit.YEARS; import java.io.InvalidObjectException; import java.io.Serializable; +import java.time.DateTimeException; import java.time.DayOfWeek; +import java.time.ZoneId; import java.time.chrono.ChronoLocalDate; import java.time.chrono.Chronology; import java.time.format.ResolverStyle; @@ -395,6 +397,11 @@ public final class WeekFields implements Serializable { *

                                * For example, if the first day-of-week is Sunday, then that will have the * value 1, with other days ranging from Monday as 2 to Saturday as 7. + *

                                + * In the resolving phase of parsing, a localized day-of-week will be converted + * to a standardized {@code ChronoField} day-of-week. + * The day-of-week must be in the valid range 1 to 7. + * Other fields in this class build dates using the standardized day-of-week. * * @return a field providing access to the day-of-week with localized numbering, not null */ @@ -421,6 +428,26 @@ public final class WeekFields implements Serializable { * - if the 5th day of the month is a Monday, week two starts on the 5th and the 1st to 4th is in week one
                                *

                                * This field can be used with any calendar system. + *

                                + * In the resolving phase of parsing, a date can be created from a year, + * week-of-month, month-of-year and day-of-week. + *

                                + * In {@linkplain ResolverStyle#STRICT strict mode}, all four fields are + * validated against their range of valid values. The week-of-month field + * is validated to ensure that the resulting month is the month requested. + *

                                + * In {@linkplain ResolverStyle#SMART smart mode}, all four fields are + * validated against their range of valid values. The week-of-month field + * is validated from 0 to 6, meaning that the resulting date can be in a + * different month to that specified. + *

                                + * In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + * are validated against the range of valid values. The resulting date is calculated + * equivalent to the following four stage approach. + * First, create a date on the first day of the first week of January in the requested year. + * Then take the month-of-year, subtract one, and add the amount in months to the date. + * Then take the week-of-month, subtract one, and add the amount in weeks to the date. + * Finally, adjust to the correct day-of-week within the localized week. * * @return a field providing access to the week-of-month, not null */ @@ -447,6 +474,25 @@ public final class WeekFields implements Serializable { * - if the 5th day of the year is a Monday, week two starts on the 5th and the 1st to 4th is in week one
                                *

                                * This field can be used with any calendar system. + *

                                + * In the resolving phase of parsing, a date can be created from a year, + * week-of-year and day-of-week. + *

                                + * In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + * validated against their range of valid values. The week-of-year field + * is validated to ensure that the resulting year is the year requested. + *

                                + * In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + * validated against their range of valid values. The week-of-year field + * is validated from 0 to 54, meaning that the resulting date can be in a + * different year to that specified. + *

                                + * In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + * are validated against the range of valid values. The resulting date is calculated + * equivalent to the following three stage approach. + * First, create a date on the first day of the first week in the requested year. + * Then take the week-of-year, subtract one, and add the amount in weeks to the date. + * Finally, adjust to the correct day-of-week within the localized week. * * @return a field providing access to the week-of-year, not null */ @@ -477,6 +523,26 @@ public final class WeekFields implements Serializable { * the 1st to 4th is in week one
                                *

                                * This field can be used with any calendar system. + *

                                + * In the resolving phase of parsing, a date can be created from a week-based-year, + * week-of-year and day-of-week. + *

                                + * In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + * validated against their range of valid values. The week-of-year field + * is validated to ensure that the resulting week-based-year is the + * week-based-year requested. + *

                                + * In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + * validated against their range of valid values. The week-of-week-based-year field + * is validated from 1 to 53, meaning that the resulting date can be in the + * following week-based-year to that specified. + *

                                + * In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + * are validated against the range of valid values. The resulting date is calculated + * equivalent to the following three stage approach. + * First, create a date on the first day of the first week in the requested week-based-year. + * Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date. + * Finally, adjust to the correct day-of-week within the localized week. * * @return a field providing access to the week-of-week-based-year, not null */ @@ -499,6 +565,26 @@ public final class WeekFields implements Serializable { * is in the last week of the previous year. *

                                * This field can be used with any calendar system. + *

                                + * In the resolving phase of parsing, a date can be created from a week-based-year, + * week-of-year and day-of-week. + *

                                + * In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are + * validated against their range of valid values. The week-of-year field + * is validated to ensure that the resulting week-based-year is the + * week-based-year requested. + *

                                + * In {@linkplain ResolverStyle#SMART smart mode}, all three fields are + * validated against their range of valid values. The week-of-week-based-year field + * is validated from 1 to 53, meaning that the resulting date can be in the + * following week-based-year to that specified. + *

                                + * In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week + * are validated against the range of valid values. The resulting date is calculated + * equivalent to the following three stage approach. + * First, create a date on the first day of the first week in the requested week-based-year. + * Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date. + * Finally, adjust to the correct day-of-week within the localized week. * * @return a field providing access to the week-based-year, not null */ @@ -615,9 +701,9 @@ public final class WeekFields implements Serializable { * @param dow the day of the week * @return a ChronoLocalDate for the requested year, week of year, and day of week */ - private ChronoLocalDate ofWeekBasedYear(Chronology chrono, + private ChronoLocalDate ofWeekBasedYear(Chronology chrono, int yowby, int wowby, int dow) { - ChronoLocalDate date = chrono.date(yowby, 1, 1); + ChronoLocalDate date = chrono.date(yowby, 1, 1); int ldow = localizedDayOfWeek(date); int offset = startOfWeekOffset(1, ldow); @@ -671,6 +757,11 @@ public final class WeekFields implements Serializable { return Math.floorMod(isoDow - sow, 7) + 1; } + private int localizedDayOfWeek(int isoDow) { + int sow = weekDef.getFirstDayOfWeek().getValue(); + return Math.floorMod(isoDow - sow, 7) + 1; + } + private long localizedWeekOfMonth(TemporalAccessor temporal) { int dow = localizedDayOfWeek(temporal); int dom = temporal.get(DAY_OF_MONTH); @@ -800,75 +891,121 @@ public final class WeekFields implements Serializable { } @Override - public Map resolve(TemporalAccessor temporal, long value, ResolverStyle resolverStyle) { - int newValue = range.checkValidIntValue(value, this); - int sow = weekDef.getFirstDayOfWeek().getValue(); + public ChronoLocalDate resolve( + Map fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) { + final long value = fieldValues.get(this); + final int newValue = Math.toIntExact(value); // broad limit makes overflow checking lighter + // first convert localized day-of-week to ISO day-of-week + // doing this first handles case where both ISO and localized were parsed and might mismatch + // day-of-week is always strict as two different day-of-week values makes lenient complex if (rangeUnit == WEEKS) { // day-of-week - int isoDow = Math.floorMod((sow - 1) + (newValue - 1), 7) + 1; - return Collections.singletonMap(DAY_OF_WEEK, (long) isoDow); - } - if (temporal.isSupported(DAY_OF_WEEK) == false) { + final int checkedValue = range.checkValidIntValue(value, this); // no leniency as too complex + final int startDow = weekDef.getFirstDayOfWeek().getValue(); + long isoDow = Math.floorMod((startDow - 1) + (checkedValue - 1), 7) + 1; + fieldValues.remove(this); + fieldValues.put(DAY_OF_WEEK, isoDow); return null; } - Chronology chrono = Chronology.from(temporal); // defaults to ISO - int dow = localizedDayOfWeek(temporal); - if (temporal.isSupported(YEAR)) { - int year = temporal.get(YEAR); - if (rangeUnit == MONTHS) { // week-of-month - if (temporal.isSupported(MONTH_OF_YEAR) == false) { - return null; - } - int month = temporal.get(ChronoField.MONTH_OF_YEAR); - @SuppressWarnings("rawtypes") - ChronoLocalDate date = chrono.date(year, month, 1); - int dateDow = localizedDayOfWeek(date); - long weeks = newValue - localizedWeekOfMonth(date); - int days = dow - dateDow; - date = date.plus(weeks * 7 + days, DAYS); - Map result = new HashMap<>(4, 1.0f); - result.put(EPOCH_DAY, date.toEpochDay()); - result.put(YEAR, null); - result.put(MONTH_OF_YEAR, null); - result.put(DAY_OF_WEEK, null); - return result; - } else if (rangeUnit == YEARS) { // week-of-year - @SuppressWarnings("rawtypes") - ChronoLocalDate date = chrono.date(year, 1, 1); - int dateDow = localizedDayOfWeek(date); - long weeks = newValue - localizedWeekOfYear(date); - int days = dow - dateDow; - date = date.plus(weeks * 7 + days, DAYS); - Map result = new HashMap<>(4, 1.0f); - result.put(EPOCH_DAY, date.toEpochDay()); - result.put(YEAR, null); - result.put(DAY_OF_WEEK, null); - return result; - } - } else if (rangeUnit == WEEK_BASED_YEARS || rangeUnit == FOREVER) { - if (temporal.isSupported(weekDef.weekBasedYear) && - temporal.isSupported(weekDef.weekOfWeekBasedYear)) { - // week-of-week-based-year and year-of-week-based-year - int yowby = temporal.get(weekDef.weekBasedYear); - int wowby = temporal.get(weekDef.weekOfWeekBasedYear); - ChronoLocalDate date = ofWeekBasedYear(Chronology.from(temporal), yowby, wowby, dow); - Map result = new HashMap<>(4, 1.0f); - result.put(EPOCH_DAY, date.toEpochDay()); - result.put(DAY_OF_WEEK, null); - result.put(weekDef.weekOfWeekBasedYear, null); - result.put(weekDef.weekBasedYear, null); - return result; + // can only build date if ISO day-of-week is present + if (fieldValues.containsKey(DAY_OF_WEEK) == false) { + return null; + } + int isoDow = DAY_OF_WEEK.checkValidIntValue(fieldValues.get(DAY_OF_WEEK)); + int dow = localizedDayOfWeek(isoDow); + + // build date + if (fieldValues.containsKey(YEAR)) { + int year = YEAR.checkValidIntValue(fieldValues.get(YEAR)); // validate + if (rangeUnit == MONTHS && fieldValues.containsKey(MONTH_OF_YEAR)) { // week-of-month + long month = fieldValues.get(MONTH_OF_YEAR); // not validated yet + return resolveWoM(fieldValues, chronology, year, month, newValue, dow, resolverStyle); } + if (rangeUnit == YEARS) { // week-of-year + return resolveWoY(fieldValues, chronology, year, newValue, dow, resolverStyle); + } + } else if ((rangeUnit == WEEK_BASED_YEARS || rangeUnit == FOREVER) && + fieldValues.containsKey(weekDef.weekBasedYear) && + fieldValues.containsKey(weekDef.weekOfWeekBasedYear)) { // week-of-week-based-year and year-of-week-based-year + return resolveWBY(fieldValues, chronology, dow, resolverStyle); } return null; } - //----------------------------------------------------------------------- - @Override - public String getName() { - return name; + private ChronoLocalDate resolveWoM( + Map fieldValues, Chronology chrono, int year, long month, long wom, int localDow, ResolverStyle resolverStyle) { + ChronoLocalDate date; + if (resolverStyle == ResolverStyle.LENIENT) { + date = chrono.date(year, 1, 1).plus(Math.subtractExact(month, 1), MONTHS); + long weeks = Math.subtractExact(wom, localizedWeekOfMonth(date)); + int days = localDow - localizedDayOfWeek(date); // safe from overflow + date = date.plus(Math.addExact(Math.multiplyExact(weeks, 7), days), DAYS); + } else { + int monthValid = MONTH_OF_YEAR.checkValidIntValue(month); // validate + date = chrono.date(year, monthValid, 1); + int womInt = range.checkValidIntValue(wom, this); // validate + int weeks = (int) (womInt - localizedWeekOfMonth(date)); // safe from overflow + int days = localDow - localizedDayOfWeek(date); // safe from overflow + date = date.plus(weeks * 7 + days, DAYS); + if (resolverStyle == ResolverStyle.STRICT && date.getLong(MONTH_OF_YEAR) != month) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different month"); + } + } + fieldValues.remove(this); + fieldValues.remove(YEAR); + fieldValues.remove(MONTH_OF_YEAR); + fieldValues.remove(DAY_OF_WEEK); + return date; } + private ChronoLocalDate resolveWoY( + Map fieldValues, Chronology chrono, int year, long woy, int localDow, ResolverStyle resolverStyle) { + ChronoLocalDate date = chrono.date(year, 1, 1); + if (resolverStyle == ResolverStyle.LENIENT) { + long weeks = Math.subtractExact(woy, localizedWeekOfYear(date)); + int days = localDow - localizedDayOfWeek(date); // safe from overflow + date = date.plus(Math.addExact(Math.multiplyExact(weeks, 7), days), DAYS); + } else { + int womInt = range.checkValidIntValue(woy, this); // validate + int weeks = (int) (womInt - localizedWeekOfYear(date)); // safe from overflow + int days = localDow - localizedDayOfWeek(date); // safe from overflow + date = date.plus(weeks * 7 + days, DAYS); + if (resolverStyle == ResolverStyle.STRICT && date.getLong(YEAR) != year) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different year"); + } + } + fieldValues.remove(this); + fieldValues.remove(YEAR); + fieldValues.remove(DAY_OF_WEEK); + return date; + } + + private ChronoLocalDate resolveWBY( + Map fieldValues, Chronology chrono, int localDow, ResolverStyle resolverStyle) { + int yowby = weekDef.weekBasedYear.range().checkValidIntValue( + fieldValues.get(weekDef.weekBasedYear), weekDef.weekBasedYear); + ChronoLocalDate date; + if (resolverStyle == ResolverStyle.LENIENT) { + date = ofWeekBasedYear(chrono, yowby, 1, localDow); + long wowby = fieldValues.get(weekDef.weekOfWeekBasedYear); + long weeks = Math.subtractExact(wowby, 1); + date = date.plus(weeks, WEEKS); + } else { + int wowby = weekDef.weekOfWeekBasedYear.range().checkValidIntValue( + fieldValues.get(weekDef.weekOfWeekBasedYear), weekDef.weekOfWeekBasedYear); // validate + date = ofWeekBasedYear(chrono, yowby, wowby, localDow); + if (resolverStyle == ResolverStyle.STRICT && localizedWeekBasedYear(date) != yowby) { + throw new DateTimeException("Strict mode rejected resolved date as it is in a different week-based-year"); + } + } + fieldValues.remove(this); + fieldValues.remove(weekDef.weekBasedYear); + fieldValues.remove(weekDef.weekOfWeekBasedYear); + fieldValues.remove(DAY_OF_WEEK); + return date; + } + + //----------------------------------------------------------------------- @Override public String getDisplayName(Locale locale) { Objects.requireNonNull(locale, "locale"); @@ -876,9 +1013,9 @@ public final class WeekFields implements Serializable { LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased() .getLocaleResources(locale); ResourceBundle rb = lr.getJavaTimeFormatData(); - return rb.containsKey("field.week") ? rb.getString("field.week") : getName(); + return rb.containsKey("field.week") ? rb.getString("field.week") : name; } - return getName(); + return name; } @Override @@ -896,6 +1033,11 @@ public final class WeekFields implements Serializable { return true; } + @Override + public boolean isTimeBased() { + return false; + } + @Override public ValueRange range() { return range; @@ -988,7 +1130,7 @@ public final class WeekFields implements Serializable { //----------------------------------------------------------------------- @Override public String toString() { - return getName() + "[" + weekDef.toString() + "]"; + return name + "[" + weekDef.toString() + "]"; } } } diff --git a/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java b/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java index ef59ec7d478..afa872c5855 100644 --- a/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java +++ b/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java @@ -128,6 +128,7 @@ class ArrayPrefixHelpers { this.lo = lo; this.hi = hi; } + @SuppressWarnings("unchecked") public final void compute() { final BinaryOperator fn; final T[] a; @@ -692,6 +693,4 @@ class ArrayPrefixHelpers { } } } - - -} \ No newline at end of file +} diff --git a/jdk/src/share/classes/java/util/Collections.java b/jdk/src/share/classes/java/util/Collections.java index 43ce42eeea6..97555f567fa 100644 --- a/jdk/src/share/classes/java/util/Collections.java +++ b/jdk/src/share/classes/java/util/Collections.java @@ -1143,6 +1143,7 @@ public class Collections { public boolean removeIf(Predicate filter) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unchecked") @Override public Spliterator spliterator() { return (Spliterator)c.spliterator(); @@ -1900,7 +1901,7 @@ public class Collections { private static final long serialVersionUID = -2239321462712562324L; - EmptyNavigableMap() { super(new TreeMap()); } + EmptyNavigableMap() { super(new TreeMap()); } @Override public NavigableSet navigableKeySet() @@ -1928,46 +1929,52 @@ public class Collections { public K ceilingKey(K key) { return nm.ceilingKey(key); } public K higherKey(K key) { return nm.higherKey(key); } + @SuppressWarnings("unchecked") public Entry lowerEntry(K key) { Entry lower = (Entry) nm.lowerEntry(key); return (null != lower) - ? new UnmodifiableEntrySet.UnmodifiableEntry(lower) + ? new UnmodifiableEntrySet.UnmodifiableEntry<>(lower) : null; } + @SuppressWarnings("unchecked") public Entry floorEntry(K key) { Entry floor = (Entry) nm.floorEntry(key); return (null != floor) - ? new UnmodifiableEntrySet.UnmodifiableEntry(floor) + ? new UnmodifiableEntrySet.UnmodifiableEntry<>(floor) : null; } + @SuppressWarnings("unchecked") public Entry ceilingEntry(K key) { Entry ceiling = (Entry) nm.ceilingEntry(key); return (null != ceiling) - ? new UnmodifiableEntrySet.UnmodifiableEntry(ceiling) + ? new UnmodifiableEntrySet.UnmodifiableEntry<>(ceiling) : null; } + @SuppressWarnings("unchecked") public Entry higherEntry(K key) { Entry higher = (Entry) nm.higherEntry(key); return (null != higher) - ? new UnmodifiableEntrySet.UnmodifiableEntry(higher) + ? new UnmodifiableEntrySet.UnmodifiableEntry<>(higher) : null; } + @SuppressWarnings("unchecked") public Entry firstEntry() { Entry first = (Entry) nm.firstEntry(); return (null != first) - ? new UnmodifiableEntrySet.UnmodifiableEntry(first) + ? new UnmodifiableEntrySet.UnmodifiableEntry<>(first) : null; } + @SuppressWarnings("unchecked") public Entry lastEntry() { Entry last = (Entry) nm.lastEntry(); return (null != last) - ? new UnmodifiableEntrySet.UnmodifiableEntry(last) + ? new UnmodifiableEntrySet.UnmodifiableEntry<>(last) : null; } @@ -2360,7 +2367,7 @@ public class Collections { } public NavigableSet tailSet(E fromElement) { synchronized (mutex) { - return new SynchronizedNavigableSet(ns.tailSet(fromElement, true), mutex); + return new SynchronizedNavigableSet<>(ns.tailSet(fromElement, true), mutex); } } @@ -2925,7 +2932,7 @@ public class Collections { public NavigableMap descendingMap() { synchronized (mutex) { return - new SynchronizedNavigableMap(nm.descendingMap(), mutex); + new SynchronizedNavigableMap<>(nm.descendingMap(), mutex); } } @@ -2935,13 +2942,13 @@ public class Collections { public NavigableSet navigableKeySet() { synchronized (mutex) { - return new SynchronizedNavigableSet(nm.navigableKeySet(), mutex); + return new SynchronizedNavigableSet<>(nm.navigableKeySet(), mutex); } } public NavigableSet descendingKeySet() { synchronized (mutex) { - return new SynchronizedNavigableSet(nm.descendingKeySet(), mutex); + return new SynchronizedNavigableSet<>(nm.descendingKeySet(), mutex); } } @@ -2959,27 +2966,27 @@ public class Collections { } public SortedMap tailMap(K fromKey) { synchronized (mutex) { - return new SynchronizedNavigableMap<>(nm.tailMap(fromKey, true),mutex); + return new SynchronizedNavigableMap<>(nm.tailMap(fromKey, true),mutex); } } public NavigableMap subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) { synchronized (mutex) { - return new SynchronizedNavigableMap( + return new SynchronizedNavigableMap<>( nm.subMap(fromKey, fromInclusive, toKey, toInclusive), mutex); } } public NavigableMap headMap(K toKey, boolean inclusive) { synchronized (mutex) { - return new SynchronizedNavigableMap( + return new SynchronizedNavigableMap<>( nm.headMap(toKey, inclusive), mutex); } } public NavigableMap tailMap(K fromKey, boolean inclusive) { synchronized (mutex) { - return new SynchronizedNavigableMap( + return new SynchronizedNavigableMap<>( nm.tailMap(fromKey, inclusive), mutex); } } @@ -4081,7 +4088,7 @@ public class Collections { public Entry lowerEntry(K key) { Entry lower = nm.lowerEntry(key); return (null != lower) - ? new CheckedMap.CheckedEntrySet.CheckedEntry(lower, valueType) + ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(lower, valueType) : null; } @@ -4090,7 +4097,7 @@ public class Collections { public Entry floorEntry(K key) { Entry floor = nm.floorEntry(key); return (null != floor) - ? new CheckedMap.CheckedEntrySet.CheckedEntry(floor, valueType) + ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(floor, valueType) : null; } @@ -4099,7 +4106,7 @@ public class Collections { public Entry ceilingEntry(K key) { Entry ceiling = nm.ceilingEntry(key); return (null != ceiling) - ? new CheckedMap.CheckedEntrySet.CheckedEntry(ceiling, valueType) + ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(ceiling, valueType) : null; } @@ -4108,7 +4115,7 @@ public class Collections { public Entry higherEntry(K key) { Entry higher = nm.higherEntry(key); return (null != higher) - ? new CheckedMap.CheckedEntrySet.CheckedEntry(higher, valueType) + ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(higher, valueType) : null; } @@ -4117,14 +4124,14 @@ public class Collections { public Entry firstEntry() { Entry first = nm.firstEntry(); return (null != first) - ? new CheckedMap.CheckedEntrySet.CheckedEntry(first, valueType) + ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(first, valueType) : null; } public Entry lastEntry() { Entry last = nm.lastEntry(); return (null != last) - ? new CheckedMap.CheckedEntrySet.CheckedEntry(last, valueType) + ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(last, valueType) : null; } @@ -4132,14 +4139,14 @@ public class Collections { Entry entry = nm.pollFirstEntry(); return (null == entry) ? null - : new CheckedMap.CheckedEntrySet.CheckedEntry(entry, valueType); + : new CheckedMap.CheckedEntrySet.CheckedEntry<>(entry, valueType); } public Entry pollLastEntry() { Entry entry = nm.pollLastEntry(); return (null == entry) ? null - : new CheckedMap.CheckedEntrySet.CheckedEntry(entry, valueType); + : new CheckedMap.CheckedEntrySet.CheckedEntry<>(entry, valueType); } public NavigableMap descendingMap() { diff --git a/jdk/src/share/classes/java/util/Comparator.java b/jdk/src/share/classes/java/util/Comparator.java index cd65ca4ea06..55d5efb9866 100644 --- a/jdk/src/share/classes/java/util/Comparator.java +++ b/jdk/src/share/classes/java/util/Comparator.java @@ -352,6 +352,7 @@ public interface Comparator { * @see Comparable * @since 1.8 */ + @SuppressWarnings("unchecked") public static > Comparator naturalOrder() { return (Comparator) Comparators.NaturalOrderComparator.INSTANCE; } @@ -374,7 +375,7 @@ public interface Comparator { * @since 1.8 */ public static Comparator nullsFirst(Comparator comparator) { - return new Comparators.NullComparator(true, comparator); + return new Comparators.NullComparator<>(true, comparator); } /** @@ -395,7 +396,7 @@ public interface Comparator { * @since 1.8 */ public static Comparator nullsLast(Comparator comparator) { - return new Comparators.NullComparator(false, comparator); + return new Comparators.NullComparator<>(false, comparator); } /** diff --git a/jdk/src/share/classes/java/util/Comparators.java b/jdk/src/share/classes/java/util/Comparators.java index a9038321085..ee806798d7a 100644 --- a/jdk/src/share/classes/java/util/Comparators.java +++ b/jdk/src/share/classes/java/util/Comparators.java @@ -87,12 +87,12 @@ class Comparators { @Override public Comparator thenComparing(Comparator other) { Objects.requireNonNull(other); - return new NullComparator(nullFirst, real == null ? other : real.thenComparing(other)); + return new NullComparator<>(nullFirst, real == null ? other : real.thenComparing(other)); } @Override public Comparator reversed() { - return new NullComparator(!nullFirst, real == null ? null : real.reversed()); + return new NullComparator<>(!nullFirst, real == null ? null : real.reversed()); } } } diff --git a/jdk/src/share/classes/java/util/Deque.java b/jdk/src/share/classes/java/util/Deque.java index 051ae9cca46..f6511417f33 100644 --- a/jdk/src/share/classes/java/util/Deque.java +++ b/jdk/src/share/classes/java/util/Deque.java @@ -38,7 +38,7 @@ package java.util; /** * A linear collection that supports element insertion and removal at * both ends. The name deque is short for "double ended queue" - * and is usually pronounced "deck". Most Deque + * and is usually pronounced "deck". Most {@code Deque} * implementations place no fixed limits on the number of elements * they may contain, but this interface supports capacity-restricted * deques as well as those with no fixed size limit. @@ -47,10 +47,10 @@ package java.util; * ends of the deque. Methods are provided to insert, remove, and * examine the element. Each of these methods exists in two forms: * one throws an exception if the operation fails, the other returns a - * special value (either null or false, depending on + * special value (either {@code null} or {@code false}, depending on * the operation). The latter form of the insert operation is * designed specifically for use with capacity-restricted - * Deque implementations; in most implementations, insert + * {@code Deque} implementations; in most implementations, insert * operations cannot fail. * *

                                The twelve methods described above are summarized in the @@ -58,6 +58,7 @@ package java.util; * *

                                *

                              Date and Time Pattern * Result *
                              "yyyy.MM.dd G 'at' HH:mm:ss z" * 2001.07.04 AD at 12:08:56 PDT - *
                              "EEE, MMM d, ''yy" * Wed, Jul 4, '01 *
                              "h:mm a" * 12:08 PM - *
                              "hh 'o''clock' a, zzzz" * 12 o'clock PM, Pacific Daylight Time *
                              "K:mm a, z" * 0:08 PM, PDT - *
                              "yyyyy.MMMMM.dd GGG hh:mm aaa" * 02001.July.04 AD 12:08 PM *
                              "EEE, d MMM yyyy HH:mm:ss Z" * Wed, 4 Jul 2001 12:08:56 -0700 - *
                              "yyMMddHHmmssZ" * 010704120856-0700 *
                              "yyyy-MM-dd'T'HH:mm:ss.SSSZ" * 2001-07-04T12:08:56.235-0700 - *
                              "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" * 2001-07-04T12:08:56.235-07:00 *
                              Hijrah-umalquraislamic-umalquraca-islamic-cv-umalquraca-islamic-umalquraIslamic - Umm Al-Qura calendar of Saudi Arabia
                              + * * * * @@ -72,38 +73,39 @@ package java.util; * * * - * - * - * - * + * + * + * + * * * * - * - * - * - * + * + * + * + * * * * - * - * - * - * + * + * + * + * * *
                              Summary of Deque methods
                              First Element (Head)
                              Insert{@link #addFirst addFirst(e)}{@link #offerFirst offerFirst(e)}{@link #addLast addLast(e)}{@link #offerLast offerLast(e)}{@link Deque#addFirst addFirst(e)}{@link Deque#offerFirst offerFirst(e)}{@link Deque#addLast addLast(e)}{@link Deque#offerLast offerLast(e)}
                              Remove{@link #removeFirst removeFirst()}{@link #pollFirst pollFirst()}{@link #removeLast removeLast()}{@link #pollLast pollLast()}{@link Deque#removeFirst removeFirst()}{@link Deque#pollFirst pollFirst()}{@link Deque#removeLast removeLast()}{@link Deque#pollLast pollLast()}
                              Examine{@link #getFirst getFirst()}{@link #peekFirst peekFirst()}{@link #getLast getLast()}{@link #peekLast peekLast()}{@link Deque#getFirst getFirst()}{@link Deque#peekFirst peekFirst()}{@link Deque#getLast getLast()}{@link Deque#peekLast peekLast()}
                              * *

                              This interface extends the {@link Queue} interface. When a deque is * used as a queue, FIFO (First-In-First-Out) behavior results. Elements are * added at the end of the deque and removed from the beginning. The methods - * inherited from the Queue interface are precisely equivalent to - * Deque methods as indicated in the following table: + * inherited from the {@code Queue} interface are precisely equivalent to + * {@code Deque} methods as indicated in the following table: * *

                              * + * * - * - * + * + * * * * @@ -135,13 +137,14 @@ package java.util; * interface should be used in preference to the legacy {@link Stack} class. * When a deque is used as a stack, elements are pushed and popped from the * beginning of the deque. Stack methods are precisely equivalent to - * Deque methods as indicated in the table below: + * {@code Deque} methods as indicated in the table below: * *

                              *

                              Comparison of Queue and Deque methods
                              Queue Method Equivalent Deque Method {@code Queue} Method Equivalent {@code Deque} Method
                              {@link java.util.Queue#add add(e)}
                              + * * * - * + * * * * @@ -168,18 +171,18 @@ package java.util; *

                              Unlike the {@link List} interface, this interface does not * provide support for indexed access to elements. * - *

                              While Deque implementations are not strictly required + *

                              While {@code Deque} implementations are not strictly required * to prohibit the insertion of null elements, they are strongly - * encouraged to do so. Users of any Deque implementations + * encouraged to do so. Users of any {@code Deque} implementations * that do allow null elements are strongly encouraged not to * take advantage of the ability to insert nulls. This is so because - * null is used as a special return value by various methods + * {@code null} is used as a special return value by various methods * to indicated that the deque is empty. * - *

                              Deque implementations generally do not define - * element-based versions of the equals and hashCode + *

                              {@code Deque} implementations generally do not define + * element-based versions of the {@code equals} and {@code hashCode} * methods, but instead inherit the identity-based versions from class - * Object. + * {@code Object}. * *

                              This interface is a member of the Java Collections @@ -190,13 +193,13 @@ package java.util; * @since 1.6 * @param the type of elements held in this collection */ - public interface Deque extends Queue { /** * Inserts the specified element at the front of this deque if it is - * possible to do so immediately without violating capacity restrictions. - * When using a capacity-restricted deque, it is generally preferable to - * use method {@link #offerFirst}. + * possible to do so immediately without violating capacity restrictions, + * throwing an {@code IllegalStateException} if no space is currently + * available. When using a capacity-restricted deque, it is generally + * preferable to use method {@link #offerFirst}. * * @param e the element to add * @throws IllegalStateException if the element cannot be added at this @@ -212,9 +215,10 @@ public interface Deque extends Queue { /** * Inserts the specified element at the end of this deque if it is - * possible to do so immediately without violating capacity restrictions. - * When using a capacity-restricted deque, it is generally preferable to - * use method {@link #offerLast}. + * possible to do so immediately without violating capacity restrictions, + * throwing an {@code IllegalStateException} if no space is currently + * available. When using a capacity-restricted deque, it is generally + * preferable to use method {@link #offerLast}. * *

                              This method is equivalent to {@link #add}. * @@ -237,8 +241,8 @@ public interface Deque extends Queue { * which can fail to insert an element only by throwing an exception. * * @param e the element to add - * @return true if the element was added to this deque, else - * false + * @return {@code true} if the element was added to this deque, else + * {@code false} * @throws ClassCastException if the class of the specified element * prevents it from being added to this deque * @throws NullPointerException if the specified element is null and this @@ -255,8 +259,8 @@ public interface Deque extends Queue { * which can fail to insert an element only by throwing an exception. * * @param e the element to add - * @return true if the element was added to this deque, else - * false + * @return {@code true} if the element was added to this deque, else + * {@code false} * @throws ClassCastException if the class of the specified element * prevents it from being added to this deque * @throws NullPointerException if the specified element is null and this @@ -288,17 +292,17 @@ public interface Deque extends Queue { /** * Retrieves and removes the first element of this deque, - * or returns null if this deque is empty. + * or returns {@code null} if this deque is empty. * - * @return the head of this deque, or null if this deque is empty + * @return the head of this deque, or {@code null} if this deque is empty */ E pollFirst(); /** * Retrieves and removes the last element of this deque, - * or returns null if this deque is empty. + * or returns {@code null} if this deque is empty. * - * @return the tail of this deque, or null if this deque is empty + * @return the tail of this deque, or {@code null} if this deque is empty */ E pollLast(); @@ -325,31 +329,31 @@ public interface Deque extends Queue { /** * Retrieves, but does not remove, the first element of this deque, - * or returns null if this deque is empty. + * or returns {@code null} if this deque is empty. * - * @return the head of this deque, or null if this deque is empty + * @return the head of this deque, or {@code null} if this deque is empty */ E peekFirst(); /** * Retrieves, but does not remove, the last element of this deque, - * or returns null if this deque is empty. + * or returns {@code null} if this deque is empty. * - * @return the tail of this deque, or null if this deque is empty + * @return the tail of this deque, or {@code null} if this deque is empty */ E peekLast(); /** * Removes the first occurrence of the specified element from this deque. * If the deque does not contain the element, it is unchanged. - * More formally, removes the first element e such that + * More formally, removes the first element {@code e} such that * (o==null ? e==null : o.equals(e)) * (if such an element exists). - * Returns true if this deque contained the specified element + * Returns {@code true} if this deque contained the specified element * (or equivalently, if this deque changed as a result of the call). * * @param o element to be removed from this deque, if present - * @return true if an element was removed as a result of this call + * @return {@code true} if an element was removed as a result of this call * @throws ClassCastException if the class of the specified element * is incompatible with this deque * (optional) @@ -362,14 +366,14 @@ public interface Deque extends Queue { /** * Removes the last occurrence of the specified element from this deque. * If the deque does not contain the element, it is unchanged. - * More formally, removes the last element e such that + * More formally, removes the last element {@code e} such that * (o==null ? e==null : o.equals(e)) * (if such an element exists). - * Returns true if this deque contained the specified element + * Returns {@code true} if this deque contained the specified element * (or equivalently, if this deque changed as a result of the call). * * @param o element to be removed from this deque, if present - * @return true if an element was removed as a result of this call + * @return {@code true} if an element was removed as a result of this call * @throws ClassCastException if the class of the specified element * is incompatible with this deque * (optional) @@ -385,15 +389,15 @@ public interface Deque extends Queue { * Inserts the specified element into the queue represented by this deque * (in other words, at the tail of this deque) if it is possible to do so * immediately without violating capacity restrictions, returning - * true upon success and throwing an - * IllegalStateException if no space is currently available. + * {@code true} upon success and throwing an + * {@code IllegalStateException} if no space is currently available. * When using a capacity-restricted deque, it is generally preferable to * use {@link #offer(Object) offer}. * *

                              This method is equivalent to {@link #addLast}. * * @param e the element to add - * @return true (as specified by {@link Collection#add}) + * @return {@code true} (as specified by {@link Collection#add}) * @throws IllegalStateException if the element cannot be added at this * time due to capacity restrictions * @throws ClassCastException if the class of the specified element @@ -409,7 +413,7 @@ public interface Deque extends Queue { * Inserts the specified element into the queue represented by this deque * (in other words, at the tail of this deque) if it is possible to do so * immediately without violating capacity restrictions, returning - * true upon success and false if no space is currently + * {@code true} upon success and {@code false} if no space is currently * available. When using a capacity-restricted deque, this method is * generally preferable to the {@link #add} method, which can fail to * insert an element only by throwing an exception. @@ -417,8 +421,8 @@ public interface Deque extends Queue { *

                              This method is equivalent to {@link #offerLast}. * * @param e the element to add - * @return true if the element was added to this deque, else - * false + * @return {@code true} if the element was added to this deque, else + * {@code false} * @throws ClassCastException if the class of the specified element * prevents it from being added to this deque * @throws NullPointerException if the specified element is null and this @@ -444,11 +448,11 @@ public interface Deque extends Queue { /** * Retrieves and removes the head of the queue represented by this deque * (in other words, the first element of this deque), or returns - * null if this deque is empty. + * {@code null} if this deque is empty. * *

                              This method is equivalent to {@link #pollFirst()}. * - * @return the first element of this deque, or null if + * @return the first element of this deque, or {@code null} if * this deque is empty */ E poll(); @@ -469,12 +473,12 @@ public interface Deque extends Queue { /** * Retrieves, but does not remove, the head of the queue represented by * this deque (in other words, the first element of this deque), or - * returns null if this deque is empty. + * returns {@code null} if this deque is empty. * *

                              This method is equivalent to {@link #peekFirst()}. * * @return the head of the queue represented by this deque, or - * null if this deque is empty + * {@code null} if this deque is empty */ E peek(); @@ -484,9 +488,8 @@ public interface Deque extends Queue { /** * Pushes an element onto the stack represented by this deque (in other * words, at the head of this deque) if it is possible to do so - * immediately without violating capacity restrictions, returning - * true upon success and throwing an - * IllegalStateException if no space is currently available. + * immediately without violating capacity restrictions, throwing an + * {@code IllegalStateException} if no space is currently available. * *

                              This method is equivalent to {@link #addFirst}. * @@ -520,16 +523,16 @@ public interface Deque extends Queue { /** * Removes the first occurrence of the specified element from this deque. * If the deque does not contain the element, it is unchanged. - * More formally, removes the first element e such that + * More formally, removes the first element {@code e} such that * (o==null ? e==null : o.equals(e)) * (if such an element exists). - * Returns true if this deque contained the specified element + * Returns {@code true} if this deque contained the specified element * (or equivalently, if this deque changed as a result of the call). * - *

                              This method is equivalent to {@link #removeFirstOccurrence}. + *

                              This method is equivalent to {@link #removeFirstOccurrence(Object)}. * * @param o element to be removed from this deque, if present - * @return true if an element was removed as a result of this call + * @return {@code true} if an element was removed as a result of this call * @throws ClassCastException if the class of the specified element * is incompatible with this deque * (optional) @@ -540,13 +543,13 @@ public interface Deque extends Queue { boolean remove(Object o); /** - * Returns true if this deque contains the specified element. - * More formally, returns true if and only if this deque contains - * at least one element e such that + * Returns {@code true} if this deque contains the specified element. + * More formally, returns {@code true} if and only if this deque contains + * at least one element {@code e} such that * (o==null ? e==null : o.equals(e)). * * @param o element whose presence in this deque is to be tested - * @return true if this deque contains the specified element + * @return {@code true} if this deque contains the specified element * @throws ClassCastException if the type of the specified element * is incompatible with this deque * (optional) diff --git a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java index fb79c56660b..63c887e23ce 100644 --- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java +++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java @@ -25,6 +25,7 @@ package java.util; import java.util.function.DoubleConsumer; +import java.util.stream.Collector; /** * A state object for collecting statistics such as count, min, max, sum, and @@ -35,24 +36,24 @@ import java.util.function.DoubleConsumer; * summary statistics on a stream of doubles with: *

                               {@code
                                * DoubleSummaryStatistics stats = doubleStream.collect(DoubleSummaryStatistics::new,
                              - *     DoubleSummaryStatistics::accept,
                              - *     DoubleSummaryStatistics::combine);
                              + *                                                      DoubleSummaryStatistics::accept,
                              + *                                                      DoubleSummaryStatistics::combine);
                                * }
                              * *

                              {@code DoubleSummaryStatistics} can be used as a - * {@linkplain java.util.stream.Stream#reduce(java.util.function.BinaryOperator) reduction} + * {@linkplain java.util.stream.Stream#collect(Collector) reduction} * target for a {@linkplain java.util.stream.Stream stream}. For example: * *

                               {@code
                                * DoubleSummaryStatistics stats = people.stream()
                              - *     .collect(Collectors.toDoubleSummaryStatistics(Person::getWeight));
                              + *     .collect(Collectors.summarizingDouble(Person::getWeight));
                                *}
                              * * This computes, in a single pass, the count of people, as well as the minimum, * maximum, sum, and average of their weights. * * @implNote This implementation is not thread safe. However, it is safe to use - * {@link java.util.stream.Collectors#toDoubleSummaryStatistics(java.util.function.ToDoubleFunction) + * {@link java.util.stream.Collectors#summarizingDouble(java.util.function.ToDoubleFunction) * Collectors.toDoubleStatistics()} on a parallel stream, because the parallel * implementation of {@link java.util.stream.Stream#collect Stream.collect()} * provides the necessary partitioning, isolation, and merging of results for @@ -152,7 +153,7 @@ public class DoubleSummaryStatistics implements DoubleConsumer { } /** - * Returns the average of values recorded, or zero if no values have been + * Returns the arithmetic mean of values recorded, or zero if no values have been * recorded. The average returned can vary depending upon the order in * which values are recorded. This is due to accumulated rounding error in * addition of values of differing magnitudes. Values sorted by increasing @@ -160,7 +161,7 @@ public class DoubleSummaryStatistics implements DoubleConsumer { * value is a {@code NaN} or the sum is at any point a {@code NaN} then the * average will be {@code NaN}. * - * @return the average of values, or zero if none + * @return the arithmetic mean of values, or zero if none */ public final double getAverage() { return getCount() > 0 ? getSum() / getCount() : 0.0d; diff --git a/jdk/src/share/classes/java/util/Formatter.java b/jdk/src/share/classes/java/util/Formatter.java index 5c096c63acf..275e1854e0a 100644 --- a/jdk/src/share/classes/java/util/Formatter.java +++ b/jdk/src/share/classes/java/util/Formatter.java @@ -626,12 +626,11 @@ import sun.misc.FormattedFloatingDecimal; *

                              For general argument types, the precision is the maximum number of * characters to be written to the output. * - *

                              For the floating-point conversions {@code 'e'}, {@code 'E'}, and - * {@code 'f'} the precision is the number of digits after the decimal - * separator. If the conversion is {@code 'g'} or {@code 'G'}, then the + *

                              For the floating-point conversions {@code 'a'}, {@code 'A'}, {@code 'e'}, + * {@code 'E'}, and {@code 'f'} the precision is the number of digits after the + * radix point. If the conversion is {@code 'g'} or {@code 'G'}, then the * precision is the total number of digits in the resulting magnitude after - * rounding. If the conversion is {@code 'a'} or {@code 'A'}, then the - * precision must not be specified. + * rounding. * *

                              For character, integral, and date/time argument types and the percent * and line separator conversions, the precision is not applicable; if a @@ -1297,14 +1296,21 @@ import sun.misc.FormattedFloatingDecimal; * of the significand as a fraction. The exponent is represented by * {@code 'p'} ('\u0070') followed by a decimal string of the * unbiased exponent as if produced by invoking {@link - * Integer#toString(int) Integer.toString} on the exponent value. + * Integer#toString(int) Integer.toString} on the exponent value. If the + * precision is specified, the value is rounded to the given number of + * hexadecimal digits. * *

                            • If m is a {@code double} value with a subnormal - * representation then the significand is represented by the characters - * {@code '0x0.'} followed by the hexadecimal representation of the rest - * of the significand as a fraction. The exponent is represented by - * {@code 'p-1022'}. Note that there must be at least one nonzero digit - * in a subnormal significand. + * representation then, unless the precision is specified to be in the range + * 1 through 12, inclusive, the significand is represented by the characters + * {@code '0x0.'} followed by the hexadecimal representation of the rest of + * the significand as a fraction, and the exponent represented by + * {@code 'p-1022'}. If the precision is in the interval + * [1, 12], the subnormal value is normalized such that it + * begins with the characters {@code '0x1.'}, rounded to the number of + * hexadecimal digits of precision, and the exponent adjusted + * accordingly. Note that there must be at least one nonzero digit in a + * subnormal significand. * * * @@ -1367,7 +1373,7 @@ import sun.misc.FormattedFloatingDecimal; * {@code 1}. * *

                              If the conversion is {@code 'a'} or {@code 'A'}, then the precision - * is the number of hexadecimal digits after the decimal separator. If the + * is the number of hexadecimal digits after the radix point. If the * precision is not provided, then all of the digits as returned by {@link * Double#toHexString(double)} will be output. * diff --git a/jdk/src/share/classes/java/util/HashMap.java b/jdk/src/share/classes/java/util/HashMap.java index c2aace9db8f..8dfafac8642 100644 --- a/jdk/src/share/classes/java/util/HashMap.java +++ b/jdk/src/share/classes/java/util/HashMap.java @@ -876,13 +876,9 @@ public class HashMap private static int roundUpToPowerOf2(int number) { // assert number >= 0 : "number must be non-negative"; - int rounded = number >= MAXIMUM_CAPACITY + return number >= MAXIMUM_CAPACITY ? MAXIMUM_CAPACITY - : (rounded = Integer.highestOneBit(number)) != 0 - ? (Integer.bitCount(number) > 1) ? rounded << 1 : rounded - : 1; - - return rounded; + : (number > 1) ? Integer.highestOneBit((number - 1) << 1) : 1; } /** diff --git a/jdk/src/share/classes/java/util/Hashtable.java b/jdk/src/share/classes/java/util/Hashtable.java index a481719be0c..518bd17f5b7 100644 --- a/jdk/src/share/classes/java/util/Hashtable.java +++ b/jdk/src/share/classes/java/util/Hashtable.java @@ -928,6 +928,7 @@ public class Hashtable return (null == result) ? defaultValue : result; } + @SuppressWarnings("unchecked") @Override public synchronized void forEach(BiConsumer action) { Objects.requireNonNull(action); // explicit check required in case @@ -947,6 +948,7 @@ public class Hashtable } } + @SuppressWarnings("unchecked") @Override public synchronized void replaceAll(BiFunction function) { Objects.requireNonNull(function); // explicit check required in case diff --git a/jdk/src/share/classes/java/util/IdentityHashMap.java b/jdk/src/share/classes/java/util/IdentityHashMap.java index 3064588c901..a4bdc4b9efd 100644 --- a/jdk/src/share/classes/java/util/IdentityHashMap.java +++ b/jdk/src/share/classes/java/util/IdentityHashMap.java @@ -1339,6 +1339,7 @@ public class IdentityHashMap tab[i + 1] = value; } + @SuppressWarnings("unchecked") @Override public void forEach(BiConsumer action) { Objects.requireNonNull(action); @@ -1357,6 +1358,7 @@ public class IdentityHashMap } } + @SuppressWarnings("unchecked") @Override public void replaceAll(BiFunction function) { Objects.requireNonNull(function); diff --git a/jdk/src/share/classes/java/util/IntSummaryStatistics.java b/jdk/src/share/classes/java/util/IntSummaryStatistics.java index fcca3296f85..f93436e7017 100644 --- a/jdk/src/share/classes/java/util/IntSummaryStatistics.java +++ b/jdk/src/share/classes/java/util/IntSummaryStatistics.java @@ -25,6 +25,7 @@ package java.util; import java.util.function.IntConsumer; +import java.util.stream.Collector; /** * A state object for collecting statistics such as count, min, max, sum, and @@ -35,24 +36,24 @@ import java.util.function.IntConsumer; * summary statistics on a stream of ints with: *

                               {@code
                                * IntSummaryStatistics stats = intStream.collect(IntSummaryStatistics::new,
                              - *     IntSummaryStatistics::accept,
                              - *     IntSummaryStatistics::combine);
                              + *                                                IntSummaryStatistics::accept,
                              + *                                                IntSummaryStatistics::combine);
                                * }
                              * *

                              {@code IntSummaryStatistics} can be used as a - * {@linkplain java.util.stream.Stream#reduce(java.util.function.BinaryOperator) reduction} + * {@linkplain java.util.stream.Stream#collect(Collector) reduction} * target for a {@linkplain java.util.stream.Stream stream}. For example: * *

                               {@code
                                * IntSummaryStatistics stats = people.stream()
                              - *     .collect(Collectors.toIntSummaryStatistics(Person::getDependents));
                              + *                                    .collect(Collectors.summarizingInt(Person::getDependents));
                                *}
                              * * This computes, in a single pass, the count of people, as well as the minimum, * maximum, sum, and average of their number of dependents. * * @implNote This implementation is not thread safe. However, it is safe to use - * {@link java.util.stream.Collectors#toIntSummaryStatistics(java.util.function.ToIntFunction) + * {@link java.util.stream.Collectors#summarizingInt(java.util.function.ToIntFunction) * Collectors.toIntStatistics()} on a parallel stream, because the parallel * implementation of {@link java.util.stream.Stream#collect Stream.collect()} * provides the necessary partitioning, isolation, and merging of results for @@ -140,10 +141,10 @@ public class IntSummaryStatistics implements IntConsumer { } /** - * Returns the average of values recorded, or zero if no values have been + * Returns the arithmetic mean of values recorded, or zero if no values have been * recorded. * - * @return the average of values, or zero if none + * @return the arithmetic mean of values, or zero if none */ public final double getAverage() { return getCount() > 0 ? (double) getSum() / getCount() : 0.0d; diff --git a/jdk/src/share/classes/java/util/List.java b/jdk/src/share/classes/java/util/List.java index daee8acd641..11104ab760e 100644 --- a/jdk/src/share/classes/java/util/List.java +++ b/jdk/src/share/classes/java/util/List.java @@ -384,10 +384,12 @@ public interface List extends Collection { * @implSpec * The default implementation is equivalent to, for this {@code list}: *
                              +     * {@code
                                    * final ListIterator li = list.listIterator();
                                    * while (li.hasNext()) {
                                    *   li.set(operator.apply(li.next()));
                                    * }
                              +     * }
                                    * 
                              * If the list's list-iterator does not support the {@code set} operation * then an {@code UnsupportedOperationException} will be thrown when diff --git a/jdk/src/share/classes/java/util/LongSummaryStatistics.java b/jdk/src/share/classes/java/util/LongSummaryStatistics.java index 0e2da71f8bc..085aa298075 100644 --- a/jdk/src/share/classes/java/util/LongSummaryStatistics.java +++ b/jdk/src/share/classes/java/util/LongSummaryStatistics.java @@ -26,6 +26,7 @@ package java.util; import java.util.function.IntConsumer; import java.util.function.LongConsumer; +import java.util.stream.Collector; /** * A state object for collecting statistics such as count, min, max, sum, and @@ -36,24 +37,24 @@ import java.util.function.LongConsumer; * summary statistics on a stream of longs with: *
                               {@code
                                * LongSummaryStatistics stats = longStream.collect(LongSummaryStatistics::new,
                              - *     LongSummaryStatistics::accept,
                              - *     LongSummaryStatistics::combine);
                              + *                                                  LongSummaryStatistics::accept,
                              + *                                                  LongSummaryStatistics::combine);
                                * }
                              * *

                              {@code LongSummaryStatistics} can be used as a - * {@linkplain java.util.stream.Stream#reduce(java.util.function.BinaryOperator) reduction} + * {@linkplain java.util.stream.Stream#collect(Collector)} reduction} * target for a {@linkplain java.util.stream.Stream stream}. For example: * *

                               {@code
                                * LongSummaryStatistics stats = people.stream()
                              - *     .collect(Collectors.toLongSummaryStatistics(Person::getAge));
                              + *                                     .collect(Collectors.summarizingLong(Person::getAge));
                                *}
                              * * This computes, in a single pass, the count of people, as well as the minimum, - * maximum, sum, and average of their ages in milliseconds. + * maximum, sum, and average of their ages. * * @implNote This implementation is not thread safe. However, it is safe to use - * {@link java.util.stream.Collectors#toLongSummaryStatistics(java.util.function.ToLongFunction) + * {@link java.util.stream.Collectors#summarizingLong(java.util.function.ToLongFunction) * Collectors.toLongStatistics()} on a parallel stream, because the parallel * implementation of {@link java.util.stream.Stream#collect Stream.collect()} * provides the necessary partitioning, isolation, and merging of results for @@ -152,10 +153,10 @@ public class LongSummaryStatistics implements LongConsumer, IntConsumer { } /** - * Returns the average of values recorded, or zero if no values have been + * Returns the arithmetic mean of values recorded, or zero if no values have been * recorded. * - * @return The average of values, or zero if none + * @return The arithmetic mean of values, or zero if none */ public final double getAverage() { return getCount() > 0 ? (double) getSum() / getCount() : 0.0d; diff --git a/jdk/src/share/classes/java/util/Map.java b/jdk/src/share/classes/java/util/Map.java index 8ad16ee8323..321233e6f8d 100644 --- a/jdk/src/share/classes/java/util/Map.java +++ b/jdk/src/share/classes/java/util/Map.java @@ -561,6 +561,7 @@ public interface Map { * concurrency properties. * * @param key the key whose associated value is to be returned + * @param defaultValue the default mapping of the key * @return the value to which the specified key is mapped, or * {@code defaultValue} if this map contains no mapping for the key * @throws ClassCastException if the key is of an inappropriate type for diff --git a/jdk/src/share/classes/java/util/Optional.java b/jdk/src/share/classes/java/util/Optional.java index 4e95e18684b..ce2a33d1de6 100644 --- a/jdk/src/share/classes/java/util/Optional.java +++ b/jdk/src/share/classes/java/util/Optional.java @@ -93,6 +93,7 @@ public final class Optional { /** * Returns an {@code Optional} with the specified present non-null value. * + * @param the class of the value * @param value the value to be present, which must be non-null * @return an {@code Optional} with the value present */ @@ -104,6 +105,7 @@ public final class Optional { * Returns an {@code Optional} describing the specified value, if non-null, * otherwise returns an empty {@code Optional}. * + * @param the class of the value * @param value the possibly-null value to describe * @return an {@code Optional} with a present value if the specified value * is non-null, otherwise an empty {@code Optional} @@ -305,7 +307,7 @@ public final class Optional { return false; } - Optional other = (Optional) obj; + Optional other = (Optional) obj; return Objects.equals(value, other.value); } diff --git a/jdk/src/share/classes/java/util/PriorityQueue.java b/jdk/src/share/classes/java/util/PriorityQueue.java index c28647b58bb..6a31f3ee292 100644 --- a/jdk/src/share/classes/java/util/PriorityQueue.java +++ b/jdk/src/share/classes/java/util/PriorityQueue.java @@ -135,6 +135,19 @@ public class PriorityQueue extends AbstractQueue this(initialCapacity, null); } + /** + * Creates a {@code PriorityQueue} with the default initial capacity and + * whose elements are ordered according to the specified comparator. + * + * @param comparator the comparator that will be used to order this + * priority queue. If {@code null}, the {@linkplain Comparable + * natural ordering} of the elements will be used. + * @since 1.8 + */ + public PriorityQueue(Comparator comparator) { + this(DEFAULT_INITIAL_CAPACITY, comparator); + } + /** * Creates a {@code PriorityQueue} with the specified initial capacity * that orders its elements according to the specified comparator. diff --git a/jdk/src/share/classes/java/util/Queue.java b/jdk/src/share/classes/java/util/Queue.java index 124cc449426..4d345df7e6f 100644 --- a/jdk/src/share/classes/java/util/Queue.java +++ b/jdk/src/share/classes/java/util/Queue.java @@ -41,14 +41,15 @@ package java.util; * queues provide additional insertion, extraction, and inspection * operations. Each of these methods exists in two forms: one throws * an exception if the operation fails, the other returns a special - * value (either null or false, depending on the + * value (either {@code null} or {@code false}, depending on the * operation). The latter form of the insert operation is designed - * specifically for use with capacity-restricted Queue + * specifically for use with capacity-restricted {@code Queue} * implementations; in most implementations, insert operations cannot * fail. * *

                              *

                            • Comparison of Stack and Deque methods
                              Stack Method Equivalent Deque Method Equivalent {@code Deque} Method
                              {@link #push push(e)}
                              + * * * * @@ -56,18 +57,18 @@ package java.util; * * * - * - * + * + * * * * - * - * + * + * * * * - * - * + * + * * *
                              Summary of Queue methods
                              Throws exception
                              Insert{@link #add add(e)}{@link #offer offer(e)}{@link Queue#add add(e)}{@link Queue#offer offer(e)}
                              Remove{@link #remove remove()}{@link #poll poll()}{@link Queue#remove remove()}{@link Queue#poll poll()}
                              Examine{@link #element element()}{@link #peek peek()}{@link Queue#element element()}{@link Queue#peek peek()}
                              * @@ -79,15 +80,15 @@ package java.util; * Whatever the ordering used, the head of the queue is that * element which would be removed by a call to {@link #remove() } or * {@link #poll()}. In a FIFO queue, all new elements are inserted at - * the tail of the queue. Other kinds of queues may use - * different placement rules. Every Queue implementation + * the tail of the queue. Other kinds of queues may use + * different placement rules. Every {@code Queue} implementation * must specify its ordering properties. * *

                              The {@link #offer offer} method inserts an element if possible, - * otherwise returning false. This differs from the {@link + * otherwise returning {@code false}. This differs from the {@link * java.util.Collection#add Collection.add} method, which can fail to * add an element only by throwing an unchecked exception. The - * offer method is designed for use when failure is a normal, + * {@code offer} method is designed for use when failure is a normal, * rather than exceptional occurrence, for example, in fixed-capacity * (or "bounded") queues. * @@ -95,32 +96,32 @@ package java.util; * return the head of the queue. * Exactly which element is removed from the queue is a * function of the queue's ordering policy, which differs from - * implementation to implementation. The remove() and - * poll() methods differ only in their behavior when the - * queue is empty: the remove() method throws an exception, - * while the poll() method returns null. + * implementation to implementation. The {@code remove()} and + * {@code poll()} methods differ only in their behavior when the + * queue is empty: the {@code remove()} method throws an exception, + * while the {@code poll()} method returns {@code null}. * *

                              The {@link #element()} and {@link #peek()} methods return, but do * not remove, the head of the queue. * - *

                              The Queue interface does not define the blocking queue + *

                              The {@code Queue} interface does not define the blocking queue * methods, which are common in concurrent programming. These methods, * which wait for elements to appear or for space to become available, are * defined in the {@link java.util.concurrent.BlockingQueue} interface, which * extends this interface. * - *

                              Queue implementations generally do not allow insertion - * of null elements, although some implementations, such as - * {@link LinkedList}, do not prohibit insertion of null. - * Even in the implementations that permit it, null should - * not be inserted into a Queue, as null is also - * used as a special return value by the poll method to + *

                              {@code Queue} implementations generally do not allow insertion + * of {@code null} elements, although some implementations, such as + * {@link LinkedList}, do not prohibit insertion of {@code null}. + * Even in the implementations that permit it, {@code null} should + * not be inserted into a {@code Queue}, as {@code null} is also + * used as a special return value by the {@code poll} method to * indicate that the queue contains no elements. * - *

                              Queue implementations generally do not define - * element-based versions of methods equals and - * hashCode but instead inherit the identity based versions - * from class Object, because element-based equality is not + *

                              {@code Queue} implementations generally do not define + * element-based versions of methods {@code equals} and + * {@code hashCode} but instead inherit the identity based versions + * from class {@code Object}, because element-based equality is not * always well-defined for queues with the same elements but different * ordering properties. * @@ -145,11 +146,11 @@ public interface Queue extends Collection { /** * Inserts the specified element into this queue if it is possible to do so * immediately without violating capacity restrictions, returning - * true upon success and throwing an IllegalStateException + * {@code true} upon success and throwing an {@code IllegalStateException} * if no space is currently available. * * @param e the element to add - * @return true (as specified by {@link Collection#add}) + * @return {@code true} (as specified by {@link Collection#add}) * @throws IllegalStateException if the element cannot be added at this * time due to capacity restrictions * @throws ClassCastException if the class of the specified element @@ -169,8 +170,8 @@ public interface Queue extends Collection { * by throwing an exception. * * @param e the element to add - * @return true if the element was added to this queue, else - * false + * @return {@code true} if the element was added to this queue, else + * {@code false} * @throws ClassCastException if the class of the specified element * prevents it from being added to this queue * @throws NullPointerException if the specified element is null and @@ -192,9 +193,9 @@ public interface Queue extends Collection { /** * Retrieves and removes the head of this queue, - * or returns null if this queue is empty. + * or returns {@code null} if this queue is empty. * - * @return the head of this queue, or null if this queue is empty + * @return the head of this queue, or {@code null} if this queue is empty */ E poll(); @@ -210,9 +211,9 @@ public interface Queue extends Collection { /** * Retrieves, but does not remove, the head of this queue, - * or returns null if this queue is empty. + * or returns {@code null} if this queue is empty. * - * @return the head of this queue, or null if this queue is empty + * @return the head of this queue, or {@code null} if this queue is empty */ E peek(); } diff --git a/jdk/src/share/classes/java/util/Random.java b/jdk/src/share/classes/java/util/Random.java index ca430bae26f..ae2551c0f9b 100644 --- a/jdk/src/share/classes/java/util/Random.java +++ b/jdk/src/share/classes/java/util/Random.java @@ -225,9 +225,8 @@ class Random implements java.io.Serializable { * Returns the next pseudorandom, uniformly distributed {@code int} * value from this random number generator's sequence. The general * contract of {@code nextInt} is that one {@code int} value is - * pseudorandomly generated and returned. All 232 - * possible {@code int} values are produced with - * (approximately) equal probability. + * pseudorandomly generated and returned. All 232 possible + * {@code int} values are produced with (approximately) equal probability. * *

                              The method {@code nextInt} is implemented by class {@code Random} * as if by: @@ -370,11 +369,9 @@ class Random implements java.io.Serializable { *

                              The general contract of {@code nextFloat} is that one * {@code float} value, chosen (approximately) uniformly from the * range {@code 0.0f} (inclusive) to {@code 1.0f} (exclusive), is - * pseudorandomly generated and returned. All 224 possible {@code float} values - * of the form m x 2-24, where m is a positive - * integer less than 224 , are + * pseudorandomly generated and returned. All 224 possible + * {@code float} values of the form m x 2-24, + * where m is a positive integer less than 224, are * produced with (approximately) equal probability. * *

                              The method {@code nextFloat} is implemented by class {@code Random} diff --git a/jdk/src/share/classes/java/util/Scanner.java b/jdk/src/share/classes/java/util/Scanner.java index f6967f3a75c..36be8e3a2f9 100644 --- a/jdk/src/share/classes/java/util/Scanner.java +++ b/jdk/src/share/classes/java/util/Scanner.java @@ -76,7 +76,7 @@ import sun.misc.LRUCache; * }

                              *

                              * prints the following output: - *

                              {@code
                              + * 
                              {@code
                                *     1
                                *     2
                                *     red
                              @@ -149,8 +149,7 @@ import sun.misc.LRUCache;
                                * {@link #reset} method will reset the value of the scanner's radix to
                                * 10 regardless of whether it was previously changed.
                                *
                              - * 
                              - * 

                              Localized numbers

                              + *

                              Localized numbers

                              * *

                              An instance of this class is capable of scanning numbers in the standard * formats as well as in the formats of the scanner's locale. A scanner's @@ -167,186 +166,139 @@ import sun.misc.LRUCache; * {@link java.text.DecimalFormatSymbols DecimalFormatSymbols} object, * dfs. * - *

                              - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
                              LocalGroupSeparator  The character used to separate thousands groups, - * i.e., dfs.{@link - * java.text.DecimalFormatSymbols#getGroupingSeparator - * getGroupingSeparator()}
                              LocalDecimalSeparator  The character used for the decimal point, - * i.e., dfs.{@link - * java.text.DecimalFormatSymbols#getDecimalSeparator - * getDecimalSeparator()}
                              LocalPositivePrefix  The string that appears before a positive number (may - * be empty), i.e., df.{@link - * java.text.DecimalFormat#getPositivePrefix - * getPositivePrefix()}
                              LocalPositiveSuffix  The string that appears after a positive number (may be - * empty), i.e., df.{@link - * java.text.DecimalFormat#getPositiveSuffix - * getPositiveSuffix()}
                              LocalNegativePrefix  The string that appears before a negative number (may - * be empty), i.e., df.{@link - * java.text.DecimalFormat#getNegativePrefix - * getNegativePrefix()}
                              LocalNegativeSuffix  The string that appears after a negative number (may be - * empty), i.e., df.{@link - * java.text.DecimalFormat#getNegativeSuffix - * getNegativeSuffix()}
                              LocalNaN  The string that represents not-a-number for - * floating-point values, - * i.e., dfs.{@link - * java.text.DecimalFormatSymbols#getNaN - * getNaN()}
                              LocalInfinity  The string that represents infinity for floating-point - * values, i.e., dfs.{@link - * java.text.DecimalFormatSymbols#getInfinity - * getInfinity()}
                              + *
                              + *
                              LocalGroupSeparator   + *
                              The character used to separate thousands groups, + * i.e., dfs.{@link + * java.text.DecimalFormatSymbols#getGroupingSeparator + * getGroupingSeparator()} + *
                              LocalDecimalSeparator   + *
                              The character used for the decimal point, + * i.e., dfs.{@link + * java.text.DecimalFormatSymbols#getDecimalSeparator + * getDecimalSeparator()} + *
                              LocalPositivePrefix   + *
                              The string that appears before a positive number (may + * be empty), i.e., df.{@link + * java.text.DecimalFormat#getPositivePrefix + * getPositivePrefix()} + *
                              LocalPositiveSuffix   + *
                              The string that appears after a positive number (may be + * empty), i.e., df.{@link + * java.text.DecimalFormat#getPositiveSuffix + * getPositiveSuffix()} + *
                              LocalNegativePrefix   + *
                              The string that appears before a negative number (may + * be empty), i.e., df.{@link + * java.text.DecimalFormat#getNegativePrefix + * getNegativePrefix()} + *
                              LocalNegativeSuffix   + *
                              The string that appears after a negative number (may be + * empty), i.e., df.{@link + * java.text.DecimalFormat#getNegativeSuffix + * getNegativeSuffix()} + *
                              LocalNaN   + *
                              The string that represents not-a-number for + * floating-point values, + * i.e., dfs.{@link + * java.text.DecimalFormatSymbols#getNaN + * getNaN()} + *
                              LocalInfinity   + *
                              The string that represents infinity for floating-point + * values, i.e., dfs.{@link + * java.text.DecimalFormatSymbols#getInfinity + * getInfinity()} + *
                              * - * - *

                              Number syntax

                              + *

                              Number syntax

                              * *

                              The strings that can be parsed as numbers by an instance of this class * are specified in terms of the following regular-expression grammar, where - * Rmax is the highest digit in the radix being used (for example, Rmax is 9 - * in base 10). + * Rmax is the highest digit in the radix being used (for example, Rmax is 9 in base 10). * *

                              - * - * - * - * + * returns true * - * + *
                              Non0Digit: + *
                              [1-Rmax] | NonASCIIDigit * - *
                              - * + *
                              Digit: + *
                              [0-Rmax] | NonASCIIDigit * - *
                              + *
                              GroupedNumeral: + *
                              Non0Digit + * Digit? + * Digit? + *
                                  LocalGroupSeparator + * Digit + * Digit + * Digit )+ ) * - *
                              - * + *
                              Numeral: + *
                              ( ( Digit+ ) + * | GroupedNumeral ) * - *
                              + *
                              Integer: + *
                              ( [-+]? ( Numeral + * ) ) + *
                              | LocalPositivePrefix Numeral + * LocalPositiveSuffix + *
                              | LocalNegativePrefix Numeral + * LocalNegativeSuffix * - *
                              - * + *
                              DecimalNumeral: + *
                              Numeral + *
                              | Numeral + * LocalDecimalSeparator + * Digit* + *
                              | LocalDecimalSeparator + * Digit+ * - *
                              + *
                              Exponent: + *
                              ( [eE] [+-]? Digit+ ) * - *
                              - * + *
                              Decimal: + *
                              ( [-+]? DecimalNumeral + * Exponent? ) + *
                              | LocalPositivePrefix + * DecimalNumeral + * LocalPositiveSuffix + * Exponent? + *
                              | LocalNegativePrefix + * DecimalNumeral + * LocalNegativeSuffix + * Exponent? * - *
                              + *
                              HexFloat: + *
                              [-+]? 0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+ + * ([pP][-+]?[0-9]+)? * - *
                              - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * | LocalInfinity * - * + *
                              SignedNonNumber: + *
                              ( [-+]? NonNumber ) + *
                              | LocalPositivePrefix + * NonNumber + * LocalPositiveSuffix + *
                              | LocalNegativePrefix + * NonNumber + * LocalNegativeSuffix * - *
                              - * - * - * - * - * + *
                              Float: + *
                              Decimal + * | HexFloat + * | SignedNonNumber * - *
                              - * - * - * - * - * - * - * - * - *
                              NonASCIIDigit  ::= A non-ASCII character c for which + *
                              + *
                              NonAsciiDigit: + *
                              A non-ASCII character c for which * {@link java.lang.Character#isDigit Character.isDigit}(c) - * returns true
                               
                              Non0Digit  ::= [1-Rmax] | NonASCIIDigit
                               
                              Digit  ::= [0-Rmax] | NonASCIIDigit
                               
                              GroupedNumeral  :: - * - * - * - * - * - *
                              = ( Non0Digit - * Digit? - * Digit?
                              LocalGroupSeparator - * Digit - * Digit - * Digit )+ )
                               
                              Numeral  ::= ( ( Digit+ ) - * | GroupedNumeral )
                               
                              - * Integer  ::= ( [-+]? ( Numeral - * ) )
                              | LocalPositivePrefix Numeral - * LocalPositiveSuffix
                              | LocalNegativePrefix Numeral - * LocalNegativeSuffix
                               
                              DecimalNumeral  ::= Numeral
                              | Numeral - * LocalDecimalSeparator - * Digit*
                              | LocalDecimalSeparator - * Digit+
                               
                              Exponent  ::= ( [eE] [+-]? Digit+ )
                               
                              - * Decimal  ::= ( [-+]? DecimalNumeral - * Exponent? )
                              | LocalPositivePrefix - * DecimalNumeral - * LocalPositiveSuffix - * Exponent?
                              | LocalNegativePrefix - * DecimalNumeral - * LocalNegativeSuffix - * Exponent?
                               
                              HexFloat  ::= [-+]? 0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+ - * ([pP][-+]?[0-9]+)?
                               
                              NonNumber  ::= NaN + *
                              NonNumber: + *
                              NaN * | LocalNan * | Infinity - * | LocalInfinity
                               
                              SignedNonNumber  ::= ( [-+]? NonNumber )
                              | LocalPositivePrefix - * NonNumber - * LocalPositiveSuffix
                              | LocalNegativePrefix - * NonNumber - * LocalNegativeSuffix
                               
                              - * Float  ::= Decimal
                              | HexFloat
                              | SignedNonNumber
                              - * - * - *

                              Whitespace is not significant in the above regular expressions. + * + *

                              Whitespace is not significant in the above regular expressions. * * @since 1.5 */ @@ -1675,6 +1627,7 @@ public final class Scanner implements Iterator, Closeable { * findWithinHorizon(Pattern.compile(pattern, horizon)). * * @param pattern a string specifying the pattern to search for + * @param horizon the search horizon * @return the text that matched the specified pattern * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if horizon is negative @@ -1709,6 +1662,7 @@ public final class Scanner implements Iterator, Closeable { * thrown. * * @param pattern the pattern to scan for + * @param horizon the search horizon * @return the text that matched the specified pattern * @throws IllegalStateException if this scanner is closed * @throws IllegalArgumentException if horizon is negative diff --git a/jdk/src/share/classes/java/util/ServiceLoader.java b/jdk/src/share/classes/java/util/ServiceLoader.java index 962438022a7..aa5c3008818 100644 --- a/jdk/src/share/classes/java/util/ServiceLoader.java +++ b/jdk/src/share/classes/java/util/ServiceLoader.java @@ -68,12 +68,13 @@ import java.util.NoSuchElementException; * *

                              A service provider is identified by placing a * provider-configuration file in the resource directory - * META-INF/services. The file's name is the fully-qualified META-INF/services. The file's name is the fully-qualified binary name of the service's type. * The file contains a list of fully-qualified binary names of concrete * provider classes, one per line. Space and tab characters surrounding each * name, as well as blank lines, are ignored. The comment character is - * '#' ('\u0023', NUMBER SIGN); on + * '#' ('\u0023', + * NUMBER SIGN); on * each line all characters following the first comment character are ignored. * The file must be encoded in UTF-8. * @@ -484,6 +485,8 @@ public final class ServiceLoader * Creates a new service loader for the given service type and class * loader. * + * @param the class of the service type + * * @param service * The interface or abstract class representing the service * @@ -517,6 +520,8 @@ public final class ServiceLoader * ServiceLoader.load(service, * Thread.currentThread().getContextClassLoader())

                              * + * @param the class of the service type + * * @param service * The interface or abstract class representing the service * @@ -546,6 +551,8 @@ public final class ServiceLoader * have been installed into the current Java virtual machine; providers on * the application's class path will be ignored. * + * @param the class of the service type + * * @param service * The interface or abstract class representing the service * diff --git a/jdk/src/share/classes/java/util/StringJoiner.java b/jdk/src/share/classes/java/util/StringJoiner.java index d2734102c67..d4050a4afd5 100644 --- a/jdk/src/share/classes/java/util/StringJoiner.java +++ b/jdk/src/share/classes/java/util/StringJoiner.java @@ -49,16 +49,17 @@ package java.util; *

                              * A {@code StringJoiner} may be employed to create formatted output from a * {@link java.util.stream.Stream} using - * {@link java.util.stream.Collectors#toStringJoiner}. For example: + * {@link java.util.stream.Collectors#joining(CharSequence)}. For example: * *

                               {@code
                                * List numbers = Arrays.asList(1, 2, 3, 4);
                                * String commaSeparatedNumbers = numbers.stream()
                                *     .map(i -> i.toString())
                              - *     .collect(Collectors.toStringJoiner(", ")).toString();
                              + *     .collect(Collectors.joining(", "));
                                * }
                              * - * @see java.util.stream.Collectors#toStringJoiner + * @see java.util.stream.Collectors#joining(CharSequence) + * @see java.util.stream.Collectors#joining(CharSequence, CharSequence, CharSequence) * @since 1.8 */ public final class StringJoiner { @@ -202,15 +203,17 @@ public final class StringJoiner { * @param other The {@code StringJoiner} whose contents should be merged * into this one * @throws NullPointerException if the other {@code StringJoiner} is null + * @return This {@code StringJoiner} */ public StringJoiner merge(StringJoiner other) { Objects.requireNonNull(other); if (other.value != null) { + final int length = other.value.length(); + // lock the length so that we can seize the data to be appended + // before initiate copying to avoid interference, especially when + // merge 'this' StringBuilder builder = prepareBuilder(); - StringBuilder otherBuilder = other.value; - if (other.prefix.length() < otherBuilder.length()) { - builder.append(otherBuilder, other.prefix.length(), otherBuilder.length()); - } + builder.append(other.value, other.prefix.length(), length); } return this; } diff --git a/jdk/src/share/classes/java/util/TimeZone.java b/jdk/src/share/classes/java/util/TimeZone.java index ba4abb91f2c..b37c9f89d1c 100644 --- a/jdk/src/share/classes/java/util/TimeZone.java +++ b/jdk/src/share/classes/java/util/TimeZone.java @@ -118,7 +118,7 @@ import sun.util.locale.provider.TimeZoneNameUtility; *
                              * For example, TimeZone.getTimeZone("GMT-8").getID() returns "GMT-08:00". * - *

                              Three-letter time zone IDs

                              + *

                              Three-letter time zone IDs

                              * * For compatibility with JDK 1.1.x, some other three-letter time zone IDs * (such as "PST", "CTT", "AST") are also supported. However, their @@ -304,10 +304,10 @@ abstract public class TimeZone implements Serializable, Cloneable { * presentation to the user in the default locale. * *

                              This method is equivalent to: - *

                              + *
                                    * getDisplayName(false, {@link #LONG},
                                    *                Locale.getDefault({@link Locale.Category#DISPLAY}))
                              -     * 
                              + * * * @return the human-readable name of this time zone in the default locale. * @since 1.2 @@ -325,9 +325,9 @@ abstract public class TimeZone implements Serializable, Cloneable { * presentation to the user in the specified {@code locale}. * *

                              This method is equivalent to: - *

                              + *
                                    * getDisplayName(false, {@link #LONG}, locale)
                              -     * 
                              + * * * @param locale the locale in which to supply the display name. * @return the human-readable name of this time zone in the given locale. @@ -347,10 +347,10 @@ abstract public class TimeZone implements Serializable, Cloneable { * Time). Otherwise, a Standard Time name is returned. * *

                              This method is equivalent to: - *

                              + *
                                    * getDisplayName(daylight, style,
                                    *                Locale.getDefault({@link Locale.Category#DISPLAY}))
                              -     * 
                              + * * * @param daylight {@code true} specifying a Daylight Saving Time name, or * {@code false} specifying a Standard Time name diff --git a/jdk/src/share/classes/java/util/TreeMap.java b/jdk/src/share/classes/java/util/TreeMap.java index 44d7449e07a..352ac237ee8 100644 --- a/jdk/src/share/classes/java/util/TreeMap.java +++ b/jdk/src/share/classes/java/util/TreeMap.java @@ -25,6 +25,7 @@ package java.util; +import java.io.Serializable; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Consumer; @@ -2865,7 +2866,7 @@ public class TreeMap } public int characteristics() { - return (side == 0 ? Spliterator.SIZED : 0); + return (side == 0 ? Spliterator.SIZED : 0) | Spliterator.ORDERED; } } @@ -2942,9 +2943,23 @@ public class TreeMap } @Override - public Comparator> getComparator() { - return tree.comparator != null ? - Map.Entry.comparingByKey(tree.comparator) : null; + public Comparator> getComparator() { + // Since SORTED is reported and Map.Entry elements are not comparable + // then a non-null comparator needs to be returned + if (tree.comparator != null) { + // Adapt the existing non-null comparator to compare entries + // by key + return Map.Entry.comparingByKey(tree.comparator); + } + else { + // Return a comparator of entries by key, with K assumed to be + // of Comparable + return (Comparator> & Serializable) (e1, e2) -> { + @SuppressWarnings("unchecked") + Comparable k1 = (Comparable) e1.getKey(); + return k1.compareTo(e2.getKey()); + }; + } } } } diff --git a/jdk/src/share/classes/java/util/UUID.java b/jdk/src/share/classes/java/util/UUID.java index 211912ef452..b9be5a47baf 100644 --- a/jdk/src/share/classes/java/util/UUID.java +++ b/jdk/src/share/classes/java/util/UUID.java @@ -286,6 +286,7 @@ public final class UUID implements java.io.Serializable, Comparable { * * @throws UnsupportedOperationException * If this UUID is not a version 1 UUID + * @return The timestamp of this {@code UUID}. */ public long timestamp() { if (version() != 1) { diff --git a/jdk/src/share/classes/java/util/Vector.java b/jdk/src/share/classes/java/util/Vector.java index fc3a1f7f235..6146957dfd6 100644 --- a/jdk/src/share/classes/java/util/Vector.java +++ b/jdk/src/share/classes/java/util/Vector.java @@ -45,9 +45,9 @@ import java.util.function.UnaryOperator; * capacity of a vector before inserting a large number of * components; this reduces the amount of incremental reallocation. * - *

                              + *

                              * The iterators returned by this class's {@link #iterator() iterator} and - * {@link #listIterator(int) listIterator} methods are fail-fast: + * {@link #listIterator(int) listIterator} methods are fail-fast: * if the vector is structurally modified at any time after the iterator is * created, in any way except through the iterator's own * {@link ListIterator#remove() remove} or @@ -1164,12 +1164,13 @@ public class Vector if (i >= size) { return; } - final Object[] elementData = Vector.this.elementData; + @SuppressWarnings("unchecked") + final E[] elementData = (E[]) Vector.this.elementData; if (i >= elementData.length) { throw new ConcurrentModificationException(); } while (i != size && modCount == expectedModCount) { - action.accept((E) elementData[i++]); + action.accept(elementData[i++]); } // update once at end of iteration to reduce heap write traffic cursor = i; @@ -1311,8 +1312,8 @@ public class Vector modCount++; } - @Override @SuppressWarnings("unchecked") + @Override public synchronized void sort(Comparator c) { final int expectedModCount = modCount; Arrays.sort((E[]) elementData, 0, elementCount, c); diff --git a/jdk/src/share/classes/java/util/WeakHashMap.java b/jdk/src/share/classes/java/util/WeakHashMap.java index eb2e636e2ba..0299d296638 100644 --- a/jdk/src/share/classes/java/util/WeakHashMap.java +++ b/jdk/src/share/classes/java/util/WeakHashMap.java @@ -1038,6 +1038,7 @@ public class WeakHashMap } } + @SuppressWarnings("unchecked") @Override public void forEach(BiConsumer action) { Objects.requireNonNull(action); @@ -1059,6 +1060,7 @@ public class WeakHashMap } } + @SuppressWarnings("unchecked") @Override public void replaceAll(BiFunction function) { Objects.requireNonNull(function); diff --git a/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java b/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java index 4e2b766c943..73aa047ca30 100644 --- a/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java +++ b/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java @@ -76,6 +76,7 @@ public abstract class AbstractExecutorService implements ExecutorService { * * @param runnable the runnable task being wrapped * @param value the default value for the returned future + * @param the type of the given value * @return a {@code RunnableFuture} which, when run, will run the * underlying runnable and which, as a {@code Future}, will yield * the given value as its result and provide for cancellation of @@ -90,6 +91,7 @@ public abstract class AbstractExecutorService implements ExecutorService { * Returns a {@code RunnableFuture} for the given callable task. * * @param callable the callable task being wrapped + * @param the type of the callable's result * @return a {@code RunnableFuture} which, when run, will call the * underlying callable and which, as a {@code Future}, will yield * the callable's result as its result and provide for diff --git a/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java b/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java index 7926f2e63b9..5e2fb134fc1 100644 --- a/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java +++ b/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java @@ -48,13 +48,16 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletionException; +import java.util.concurrent.CompletionStage; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.LockSupport; /** * A {@link Future} that may be explicitly completed (setting its - * value and status), and may include dependent functions and actions - * that trigger upon its completion. + * value and status), and may be used as a {@link CompletionStage}, + * supporting dependent functions and actions that trigger upon its + * completion. * *

                              When two or more threads attempt to * {@link #complete complete}, @@ -62,64 +65,50 @@ import java.util.concurrent.locks.LockSupport; * {@link #cancel cancel} * a CompletableFuture, only one of them succeeds. * - *

                              Methods are available for adding dependents based on - * user-provided Functions, Consumers, or Runnables. The appropriate - * form to use depends on whether actions require arguments and/or - * produce results. Completion of a dependent action will trigger the - * completion of another CompletableFuture. Actions may also be - * triggered after either or both the current and another - * CompletableFuture complete. Multiple CompletableFutures may also - * be grouped as one using {@link #anyOf(CompletableFuture...)} and - * {@link #allOf(CompletableFuture...)}. + *

                              In addition to these and related methods for directly + * manipulating status and results, CompletableFuture implements + * interface {@link CompletionStage} with the following policies:

                                * - *

                                CompletableFutures themselves do not execute asynchronously. - * However, actions supplied for dependent completions of another - * CompletableFuture may do so, depending on whether they are provided - * via one of the async methods (that is, methods with names - * of the form xxxAsync). The async - * methods provide a way to commence asynchronous processing of an - * action using either a given {@link Executor} or by default the - * {@link ForkJoinPool#commonPool()}. To simplify monitoring, + *

                              • Actions supplied for dependent completions of + * non-async methods may be performed by the thread that + * completes the current CompletableFuture, or by any other caller of + * a completion method.
                              • + * + *
                              • All async methods without an explicit Executor + * argument are performed using the {@link ForkJoinPool#commonPool()} + * (unless it does not support a parallelism level of at least two, in + * which case, a new Thread is used). To simplify monitoring, * debugging, and tracking, all generated asynchronous tasks are - * instances of the marker interface {@link AsynchronousCompletionTask}. + * instances of the marker interface {@link + * AsynchronousCompletionTask}.
                              • * - *

                                Actions supplied for dependent completions of non-async - * methods may be performed by the thread that completes the current - * CompletableFuture, or by any other caller of these methods. There - * are no guarantees about the order of processing completions unless - * constrained by these methods. + *

                              • All CompletionStage methods are implemented independently of + * other public methods, so the behavior of one method is not impacted + * by overrides of others in subclasses.
                              * - *

                              Since (unlike {@link FutureTask}) this class has no direct + *

                              CompletableFuture also implements {@link Future} with the following + * policies:

                                + * + *
                              • Since (unlike {@link FutureTask}) this class has no direct * control over the computation that causes it to be completed, - * cancellation is treated as just another form of exceptional completion. - * Method {@link #cancel cancel} has the same effect as - * {@code completeExceptionally(new CancellationException())}. + * cancellation is treated as just another form of exceptional + * completion. Method {@link #cancel cancel} has the same effect as + * {@code completeExceptionally(new CancellationException())}. Method + * {@link #isCompletedExceptionally} can be used to determine if a + * CompletableFuture completed in any exceptional fashion.
                              • * - *

                                Upon exceptional completion (including cancellation), or when a - * completion entails an additional computation which terminates - * abruptly with an (unchecked) exception or error, then all of their - * dependent completions (and their dependents in turn) generally act - * as {@code completeExceptionally} with a {@link CompletionException} - * holding that exception as its cause. However, the {@link - * #exceptionally exceptionally} and {@link #handle handle} - * completions are able to handle exceptional completions of - * the CompletableFutures they depend on. - * - *

                                In case of exceptional completion with a CompletionException, + *

                              • In case of exceptional completion with a CompletionException, * methods {@link #get()} and {@link #get(long, TimeUnit)} throw an * {@link ExecutionException} with the same cause as held in the - * corresponding CompletionException. However, in these cases, - * methods {@link #join()} and {@link #getNow} throw the - * CompletionException, which simplifies usage. - * - *

                                Arguments used to pass a completion result (that is, for parameters - * of type {@code T}) may be null, but passing a null value for any other - * parameter will result in a {@link NullPointerException} being thrown. + * corresponding CompletionException. To simplify usage in most + * contexts, this class also defines methods {@link #join()} and + * {@link #getNow} that instead throw the CompletionException directly + * in these cases.

                              * * @author Doug Lea * @since 1.8 */ -public class CompletableFuture implements Future { +public class CompletableFuture implements Future, CompletionStage { /* * Overview: @@ -438,6 +427,19 @@ public class CompletableFuture implements Future { public final void run() { exec(); } } + /** + * Starts the given async task using the given executor, unless + * the executor is ForkJoinPool.commonPool and it has been + * disabled, in which case starts a new thread. + */ + static void execAsync(Executor e, Async r) { + if (e == ForkJoinPool.commonPool() && + ForkJoinPool.getCommonPoolParallelism() <= 1) + new Thread(r).start(); + else + e.execute(r); + } + static final class AsyncRun extends Async { final Runnable fn; final CompletableFuture dst; @@ -538,13 +540,13 @@ public class CompletableFuture implements Future { static final class AsyncAccept extends Async { final T arg; final Consumer fn; - final CompletableFuture dst; + final CompletableFuture dst; AsyncAccept(T arg, Consumer fn, - CompletableFuture dst) { + CompletableFuture dst) { this.arg = arg; this.fn = fn; this.dst = dst; } public final boolean exec() { - CompletableFuture d; Throwable ex; + CompletableFuture d; Throwable ex; if ((d = this.dst) != null && d.result == null) { try { fn.accept(arg); @@ -563,14 +565,14 @@ public class CompletableFuture implements Future { final T arg1; final U arg2; final BiConsumer fn; - final CompletableFuture dst; + final CompletableFuture dst; AsyncAcceptBoth(T arg1, U arg2, BiConsumer fn, - CompletableFuture dst) { + CompletableFuture dst) { this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst; } public final boolean exec() { - CompletableFuture d; Throwable ex; + CompletableFuture d; Throwable ex; if ((d = this.dst) != null && d.result == null) { try { fn.accept(arg1, arg2); @@ -587,10 +589,10 @@ public class CompletableFuture implements Future { static final class AsyncCompose extends Async { final T arg; - final Function> fn; + final Function> fn; final CompletableFuture dst; AsyncCompose(T arg, - Function> fn, + Function> fn, CompletableFuture dst) { this.arg = arg; this.fn = fn; this.dst = dst; } @@ -598,7 +600,8 @@ public class CompletableFuture implements Future { CompletableFuture d, fr; U u; Throwable ex; if ((d = this.dst) != null && d.result == null) { try { - fr = fn.apply(arg); + CompletionStage cs = fn.apply(arg); + fr = (cs == null) ? null : cs.toCompletableFuture(); ex = (fr == null) ? new NullPointerException() : null; } catch (Throwable rex) { ex = rex; @@ -626,6 +629,33 @@ public class CompletableFuture implements Future { private static final long serialVersionUID = 5232453952276885070L; } + static final class AsyncWhenComplete extends Async { + final T arg1; + final Throwable arg2; + final BiConsumer fn; + final CompletableFuture dst; + AsyncWhenComplete(T arg1, Throwable arg2, + BiConsumer fn, + CompletableFuture dst) { + this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst; + } + public final boolean exec() { + CompletableFuture d; + if ((d = this.dst) != null && d.result == null) { + Throwable ex = arg2; + try { + fn.accept(arg1, ex); + } catch (Throwable rex) { + if (ex == null) + ex = rex; + } + d.internalComplete(arg1, ex); + } + return true; + } + private static final long serialVersionUID = 5232453952276885070L; + } + /* ------------- Completions -------------- */ /** @@ -680,7 +710,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncApply(t, fn, dst)); + execAsync(e, new AsyncApply(t, fn, dst)); else u = fn.apply(t); } catch (Throwable rex) { @@ -697,11 +727,11 @@ public class CompletableFuture implements Future { static final class ThenAccept extends Completion { final CompletableFuture src; final Consumer fn; - final CompletableFuture dst; + final CompletableFuture dst; final Executor executor; ThenAccept(CompletableFuture src, Consumer fn, - CompletableFuture dst, + CompletableFuture dst, Executor executor) { this.src = src; this.fn = fn; this.dst = dst; this.executor = executor; @@ -709,7 +739,7 @@ public class CompletableFuture implements Future { public final void run() { final CompletableFuture a; final Consumer fn; - final CompletableFuture dst; + final CompletableFuture dst; Object r; T t; Throwable ex; if ((dst = this.dst) != null && (fn = this.fn) != null && @@ -729,7 +759,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncAccept(t, fn, dst)); + execAsync(e, new AsyncAccept(t, fn, dst)); else fn.accept(t); } catch (Throwable rex) { @@ -773,7 +803,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncRun(fn, dst)); + execAsync(e, new AsyncRun(fn, dst)); else fn.run(); } catch (Throwable rex) { @@ -839,7 +869,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncCombine(t, u, fn, dst)); + execAsync(e, new AsyncCombine(t, u, fn, dst)); else v = fn.apply(t, u); } catch (Throwable rex) { @@ -904,7 +934,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncAcceptBoth(t, u, fn, dst)); + execAsync(e, new AsyncAcceptBoth(t, u, fn, dst)); else fn.accept(t, u); } catch (Throwable rex) { @@ -956,7 +986,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncRun(fn, dst)); + execAsync(e, new AsyncRun(fn, dst)); else fn.run(); } catch (Throwable rex) { @@ -1042,7 +1072,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncApply(t, fn, dst)); + execAsync(e, new AsyncApply(t, fn, dst)); else u = fn.apply(t); } catch (Throwable rex) { @@ -1095,7 +1125,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncAccept(t, fn, dst)); + execAsync(e, new AsyncAccept(t, fn, dst)); else fn.accept(t); } catch (Throwable rex) { @@ -1143,7 +1173,7 @@ public class CompletableFuture implements Future { if (ex == null) { try { if (e != null) - e.execute(new AsyncRun(fn, dst)); + execAsync(e, new AsyncRun(fn, dst)); else fn.run(); } catch (Throwable rex) { @@ -1226,6 +1256,54 @@ public class CompletableFuture implements Future { private static final long serialVersionUID = 5232453952276885070L; } + static final class WhenCompleteCompletion extends Completion { + final CompletableFuture src; + final BiConsumer fn; + final CompletableFuture dst; + final Executor executor; + WhenCompleteCompletion(CompletableFuture src, + BiConsumer fn, + CompletableFuture dst, + Executor executor) { + this.src = src; this.fn = fn; this.dst = dst; + this.executor = executor; + } + public final void run() { + final CompletableFuture a; + final BiConsumer fn; + final CompletableFuture dst; + Object r; T t; Throwable ex; + if ((dst = this.dst) != null && + (fn = this.fn) != null && + (a = this.src) != null && + (r = a.result) != null && + compareAndSet(0, 1)) { + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + Executor e = executor; + Throwable dx = null; + try { + if (e != null) + execAsync(e, new AsyncWhenComplete(t, ex, fn, dst)); + else + fn.accept(t, ex); + } catch (Throwable rex) { + dx = rex; + } + if (e == null || dx != null) + dst.internalComplete(t, ex != null ? ex : dx); + } + } + private static final long serialVersionUID = 5232453952276885070L; + } + static final class ThenCopy extends Completion { final CompletableFuture src; final CompletableFuture dst; @@ -1286,10 +1364,13 @@ public class CompletableFuture implements Future { final CompletableFuture src; final BiFunction fn; final CompletableFuture dst; + final Executor executor; HandleCompletion(CompletableFuture src, BiFunction fn, - CompletableFuture dst) { + CompletableFuture dst, + Executor executor) { this.src = src; this.fn = fn; this.dst = dst; + this.executor = executor; } public final void run() { final CompletableFuture a; @@ -1310,13 +1391,19 @@ public class CompletableFuture implements Future { @SuppressWarnings("unchecked") T tr = (T) r; t = tr; } - U u = null; Throwable dx = null; + Executor e = executor; + U u = null; + Throwable dx = null; try { - u = fn.apply(t, ex); + if (e != null) + execAsync(e, new AsyncCombine(t, ex, fn, dst)); + else + u = fn.apply(t, ex); } catch (Throwable rex) { dx = rex; } - dst.internalComplete(u, dx); + if (e == null || dx != null) + dst.internalComplete(u, dx); } } private static final long serialVersionUID = 5232453952276885070L; @@ -1324,11 +1411,11 @@ public class CompletableFuture implements Future { static final class ThenCompose extends Completion { final CompletableFuture src; - final Function> fn; + final Function> fn; final CompletableFuture dst; final Executor executor; ThenCompose(CompletableFuture src, - Function> fn, + Function> fn, CompletableFuture dst, Executor executor) { this.src = src; this.fn = fn; this.dst = dst; @@ -1336,7 +1423,7 @@ public class CompletableFuture implements Future { } public final void run() { final CompletableFuture a; - final Function> fn; + final Function> fn; final CompletableFuture dst; Object r; T t; Throwable ex; Executor e; if ((dst = this.dst) != null && @@ -1358,10 +1445,12 @@ public class CompletableFuture implements Future { boolean complete = false; if (ex == null) { if ((e = executor) != null) - e.execute(new AsyncCompose(t, fn, dst)); + execAsync(e, new AsyncCompose(t, fn, dst)); else { try { - if ((c = fn.apply(t)) == null) + CompletionStage cs = fn.apply(t); + c = (cs == null) ? null : cs.toCompletableFuture(); + if (c == null) ex = new NullPointerException(); } catch (Throwable rex) { ex = rex; @@ -1401,6 +1490,619 @@ public class CompletableFuture implements Future { private static final long serialVersionUID = 5232453952276885070L; } + // Implementations of stage methods with (plain, async, Executor) forms + + private CompletableFuture doThenApply + (Function fn, + Executor e) { + if (fn == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + ThenApply d = null; + Object r; + if ((r = result) == null) { + CompletionNode p = new CompletionNode + (d = new ThenApply(this, fn, dst, e)); + while ((r = result) == null) { + if (UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) + break; + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + T t; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + U u = null; + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncApply(t, fn, dst)); + else + u = fn.apply(t); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(u, ex); + } + helpPostComplete(); + return dst; + } + + private CompletableFuture doThenAccept(Consumer fn, + Executor e) { + if (fn == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + ThenAccept d = null; + Object r; + if ((r = result) == null) { + CompletionNode p = new CompletionNode + (d = new ThenAccept(this, fn, dst, e)); + while ((r = result) == null) { + if (UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) + break; + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + T t; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncAccept(t, fn, dst)); + else + fn.accept(t); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(null, ex); + } + helpPostComplete(); + return dst; + } + + private CompletableFuture doThenRun(Runnable action, + Executor e) { + if (action == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + ThenRun d = null; + Object r; + if ((r = result) == null) { + CompletionNode p = new CompletionNode + (d = new ThenRun(this, action, dst, e)); + while ((r = result) == null) { + if (UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) + break; + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + Throwable ex; + if (r instanceof AltResult) + ex = ((AltResult)r).ex; + else + ex = null; + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncRun(action, dst)); + else + action.run(); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(null, ex); + } + helpPostComplete(); + return dst; + } + + private CompletableFuture doThenCombine + (CompletableFuture other, + BiFunction fn, + Executor e) { + if (other == null || fn == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + ThenCombine d = null; + Object r, s = null; + if ((r = result) == null || (s = other.result) == null) { + d = new ThenCombine(this, other, fn, dst, e); + CompletionNode q = null, p = new CompletionNode(d); + while ((r == null && (r = result) == null) || + (s == null && (s = other.result) == null)) { + if (q != null) { + if (s != null || + UNSAFE.compareAndSwapObject + (other, COMPLETIONS, q.next = other.completions, q)) + break; + } + else if (r != null || + UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) { + if (s != null) + break; + q = new CompletionNode(d); + } + } + } + if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) { + T t; U u; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + if (ex != null) + u = null; + else if (s instanceof AltResult) { + ex = ((AltResult)s).ex; + u = null; + } + else { + @SuppressWarnings("unchecked") U us = (U) s; + u = us; + } + V v = null; + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncCombine(t, u, fn, dst)); + else + v = fn.apply(t, u); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(v, ex); + } + helpPostComplete(); + other.helpPostComplete(); + return dst; + } + + private CompletableFuture doThenAcceptBoth + (CompletableFuture other, + BiConsumer fn, + Executor e) { + if (other == null || fn == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + ThenAcceptBoth d = null; + Object r, s = null; + if ((r = result) == null || (s = other.result) == null) { + d = new ThenAcceptBoth(this, other, fn, dst, e); + CompletionNode q = null, p = new CompletionNode(d); + while ((r == null && (r = result) == null) || + (s == null && (s = other.result) == null)) { + if (q != null) { + if (s != null || + UNSAFE.compareAndSwapObject + (other, COMPLETIONS, q.next = other.completions, q)) + break; + } + else if (r != null || + UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) { + if (s != null) + break; + q = new CompletionNode(d); + } + } + } + if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) { + T t; U u; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + if (ex != null) + u = null; + else if (s instanceof AltResult) { + ex = ((AltResult)s).ex; + u = null; + } + else { + @SuppressWarnings("unchecked") U us = (U) s; + u = us; + } + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncAcceptBoth(t, u, fn, dst)); + else + fn.accept(t, u); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(null, ex); + } + helpPostComplete(); + other.helpPostComplete(); + return dst; + } + + private CompletableFuture doRunAfterBoth(CompletableFuture other, + Runnable action, + Executor e) { + if (other == null || action == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + RunAfterBoth d = null; + Object r, s = null; + if ((r = result) == null || (s = other.result) == null) { + d = new RunAfterBoth(this, other, action, dst, e); + CompletionNode q = null, p = new CompletionNode(d); + while ((r == null && (r = result) == null) || + (s == null && (s = other.result) == null)) { + if (q != null) { + if (s != null || + UNSAFE.compareAndSwapObject + (other, COMPLETIONS, q.next = other.completions, q)) + break; + } + else if (r != null || + UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) { + if (s != null) + break; + q = new CompletionNode(d); + } + } + } + if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) { + Throwable ex; + if (r instanceof AltResult) + ex = ((AltResult)r).ex; + else + ex = null; + if (ex == null && (s instanceof AltResult)) + ex = ((AltResult)s).ex; + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncRun(action, dst)); + else + action.run(); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(null, ex); + } + helpPostComplete(); + other.helpPostComplete(); + return dst; + } + + private CompletableFuture doApplyToEither + (CompletableFuture other, + Function fn, + Executor e) { + if (other == null || fn == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + ApplyToEither d = null; + Object r; + if ((r = result) == null && (r = other.result) == null) { + d = new ApplyToEither(this, other, fn, dst, e); + CompletionNode q = null, p = new CompletionNode(d); + while ((r = result) == null && (r = other.result) == null) { + if (q != null) { + if (UNSAFE.compareAndSwapObject + (other, COMPLETIONS, q.next = other.completions, q)) + break; + } + else if (UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) + q = new CompletionNode(d); + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + T t; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + U u = null; + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncApply(t, fn, dst)); + else + u = fn.apply(t); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(u, ex); + } + helpPostComplete(); + other.helpPostComplete(); + return dst; + } + + private CompletableFuture doAcceptEither + (CompletableFuture other, + Consumer fn, + Executor e) { + if (other == null || fn == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + AcceptEither d = null; + Object r; + if ((r = result) == null && (r = other.result) == null) { + d = new AcceptEither(this, other, fn, dst, e); + CompletionNode q = null, p = new CompletionNode(d); + while ((r = result) == null && (r = other.result) == null) { + if (q != null) { + if (UNSAFE.compareAndSwapObject + (other, COMPLETIONS, q.next = other.completions, q)) + break; + } + else if (UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) + q = new CompletionNode(d); + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + T t; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncAccept(t, fn, dst)); + else + fn.accept(t); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(null, ex); + } + helpPostComplete(); + other.helpPostComplete(); + return dst; + } + + private CompletableFuture doRunAfterEither + (CompletableFuture other, + Runnable action, + Executor e) { + if (other == null || action == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + RunAfterEither d = null; + Object r; + if ((r = result) == null && (r = other.result) == null) { + d = new RunAfterEither(this, other, action, dst, e); + CompletionNode q = null, p = new CompletionNode(d); + while ((r = result) == null && (r = other.result) == null) { + if (q != null) { + if (UNSAFE.compareAndSwapObject + (other, COMPLETIONS, q.next = other.completions, q)) + break; + } + else if (UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) + q = new CompletionNode(d); + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + Throwable ex; + if (r instanceof AltResult) + ex = ((AltResult)r).ex; + else + ex = null; + if (ex == null) { + try { + if (e != null) + execAsync(e, new AsyncRun(action, dst)); + else + action.run(); + } catch (Throwable rex) { + ex = rex; + } + } + if (e == null || ex != null) + dst.internalComplete(null, ex); + } + helpPostComplete(); + other.helpPostComplete(); + return dst; + } + + private CompletableFuture doThenCompose + (Function> fn, + Executor e) { + if (fn == null) throw new NullPointerException(); + CompletableFuture dst = null; + ThenCompose d = null; + Object r; + if ((r = result) == null) { + dst = new CompletableFuture(); + CompletionNode p = new CompletionNode + (d = new ThenCompose(this, fn, dst, e)); + while ((r = result) == null) { + if (UNSAFE.compareAndSwapObject + (this, COMPLETIONS, p.next = completions, p)) + break; + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + T t; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + if (ex == null) { + if (e != null) { + if (dst == null) + dst = new CompletableFuture(); + execAsync(e, new AsyncCompose(t, fn, dst)); + } + else { + try { + CompletionStage cs = fn.apply(t); + if (cs == null || + (dst = cs.toCompletableFuture()) == null) + ex = new NullPointerException(); + } catch (Throwable rex) { + ex = rex; + } + } + } + if (dst == null) + dst = new CompletableFuture(); + if (e == null || ex != null) + dst.internalComplete(null, ex); + } + helpPostComplete(); + dst.helpPostComplete(); + return dst; + } + + private CompletableFuture doWhenComplete + (BiConsumer fn, + Executor e) { + if (fn == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + WhenCompleteCompletion d = null; + Object r; + if ((r = result) == null) { + CompletionNode p = + new CompletionNode(d = new WhenCompleteCompletion + (this, fn, dst, e)); + while ((r = result) == null) { + if (UNSAFE.compareAndSwapObject(this, COMPLETIONS, + p.next = completions, p)) + break; + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + T t; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + Throwable dx = null; + try { + if (e != null) + execAsync(e, new AsyncWhenComplete(t, ex, fn, dst)); + else + fn.accept(t, ex); + } catch (Throwable rex) { + dx = rex; + } + if (e == null || dx != null) + dst.internalComplete(t, ex != null ? ex : dx); + } + helpPostComplete(); + return dst; + } + + private CompletableFuture doHandle + (BiFunction fn, + Executor e) { + if (fn == null) throw new NullPointerException(); + CompletableFuture dst = new CompletableFuture(); + HandleCompletion d = null; + Object r; + if ((r = result) == null) { + CompletionNode p = + new CompletionNode(d = new HandleCompletion + (this, fn, dst, e)); + while ((r = result) == null) { + if (UNSAFE.compareAndSwapObject(this, COMPLETIONS, + p.next = completions, p)) + break; + } + } + if (r != null && (d == null || d.compareAndSet(0, 1))) { + T t; Throwable ex; + if (r instanceof AltResult) { + ex = ((AltResult)r).ex; + t = null; + } + else { + ex = null; + @SuppressWarnings("unchecked") T tr = (T) r; + t = tr; + } + U u = null; + Throwable dx = null; + try { + if (e != null) + execAsync(e, new AsyncCombine(t, ex, fn, dst)); + else { + u = fn.apply(t, ex); + dx = null; + } + } catch (Throwable rex) { + dx = rex; + u = null; + } + if (e == null || dx != null) + dst.internalComplete(u, dx); + } + helpPostComplete(); + return dst; + } + + // public methods /** @@ -1416,13 +2118,13 @@ public class CompletableFuture implements Future { * * @param supplier a function returning the value to be used * to complete the returned CompletableFuture + * @param the function's return type * @return the new CompletableFuture */ public static CompletableFuture supplyAsync(Supplier supplier) { if (supplier == null) throw new NullPointerException(); CompletableFuture f = new CompletableFuture(); - ForkJoinPool.commonPool(). - execute((ForkJoinTask)new AsyncSupply(supplier, f)); + execAsync(ForkJoinPool.commonPool(), new AsyncSupply(supplier, f)); return f; } @@ -1434,6 +2136,7 @@ public class CompletableFuture implements Future { * @param supplier a function returning the value to be used * to complete the returned CompletableFuture * @param executor the executor to use for asynchronous execution + * @param the function's return type * @return the new CompletableFuture */ public static CompletableFuture supplyAsync(Supplier supplier, @@ -1441,7 +2144,7 @@ public class CompletableFuture implements Future { if (executor == null || supplier == null) throw new NullPointerException(); CompletableFuture f = new CompletableFuture(); - executor.execute(new AsyncSupply(supplier, f)); + execAsync(executor, new AsyncSupply(supplier, f)); return f; } @@ -1457,8 +2160,7 @@ public class CompletableFuture implements Future { public static CompletableFuture runAsync(Runnable runnable) { if (runnable == null) throw new NullPointerException(); CompletableFuture f = new CompletableFuture(); - ForkJoinPool.commonPool(). - execute((ForkJoinTask)new AsyncRun(runnable, f)); + execAsync(ForkJoinPool.commonPool(), new AsyncRun(runnable, f)); return f; } @@ -1477,7 +2179,7 @@ public class CompletableFuture implements Future { if (executor == null || runnable == null) throw new NullPointerException(); CompletableFuture f = new CompletableFuture(); - executor.execute(new AsyncRun(runnable, f)); + execAsync(executor, new AsyncRun(runnable, f)); return f; } @@ -1486,6 +2188,7 @@ public class CompletableFuture implements Future { * the given value. * * @param value the value + * @param the type of the value * @return the completed CompletableFuture */ public static CompletableFuture completedFuture(U value) { @@ -1657,60 +2360,18 @@ public class CompletableFuture implements Future { return triggered; } - /** - * Returns a new CompletableFuture that is completed - * when this CompletableFuture completes, with the result of the - * given function of this CompletableFuture's result. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied function throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture thenApply(Function fn) { + // CompletionStage methods + + public CompletableFuture thenApply + (Function fn) { return doThenApply(fn, null); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when this CompletableFuture completes, with the result of the - * given function of this CompletableFuture's result from a - * task running in the {@link ForkJoinPool#commonPool()}. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied function throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @return the new CompletableFuture - */ public CompletableFuture thenApplyAsync (Function fn) { return doThenApply(fn, ForkJoinPool.commonPool()); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when this CompletableFuture completes, with the result of the - * given function of this CompletableFuture's result from a - * task running in the given executor. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied function throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ public CompletableFuture thenApplyAsync (Function fn, Executor executor) { @@ -1718,1149 +2379,228 @@ public class CompletableFuture implements Future { return doThenApply(fn, executor); } - private CompletableFuture doThenApply - (Function fn, - Executor e) { - if (fn == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - ThenApply d = null; - Object r; - if ((r = result) == null) { - CompletionNode p = new CompletionNode - (d = new ThenApply(this, fn, dst, e)); - while ((r = result) == null) { - if (UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) - break; - } - } - if (r != null && (d == null || d.compareAndSet(0, 1))) { - T t; Throwable ex; - if (r instanceof AltResult) { - ex = ((AltResult)r).ex; - t = null; - } - else { - ex = null; - @SuppressWarnings("unchecked") T tr = (T) r; - t = tr; - } - U u = null; - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncApply(t, fn, dst)); - else - u = fn.apply(t); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(u, ex); - } - helpPostComplete(); - return dst; + public CompletableFuture thenAccept + (Consumer action) { + return doThenAccept(action, null); } - /** - * Returns a new CompletableFuture that is completed - * when this CompletableFuture completes, after performing the given - * action with this CompletableFuture's result. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied action throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param block the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture thenAccept(Consumer block) { - return doThenAccept(block, null); + public CompletableFuture thenAcceptAsync + (Consumer action) { + return doThenAccept(action, ForkJoinPool.commonPool()); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when this CompletableFuture completes, after performing the given - * action with this CompletableFuture's result from a task running - * in the {@link ForkJoinPool#commonPool()}. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied action throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param block the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture thenAcceptAsync(Consumer block) { - return doThenAccept(block, ForkJoinPool.commonPool()); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * when this CompletableFuture completes, after performing the given - * action with this CompletableFuture's result from a task running - * in the given executor. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied action throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param block the action to perform before completing the - * returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public CompletableFuture thenAcceptAsync(Consumer block, - Executor executor) { + public CompletableFuture thenAcceptAsync + (Consumer action, + Executor executor) { if (executor == null) throw new NullPointerException(); - return doThenAccept(block, executor); + return doThenAccept(action, executor); } - private CompletableFuture doThenAccept(Consumer fn, - Executor e) { - if (fn == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - ThenAccept d = null; - Object r; - if ((r = result) == null) { - CompletionNode p = new CompletionNode - (d = new ThenAccept(this, fn, dst, e)); - while ((r = result) == null) { - if (UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) - break; - } - } - if (r != null && (d == null || d.compareAndSet(0, 1))) { - T t; Throwable ex; - if (r instanceof AltResult) { - ex = ((AltResult)r).ex; - t = null; - } - else { - ex = null; - @SuppressWarnings("unchecked") T tr = (T) r; - t = tr; - } - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncAccept(t, fn, dst)); - else - fn.accept(t); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(null, ex); - } - helpPostComplete(); - return dst; - } - - /** - * Returns a new CompletableFuture that is completed - * when this CompletableFuture completes, after performing the given - * action. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied action throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param action the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture thenRun(Runnable action) { + public CompletableFuture thenRun + (Runnable action) { return doThenRun(action, null); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when this CompletableFuture completes, after performing the given - * action from a task running in the {@link ForkJoinPool#commonPool()}. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied action throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param action the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture thenRunAsync(Runnable action) { + public CompletableFuture thenRunAsync + (Runnable action) { return doThenRun(action, ForkJoinPool.commonPool()); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when this CompletableFuture completes, after performing the given - * action from a task running in the given executor. - * - *

                              If this CompletableFuture completes exceptionally, or the - * supplied action throws an exception, then the returned - * CompletableFuture completes exceptionally with a - * CompletionException holding the exception as its cause. - * - * @param action the action to perform before completing the - * returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public CompletableFuture thenRunAsync(Runnable action, - Executor executor) { + public CompletableFuture thenRunAsync + (Runnable action, + Executor executor) { if (executor == null) throw new NullPointerException(); return doThenRun(action, executor); } - private CompletableFuture doThenRun(Runnable action, - Executor e) { - if (action == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - ThenRun d = null; - Object r; - if ((r = result) == null) { - CompletionNode p = new CompletionNode - (d = new ThenRun(this, action, dst, e)); - while ((r = result) == null) { - if (UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) - break; - } - } - if (r != null && (d == null || d.compareAndSet(0, 1))) { - Throwable ex; - if (r instanceof AltResult) - ex = ((AltResult)r).ex; - else - ex = null; - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncRun(action, dst)); - else - action.run(); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(null, ex); - } - helpPostComplete(); - return dst; - } - - /** - * Returns a new CompletableFuture that is completed - * when both this and the other given CompletableFuture complete, - * with the result of the given function of the results of the two - * CompletableFutures. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied function throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @return the new CompletableFuture - */ public CompletableFuture thenCombine - (CompletableFuture other, + (CompletionStage other, BiFunction fn) { - return doThenCombine(other, fn, null); + return doThenCombine(other.toCompletableFuture(), fn, null); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when both this and the other given CompletableFuture complete, - * with the result of the given function of the results of the two - * CompletableFutures from a task running in the - * {@link ForkJoinPool#commonPool()}. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied function throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @return the new CompletableFuture - */ public CompletableFuture thenCombineAsync - (CompletableFuture other, + (CompletionStage other, BiFunction fn) { - return doThenCombine(other, fn, ForkJoinPool.commonPool()); + return doThenCombine(other.toCompletableFuture(), fn, + ForkJoinPool.commonPool()); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when both this and the other given CompletableFuture complete, - * with the result of the given function of the results of the two - * CompletableFutures from a task running in the given executor. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied function throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ public CompletableFuture thenCombineAsync - (CompletableFuture other, + (CompletionStage other, BiFunction fn, Executor executor) { if (executor == null) throw new NullPointerException(); - return doThenCombine(other, fn, executor); + return doThenCombine(other.toCompletableFuture(), fn, executor); } - private CompletableFuture doThenCombine - (CompletableFuture other, - BiFunction fn, - Executor e) { - if (other == null || fn == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - ThenCombine d = null; - Object r, s = null; - if ((r = result) == null || (s = other.result) == null) { - d = new ThenCombine(this, other, fn, dst, e); - CompletionNode q = null, p = new CompletionNode(d); - while ((r == null && (r = result) == null) || - (s == null && (s = other.result) == null)) { - if (q != null) { - if (s != null || - UNSAFE.compareAndSwapObject - (other, COMPLETIONS, q.next = other.completions, q)) - break; - } - else if (r != null || - UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) { - if (s != null) - break; - q = new CompletionNode(d); - } - } - } - if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) { - T t; U u; Throwable ex; - if (r instanceof AltResult) { - ex = ((AltResult)r).ex; - t = null; - } - else { - ex = null; - @SuppressWarnings("unchecked") T tr = (T) r; - t = tr; - } - if (ex != null) - u = null; - else if (s instanceof AltResult) { - ex = ((AltResult)s).ex; - u = null; - } - else { - @SuppressWarnings("unchecked") U us = (U) s; - u = us; - } - V v = null; - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncCombine(t, u, fn, dst)); - else - v = fn.apply(t, u); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(v, ex); - } - helpPostComplete(); - other.helpPostComplete(); - return dst; - } - - /** - * Returns a new CompletableFuture that is completed - * when both this and the other given CompletableFuture complete, - * after performing the given action with the results of the two - * CompletableFutures. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied action throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param block the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ public CompletableFuture thenAcceptBoth - (CompletableFuture other, - BiConsumer block) { - return doThenAcceptBoth(other, block, null); + (CompletionStage other, + BiConsumer action) { + return doThenAcceptBoth(other.toCompletableFuture(), action, null); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when both this and the other given CompletableFuture complete, - * after performing the given action with the results of the two - * CompletableFutures from a task running in the {@link - * ForkJoinPool#commonPool()}. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied action throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param block the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ public CompletableFuture thenAcceptBothAsync - (CompletableFuture other, - BiConsumer block) { - return doThenAcceptBoth(other, block, ForkJoinPool.commonPool()); + (CompletionStage other, + BiConsumer action) { + return doThenAcceptBoth(other.toCompletableFuture(), action, + ForkJoinPool.commonPool()); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when both this and the other given CompletableFuture complete, - * after performing the given action with the results of the two - * CompletableFutures from a task running in the given executor. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied action throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param block the action to perform before completing the - * returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ public CompletableFuture thenAcceptBothAsync - (CompletableFuture other, - BiConsumer block, + (CompletionStage other, + BiConsumer action, Executor executor) { if (executor == null) throw new NullPointerException(); - return doThenAcceptBoth(other, block, executor); + return doThenAcceptBoth(other.toCompletableFuture(), action, executor); } - private CompletableFuture doThenAcceptBoth - (CompletableFuture other, - BiConsumer fn, - Executor e) { - if (other == null || fn == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - ThenAcceptBoth d = null; - Object r, s = null; - if ((r = result) == null || (s = other.result) == null) { - d = new ThenAcceptBoth(this, other, fn, dst, e); - CompletionNode q = null, p = new CompletionNode(d); - while ((r == null && (r = result) == null) || - (s == null && (s = other.result) == null)) { - if (q != null) { - if (s != null || - UNSAFE.compareAndSwapObject - (other, COMPLETIONS, q.next = other.completions, q)) - break; - } - else if (r != null || - UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) { - if (s != null) - break; - q = new CompletionNode(d); - } - } - } - if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) { - T t; U u; Throwable ex; - if (r instanceof AltResult) { - ex = ((AltResult)r).ex; - t = null; - } - else { - ex = null; - @SuppressWarnings("unchecked") T tr = (T) r; - t = tr; - } - if (ex != null) - u = null; - else if (s instanceof AltResult) { - ex = ((AltResult)s).ex; - u = null; - } - else { - @SuppressWarnings("unchecked") U us = (U) s; - u = us; - } - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncAcceptBoth(t, u, fn, dst)); - else - fn.accept(t, u); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(null, ex); - } - helpPostComplete(); - other.helpPostComplete(); - return dst; - } - - /** - * Returns a new CompletableFuture that is completed - * when both this and the other given CompletableFuture complete, - * after performing the given action. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied action throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param action the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture runAfterBoth(CompletableFuture other, - Runnable action) { - return doRunAfterBoth(other, action, null); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * when both this and the other given CompletableFuture complete, - * after performing the given action from a task running in the - * {@link ForkJoinPool#commonPool()}. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied action throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param action the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture runAfterBothAsync(CompletableFuture other, - Runnable action) { - return doRunAfterBoth(other, action, ForkJoinPool.commonPool()); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * when both this and the other given CompletableFuture complete, - * after performing the given action from a task running in the - * given executor. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, or the supplied action throws an exception, - * then the returned CompletableFuture completes exceptionally - * with a CompletionException holding the exception as its cause. - * - * @param other the other CompletableFuture - * @param action the action to perform before completing the - * returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public CompletableFuture runAfterBothAsync(CompletableFuture other, - Runnable action, - Executor executor) { - if (executor == null) throw new NullPointerException(); - return doRunAfterBoth(other, action, executor); - } - - private CompletableFuture doRunAfterBoth(CompletableFuture other, - Runnable action, - Executor e) { - if (other == null || action == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - RunAfterBoth d = null; - Object r, s = null; - if ((r = result) == null || (s = other.result) == null) { - d = new RunAfterBoth(this, other, action, dst, e); - CompletionNode q = null, p = new CompletionNode(d); - while ((r == null && (r = result) == null) || - (s == null && (s = other.result) == null)) { - if (q != null) { - if (s != null || - UNSAFE.compareAndSwapObject - (other, COMPLETIONS, q.next = other.completions, q)) - break; - } - else if (r != null || - UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) { - if (s != null) - break; - q = new CompletionNode(d); - } - } - } - if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) { - Throwable ex; - if (r instanceof AltResult) - ex = ((AltResult)r).ex; - else - ex = null; - if (ex == null && (s instanceof AltResult)) - ex = ((AltResult)s).ex; - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncRun(action, dst)); - else - action.run(); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(null, ex); - } - helpPostComplete(); - other.helpPostComplete(); - return dst; - } - - /** - * Returns a new CompletableFuture that is completed - * when either this or the other given CompletableFuture completes, - * with the result of the given function of either this or the other - * CompletableFuture's result. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied function - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture applyToEither - (CompletableFuture other, - Function fn) { - return doApplyToEither(other, fn, null); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * when either this or the other given CompletableFuture completes, - * with the result of the given function of either this or the other - * CompletableFuture's result from a task running in the - * {@link ForkJoinPool#commonPool()}. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied function - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture applyToEitherAsync - (CompletableFuture other, - Function fn) { - return doApplyToEither(other, fn, ForkJoinPool.commonPool()); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * when either this or the other given CompletableFuture completes, - * with the result of the given function of either this or the other - * CompletableFuture's result from a task running in the - * given executor. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied function - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param fn the function to use to compute the value of - * the returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public CompletableFuture applyToEitherAsync - (CompletableFuture other, - Function fn, - Executor executor) { - if (executor == null) throw new NullPointerException(); - return doApplyToEither(other, fn, executor); - } - - private CompletableFuture doApplyToEither - (CompletableFuture other, - Function fn, - Executor e) { - if (other == null || fn == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - ApplyToEither d = null; - Object r; - if ((r = result) == null && (r = other.result) == null) { - d = new ApplyToEither(this, other, fn, dst, e); - CompletionNode q = null, p = new CompletionNode(d); - while ((r = result) == null && (r = other.result) == null) { - if (q != null) { - if (UNSAFE.compareAndSwapObject - (other, COMPLETIONS, q.next = other.completions, q)) - break; - } - else if (UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) - q = new CompletionNode(d); - } - } - if (r != null && (d == null || d.compareAndSet(0, 1))) { - T t; Throwable ex; - if (r instanceof AltResult) { - ex = ((AltResult)r).ex; - t = null; - } - else { - ex = null; - @SuppressWarnings("unchecked") T tr = (T) r; - t = tr; - } - U u = null; - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncApply(t, fn, dst)); - else - u = fn.apply(t); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(u, ex); - } - helpPostComplete(); - other.helpPostComplete(); - return dst; - } - - /** - * Returns a new CompletableFuture that is completed - * when either this or the other given CompletableFuture completes, - * after performing the given action with the result of either this - * or the other CompletableFuture's result. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied action - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param block the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture acceptEither - (CompletableFuture other, - Consumer block) { - return doAcceptEither(other, block, null); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * when either this or the other given CompletableFuture completes, - * after performing the given action with the result of either this - * or the other CompletableFuture's result from a task running in - * the {@link ForkJoinPool#commonPool()}. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied action - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param block the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture acceptEitherAsync - (CompletableFuture other, - Consumer block) { - return doAcceptEither(other, block, ForkJoinPool.commonPool()); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * when either this or the other given CompletableFuture completes, - * after performing the given action with the result of either this - * or the other CompletableFuture's result from a task running in - * the given executor. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied action - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param block the action to perform before completing the - * returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public CompletableFuture acceptEitherAsync - (CompletableFuture other, - Consumer block, - Executor executor) { - if (executor == null) throw new NullPointerException(); - return doAcceptEither(other, block, executor); - } - - private CompletableFuture doAcceptEither - (CompletableFuture other, - Consumer fn, - Executor e) { - if (other == null || fn == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - AcceptEither d = null; - Object r; - if ((r = result) == null && (r = other.result) == null) { - d = new AcceptEither(this, other, fn, dst, e); - CompletionNode q = null, p = new CompletionNode(d); - while ((r = result) == null && (r = other.result) == null) { - if (q != null) { - if (UNSAFE.compareAndSwapObject - (other, COMPLETIONS, q.next = other.completions, q)) - break; - } - else if (UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) - q = new CompletionNode(d); - } - } - if (r != null && (d == null || d.compareAndSet(0, 1))) { - T t; Throwable ex; - if (r instanceof AltResult) { - ex = ((AltResult)r).ex; - t = null; - } - else { - ex = null; - @SuppressWarnings("unchecked") T tr = (T) r; - t = tr; - } - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncAccept(t, fn, dst)); - else - fn.accept(t); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(null, ex); - } - helpPostComplete(); - other.helpPostComplete(); - return dst; - } - - /** - * Returns a new CompletableFuture that is completed - * when either this or the other given CompletableFuture completes, - * after performing the given action. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied action - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param action the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture runAfterEither(CompletableFuture other, - Runnable action) { - return doRunAfterEither(other, action, null); - } - - /** - * Returns a new CompletableFuture that is asynchronously completed - * when either this or the other given CompletableFuture completes, - * after performing the given action from a task running in the - * {@link ForkJoinPool#commonPool()}. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied action - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param action the action to perform before completing the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture runAfterEitherAsync - (CompletableFuture other, + public CompletableFuture runAfterBoth + (CompletionStage other, Runnable action) { - return doRunAfterEither(other, action, ForkJoinPool.commonPool()); + return doRunAfterBoth(other.toCompletableFuture(), action, null); } - /** - * Returns a new CompletableFuture that is asynchronously completed - * when either this or the other given CompletableFuture completes, - * after performing the given action from a task running in the - * given executor. - * - *

                              If this and/or the other CompletableFuture complete - * exceptionally, then the returned CompletableFuture may also do so, - * with a CompletionException holding one of these exceptions as its - * cause. No guarantees are made about which result or exception is - * used in the returned CompletableFuture. If the supplied action - * throws an exception, then the returned CompletableFuture completes - * exceptionally with a CompletionException holding the exception as - * its cause. - * - * @param other the other CompletableFuture - * @param action the action to perform before completing the - * returned CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the new CompletableFuture - */ - public CompletableFuture runAfterEitherAsync - (CompletableFuture other, + public CompletableFuture runAfterBothAsync + (CompletionStage other, + Runnable action) { + return doRunAfterBoth(other.toCompletableFuture(), action, + ForkJoinPool.commonPool()); + } + + public CompletableFuture runAfterBothAsync + (CompletionStage other, Runnable action, Executor executor) { if (executor == null) throw new NullPointerException(); - return doRunAfterEither(other, action, executor); + return doRunAfterBoth(other.toCompletableFuture(), action, executor); } - private CompletableFuture doRunAfterEither - (CompletableFuture other, + + public CompletableFuture applyToEither + (CompletionStage other, + Function fn) { + return doApplyToEither(other.toCompletableFuture(), fn, null); + } + + public CompletableFuture applyToEitherAsync + (CompletionStage other, + Function fn) { + return doApplyToEither(other.toCompletableFuture(), fn, + ForkJoinPool.commonPool()); + } + + public CompletableFuture applyToEitherAsync + (CompletionStage other, + Function fn, + Executor executor) { + if (executor == null) throw new NullPointerException(); + return doApplyToEither(other.toCompletableFuture(), fn, executor); + } + + public CompletableFuture acceptEither + (CompletionStage other, + Consumer action) { + return doAcceptEither(other.toCompletableFuture(), action, null); + } + + public CompletableFuture acceptEitherAsync + (CompletionStage other, + Consumer action) { + return doAcceptEither(other.toCompletableFuture(), action, + ForkJoinPool.commonPool()); + } + + public CompletableFuture acceptEitherAsync + (CompletionStage other, + Consumer action, + Executor executor) { + if (executor == null) throw new NullPointerException(); + return doAcceptEither(other.toCompletableFuture(), action, executor); + } + + public CompletableFuture runAfterEither(CompletionStage other, + Runnable action) { + return doRunAfterEither(other.toCompletableFuture(), action, null); + } + + public CompletableFuture runAfterEitherAsync + (CompletionStage other, + Runnable action) { + return doRunAfterEither(other.toCompletableFuture(), action, + ForkJoinPool.commonPool()); + } + + public CompletableFuture runAfterEitherAsync + (CompletionStage other, Runnable action, - Executor e) { - if (other == null || action == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - RunAfterEither d = null; - Object r; - if ((r = result) == null && (r = other.result) == null) { - d = new RunAfterEither(this, other, action, dst, e); - CompletionNode q = null, p = new CompletionNode(d); - while ((r = result) == null && (r = other.result) == null) { - if (q != null) { - if (UNSAFE.compareAndSwapObject - (other, COMPLETIONS, q.next = other.completions, q)) - break; - } - else if (UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) - q = new CompletionNode(d); - } - } - if (r != null && (d == null || d.compareAndSet(0, 1))) { - Throwable ex; - if (r instanceof AltResult) - ex = ((AltResult)r).ex; - else - ex = null; - if (ex == null) { - try { - if (e != null) - e.execute(new AsyncRun(action, dst)); - else - action.run(); - } catch (Throwable rex) { - ex = rex; - } - } - if (e == null || ex != null) - dst.internalComplete(null, ex); - } - helpPostComplete(); - other.helpPostComplete(); - return dst; + Executor executor) { + if (executor == null) throw new NullPointerException(); + return doRunAfterEither(other.toCompletableFuture(), action, executor); } - /** - * Returns a CompletableFuture that upon completion, has the same - * value as produced by the given function of the result of this - * CompletableFuture. - * - *

                              If this CompletableFuture completes exceptionally, then the - * returned CompletableFuture also does so, with a - * CompletionException holding this exception as its cause. - * Similarly, if the computed CompletableFuture completes - * exceptionally, then so does the returned CompletableFuture. - * - * @param fn the function returning a new CompletableFuture - * @return the CompletableFuture - */ public CompletableFuture thenCompose - (Function> fn) { + (Function> fn) { return doThenCompose(fn, null); } - /** - * Returns a CompletableFuture that upon completion, has the same - * value as that produced asynchronously using the {@link - * ForkJoinPool#commonPool()} by the given function of the result - * of this CompletableFuture. - * - *

                              If this CompletableFuture completes exceptionally, then the - * returned CompletableFuture also does so, with a - * CompletionException holding this exception as its cause. - * Similarly, if the computed CompletableFuture completes - * exceptionally, then so does the returned CompletableFuture. - * - * @param fn the function returning a new CompletableFuture - * @return the CompletableFuture - */ public CompletableFuture thenComposeAsync - (Function> fn) { + (Function> fn) { return doThenCompose(fn, ForkJoinPool.commonPool()); } - /** - * Returns a CompletableFuture that upon completion, has the same - * value as that produced asynchronously using the given executor - * by the given function of this CompletableFuture. - * - *

                              If this CompletableFuture completes exceptionally, then the - * returned CompletableFuture also does so, with a - * CompletionException holding this exception as its cause. - * Similarly, if the computed CompletableFuture completes - * exceptionally, then so does the returned CompletableFuture. - * - * @param fn the function returning a new CompletableFuture - * @param executor the executor to use for asynchronous execution - * @return the CompletableFuture - */ public CompletableFuture thenComposeAsync - (Function> fn, + (Function> fn, Executor executor) { if (executor == null) throw new NullPointerException(); return doThenCompose(fn, executor); } - private CompletableFuture doThenCompose - (Function> fn, - Executor e) { - if (fn == null) throw new NullPointerException(); - CompletableFuture dst = null; - ThenCompose d = null; - Object r; - if ((r = result) == null) { - dst = new CompletableFuture(); - CompletionNode p = new CompletionNode - (d = new ThenCompose(this, fn, dst, e)); - while ((r = result) == null) { - if (UNSAFE.compareAndSwapObject - (this, COMPLETIONS, p.next = completions, p)) - break; - } - } - if (r != null && (d == null || d.compareAndSet(0, 1))) { - T t; Throwable ex; - if (r instanceof AltResult) { - ex = ((AltResult)r).ex; - t = null; - } - else { - ex = null; - @SuppressWarnings("unchecked") T tr = (T) r; - t = tr; - } - if (ex == null) { - if (e != null) { - if (dst == null) - dst = new CompletableFuture(); - e.execute(new AsyncCompose(t, fn, dst)); - } - else { - try { - if ((dst = fn.apply(t)) == null) - ex = new NullPointerException(); - } catch (Throwable rex) { - ex = rex; - } - } - } - if (dst == null) - dst = new CompletableFuture(); - if (e == null || ex != null) - dst.internalComplete(null, ex); - } - helpPostComplete(); - dst.helpPostComplete(); - return dst; + public CompletableFuture whenComplete + (BiConsumer action) { + return doWhenComplete(action, null); } + public CompletableFuture whenCompleteAsync + (BiConsumer action) { + return doWhenComplete(action, ForkJoinPool.commonPool()); + } + + public CompletableFuture whenCompleteAsync + (BiConsumer action, + Executor executor) { + if (executor == null) throw new NullPointerException(); + return doWhenComplete(action, executor); + } + + public CompletableFuture handle + (BiFunction fn) { + return doHandle(fn, null); + } + + public CompletableFuture handleAsync + (BiFunction fn) { + return doHandle(fn, ForkJoinPool.commonPool()); + } + + public CompletableFuture handleAsync + (BiFunction fn, + Executor executor) { + if (executor == null) throw new NullPointerException(); + return doHandle(fn, executor); + } + + /** + * Returns this CompletableFuture + * + * @return this CompletableFuture + */ + public CompletableFuture toCompletableFuture() { + return this; + } + + // not in interface CompletionStage + /** * Returns a new CompletableFuture that is completed when this * CompletableFuture completes, with the result of the given @@ -2868,6 +2608,8 @@ public class CompletableFuture implements Future { * completion when it completes exceptionally; otherwise, if this * CompletableFuture completes normally, then the returned * CompletableFuture also completes normally with the same value. + * Note: More flexible versions of this functionality are + * available using methods {@code whenComplete} and {@code handle}. * * @param fn the function to use to compute the value of the * returned CompletableFuture if this CompletableFuture completed @@ -2882,7 +2624,8 @@ public class CompletableFuture implements Future { Object r; if ((r = result) == null) { CompletionNode p = - new CompletionNode(d = new ExceptionCompletion(this, fn, dst)); + new CompletionNode(d = new ExceptionCompletion + (this, fn, dst)); while ((r = result) == null) { if (UNSAFE.compareAndSwapObject(this, COMPLETIONS, p.next = completions, p)) @@ -2910,59 +2653,6 @@ public class CompletableFuture implements Future { return dst; } - /** - * Returns a new CompletableFuture that is completed when this - * CompletableFuture completes, with the result of the given - * function of the result and exception of this CompletableFuture's - * completion. The given function is invoked with the result (or - * {@code null} if none) and the exception (or {@code null} if none) - * of this CompletableFuture when complete. - * - * @param fn the function to use to compute the value of the - * returned CompletableFuture - * @return the new CompletableFuture - */ - public CompletableFuture handle - (BiFunction fn) { - if (fn == null) throw new NullPointerException(); - CompletableFuture dst = new CompletableFuture(); - HandleCompletion d = null; - Object r; - if ((r = result) == null) { - CompletionNode p = - new CompletionNode(d = new HandleCompletion(this, fn, dst)); - while ((r = result) == null) { - if (UNSAFE.compareAndSwapObject(this, COMPLETIONS, - p.next = completions, p)) - break; - } - } - if (r != null && (d == null || d.compareAndSet(0, 1))) { - T t; Throwable ex; - if (r instanceof AltResult) { - ex = ((AltResult)r).ex; - t = null; - } - else { - ex = null; - @SuppressWarnings("unchecked") T tr = (T) r; - t = tr; - } - U u; Throwable dx; - try { - u = fn.apply(t, ex); - dx = null; - } catch (Throwable rex) { - dx = rex; - u = null; - } - dst.internalComplete(u, dx); - } - helpPostComplete(); - return dst; - } - - /* ------------- Arbitrary-arity constructions -------------- */ /* @@ -3214,6 +2904,21 @@ public class CompletableFuture implements Future { (((AltResult)r).ex instanceof CancellationException); } + /** + * Returns {@code true} if this CompletableFuture completed + * exceptionally, in any way. Possible causes include + * cancellation, explicit invocation of {@code + * completeExceptionally}, and abrupt termination of a + * CompletionStage action. + * + * @return {@code true} if this CompletableFuture completed + * exceptionally + */ + public boolean isCompletedExceptionally() { + Object r; + return ((r = result) instanceof AltResult) && r != NIL; + } + /** * Forcibly sets or resets the value subsequently returned by * method {@link #get()} and related methods, whether or not diff --git a/jdk/src/share/classes/java/util/concurrent/CompletionStage.java b/jdk/src/share/classes/java/util/concurrent/CompletionStage.java new file mode 100644 index 00000000000..6de60980cff --- /dev/null +++ b/jdk/src/share/classes/java/util/concurrent/CompletionStage.java @@ -0,0 +1,760 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * + * Written by Doug Lea with assistance from members of JCP JSR-166 + * Expert Group and released to the public domain, as explained at + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +package java.util.concurrent; +import java.util.function.Supplier; +import java.util.function.Consumer; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.function.BiFunction; +import java.util.concurrent.Executor; + +/** + * A stage of a possibly asynchronous computation, that performs an + * action or computes a value when another CompletionStage completes. + * A stage completes upon termination of its computation, but this may + * in turn trigger other dependent stages. The functionality defined + * in this interface takes only a few basic forms, which expand out to + * a larger set of methods to capture a range of usage styles:

                                + * + *
                              • The computation performed by a stage may be expressed as a + * Function, Consumer, or Runnable (using methods with names including + * apply, accept, or run, respectively) + * depending on whether it requires arguments and/or produces results. + * For example, {@code stage.thenApply(x -> square(x)).thenAccept(x -> + * System.out.print(x)).thenRun(() -> System.out.println())}. An + * additional form (compose) applies functions of stages + * themselves, rather than their results.
                              • + * + *
                              • One stage's execution may be triggered by completion of a + * single stage, or both of two stages, or either of two stages. + * Dependencies on a single stage are arranged using methods with + * prefix then. Those triggered by completion of + * both of two stages may combine their results or + * effects, using correspondingly named methods. Those triggered by + * either of two stages make no guarantees about which of the + * results or effects are used for the dependent stage's + * computation.
                              • + * + *
                              • Dependencies among stages control the triggering of + * computations, but do not otherwise guarantee any particular + * ordering. Additionally, execution of a new stage's computations may + * be arranged in any of three ways: default execution, default + * asynchronous execution (using methods with suffix async + * that employ the stage's default asynchronous execution facility), + * or custom (via a supplied {@link Executor}). The execution + * properties of default and async modes are specified by + * CompletionStage implementations, not this interface. Methods with + * explicit Executor arguments may have arbitrary execution + * properties, and might not even support concurrent execution, but + * are arranged for processing in a way that accommodates asynchrony. + * + *
                              • Two method forms support processing whether the triggering + * stage completed normally or exceptionally: Method {@link + * #whenComplete whenComplete} allows injection of an action + * regardless of outcome, otherwise preserving the outcome in its + * completion. Method {@link #handle handle} additionally allows the + * stage to compute a replacement result that may enable further + * processing by other dependent stages. In all other cases, if a + * stage's computation terminates abruptly with an (unchecked) + * exception or error, then all dependent stages requiring its + * completion complete exceptionally as well, with a {@link + * CompletionException} holding the exception as its cause. If a + * stage is dependent on both of two stages, and both + * complete exceptionally, then the CompletionException may correspond + * to either one of these exceptions. If a stage is dependent on + * either of two others, and only one of them completes + * exceptionally, no guarantees are made about whether the dependent + * stage completes normally or exceptionally. In the case of method + * {@code whenComplete}, when the supplied action itself encounters an + * exception, then the stage exceptionally completes with this + * exception if not already completed exceptionally.
                              • + * + *
                              + * + *

                              All methods adhere to the above triggering, execution, and + * exceptional completion specifications (which are not repeated in + * individual method specifications). Additionally, while arguments + * used to pass a completion result (that is, for parameters of type + * {@code T}) for methods accepting them may be null, passing a null + * value for any other parameter will result in a {@link + * NullPointerException} being thrown. + * + *

                              This interface does not define methods for initially creating, + * forcibly completing normally or exceptionally, probing completion + * status or results, or awaiting completion of a stage. + * Implementations of CompletionStage may provide means of achieving + * such effects, as appropriate. Method {@link #toCompletableFuture} + * enables interoperability among different implementations of this + * interface by providing a common conversion type. + * + * @author Doug Lea + * @since 1.8 + */ +public interface CompletionStage { + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed with this stage's result as the argument + * to the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage thenApply(Function fn); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed using this stage's default asynchronous + * execution facility, with this stage's result as the argument to + * the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage thenApplyAsync + (Function fn); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed using the supplied Executor, with this + * stage's result as the argument to the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage thenApplyAsync + (Function fn, + Executor executor); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed with this stage's result as the argument + * to the supplied action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage thenAccept(Consumer action); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed using this stage's default asynchronous + * execution facility, with this stage's result as the argument to + * the supplied action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage thenAcceptAsync(Consumer action); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed using the supplied Executor, with this + * stage's result as the argument to the supplied action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param action the action to perform before completing the + * returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @return the new CompletionStage + */ + public CompletionStage thenAcceptAsync(Consumer action, + Executor executor); + /** + * Returns a new CompletionStage that, when this stage completes + * normally, executes the given action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage thenRun(Runnable action); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, executes the given action using this stage's default + * asynchronous execution facility. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage thenRunAsync(Runnable action); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, executes the given action using the supplied Executor. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param action the action to perform before completing the + * returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @return the new CompletionStage + */ + public CompletionStage thenRunAsync(Runnable action, + Executor executor); + + /** + * Returns a new CompletionStage that, when this and the other + * given stage both complete normally, is executed with the two + * results as arguments to the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param the type of the other CompletionStage's result + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage thenCombine + (CompletionStage other, + BiFunction fn); + + /** + * Returns a new CompletionStage that, when this and the other + * given stage complete normally, is executed using this stage's + * default asynchronous execution facility, with the two results + * as arguments to the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param the type of the other CompletionStage's result + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage thenCombineAsync + (CompletionStage other, + BiFunction fn); + + /** + * Returns a new CompletionStage that, when this and the other + * given stage complete normally, is executed using the supplied + * executor, with the two results as arguments to the supplied + * function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @param the type of the other CompletionStage's result + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage thenCombineAsync + (CompletionStage other, + BiFunction fn, + Executor executor); + + /** + * Returns a new CompletionStage that, when this and the other + * given stage both complete normally, is executed with the two + * results as arguments to the supplied action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @param the type of the other CompletionStage's result + * @return the new CompletionStage + */ + public CompletionStage thenAcceptBoth + (CompletionStage other, + BiConsumer action); + + /** + * Returns a new CompletionStage that, when this and the other + * given stage complete normally, is executed using this stage's + * default asynchronous execution facility, with the two results + * as arguments to the supplied action. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @param the type of the other CompletionStage's result + * @return the new CompletionStage + */ + public CompletionStage thenAcceptBothAsync + (CompletionStage other, + BiConsumer action); + + /** + * Returns a new CompletionStage that, when this and the other + * given stage complete normally, is executed using the supplied + * executor, with the two results as arguments to the supplied + * function. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @param the type of the other CompletionStage's result + * @return the new CompletionStage + */ + public CompletionStage thenAcceptBothAsync + (CompletionStage other, + BiConsumer action, + Executor executor); + + /** + * Returns a new CompletionStage that, when this and the other + * given stage both complete normally, executes the given action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage runAfterBoth(CompletionStage other, + Runnable action); + /** + * Returns a new CompletionStage that, when this and the other + * given stage complete normally, executes the given action using + * this stage's default asynchronous execution facility. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage runAfterBothAsync(CompletionStage other, + Runnable action); + + /** + * Returns a new CompletionStage that, when this and the other + * given stage complete normally, executes the given action using + * the supplied executor + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @return the new CompletionStage + */ + public CompletionStage runAfterBothAsync(CompletionStage other, + Runnable action, + Executor executor); + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, is executed with the + * corresponding result as argument to the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage applyToEither + (CompletionStage other, + Function fn); + + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, is executed using this + * stage's default asynchronous execution facility, with the + * corresponding result as argument to the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage applyToEitherAsync + (CompletionStage other, + Function fn); + + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, is executed using the + * supplied executor, with the corresponding result as argument to + * the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param fn the function to use to compute the value of + * the returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage applyToEitherAsync + (CompletionStage other, + Function fn, + Executor executor); + + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, is executed with the + * corresponding result as argument to the supplied action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage acceptEither + (CompletionStage other, + Consumer action); + + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, is executed using this + * stage's default asynchronous execution facility, with the + * corresponding result as argument to the supplied action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage acceptEitherAsync + (CompletionStage other, + Consumer action); + + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, is executed using the + * supplied executor, with the corresponding result as argument to + * the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @return the new CompletionStage + */ + public CompletionStage acceptEitherAsync + (CompletionStage other, + Consumer action, + Executor executor); + + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, executes the given action. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage runAfterEither(CompletionStage other, + Runnable action); + + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, executes the given action + * using this stage's default asynchronous execution facility. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @return the new CompletionStage + */ + public CompletionStage runAfterEitherAsync + (CompletionStage other, + Runnable action); + + /** + * Returns a new CompletionStage that, when either this or the + * other given stage complete normally, executes the given action + * using supplied executor. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param other the other CompletionStage + * @param action the action to perform before completing the + * returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @return the new CompletionStage + */ + public CompletionStage runAfterEitherAsync + (CompletionStage other, + Runnable action, + Executor executor); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed with this stage as the argument + * to the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param fn the function returning a new CompletionStage + * @param the type of the returned CompletionStage's result + * @return the CompletionStage + */ + public CompletionStage thenCompose + (Function> fn); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed using this stage's default asynchronous + * execution facility, with this stage as the argument to the + * supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param fn the function returning a new CompletionStage + * @param the type of the returned CompletionStage's result + * @return the CompletionStage + */ + public CompletionStage thenComposeAsync + (Function> fn); + + /** + * Returns a new CompletionStage that, when this stage completes + * normally, is executed using the supplied Executor, with this + * stage's result as the argument to the supplied function. + * + * See the {@link CompletionStage} documentation for rules + * covering exceptional completion. + * + * @param fn the function returning a new CompletionStage + * @param executor the executor to use for asynchronous execution + * @param the type of the returned CompletionStage's result + * @return the CompletionStage + */ + public CompletionStage thenComposeAsync + (Function> fn, + Executor executor); + + /** + * Returns a new CompletionStage that, when this stage completes + * exceptionally, is executed with this stage's exception as the + * argument to the supplied function. Otherwise, if this stage + * completes normally, then the returned stage also completes + * normally with the same value. + * + * @param fn the function to use to compute the value of the + * returned CompletionStage if this CompletionStage completed + * exceptionally + * @return the new CompletionStage + */ + public CompletionStage exceptionally + (Function fn); + + /** + * Returns a new CompletionStage with the same result or exception + * as this stage, and when this stage completes, executes the + * given action with the result (or {@code null} if none) and the + * exception (or {@code null} if none) of this stage. + * + * @param action the action to perform + * @return the new CompletionStage + */ + public CompletionStage whenComplete + (BiConsumer action); + + /** + * Returns a new CompletionStage with the same result or exception + * as this stage, and when this stage completes, executes the + * given action executes the given action using this stage's + * default asynchronous execution facility, with the result (or + * {@code null} if none) and the exception (or {@code null} if + * none) of this stage as arguments. + * + * @param action the action to perform + * @return the new CompletionStage + */ + public CompletionStage whenCompleteAsync + (BiConsumer action); + + /** + * Returns a new CompletionStage with the same result or exception + * as this stage, and when this stage completes, executes using + * the supplied Executor, the given action with the result (or + * {@code null} if none) and the exception (or {@code null} if + * none) of this stage as arguments. + * + * @param action the action to perform + * @param executor the executor to use for asynchronous execution + * @return the new CompletionStage + */ + public CompletionStage whenCompleteAsync + (BiConsumer action, + Executor executor); + + /** + * Returns a new CompletionStage that, when this stage completes + * either normally or exceptionally, is executed with this stage's + * result and exception as arguments to the supplied function. + * The given function is invoked with the result (or {@code null} + * if none) and the exception (or {@code null} if none) of this + * stage when complete as arguments. + * + * @param fn the function to use to compute the value of the + * returned CompletionStage + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage handle + (BiFunction fn); + + /** + * Returns a new CompletionStage that, when this stage completes + * either normally or exceptionally, is executed using this stage's + * default asynchronous execution facility, with this stage's + * result and exception as arguments to the supplied function. + * The given function is invoked with the result (or {@code null} + * if none) and the exception (or {@code null} if none) of this + * stage when complete as arguments. + * + * @param fn the function to use to compute the value of the + * returned CompletionStage + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage handleAsync + (BiFunction fn); + + /** + * Returns a new CompletionStage that, when this stage completes + * either normally or exceptionally, is executed using the + * supplied executor, with this stage's result and exception as + * arguments to the supplied function. The given function is + * invoked with the result (or {@code null} if none) and the + * exception (or {@code null} if none) of this stage when complete + * as arguments. + * + * @param fn the function to use to compute the value of the + * returned CompletionStage + * @param executor the executor to use for asynchronous execution + * @param the function's return type + * @return the new CompletionStage + */ + public CompletionStage handleAsync + (BiFunction fn, + Executor executor); + + /** + * Returns a {@link CompletableFuture} maintaining the same + * completion properties as this stage. If this stage is already a + * CompletableFuture, this method may return this stage itself. + * Otherwise, invocation of this method may be equivalent in + * effect to {@code thenApply(x -> x)}, but returning an instance + * of type {@code CompletableFuture}. A CompletionStage + * implementation that does not choose to interoperate with others + * may throw {@code UnsupportedOperationException}. + * + * @return the CompletableFuture + * @throws UnsupportedOperationException if this implementation + * does not interoperate with CompletableFuture + */ + public CompletableFuture toCompletableFuture(); + +} diff --git a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java index 08e2bd38239..edd788afe25 100644 --- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java +++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java @@ -265,7 +265,8 @@ import java.util.stream.Stream; * @param the type of keys maintained by this map * @param the type of mapped values */ -public class ConcurrentHashMap extends AbstractMap implements ConcurrentMap, Serializable { +public class ConcurrentHashMap extends AbstractMap + implements ConcurrentMap, Serializable { private static final long serialVersionUID = 7249069246763182397L; /* @@ -439,16 +440,18 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * related operations (which is the main reason we cannot use * existing collections such as TreeMaps). TreeBins contain * Comparable elements, but may contain others, as well as - * elements that are Comparable but not necessarily Comparable - * for the same T, so we cannot invoke compareTo among them. To - * handle this, the tree is ordered primarily by hash value, then - * by Comparable.compareTo order if applicable. On lookup at a - * node, if elements are not comparable or compare as 0 then both - * left and right children may need to be searched in the case of - * tied hash values. (This corresponds to the full list search - * that would be necessary if all elements were non-Comparable and - * had tied hashes.) The red-black balancing code is updated from - * pre-jdk-collections + * elements that are Comparable but not necessarily Comparable for + * the same T, so we cannot invoke compareTo among them. To handle + * this, the tree is ordered primarily by hash value, then by + * Comparable.compareTo order if applicable. On lookup at a node, + * if elements are not comparable or compare as 0 then both left + * and right children may need to be searched in the case of tied + * hash values. (This corresponds to the full list search that + * would be necessary if all elements were non-Comparable and had + * tied hashes.) On insertion, to keep a total ordering (or as + * close as is required here) across rebalancings, we compare + * classes and identityHashCodes as tie-breakers. The red-black + * balancing code is updated from pre-jdk-collections * (http://gee.cs.oswego.edu/dl/classes/collections/RBCell.java) * based in turn on Cormen, Leiserson, and Rivest "Introduction to * Algorithms" (CLR). @@ -478,6 +481,10 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * unused "Segment" class that is instantiated in minimal form * only when serializing. * + * Also, solely for compatibility with previous versions of this + * class, it extends AbstractMap, even though all of its methods + * are overridden, so it is just useless baggage. + * * This file is organized to make things a little easier to follow * while reading than they might otherwise: First the main static * declarations and utilities, then fields, then main public @@ -1352,6 +1359,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * Saves the state of the {@code ConcurrentHashMap} instance to a * stream (i.e., serializes it). * @param s the stream + * @throws java.io.IOException if an I/O error occurs * @serialData * the key (Object) and value (Object) * for each key-value mapping, followed by a null pair. @@ -1394,6 +1402,9 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre /** * Reconstitutes the instance from a stream (that is, deserializes it). * @param s the stream + * @throws ClassNotFoundException if the class of a serialized object + * could not be found + * @throws java.io.IOException if an I/O error occurs */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { @@ -2080,6 +2091,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * Creates a new {@link Set} backed by a ConcurrentHashMap * from the given type to {@code Boolean.TRUE}. * + * @param the element type of the returned set * @return the new set * @since 1.8 */ @@ -2094,9 +2106,10 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * * @param initialCapacity The implementation performs internal * sizing to accommodate this many elements. + * @param the element type of the returned set + * @return the new set * @throws IllegalArgumentException if the initial capacity of * elements is negative - * @return the new set * @since 1.8 */ public static KeySetView newKeySet(int initialCapacity) { @@ -2643,19 +2656,18 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre p = pr; else if ((pk = p.key) == k || (pk != null && k.equals(pk))) return p; - else if (pl == null && pr == null) - break; + else if (pl == null) + p = pr; + else if (pr == null) + p = pl; else if ((kc != null || (kc = comparableClassFor(k)) != null) && (dir = compareComparables(kc, k, pk)) != 0) p = (dir < 0) ? pl : pr; - else if (pl == null) - p = pr; - else if (pr == null || - (q = pr.findTreeNode(h, k, kc)) == null) - p = pl; - else + else if ((q = pr.findTreeNode(h, k, kc)) != null) return q; + else + p = pl; } while (p != null); } return null; @@ -2681,6 +2693,23 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre static final int WAITER = 2; // set when waiting for write lock static final int READER = 4; // increment value for setting read lock + /** + * Tie-breaking utility for ordering insertions when equal + * hashCodes and non-comparable. We don't require a total + * order, just a consistent insertion rule to maintain + * equivalence across rebalancings. Tie-breaking further than + * necessary simplifies testing a bit. + */ + static int tieBreakOrder(Object a, Object b) { + int d; + if (a == null || b == null || + (d = a.getClass().getName(). + compareTo(b.getClass().getName())) == 0) + d = (System.identityHashCode(a) <= System.identityHashCode(b) ? + -1 : 1); + return d; + } + /** * Creates bin with initial set of nodes headed by b. */ @@ -2697,21 +2726,21 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre r = x; } else { - Object key = x.key; - int hash = x.hash; + K k = x.key; + int h = x.hash; Class kc = null; for (TreeNode p = r;;) { int dir, ph; - if ((ph = p.hash) > hash) + K pk = p.key; + if ((ph = p.hash) > h) dir = -1; - else if (ph < hash) + else if (ph < h) dir = 1; - else if ((kc != null || - (kc = comparableClassFor(key)) != null)) - dir = compareComparables(kc, key, p.key); - else - dir = 0; - TreeNode xp = p; + else if ((kc == null && + (kc = comparableClassFor(k)) == null) || + (dir = compareComparables(kc, k, pk)) == 0) + dir = tieBreakOrder(k, pk); + TreeNode xp = p; if ((p = (dir <= 0) ? p.left : p.right) == null) { x.parent = xp; if (dir <= 0) @@ -2725,6 +2754,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre } } this.root = r; + assert checkInvariants(root); } /** @@ -2805,8 +2835,9 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre */ final TreeNode putTreeVal(int h, K k, V v) { Class kc = null; + boolean searched = false; for (TreeNode p = root;;) { - int dir, ph; K pk; TreeNode q, pr; + int dir, ph; K pk; if (p == null) { first = root = new TreeNode(h, k, v, null, null); break; @@ -2820,21 +2851,25 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre else if ((kc == null && (kc = comparableClassFor(k)) == null) || (dir = compareComparables(kc, k, pk)) == 0) { - if (p.left == null) - dir = 1; - else if ((pr = p.right) == null || - (q = pr.findTreeNode(h, k, kc)) == null) - dir = -1; - else - return q; + if (!searched) { + TreeNode q, ch; + searched = true; + if (((ch = p.left) != null && + (q = ch.findTreeNode(h, k, kc)) != null) || + ((ch = p.right) != null && + (q = ch.findTreeNode(h, k, kc)) != null)) + return q; + } + dir = tieBreakOrder(k, pk); } + TreeNode xp = p; - if ((p = (dir < 0) ? p.left : p.right) == null) { + if ((p = (dir <= 0) ? p.left : p.right) == null) { TreeNode x, f = first; first = x = new TreeNode(h, k, v, f, xp); if (f != null) f.prev = x; - if (dir < 0) + if (dir <= 0) xp.left = x; else xp.right = x; @@ -3546,6 +3581,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * for an element, or null if there is no transformation (in * which case the action is not applied) * @param action the action + * @param the return type of the transformer * @since 1.8 */ public void forEach(long parallelismThreshold, @@ -3569,6 +3605,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * needed for this operation to be executed in parallel * @param searchFunction a function returning a non-null * result on success, else null + * @param the return type of the search function * @return a non-null result from applying the given search * function on each (key, value), or null if none * @since 1.8 @@ -3592,6 +3629,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * for an element, or null if there is no transformation (in * which case it is not combined) * @param reducer a commutative associative combining function + * @param the return type of the transformer * @return the result of accumulating the given transformation * of all (key, value) pairs * @since 1.8 @@ -3710,6 +3748,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * for an element, or null if there is no transformation (in * which case the action is not applied) * @param action the action + * @param the return type of the transformer * @since 1.8 */ public void forEachKey(long parallelismThreshold, @@ -3733,6 +3772,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * needed for this operation to be executed in parallel * @param searchFunction a function returning a non-null * result on success, else null + * @param the return type of the search function * @return a non-null result from applying the given search * function on each key, or null if none * @since 1.8 @@ -3775,6 +3815,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * for an element, or null if there is no transformation (in * which case it is not combined) * @param reducer a commutative associative combining function + * @param the return type of the transformer * @return the result of accumulating the given transformation * of all keys * @since 1.8 @@ -3894,6 +3935,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * for an element, or null if there is no transformation (in * which case the action is not applied) * @param action the action + * @param the return type of the transformer * @since 1.8 */ public void forEachValue(long parallelismThreshold, @@ -3917,6 +3959,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * needed for this operation to be executed in parallel * @param searchFunction a function returning a non-null * result on success, else null + * @param the return type of the search function * @return a non-null result from applying the given search * function on each value, or null if none * @since 1.8 @@ -3958,6 +4001,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * for an element, or null if there is no transformation (in * which case it is not combined) * @param reducer a commutative associative combining function + * @param the return type of the transformer * @return the result of accumulating the given transformation * of all values * @since 1.8 @@ -4075,6 +4119,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * for an element, or null if there is no transformation (in * which case the action is not applied) * @param action the action + * @param the return type of the transformer * @since 1.8 */ public void forEachEntry(long parallelismThreshold, @@ -4098,6 +4143,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * needed for this operation to be executed in parallel * @param searchFunction a function returning a non-null * result on success, else null + * @param the return type of the search function * @return a non-null result from applying the given search * function on each entry, or null if none * @since 1.8 @@ -4139,6 +4185,7 @@ public class ConcurrentHashMap extends AbstractMap implements Concurre * for an element, or null if there is no transformation (in * which case it is not combined) * @param reducer a commutative associative combining function + * @param the return type of the transformer * @return the result of accumulating the given transformation * of all entries * @since 1.8 diff --git a/jdk/src/share/classes/java/util/concurrent/ExecutorService.java b/jdk/src/share/classes/java/util/concurrent/ExecutorService.java index e01921d16ce..455b312b6f9 100644 --- a/jdk/src/share/classes/java/util/concurrent/ExecutorService.java +++ b/jdk/src/share/classes/java/util/concurrent/ExecutorService.java @@ -227,6 +227,7 @@ public interface ExecutorService extends Executor { * {@link Callable} form so they can be submitted. * * @param task the task to submit + * @param the type of the task's result * @return a Future representing pending completion of the task * @throws RejectedExecutionException if the task cannot be * scheduled for execution @@ -241,6 +242,7 @@ public interface ExecutorService extends Executor { * * @param task the task to submit * @param result the result to return + * @param the type of the result * @return a Future representing pending completion of the task * @throws RejectedExecutionException if the task cannot be * scheduled for execution @@ -272,6 +274,7 @@ public interface ExecutorService extends Executor { * collection is modified while this operation is in progress. * * @param tasks the collection of tasks + * @param the type of the values returned from the tasks * @return a list of Futures representing the tasks, in the same * sequential order as produced by the iterator for the * given task list, each of which has completed @@ -299,6 +302,7 @@ public interface ExecutorService extends Executor { * @param tasks the collection of tasks * @param timeout the maximum time to wait * @param unit the time unit of the timeout argument + * @param the type of the values returned from the tasks * @return a list of Futures representing the tasks, in the same * sequential order as produced by the iterator for the * given task list. If the operation did not time out, @@ -324,6 +328,7 @@ public interface ExecutorService extends Executor { * collection is modified while this operation is in progress. * * @param tasks the collection of tasks + * @param the type of the values returned from the tasks * @return the result returned by one of the tasks * @throws InterruptedException if interrupted while waiting * @throws NullPointerException if tasks or any element task @@ -348,6 +353,7 @@ public interface ExecutorService extends Executor { * @param tasks the collection of tasks * @param timeout the maximum time to wait * @param unit the time unit of the timeout argument + * @param the type of the values returned from the tasks * @return the result returned by one of the tasks * @throws InterruptedException if interrupted while waiting * @throws NullPointerException if tasks, or unit, or any element diff --git a/jdk/src/share/classes/java/util/concurrent/Executors.java b/jdk/src/share/classes/java/util/concurrent/Executors.java index 264e7ae33e7..8f39829d6f5 100644 --- a/jdk/src/share/classes/java/util/concurrent/Executors.java +++ b/jdk/src/share/classes/java/util/concurrent/Executors.java @@ -397,6 +397,7 @@ public class Executors { * {@code Callable} to an otherwise resultless action. * @param task the task to run * @param result the result to return + * @param the type of the result * @return a callable object * @throws NullPointerException if task null */ @@ -458,6 +459,7 @@ public class Executors { * action; or if not possible, throw an associated {@link * AccessControlException}. * @param callable the underlying task + * @param the type of the callable's result * @return a callable object * @throws NullPointerException if callable null */ @@ -480,6 +482,7 @@ public class Executors { * AccessControlException}. * * @param callable the underlying task + * @param the type of the callable's result * @return a callable object * @throws NullPointerException if callable null * @throws AccessControlException if the current access control diff --git a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java index c9df40bc7b0..6db2d48c166 100644 --- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java +++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java @@ -561,8 +561,8 @@ public class ForkJoinPool extends AbstractExecutorService { * Returns a new worker thread operating in the given pool. * * @param pool the pool this thread works in - * @throws NullPointerException if the pool is null * @return the new worker thread + * @throws NullPointerException if the pool is null */ public ForkJoinWorkerThread newThread(ForkJoinPool pool); } @@ -2497,6 +2497,7 @@ public class ForkJoinPool extends AbstractExecutorService { * minimally only the latter. * * @param task the task + * @param the type of the task's result * @return the task's result * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be @@ -2545,6 +2546,7 @@ public class ForkJoinPool extends AbstractExecutorService { * Submits a ForkJoinTask for execution. * * @param task the task to submit + * @param the type of the task's result * @return the task * @throws NullPointerException if the task is null * @throws RejectedExecutionException if the task cannot be diff --git a/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java b/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java index 56262ea1bdb..5f239dbf894 100644 --- a/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java +++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java @@ -810,6 +810,7 @@ public abstract class ForkJoinTask implements Future, Serializable { * unprocessed. * * @param tasks the collection of tasks + * @param the type of the values returned from the tasks * @return the tasks argument, to simplify usage * @throws NullPointerException if tasks or any element are null */ @@ -1472,6 +1473,7 @@ public abstract class ForkJoinTask implements Future, Serializable { * * @param runnable the runnable action * @param result the result upon completion + * @param the type of the result * @return the task */ public static ForkJoinTask adapt(Runnable runnable, T result) { @@ -1485,6 +1487,7 @@ public abstract class ForkJoinTask implements Future, Serializable { * encountered into {@code RuntimeException}. * * @param callable the callable action + * @param the type of the callable's result * @return the task */ public static ForkJoinTask adapt(Callable callable) { @@ -1498,6 +1501,8 @@ public abstract class ForkJoinTask implements Future, Serializable { /** * Saves this task to a stream (that is, serializes it). * + * @param s the stream + * @throws java.io.IOException if an I/O error occurs * @serialData the current run status and the exception thrown * during execution, or {@code null} if none */ @@ -1509,6 +1514,10 @@ public abstract class ForkJoinTask implements Future, Serializable { /** * Reconstitutes this task from a stream (that is, deserializes it). + * @param s the stream + * @throws ClassNotFoundException if the class of a serialized object + * could not be found + * @throws java.io.IOException if an I/O error occurs */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { diff --git a/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java b/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java index da9c68c0dab..d20aaef060e 100644 --- a/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java +++ b/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java @@ -117,6 +117,7 @@ public interface ScheduledExecutorService extends ExecutorService { * @param callable the function to execute * @param delay the time from now to delay execution * @param unit the time unit of the delay parameter + * @param the type of the callable's result * @return a ScheduledFuture that can be used to extract result or cancel * @throws RejectedExecutionException if the task cannot be * scheduled for execution diff --git a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java index afe3b36196f..458828c90ed 100644 --- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java +++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java @@ -392,6 +392,7 @@ public class ScheduledThreadPoolExecutor * * @param runnable the submitted Runnable * @param task the task created to execute the runnable + * @param the type of the task's result * @return a task that can execute the runnable * @since 1.6 */ @@ -408,6 +409,7 @@ public class ScheduledThreadPoolExecutor * * @param callable the submitted Callable * @param task the task created to execute the callable + * @param the type of the task's result * @return a task that can execute the callable * @since 1.6 */ diff --git a/jdk/src/share/classes/java/util/concurrent/TimeUnit.java b/jdk/src/share/classes/java/util/concurrent/TimeUnit.java index bd56b4835a7..e5c007d8c5f 100644 --- a/jdk/src/share/classes/java/util/concurrent/TimeUnit.java +++ b/jdk/src/share/classes/java/util/concurrent/TimeUnit.java @@ -69,6 +69,9 @@ package java.util.concurrent; * @author Doug Lea */ public enum TimeUnit { + /** + * Time unit representing one thousandth of a microsecond + */ NANOSECONDS { public long toNanos(long d) { return d; } public long toMicros(long d) { return d/(C1/C0); } @@ -80,6 +83,10 @@ public enum TimeUnit { public long convert(long d, TimeUnit u) { return u.toNanos(d); } int excessNanos(long d, long m) { return (int)(d - (m*C2)); } }, + + /** + * Time unit representing one thousandth of a millisecond + */ MICROSECONDS { public long toNanos(long d) { return x(d, C1/C0, MAX/(C1/C0)); } public long toMicros(long d) { return d; } @@ -91,6 +98,10 @@ public enum TimeUnit { public long convert(long d, TimeUnit u) { return u.toMicros(d); } int excessNanos(long d, long m) { return (int)((d*C1) - (m*C2)); } }, + + /** + * Time unit representing one thousandth of a second + */ MILLISECONDS { public long toNanos(long d) { return x(d, C2/C0, MAX/(C2/C0)); } public long toMicros(long d) { return x(d, C2/C1, MAX/(C2/C1)); } @@ -102,6 +113,10 @@ public enum TimeUnit { public long convert(long d, TimeUnit u) { return u.toMillis(d); } int excessNanos(long d, long m) { return 0; } }, + + /** + * Time unit representing one second + */ SECONDS { public long toNanos(long d) { return x(d, C3/C0, MAX/(C3/C0)); } public long toMicros(long d) { return x(d, C3/C1, MAX/(C3/C1)); } @@ -113,6 +128,10 @@ public enum TimeUnit { public long convert(long d, TimeUnit u) { return u.toSeconds(d); } int excessNanos(long d, long m) { return 0; } }, + + /** + * Time unit representing sixty seconds + */ MINUTES { public long toNanos(long d) { return x(d, C4/C0, MAX/(C4/C0)); } public long toMicros(long d) { return x(d, C4/C1, MAX/(C4/C1)); } @@ -124,6 +143,10 @@ public enum TimeUnit { public long convert(long d, TimeUnit u) { return u.toMinutes(d); } int excessNanos(long d, long m) { return 0; } }, + + /** + * Time unit representing sixty minutes + */ HOURS { public long toNanos(long d) { return x(d, C5/C0, MAX/(C5/C0)); } public long toMicros(long d) { return x(d, C5/C1, MAX/(C5/C1)); } @@ -135,6 +158,10 @@ public enum TimeUnit { public long convert(long d, TimeUnit u) { return u.toHours(d); } int excessNanos(long d, long m) { return 0; } }, + + /** + * Time unit representing twenty four hours + */ DAYS { public long toNanos(long d) { return x(d, C6/C0, MAX/(C6/C0)); } public long toMicros(long d) { return x(d, C6/C1, MAX/(C6/C1)); } diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java index af72a4755d4..a60b7ce621b 100644 --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java @@ -71,6 +71,7 @@ public abstract class AtomicIntegerFieldUpdater { * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated + * @param the type of instances of tclass * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java index 9a298d64931..aae2b248a12 100644 --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java @@ -71,6 +71,7 @@ public abstract class AtomicLongFieldUpdater { * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated + * @param the type of instances of tclass * @return the updater * @throws IllegalArgumentException if the field is not a * volatile long type diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java index 901b71c9d2b..f0a08400182 100644 --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java @@ -91,6 +91,8 @@ public abstract class AtomicReferenceFieldUpdater { * @param tclass the class of the objects holding the field * @param vclass the class of the field * @param fieldName the name of the field to be updated + * @param the type of instances of tclass + * @param the type of instances of vclass * @return the updater * @throws ClassCastException if the field is of the wrong type * @throws IllegalArgumentException if the field is not volatile diff --git a/jdk/src/share/classes/java/util/function/BiConsumer.java b/jdk/src/share/classes/java/util/function/BiConsumer.java index afc0ba34d1e..61690e6471a 100644 --- a/jdk/src/share/classes/java/util/function/BiConsumer.java +++ b/jdk/src/share/classes/java/util/function/BiConsumer.java @@ -27,13 +27,16 @@ package java.util.function; import java.util.Objects; /** - * An operation which accepts two input arguments and returns no result. This is - * the two-arity specialization of {@link Consumer}. Unlike most other - * functional interfaces, {@code BiConsumer} is expected to operate via - * side-effects. + * Represents an operation that accepts two input arguments and returns no + * result. This is the two-arity specialization of {@link Consumer}. + * Unlike most other functional interfaces, {@code BiConsumer} is expected + * to operate via side-effects. * - * @param the type of the first argument to the {@code accept} operation - * @param the type of the second argument to the {@code accept} operation + *

                              This is a functional interface + * whose functional method is {@link #accept(Object, Object)}. + * + * @param the type of the first argument to the operation + * @param the type of the second argument to the operation * * @see Consumer * @since 1.8 @@ -42,35 +45,31 @@ import java.util.Objects; public interface BiConsumer { /** - * Performs operations upon the provided objects which may modify those - * objects and/or external state. + * Performs this operation on the given arguments. * - * @param t an input object - * @param u an input object + * @param t the first input argument + * @param u the second input argument */ void accept(T t, U u); /** - * Returns a {@code BiConsumer} which performs, in sequence, the operation - * represented by this object followed by the operation represented by - * the other {@code BiConsumer}. + * Returns a composed {@code BiConsumer} that performs, in sequence, this + * operation followed by the {@code after} operation. If performing either + * operation throws an exception, it is relayed to the caller of the + * composed operation. If performing this operation throws an exception, + * the {@code after} operation will not be performed. * - *

                              Any exceptions thrown by either {@code accept} method are relayed - * to the caller; if performing this operation throws an exception, the - * other operation will not be performed. - * - * @param other a BiConsumer which will be chained after this BiConsumer - * @return a BiConsumer which performs in sequence the {@code accept} method - * of this BiConsumer and the {@code accept} method of the specified - * BiConsumer operation - * @throws NullPointerException if other is null + * @param after the operation to perform after this operation + * @return a composed {@code BiConsumer} that performs in sequence this + * operation followed by the {@code after} operation + * @throws NullPointerException if {@code after} is null */ - default BiConsumer chain(BiConsumer other) { - Objects.requireNonNull(other); + default BiConsumer andThen(BiConsumer after) { + Objects.requireNonNull(after); return (l, r) -> { accept(l, r); - other.accept(l, r); + after.accept(l, r); }; } } diff --git a/jdk/src/share/classes/java/util/function/BiFunction.java b/jdk/src/share/classes/java/util/function/BiFunction.java index fb66ec0e8bb..ef75901fb34 100644 --- a/jdk/src/share/classes/java/util/function/BiFunction.java +++ b/jdk/src/share/classes/java/util/function/BiFunction.java @@ -27,14 +27,15 @@ package java.util.function; import java.util.Objects; /** - * Apply a function to the input arguments, yielding an appropriate result. This - * is the two-arity specialization of {@link Function}. A function may - * variously provide a mapping between types, object instances or keys and - * values or any other form of transformation upon the input. + * Represents a function that accepts two arguments and produces a result. + * This is the two-arity specialization of {@link Function}. * - * @param the type of the first argument to the {@code apply} operation - * @param the type of the second argument to the {@code apply} operation - * @param the type of results returned by the {@code apply} operation + *

                              This is a functional interface + * whose functional method is {@link #apply(Object, Object)}. + * + * @param the type of the first argument to the function + * @param the type of the second argument to the function + * @param the type of the result of the function * * @see Function * @since 1.8 @@ -43,25 +44,25 @@ import java.util.Objects; public interface BiFunction { /** - * Compute the result of applying the function to the input arguments + * Applies this function to the given arguments. * - * @param t an input object - * @param u an input object + * @param t the first function argument + * @param u the second function argument * @return the function result */ R apply(T t, U u); /** - * Returns a new function which applies this function followed by the - * provided function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed function that first applies this function to + * its input, and then applies the {@code after} function to the result. + * If evaluation of either function throws an exception, it is relayed to + * the caller of the composed function. * - * @param Type of output objects to the combined function. May be the - * same type as {@code }, {@code } or {@code } - * @param after An additional function to be applied after this function is - * applied - * @return A function which performs this function followed by the provided - * function + * @param the type of output of the {@code after} function, and of the + * composed function + * @param after the function to apply after this function is applied + * @return a composed function that first applies this function and then + * applies the {@code after} function * @throws NullPointerException if after is null */ default BiFunction andThen(Function after) { diff --git a/jdk/src/share/classes/java/util/function/BiPredicate.java b/jdk/src/share/classes/java/util/function/BiPredicate.java index 29e92b875f7..a0f19b812d0 100644 --- a/jdk/src/share/classes/java/util/function/BiPredicate.java +++ b/jdk/src/share/classes/java/util/function/BiPredicate.java @@ -27,11 +27,14 @@ package java.util.function; import java.util.Objects; /** - * Determines if the input objects match some criteria. This is the two-arity - * specialization of {@link Predicate}. + * Represents a predicate (boolean-valued function) of two arguments. This is + * the two-arity specialization of {@link Predicate}. * - * @param the type of the first argument to {@code test} - * @param the type of the second argument to {@code test} + *

                              This is a functional interface + * whose functional method is {@link #test(Object, Object)}. + * + * @param the type of the first argument to the predicate + * @param the type of the second argument the predicate * * @see Predicate * @since 1.8 @@ -40,34 +43,41 @@ import java.util.Objects; public interface BiPredicate { /** - * Return {@code true} if the inputs match some criteria. + * Evaluates this predicate on the given arguments. * - * @param t an input object - * @param u an input object - * @return {@code true} if the inputs match some criteria + * @param t the first input argument + * @param u the second input argument + * @return {@code true} if the input arguments match the predicate, + * otherwise {@code false} */ boolean test(T t, U u); /** - * Returns a predicate which evaluates to {@code true} only if this - * predicate and the provided predicate both evaluate to {@code true}. If - * this predicate returns {@code false} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * AND of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code false}, then the {@code other} + * predicate is not evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate - * @return a new predicate which returns {@code true} only if both - * predicates return {@code true} - * @throws NullPointerException if p is null + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. + * + * @param other a predicate that will be logically-ANDed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * AND of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default BiPredicate and(BiPredicate p) { - Objects.requireNonNull(p); - return (T t, U u) -> test(t, u) && p.test(t, u); + default BiPredicate and(BiPredicate other) { + Objects.requireNonNull(other); + return (T t, U u) -> test(t, u) && other.test(t, u); } /** - * Returns a predicate which negates the result of this predicate. + * Returns a predicate that represents the logical negation of this + * predicate. * - * @return a new predicate who's result is always the opposite of this + * @return a predicate that represents the logical negation of this * predicate */ default BiPredicate negate() { @@ -75,18 +85,23 @@ public interface BiPredicate { } /** - * Returns a predicate which evaluates to {@code true} if either this - * predicate or the provided predicate evaluates to {@code true}. If this - * predicate returns {@code true} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * OR of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code true}, then the {@code other} + * predicate is not evaluated. * - * @param p a predicate which will be logically-ORed with this predicate - * @return a new predicate which returns {@code true} if either predicate - * returns {@code true} - * @throws NullPointerException if p is null + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. + * + * @param other a predicate that will be logically-ORed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * OR of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default BiPredicate or(BiPredicate p) { - Objects.requireNonNull(p); - return (T t, U u) -> test(t, u) || p.test(t, u); + default BiPredicate or(BiPredicate other) { + Objects.requireNonNull(other); + return (T t, U u) -> test(t, u) || other.test(t, u); } } diff --git a/jdk/src/share/classes/java/util/function/BinaryOperator.java b/jdk/src/share/classes/java/util/function/BinaryOperator.java index 195eba1c3c1..a0150589c80 100644 --- a/jdk/src/share/classes/java/util/function/BinaryOperator.java +++ b/jdk/src/share/classes/java/util/function/BinaryOperator.java @@ -28,42 +28,48 @@ import java.util.Objects; import java.util.Comparator; /** - * An operation upon two operands yielding a result. This is a specialization of - * {@code BiFunction} where the operands and the result are all of the same type. + * Represents an operation upon two operands of the same type, producing a result + * of the same type as the operands. This is a specialization of + * {@link BiFunction} for the case where the operands and the result are all of + * the same type. * - * @param the type of operands to {@code apply} and of the result + *

                              This is a functional interface + * whose functional method is {@link #apply(Object, Object)}. + * + * @param the type of the operands and result of the operator * * @see BiFunction + * @see UnaryOperator * @since 1.8 */ @FunctionalInterface public interface BinaryOperator extends BiFunction { /** * Returns a {@link BinaryOperator} which returns the lesser of two elements - * according to the specified {@code Comparator} + * according to the specified {@code Comparator}. * - * @param the type of values to be compared and returned - * @param comparator a {@code Comparator} for comparing the two values + * @param the type of the input arguments of the comparator + * @param comparator a {@code Comparator} for comparing the two values * @return a {@code BinaryOperator} which returns the lesser of its operands, * according to the supplied {@code Comparator} * @throws NullPointerException if the argument is null */ - public static BinaryOperator minBy(Comparator comparator) { + public static BinaryOperator minBy(Comparator comparator) { Objects.requireNonNull(comparator); return (a, b) -> comparator.compare(a, b) <= 0 ? a : b; } /** * Returns a {@link BinaryOperator} which returns the greater of two elements - * according to the specified {@code Comparator} + * according to the specified {@code Comparator}. * - * @param the type of values to be compared and returned - * @param comparator a {@code Comparator} for comparing the two values + * @param the type of the input arguments of the comparator + * @param comparator a {@code Comparator} for comparing the two values * @return a {@code BinaryOperator} which returns the greater of its operands, * according to the supplied {@code Comparator} * @throws NullPointerException if the argument is null */ - public static BinaryOperator maxBy(Comparator comparator) { + public static BinaryOperator maxBy(Comparator comparator) { Objects.requireNonNull(comparator); return (a, b) -> comparator.compare(a, b) >= 0 ? a : b; } diff --git a/jdk/src/share/classes/java/util/function/BooleanSupplier.java b/jdk/src/share/classes/java/util/function/BooleanSupplier.java index 875ac748628..2faff307e63 100644 --- a/jdk/src/share/classes/java/util/function/BooleanSupplier.java +++ b/jdk/src/share/classes/java/util/function/BooleanSupplier.java @@ -26,8 +26,14 @@ package java.util.function; /** - * A supplier of {@code boolean} values. This is the {@code boolean}-providing - * primitive specialization of {@link Supplier}. + * Represents a supplier of {@code boolean}-valued results. This is the + * {@code boolean}-producing primitive specialization of {@link Supplier}. + * + *

                              There is no requirement that a new or distinct result be returned each + * time the supplier is invoked. + * + *

                              This is a functional interface + * whose functional method is {@link #getAsBoolean()}. * * @see Supplier * @since 1.8 @@ -36,9 +42,9 @@ package java.util.function; public interface BooleanSupplier { /** - * Returns a {@code boolean} value. + * Gets a result. * - * @return a {@code boolean} value + * @return a result */ boolean getAsBoolean(); } diff --git a/jdk/src/share/classes/java/util/function/Consumer.java b/jdk/src/share/classes/java/util/function/Consumer.java index 69add851dcc..a2481fe4f41 100644 --- a/jdk/src/share/classes/java/util/function/Consumer.java +++ b/jdk/src/share/classes/java/util/function/Consumer.java @@ -27,11 +27,14 @@ package java.util.function; import java.util.Objects; /** - * An operation which accepts a single input argument and returns no result. - * Unlike most other functional interfaces, {@code Consumer} is expected to - * operate via side-effects. + * Represents an operation that accepts a single input argument and returns no + * result. Unlike most other functional interfaces, {@code Consumer} is expected + * to operate via side-effects. * - * @param The type of input objects to {@code accept} + *

                              This is a functional interface + * whose functional method is {@link #accept(Object)}. + * + * @param the type of the input to the operation * * @since 1.8 */ @@ -39,29 +42,26 @@ import java.util.Objects; public interface Consumer { /** - * Accept an input value. + * Performs this operation on the given argument. * - * @param t the input object + * @param t the input argument */ void accept(T t); /** - * Returns a {@code Consumer} which performs, in sequence, the operation - * represented by this object followed by the operation represented by - * the other {@code Consumer}. + * Returns a composed {@code Consumer} that performs, in sequence, this + * operation followed by the {@code after} operation. If performing either + * operation throws an exception, it is relayed to the caller of the + * composed operation. If performing this operation throws an exception, + * the {@code after} operation will not be performed. * - *

                              Any exceptions thrown by either {@code accept} method are relayed - * to the caller; if performing this operation throws an exception, the - * other operation will not be performed. - * - * @param other a Consumer which will be chained after this Consumer - * @return a Consumer which performs in sequence the {@code accept} method - * of this Consumer and the {@code accept} method of the specified Consumer - * operation - * @throws NullPointerException if other is null + * @param after the operation to perform after this operation + * @return a composed {@code Consumer} that performs in sequence this + * operation followed by the {@code after} operation + * @throws NullPointerException if {@code after} is null */ - default Consumer chain(Consumer other) { - Objects.requireNonNull(other); - return (T t) -> { accept(t); other.accept(t); }; + default Consumer andThen(Consumer after) { + Objects.requireNonNull(after); + return (T t) -> { accept(t); after.accept(t); }; } } diff --git a/jdk/src/share/classes/java/util/function/DoubleBinaryOperator.java b/jdk/src/share/classes/java/util/function/DoubleBinaryOperator.java index 7d1e68aaced..839433da573 100644 --- a/jdk/src/share/classes/java/util/function/DoubleBinaryOperator.java +++ b/jdk/src/share/classes/java/util/function/DoubleBinaryOperator.java @@ -25,23 +25,25 @@ package java.util.function; /** - * An operation on two {@code double} operands yielding a {@code double} result. - * This is the primitive type specialization of {@link BinaryOperator} for - * {@code double}. + * Represents an operation upon two {@code double}-valued operands and producing a + * {@code double}-valued result. This is the primitive type specialization of + * {@link BinaryOperator} for {@code double}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsDouble(double, double)}. * * @see BinaryOperator + * @see DoubleUnaryOperator * @since 1.8 */ @FunctionalInterface public interface DoubleBinaryOperator { /** - * Returns the {@code double} result of the operation upon the - * {@code double} operands. The parameters are named {@code left} and - * {@code right} for operations where the order of parameters matters. + * Applies this operator to the given operands. * - * @param left the left operand value - * @param right the right operand value - * @return the result of the operation + * @param left the first operand + * @param right the second operand + * @return the operator result */ double applyAsDouble(double left, double right); } diff --git a/jdk/src/share/classes/java/util/function/DoubleConsumer.java b/jdk/src/share/classes/java/util/function/DoubleConsumer.java index 665b80a3d20..046360c6da8 100644 --- a/jdk/src/share/classes/java/util/function/DoubleConsumer.java +++ b/jdk/src/share/classes/java/util/function/DoubleConsumer.java @@ -27,11 +27,14 @@ package java.util.function; import java.util.Objects; /** - * An operation which accepts a single double argument and returns no result. - * This is the primitive type specialization of {@link Consumer} for - * {@code double}. Unlike most other functional interfaces, + * Represents an operation that accepts a single {@code double}-valued argument and + * returns no result. This is the primitive type specialization of + * {@link Consumer} for {@code double}. Unlike most other functional interfaces, * {@code DoubleConsumer} is expected to operate via side-effects. * + *

                              This is a functional interface + * whose functional method is {@link #accept(double)}. + * * @see Consumer * @since 1.8 */ @@ -39,30 +42,26 @@ import java.util.Objects; public interface DoubleConsumer { /** - * Accept an input value. + * Performs this operation on the given argument. * - * @param value the input value + * @param value the input argument */ void accept(double value); /** - * Returns a {@code DoubleConsumer} which performs, in sequence, the operation - * represented by this object followed by the operation represented by - * another {@code DoubleConsumer}. + * Returns a composed {@code DoubleConsumer} that performs, in sequence, this + * operation followed by the {@code after} operation. If performing either + * operation throws an exception, it is relayed to the caller of the + * composed operation. If performing this operation throws an exception, + * the {@code after} operation will not be performed. * - *

                              Any exceptions thrown by either {@code accept} method are relayed - * to the caller; if performing this operation throws an exception, the - * other operation will not be performed. - * - * @param other a DoubleConsumer which will be chained after this - * DoubleConsumer - * @return an DoubleConsumer which performs in sequence the {@code accept} method - * of this DoubleConsumer and the {@code accept} method of the specified IntConsumer - * operation - * @throws NullPointerException if other is null + * @param after the operation to perform after this operation + * @return a composed {@code DoubleConsumer} that performs in sequence this + * operation followed by the {@code after} operation + * @throws NullPointerException if {@code after} is null */ - default DoubleConsumer chain(DoubleConsumer other) { - Objects.requireNonNull(other); - return (double t) -> { accept(t); other.accept(t); }; + default DoubleConsumer andThen(DoubleConsumer after) { + Objects.requireNonNull(after); + return (double t) -> { accept(t); after.accept(t); }; } } diff --git a/jdk/src/share/classes/java/util/function/DoubleFunction.java b/jdk/src/share/classes/java/util/function/DoubleFunction.java index d8141d0a8a2..a8bb57ddd88 100644 --- a/jdk/src/share/classes/java/util/function/DoubleFunction.java +++ b/jdk/src/share/classes/java/util/function/DoubleFunction.java @@ -25,11 +25,14 @@ package java.util.function; /** - * Apply a function to the double-valued input argument, yielding an appropriate - * result. This is the {@code double}-consuming primitive specialization for + * Represents a function that accepts a double-valued argument and produces a + * result. This is the {@code double}-consuming primitive specialization for * {@link Function}. * - * @param the type of output objects from the function + *

                              This is a functional interface + * whose functional method is {@link #apply(double)}. + * + * @param the type of the result of the function * * @see Function * @since 1.8 @@ -38,9 +41,9 @@ package java.util.function; public interface DoubleFunction { /** - * Compute the result of applying the function to the input argument + * Applies this function to the given argument. * - * @param value the input value + * @param value the function argument * @return the function result */ R apply(double value); diff --git a/jdk/src/share/classes/java/util/function/DoublePredicate.java b/jdk/src/share/classes/java/util/function/DoublePredicate.java index 8156b65cb93..1df17624cab 100644 --- a/jdk/src/share/classes/java/util/function/DoublePredicate.java +++ b/jdk/src/share/classes/java/util/function/DoublePredicate.java @@ -27,9 +27,12 @@ package java.util.function; import java.util.Objects; /** - * Determines if the {@code double} input value matches some criteria. This is - * the {@code double}-consuming primitive type specialization of - * {@link Predicate}. + * Represents a predicate (boolean-valued function) of one {@code double}-valued + * argument. This is the {@code double}-consuming primitive type specialization + * of {@link Predicate}. + * + *

                              This is a functional interface + * whose functional method is {@link #test(double)}. * * @see Predicate * @since 1.8 @@ -38,38 +41,40 @@ import java.util.Objects; public interface DoublePredicate { /** - * Returns {@code true} if the input value matches some criteria. + * Evaluates this predicate on the given argument. * - * @param value the value to be tested - * @return {@code true} if the input value matches some criteria, otherwise - * {@code false} + * @param value the input argument + * @return {@code true} if the input argument matches the predicate, + * otherwise {@code false} */ boolean test(double value); /** - * Returns a predicate which evaluates to {@code true} only if this - * predicate and the provided predicate both evaluate to {@code true}. If - * this predicate returns {@code false} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * AND of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code false}, then the {@code other} + * predicate is not evaluated. * - *

                              Any exceptions thrown by either {@code test} method are relayed - * to the caller; if performing first operation throws an exception, the - * second operation will not be performed. + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate - * @return a new predicate which returns {@code true} only if both - * predicates return {@code true} - * @throws NullPointerException if p is null + * @param other a predicate that will be logically-ANDed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * AND of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default DoublePredicate and(DoublePredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) && p.test(value); + default DoublePredicate and(DoublePredicate other) { + Objects.requireNonNull(other); + return (value) -> test(value) && other.test(value); } /** - * Returns a predicate which negates the result of this predicate. + * Returns a predicate that represents the logical negation of this + * predicate. * - * @return a new predicate who's result is always the opposite of this + * @return a predicate that represents the logical negation of this * predicate */ default DoublePredicate negate() { @@ -77,22 +82,23 @@ public interface DoublePredicate { } /** - * Returns a predicate which evaluates to {@code true} if either this - * predicate or the provided predicate evaluates to {@code true}. If this - * predicate returns {@code true} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * OR of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code true}, then the {@code other} + * predicate is not evaluated. * - *

                              Any exceptions thrown by either {@code test} method are relayed - * to the caller; if performing first operation throws an exception, the - * second operation will not be performed. + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate - * @return a new predicate which returns {@code true} if either predicate - * returns {@code true} - * @throws NullPointerException if p is null + * @param other a predicate that will be logically-ORed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * OR of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default DoublePredicate or(DoublePredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) || p.test(value); + default DoublePredicate or(DoublePredicate other) { + Objects.requireNonNull(other); + return (value) -> test(value) || other.test(value); } } diff --git a/jdk/src/share/classes/java/util/function/DoubleSupplier.java b/jdk/src/share/classes/java/util/function/DoubleSupplier.java index c661fdff927..5169011b3a5 100644 --- a/jdk/src/share/classes/java/util/function/DoubleSupplier.java +++ b/jdk/src/share/classes/java/util/function/DoubleSupplier.java @@ -25,8 +25,14 @@ package java.util.function; /** - * A supplier of {@code double} values. This is the {@code double}-providing - * primitive specialization of {@link Supplier}. + * Represents a supplier of {@code double}-valued results. This is the + * {@code double}-producing primitive specialization of {@link Supplier}. + * + *

                              There is no requirement that a distinct result be returned each + * time the supplier is invoked. + * + *

                              This is a functional interface + * whose functional method is {@link #getAsDouble()}. * * @see Supplier * @since 1.8 @@ -35,9 +41,9 @@ package java.util.function; public interface DoubleSupplier { /** - * Returns a {@code double} value. + * Gets a result. * - * @return a {@code double} value + * @return a result */ double getAsDouble(); } diff --git a/jdk/src/share/classes/java/util/function/DoubleToIntFunction.java b/jdk/src/share/classes/java/util/function/DoubleToIntFunction.java index 8eaf0b8374a..a23f033e4df 100644 --- a/jdk/src/share/classes/java/util/function/DoubleToIntFunction.java +++ b/jdk/src/share/classes/java/util/function/DoubleToIntFunction.java @@ -25,22 +25,24 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code double}-to-{@code int} specialization for {@link Function}. + * Represents a function that accepts a double-valued argument and produces an + * int-valued result. This is the {@code double}-to-{@code int} primitive + * specialization for {@link Function}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsInt(double)}. * * @see Function - * @see IntToDoubleFunction - * @see LongToIntFunction * @since 1.8 */ @FunctionalInterface public interface DoubleToIntFunction { /** - * Compute the result of applying the function to the input arguments. + * Applies this function to the given argument. * - * @param value the input value - * @return the function result value + * @param value the function argument + * @return the function result */ int applyAsInt(double value); } diff --git a/jdk/src/share/classes/java/util/function/DoubleToLongFunction.java b/jdk/src/share/classes/java/util/function/DoubleToLongFunction.java index 7568157353d..436369c6f48 100644 --- a/jdk/src/share/classes/java/util/function/DoubleToLongFunction.java +++ b/jdk/src/share/classes/java/util/function/DoubleToLongFunction.java @@ -25,22 +25,24 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code double}-to-{@code long} specialization for {@link Function}. + * Represents a function that accepts a double-valued argument and produces a + * long-valued result. This is the {@code double}-to-{@code long} primitive + * specialization for {@link Function}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsLong(double)}. * * @see Function - * @see LongToDoubleFunction - * @see IntToLongFunction * @since 1.8 */ @FunctionalInterface public interface DoubleToLongFunction { /** - * Compute the result of applying the function to the input arguments. + * Applies this function to the given argument. * - * @param value the input value - * @return the function result value + * @param value the function argument + * @return the function result */ long applyAsLong(double value); } diff --git a/jdk/src/share/classes/java/util/function/DoubleUnaryOperator.java b/jdk/src/share/classes/java/util/function/DoubleUnaryOperator.java index 39dfa6ab6a7..2f134c9994f 100644 --- a/jdk/src/share/classes/java/util/function/DoubleUnaryOperator.java +++ b/jdk/src/share/classes/java/util/function/DoubleUnaryOperator.java @@ -27,9 +27,12 @@ package java.util.function; import java.util.Objects; /** - * An operation on a {@code double} operand yielding a {@code double} - * result. This is the primitive type specialization of {@link UnaryOperator} - * for {@code double}. + * Represents an operation on a single {@code double}-valued operand that produces + * a {@code double}-valued result. This is the primitive type specialization of + * {@link UnaryOperator} for {@code double}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsDouble(double)}. * * @see UnaryOperator * @since 1.8 @@ -38,24 +41,25 @@ import java.util.Objects; public interface DoubleUnaryOperator { /** - * Returns the {@code double} result of the operation upon the - * {@code double} operand. + * Applies this operator to the given operand. * - * @param operand the operand value - * @return the operation result value + * @param operand the operand + * @return the operator result */ double applyAsDouble(double operand); /** - * Compose a new function which applies the provided function followed by - * this function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed operator that first applies the {@code before} + * operator to its input, and then applies this operator to the result. + * If evaluation of either operator throws an exception, it is relayed to + * the caller of the composed operator. * - * @param before An additional function to be applied before this function - * is applied - * @return A function which performs the provided function followed by this - * function + * @param before the operator to apply before this operator is applied + * @return a composed operator that first applies the {@code before} + * operator and then applies this operator * @throws NullPointerException if before is null + * + * @see #andThen(DoubleUnaryOperator) */ default DoubleUnaryOperator compose(DoubleUnaryOperator before) { Objects.requireNonNull(before); @@ -63,15 +67,17 @@ public interface DoubleUnaryOperator { } /** - * Compose a new function which applies this function followed by the - * provided function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed operator that first applies this operator to + * its input, and then applies the {@code after} operator to the result. + * If evaluation of either operator throws an exception, it is relayed to + * the caller of the composed operator. * - * @param after An additional function to be applied after this function is - * applied - * @return A function which performs this function followed by the provided - * function followed + * @param after the operator to apply after this operator is applied + * @return a composed operator that first applies this operator and then + * applies the {@code after} operator * @throws NullPointerException if after is null + * + * @see #compose(DoubleUnaryOperator) */ default DoubleUnaryOperator andThen(DoubleUnaryOperator after) { Objects.requireNonNull(after); @@ -79,9 +85,9 @@ public interface DoubleUnaryOperator { } /** - * Returns a unary operator that provides its input value as the result. + * Returns a unary operator that always returns its input argument. * - * @return a unary operator that provides its input value as the result + * @return a unary operator that always returns its input argument */ static DoubleUnaryOperator identity() { return t -> t; diff --git a/jdk/src/share/classes/java/util/function/Function.java b/jdk/src/share/classes/java/util/function/Function.java index 084ba4cc9c7..7bcbfd06bb6 100644 --- a/jdk/src/share/classes/java/util/function/Function.java +++ b/jdk/src/share/classes/java/util/function/Function.java @@ -27,12 +27,13 @@ package java.util.function; import java.util.Objects; /** - * Apply a function to the input argument, yielding an appropriate result. A - * function may variously provide a mapping between types, object instances or - * keys and values or any other form of transformation upon the input. + * Represents a function that accepts one argument and produces a result. * - * @param the type of the input to the {@code apply} operation - * @param the type of the result of the {@code apply} operation + *

                              This is a functional interface + * whose functional method is {@link #apply(Object)}. + * + * @param the type of the input to the function + * @param the type of the result of the function * * @since 1.8 */ @@ -40,25 +41,27 @@ import java.util.Objects; public interface Function { /** - * Compute the result of applying the function to the input argument + * Applies this function to the given argument. * - * @param t the input object + * @param t the function argument * @return the function result */ R apply(T t); /** - * Returns a new function which applies the provided function followed by - * this function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed function that first applies the {@code before} + * function to its input, and then applies this function to the result. + * If evaluation of either function throws an exception, it is relayed to + * the caller of the composed function. * - * @param type of input objects to the combined function. May be the - * same type as {@code } or {@code } - * @param before an additional function to be applied before this function - * is applied - * @return a function which performs the provided function followed by this - * function + * @param the type of input to the {@code before} function, and to the + * composed function + * @param before the function to apply before this function is applied + * @return a composed function that first applies the {@code before} + * function and then applies this function * @throws NullPointerException if before is null + * + * @see #andThen(Function) */ default Function compose(Function before) { Objects.requireNonNull(before); @@ -66,17 +69,19 @@ public interface Function { } /** - * Returns a new function which applies this function followed by the - * provided function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed function that first applies this function to + * its input, and then applies the {@code after} function to the result. + * If evaluation of either function throws an exception, it is relayed to + * the caller of the composed function. * - * @param type of output objects to the combined function. May be the - * same type as {@code } or {@code } - * @param after an additional function to be applied after this function is - * applied - * @return a function which performs this function followed by the provided - * function + * @param the type of output of the {@code after} function, and of the + * composed function + * @param after the function to apply after this function is applied + * @return a composed function that first applies this function and then + * applies the {@code after} function * @throws NullPointerException if after is null + * + * @see #compose(Function) */ default Function andThen(Function after) { Objects.requireNonNull(after); @@ -84,10 +89,10 @@ public interface Function { } /** - * Returns a {@code Function} whose {@code apply} method returns its input. + * Returns a function that always returns its input argument. * * @param the type of the input and output objects to the function - * @return a {@code Function} whose {@code apply} method returns its input + * @return a function that always returns its input argument */ static Function identity() { return t -> t; diff --git a/jdk/src/share/classes/java/util/function/IntBinaryOperator.java b/jdk/src/share/classes/java/util/function/IntBinaryOperator.java index a0788a1d734..21bb9469ede 100644 --- a/jdk/src/share/classes/java/util/function/IntBinaryOperator.java +++ b/jdk/src/share/classes/java/util/function/IntBinaryOperator.java @@ -25,24 +25,26 @@ package java.util.function; /** - * An operation on two {@code int} operands yielding an {@code int} result. - * This is the primitive type specialization of {@link BinaryOperator} for - * {@code int}. + * Represents an operation upon two {@code int}-valued operands and producing an + * {@code int}-valued result. This is the primitive type specialization of + * {@link BinaryOperator} for {@code int}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsInt(int, int)}. * * @see BinaryOperator + * @see IntUnaryOperator * @since 1.8 */ @FunctionalInterface public interface IntBinaryOperator { /** - * Returns the {@code int} result of the operation upon the {@code int} - * operands. The parameters are named {@code left} and {@code right} for - * operations where the order of parameters matters. + * Applies this operator to the given operands. * - * @param left the left operand value - * @param right the right operand value - * @return the result of the operation + * @param left the first operand + * @param right the second operand + * @return the operator result */ int applyAsInt(int left, int right); } diff --git a/jdk/src/share/classes/java/util/function/IntConsumer.java b/jdk/src/share/classes/java/util/function/IntConsumer.java index 3c2a770332f..d8daf73ca2c 100644 --- a/jdk/src/share/classes/java/util/function/IntConsumer.java +++ b/jdk/src/share/classes/java/util/function/IntConsumer.java @@ -27,10 +27,13 @@ package java.util.function; import java.util.Objects; /** - * An operation which accepts a single integer argument and returns no result. - * This is the primitive type specialization of {@link Consumer} for {@code int}. - * Unlike most other functional interfaces, {@code IntConsumer} is expected to - * operate via side-effects. + * Represents an operation that accepts a single {@code int}-valued argument and + * returns no result. This is the primitive type specialization of + * {@link Consumer} for {@code int}. Unlike most other functional interfaces, + * {@code IntConsumer} is expected to operate via side-effects. + * + *

                              This is a functional interface + * whose functional method is {@link #accept(int)}. * * @see Consumer * @since 1.8 @@ -39,30 +42,26 @@ import java.util.Objects; public interface IntConsumer { /** - * Accept an input value. + * Performs this operation on the given argument. * - * @param value the input value + * @param value the input argument */ void accept(int value); /** - * Returns an {@code IntConsumer} which performs, in sequence, the operation - * represented by this object followed by the operation represented by - * another {@code IntConsumer}. + * Returns a composed {@code IntConsumer} that performs, in sequence, this + * operation followed by the {@code after} operation. If performing either + * operation throws an exception, it is relayed to the caller of the + * composed operation. If performing this operation throws an exception, + * the {@code after} operation will not be performed. * - *

                              Any exceptions thrown by either {@code accept} method are relayed - * to the caller; if performing this operation throws an exception, the - * other operation will not be performed. - * - * @param other an IntConsumer which will be chained after this - * IntConsumer - * @return an IntConsumer which performs in sequence the {@code accept} method - * of this IntConsumer and the {@code accept} method of the specified IntConsumer - * operation - * @throws NullPointerException if other is null + * @param after the operation to perform after this operation + * @return a composed {@code IntConsumer} that performs in sequence this + * operation followed by the {@code after} operation + * @throws NullPointerException if {@code after} is null */ - default IntConsumer chain(IntConsumer other) { - Objects.requireNonNull(other); - return (int t) -> { accept(t); other.accept(t); }; + default IntConsumer andThen(IntConsumer after) { + Objects.requireNonNull(after); + return (int t) -> { accept(t); after.accept(t); }; } } diff --git a/jdk/src/share/classes/java/util/function/IntFunction.java b/jdk/src/share/classes/java/util/function/IntFunction.java index ec2ffcae249..de10df499e1 100644 --- a/jdk/src/share/classes/java/util/function/IntFunction.java +++ b/jdk/src/share/classes/java/util/function/IntFunction.java @@ -25,11 +25,14 @@ package java.util.function; /** - * Apply a function to the integer-valued input argument, yielding an - * appropriate result. This is the {@code int}-consuming primitive - * specialization for {@link Function}. + * Represents a function that accepts an int-valued argument and produces a + * result. This is the {@code int}-consuming primitive specialization for + * {@link Function}. * - * @param the type of output objects from the function + *

                              This is a functional interface + * whose functional method is {@link #apply(int)}. + * + * @param the type of the result of the function * * @see Function * @since 1.8 @@ -38,9 +41,9 @@ package java.util.function; public interface IntFunction { /** - * Compute the result of applying the function to the input argument + * Applies this function to the given argument. * - * @param value the input value + * @param value the function argument * @return the function result */ R apply(int value); diff --git a/jdk/src/share/classes/java/util/function/IntPredicate.java b/jdk/src/share/classes/java/util/function/IntPredicate.java index 0e7ec0737d5..5a9bd46dd70 100644 --- a/jdk/src/share/classes/java/util/function/IntPredicate.java +++ b/jdk/src/share/classes/java/util/function/IntPredicate.java @@ -27,8 +27,12 @@ package java.util.function; import java.util.Objects; /** - * Determines if the {@code int} input value matches some criteria. This is the - * {@code int}-consuming primitive type specialization of {@link Predicate}. + * Represents a predicate (boolean-valued function) of one {@code int}-valued + * argument. This is the {@code int}-consuming primitive type specialization of + * {@link Predicate}. + * + *

                              This is a functional interface + * whose functional method is {@link #test(int)}. * * @see Predicate * @since 1.8 @@ -37,38 +41,40 @@ import java.util.Objects; public interface IntPredicate { /** - * Returns {@code true} if the input value matches some criteria. + * Evaluates this predicate on the given argument. * - * @param value the value to be tested - * @return {@code true} if the input value matches some criteria, otherwise - * {@code false} + * @param value the input argument + * @return {@code true} if the input argument matches the predicate, + * otherwise {@code false} */ boolean test(int value); /** - * Returns a predicate which evaluates to {@code true} only if this - * predicate and the provided predicate both evaluate to {@code true}. If - * this predicate returns {@code false} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * AND of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code false}, then the {@code other} + * predicate is not evaluated. * - *

                              Any exceptions thrown by either {@code test} method are relayed - * to the caller; if performing first operation throws an exception, the - * second operation will not be performed. + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate - * @return a new predicate which returns {@code true} only if both - * predicates return {@code true} - * @throws NullPointerException if p is null + * @param other a predicate that will be logically-ANDed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * AND of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default IntPredicate and(IntPredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) && p.test(value); + default IntPredicate and(IntPredicate other) { + Objects.requireNonNull(other); + return (value) -> test(value) && other.test(value); } /** - * Returns a predicate which negates the result of this predicate. + * Returns a predicate that represents the logical negation of this + * predicate. * - * @return a new predicate who's result is always the opposite of this + * @return a predicate that represents the logical negation of this * predicate */ default IntPredicate negate() { @@ -76,22 +82,23 @@ public interface IntPredicate { } /** - * Returns a predicate which evaluates to {@code true} if either this - * predicate or the provided predicate evaluates to {@code true}. If this - * predicate returns {@code true} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * OR of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code true}, then the {@code other} + * predicate is not evaluated. * - *

                              Any exceptions thrown by either {@code test} method are relayed - * to the caller; if performing first operation throws an exception, the - * second operation will not be performed. + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. * - * @param p a predicate which will be logically-ORed with this predicate - * @return a new predicate which returns {@code true} if either predicate - * returns {@code true} - * @throws NullPointerException if p is null + * @param other a predicate that will be logically-ORed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * OR of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default IntPredicate or(IntPredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) || p.test(value); + default IntPredicate or(IntPredicate other) { + Objects.requireNonNull(other); + return (value) -> test(value) || other.test(value); } } diff --git a/jdk/src/share/classes/java/util/function/IntSupplier.java b/jdk/src/share/classes/java/util/function/IntSupplier.java index 3165d3f4061..89489c59bac 100644 --- a/jdk/src/share/classes/java/util/function/IntSupplier.java +++ b/jdk/src/share/classes/java/util/function/IntSupplier.java @@ -25,8 +25,14 @@ package java.util.function; /** - * A supplier of {@code int} values. This is the {@code int}-providing - * primitive specialization of {@link Supplier}. + * Represents a supplier of {@code int}-valued results. This is the + * {@code int}-producing primitive specialization of {@link Supplier}. + * + *

                              There is no requirement that a distinct result be returned each + * time the supplier is invoked. + * + *

                              This is a functional interface + * whose functional method is {@link #getAsInt()}. * * @see Supplier * @since 1.8 @@ -35,9 +41,9 @@ package java.util.function; public interface IntSupplier { /** - * Returns an {@code int} value. + * Gets a result. * - * @return an {@code int} value + * @return a result */ int getAsInt(); } diff --git a/jdk/src/share/classes/java/util/function/IntToDoubleFunction.java b/jdk/src/share/classes/java/util/function/IntToDoubleFunction.java index 773164d4c96..5012154c2a0 100644 --- a/jdk/src/share/classes/java/util/function/IntToDoubleFunction.java +++ b/jdk/src/share/classes/java/util/function/IntToDoubleFunction.java @@ -25,22 +25,24 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code int}-to-{@code double} specialization for {@link Function}. + * Represents a function that accepts an int-valued argument and produces a + * double-valued result. This is the {@code int}-to-{@code double} primitive + * specialization for {@link Function}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsDouble(int)}. * * @see Function - * @see DoubleToIntFunction - * @see LongToDoubleFunction * @since 1.8 */ @FunctionalInterface public interface IntToDoubleFunction { /** - * Compute the result of applying the function to the input arguments. + * Applies this function to the given argument. * - * @param value the input value - * @return the function result value + * @param value the function argument + * @return the function result */ double applyAsDouble(int value); } diff --git a/jdk/src/share/classes/java/util/function/IntToLongFunction.java b/jdk/src/share/classes/java/util/function/IntToLongFunction.java index c50b20fc8c8..6c52faa7009 100644 --- a/jdk/src/share/classes/java/util/function/IntToLongFunction.java +++ b/jdk/src/share/classes/java/util/function/IntToLongFunction.java @@ -25,22 +25,24 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code int}-to-{@code long} specialization for {@link Function}. + * Represents a function that accepts an int-valued argument and produces a + * long-valued result. This is the {@code int}-to-{@code long} primitive + * specialization for {@link Function}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsLong(int)}. * * @see Function - * @see LongToIntFunction - * @see DoubleToLongFunction * @since 1.8 */ @FunctionalInterface public interface IntToLongFunction { /** - * Compute the result of applying the function to the input arguments. + * Applies this function to the given argument. * - * @param value the input value - * @return the function result value + * @param value the function argument + * @return the function result */ long applyAsLong(int value); } diff --git a/jdk/src/share/classes/java/util/function/IntUnaryOperator.java b/jdk/src/share/classes/java/util/function/IntUnaryOperator.java index 2e14c151b1f..300fc14666a 100644 --- a/jdk/src/share/classes/java/util/function/IntUnaryOperator.java +++ b/jdk/src/share/classes/java/util/function/IntUnaryOperator.java @@ -27,9 +27,12 @@ package java.util.function; import java.util.Objects; /** - * An operation on a single {@code int} operand yielding an {@code int} result. - * This is the primitive type specialization of {@link UnaryOperator} for - * {@code int}. + * Represents an operation on a single {@code int}-valued operand that produces + * an {@code int}-valued result. This is the primitive type specialization of + * {@link UnaryOperator} for {@code int}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsInt(int)}. * * @see UnaryOperator * @since 1.8 @@ -38,24 +41,25 @@ import java.util.Objects; public interface IntUnaryOperator { /** - * Returns the {@code int} value result of the operation upon the - * {@code int} operand. + * Applies this operator to the given operand. * - * @param operand the operand value - * @return the operation result value + * @param operand the operand + * @return the operator result */ int applyAsInt(int operand); /** - * Compose a new function which applies the provided function followed by - * this function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed operator that first applies the {@code before} + * operator to its input, and then applies this operator to the result. + * If evaluation of either operator throws an exception, it is relayed to + * the caller of the composed operator. * - * @param before an additional function to be applied before this function - * is applied - * @return a function which performs the provided function followed by this - * function + * @param before the operator to apply before this operator is applied + * @return a composed operator that first applies the {@code before} + * operator and then applies this operator * @throws NullPointerException if before is null + * + * @see #andThen(IntUnaryOperator) */ default IntUnaryOperator compose(IntUnaryOperator before) { Objects.requireNonNull(before); @@ -63,15 +67,17 @@ public interface IntUnaryOperator { } /** - * Compose a new function which applies this function followed by the - * provided function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed operator that first applies this operator to + * its input, and then applies the {@code after} operator to the result. + * If evaluation of either operator throws an exception, it is relayed to + * the caller of the composed operator. * - * @param after an additional function to be applied after this function is - * applied - * @return a function which performs this function followed by the provided - * function followed + * @param after the operator to apply after this operator is applied + * @return a composed operator that first applies this operator and then + * applies the {@code after} operator * @throws NullPointerException if after is null + * + * @see #compose(IntUnaryOperator) */ default IntUnaryOperator andThen(IntUnaryOperator after) { Objects.requireNonNull(after); @@ -79,9 +85,9 @@ public interface IntUnaryOperator { } /** - * Returns a unary operator that provides its input value as the result. + * Returns a unary operator that always returns its input argument. * - * @return a unary operator that provides its input value as the result + * @return a unary operator that always returns its input argument */ static IntUnaryOperator identity() { return t -> t; diff --git a/jdk/src/share/classes/java/util/function/LongBinaryOperator.java b/jdk/src/share/classes/java/util/function/LongBinaryOperator.java index f35258bea60..287481e4e34 100644 --- a/jdk/src/share/classes/java/util/function/LongBinaryOperator.java +++ b/jdk/src/share/classes/java/util/function/LongBinaryOperator.java @@ -25,24 +25,26 @@ package java.util.function; /** - * An operation on two {@code long} operands yielding a {@code long} result. - * This is the primitive type specialization of {@link BinaryOperator} for - * {@code long}. + * Represents an operation upon two {@code long}-valued operands and producing a + * {@code long}-valued result. This is the primitive type specialization of + * {@link BinaryOperator} for {@code long}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsLong(long, long)}. * * @see BinaryOperator + * @see LongUnaryOperator * @since 1.8 */ @FunctionalInterface public interface LongBinaryOperator { /** - * Returns the {@code long} result of the operation upon the {@code long} - * operands. The parameters are named {@code left} and {@code right} for - * operations where the order of parameters matters. + * Applies this operator to the given operands. * - * @param left the left operand value - * @param right the right operand value - * @return the result of the operation + * @param left the first operand + * @param right the second operand + * @return the operator result */ long applyAsLong(long left, long right); } diff --git a/jdk/src/share/classes/java/util/function/LongConsumer.java b/jdk/src/share/classes/java/util/function/LongConsumer.java index 754af39d918..b59d0303f91 100644 --- a/jdk/src/share/classes/java/util/function/LongConsumer.java +++ b/jdk/src/share/classes/java/util/function/LongConsumer.java @@ -27,10 +27,13 @@ package java.util.function; import java.util.Objects; /** - * An operation which accepts a single long argument and returns no result. - * This is the {@code long}-consuming primitive type specialization of - * {@link Consumer}. Unlike most other functional interfaces, {@code LongConsumer} - * is expected to operate via side-effects. + * Represents an operation that accepts a single {@code long}-valued argument and + * returns no result. This is the primitive type specialization of + * {@link Consumer} for {@code long}. Unlike most other functional interfaces, + * {@code LongConsumer} is expected to operate via side-effects. + * + *

                              This is a functional interface + * whose functional method is {@link #accept(long)}. * * @see Consumer * @since 1.8 @@ -39,30 +42,26 @@ import java.util.Objects; public interface LongConsumer { /** - * Accept an input value. + * Performs this operation on the given argument. * - * @param value the input value + * @param value the input argument */ void accept(long value); /** - * Returns a {@code LongConsumer} which performs, in sequence, the operation - * represented by this object followed by the operation represented by - * another {@code LongConsumer}. + * Returns a composed {@code LongConsumer} that performs, in sequence, this + * operation followed by the {@code after} operation. If performing either + * operation throws an exception, it is relayed to the caller of the + * composed operation. If performing this operation throws an exception, + * the {@code after} operation will not be performed. * - *

                              Any exceptions thrown by either {@code accept} method are relayed - * to the caller; if performing this operation throws an exception, the - * other operation will not be performed. - * - * @param other a LongConsumer which will be chained after this - * LongConsumer - * @return a LongConsumer which performs in sequence the {@code accept} method - * of this LongConsumer and the {@code accept} method of the specified LongConsumer - * operation - * @throws NullPointerException if other is null + * @param after the operation to perform after this operation + * @return a composed {@code LongConsumer} that performs in sequence this + * operation followed by the {@code after} operation + * @throws NullPointerException if {@code after} is null */ - default LongConsumer chain(LongConsumer other) { - Objects.requireNonNull(other); - return (long t) -> { accept(t); other.accept(t); }; + default LongConsumer andThen(LongConsumer after) { + Objects.requireNonNull(after); + return (long t) -> { accept(t); after.accept(t); }; } } diff --git a/jdk/src/share/classes/java/util/function/LongFunction.java b/jdk/src/share/classes/java/util/function/LongFunction.java index d87f22ab7e9..2030c04e422 100644 --- a/jdk/src/share/classes/java/util/function/LongFunction.java +++ b/jdk/src/share/classes/java/util/function/LongFunction.java @@ -25,11 +25,14 @@ package java.util.function; /** - * Apply a function to the long-valued input argument, yielding an appropriate - * result. This is the {@code long}-consuming primitive specialization for + * Represents a function that accepts a long-valued argument and produces a + * result. This is the {@code long}-consuming primitive specialization for * {@link Function}. * - * @param the type of output objects from the function + *

                              This is a functional interface + * whose functional method is {@link #apply(long)}. + * + * @param the type of the result of the function * * @see Function * @since 1.8 @@ -38,9 +41,9 @@ package java.util.function; public interface LongFunction { /** - * Compute the result of applying the function to the input argument + * Applies this function to the given argument. * - * @param value the input value + * @param value the function argument * @return the function result */ R apply(long value); diff --git a/jdk/src/share/classes/java/util/function/LongPredicate.java b/jdk/src/share/classes/java/util/function/LongPredicate.java index 1a28708ea45..5afdd41ef1d 100644 --- a/jdk/src/share/classes/java/util/function/LongPredicate.java +++ b/jdk/src/share/classes/java/util/function/LongPredicate.java @@ -27,8 +27,12 @@ package java.util.function; import java.util.Objects; /** - * Determines if the {@code long} input value matches some criteria. This is the - * {@code long}-consuming primitive type specialization of {@link Predicate}. + * Represents a predicate (boolean-valued function) of one {@code long}-valued + * argument. This is the {@code long}-consuming primitive type specialization of + * {@link Predicate}. + * + *

                              This is a functional interface + * whose functional method is {@link #test(long)}. * * @see Predicate * @since 1.8 @@ -37,37 +41,40 @@ import java.util.Objects; public interface LongPredicate { /** - * Returns {@code true} if the input value matches some criteria. + * Evaluates this predicate on the given argument. * - * @param value the value to be tested - * @return {@code true} if the input value matches some criteria, otherwise - * {@code false} + * @param value the input argument + * @return {@code true} if the input argument matches the predicate, + * otherwise {@code false} */ boolean test(long value); /** - * Returns a predicate which evaluates to {@code true} only if this - * predicate and the provided predicate both evaluate to {@code true}. If - * this predicate returns {@code false} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * AND of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code false}, then the {@code other} + * predicate is not evaluated. * - *

                              Any exceptions thrown by either {@code test} method are relayed - * to the caller; if performing first operation throws an exception, the - * second operation will not be performed. + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate - * @return a new predicate which returns {@code true} only if both - * predicates return {@code true} + * @param other a predicate that will be logically-ANDed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * AND of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default LongPredicate and(LongPredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) && p.test(value); + default LongPredicate and(LongPredicate other) { + Objects.requireNonNull(other); + return (value) -> test(value) && other.test(value); } /** - * Returns a predicate which negates the result of this predicate. + * Returns a predicate that represents the logical negation of this + * predicate. * - * @return a new predicate who's result is always the opposite of this + * @return a predicate that represents the logical negation of this * predicate */ default LongPredicate negate() { @@ -75,22 +82,23 @@ public interface LongPredicate { } /** - * Returns a predicate which evaluates to {@code true} if either this - * predicate or the provided predicate evaluates to {@code true}. If this - * predicate returns {@code true} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * OR of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code true}, then the {@code other} + * predicate is not evaluated. * - *

                              Any exceptions thrown by either {@code test} method are relayed - * to the caller; if performing first operation throws an exception, the - * second operation will not be performed. + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. * - * @param p a predicate which will be logically-ORed with this predicate - * @return a new predicate which returns {@code true} if either predicate - * returns {@code true} - * @throws NullPointerException if p is null + * @param other a predicate that will be logically-ORed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * OR of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default LongPredicate or(LongPredicate p) { - Objects.requireNonNull(p); - return (value) -> test(value) || p.test(value); + default LongPredicate or(LongPredicate other) { + Objects.requireNonNull(other); + return (value) -> test(value) || other.test(value); } } diff --git a/jdk/src/share/classes/java/util/function/LongSupplier.java b/jdk/src/share/classes/java/util/function/LongSupplier.java index d88c399a790..513d9062e94 100644 --- a/jdk/src/share/classes/java/util/function/LongSupplier.java +++ b/jdk/src/share/classes/java/util/function/LongSupplier.java @@ -25,8 +25,14 @@ package java.util.function; /** - * A supplier of {@code long} values. This is the {@code long}-providing - * primitive specialization of {@link Supplier}. + * Represents a supplier of {@code long}-valued results. This is the + * {@code long}-producing primitive specialization of {@link Supplier}. + * + *

                              There is no requirement that a distinct result be returned each + * time the supplier is invoked. + * + *

                              This is a functional interface + * whose functional method is {@link #getAsLong()}. * * @see Supplier * @since 1.8 @@ -35,9 +41,9 @@ package java.util.function; public interface LongSupplier { /** - * Returns a {@code long} value. + * Gets a result. * - * @return a {@code long} value + * @return a result */ long getAsLong(); } diff --git a/jdk/src/share/classes/java/util/function/LongToDoubleFunction.java b/jdk/src/share/classes/java/util/function/LongToDoubleFunction.java index 718021cc9a8..9d0831f35ec 100644 --- a/jdk/src/share/classes/java/util/function/LongToDoubleFunction.java +++ b/jdk/src/share/classes/java/util/function/LongToDoubleFunction.java @@ -25,22 +25,24 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code long}-to-{@code double} specialization for {@link Function}. + * Represents a function that accepts a long-valued argument and produces a + * double-valued result. This is the {@code long}-to-{@code double} primitive + * specialization for {@link Function}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsDouble(long)}. * * @see Function - * @see DoubleToLongFunction - * @see IntToDoubleFunction * @since 1.8 */ @FunctionalInterface public interface LongToDoubleFunction { /** - * Compute the result of applying the function to the input arguments. + * Applies this function to the given argument. * - * @param value the input value - * @return the function result value + * @param value the function argument + * @return the function result */ double applyAsDouble(long value); } diff --git a/jdk/src/share/classes/java/util/function/LongToIntFunction.java b/jdk/src/share/classes/java/util/function/LongToIntFunction.java index e5dc6ba3d0d..d1d6c347054 100644 --- a/jdk/src/share/classes/java/util/function/LongToIntFunction.java +++ b/jdk/src/share/classes/java/util/function/LongToIntFunction.java @@ -25,22 +25,24 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code long}-to-{@code int} specialization for {@link Function}. + * Represents a function that accepts a long-valued argument and produces an + * int-valued result. This is the {@code long}-to-{@code int} primitive + * specialization for {@link Function}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsInt(long)}. * * @see Function - * @see IntToLongFunction - * @see DoubleToIntFunction * @since 1.8 */ @FunctionalInterface public interface LongToIntFunction { /** - * Compute the result of applying the function to the input arguments. + * Applies this function to the given argument. * - * @param value the input value - * @return the function result value + * @param value the function argument + * @return the function result */ int applyAsInt(long value); } diff --git a/jdk/src/share/classes/java/util/function/LongUnaryOperator.java b/jdk/src/share/classes/java/util/function/LongUnaryOperator.java index a32918fc56b..e2bbdddbfc9 100644 --- a/jdk/src/share/classes/java/util/function/LongUnaryOperator.java +++ b/jdk/src/share/classes/java/util/function/LongUnaryOperator.java @@ -27,9 +27,12 @@ package java.util.function; import java.util.Objects; /** - * An operation on a single {@code long} operand yielding a {@code long} result. - * This is the primitive type specialization of {@link UnaryOperator} for - * {@code long}. + * Represents an operation on a single {@code long}-valued operand that produces + * a {@code long}-valued result. This is the primitive type specialization of + * {@link UnaryOperator} for {@code long}. + * + *

                              This is a functional interface + * whose functional method is {@link #applyAsLong(long)}. * * @see UnaryOperator * @since 1.8 @@ -38,24 +41,25 @@ import java.util.Objects; public interface LongUnaryOperator { /** - * Returns the {@code long} result of the operation upon the {@code long} - * operand. + * Applies this operator to the given operand. * - * @param operand the operand value - * @return the operation result value + * @param operand the operand + * @return the operator result */ long applyAsLong(long operand); /** - * Compose a new function which applies the provided function followed by - * this function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed operator that first applies the {@code before} + * operator to its input, and then applies this operator to the result. + * If evaluation of either operator throws an exception, it is relayed to + * the caller of the composed operator. * - * @param before An additional function to be applied before this function - * is applied - * @return A function which performs the provided function followed by this - * function + * @param before the operator to apply before this operator is applied + * @return a composed operator that first applies the {@code before} + * operator and then applies this operator * @throws NullPointerException if before is null + * + * @see #andThen(LongUnaryOperator) */ default LongUnaryOperator compose(LongUnaryOperator before) { Objects.requireNonNull(before); @@ -63,15 +67,17 @@ public interface LongUnaryOperator { } /** - * Compose a new function which applies this function followed by the - * provided function. If either function throws an exception, it is relayed - * to the caller. + * Returns a composed operator that first applies this operator to + * its input, and then applies the {@code after} operator to the result. + * If evaluation of either operator throws an exception, it is relayed to + * the caller of the composed operator. * - * @param after An additional function to be applied after this function is - * applied - * @return A function which performs this function followed by the provided - * function followed + * @param after the operator to apply after this operator is applied + * @return a composed operator that first applies this operator and then + * applies the {@code after} operator * @throws NullPointerException if after is null + * + * @see #compose(LongUnaryOperator) */ default LongUnaryOperator andThen(LongUnaryOperator after) { Objects.requireNonNull(after); @@ -79,9 +85,9 @@ public interface LongUnaryOperator { } /** - * Returns a unary operator that provides its input value as the result. + * Returns a unary operator that always returns its input argument. * - * @return a unary operator that provides its input value as the result + * @return a unary operator that always returns its input argument */ static LongUnaryOperator identity() { return t -> t; diff --git a/jdk/src/share/classes/java/util/function/ObjDoubleConsumer.java b/jdk/src/share/classes/java/util/function/ObjDoubleConsumer.java index dd8c0c9cf99..d551fc7bf00 100644 --- a/jdk/src/share/classes/java/util/function/ObjDoubleConsumer.java +++ b/jdk/src/share/classes/java/util/function/ObjDoubleConsumer.java @@ -25,12 +25,16 @@ package java.util.function; /** - * An operation which accepts an object reference and a double, and returns no - * result. This is the {@code (reference, double)} specialization of - * {@link BiConsumer}. Unlike most other functional interfaces, - * {@code ObjDoubleConsumer} is expected to operate via side-effects. + * Represents an operation that accepts an object-valued and a + * {@code double}-valued argument, and returns no result. This is the + * {@code (reference, double)} specialization of {@link BiConsumer}. + * Unlike most other functional interfaces, {@code ObjDoubleConsumer} is + * expected to operate via side-effects. * - * @param Type of reference argument to {@code accept()}. + *

                              This is a functional interface + * whose functional method is {@link #accept(Object, double)}. + * + * @param the type of the object argument to the operation * * @see BiConsumer * @since 1.8 @@ -39,10 +43,10 @@ package java.util.function; public interface ObjDoubleConsumer { /** - * Accept a set of input values. + * Performs this operation on the given arguments. * - * @param t an input object - * @param value an input value + * @param t the first input argument + * @param value the second input argument */ void accept(T t, double value); } diff --git a/jdk/src/share/classes/java/util/function/ObjIntConsumer.java b/jdk/src/share/classes/java/util/function/ObjIntConsumer.java index 3ab4d5eef05..2eb32d63ec4 100644 --- a/jdk/src/share/classes/java/util/function/ObjIntConsumer.java +++ b/jdk/src/share/classes/java/util/function/ObjIntConsumer.java @@ -25,12 +25,16 @@ package java.util.function; /** - * An operation which accepts an object reference and an int, and returns no - * result. This is the {@code (reference, int)} specialization of - * {@link BiConsumer}. Unlike most other functional interfaces, - * {@code ObjIntConsumer} is expected to operate via side-effects. + * Represents an operation that accepts an object-valued and a + * {@code int}-valued argument, and returns no result. This is the + * {@code (reference, int)} specialization of {@link BiConsumer}. + * Unlike most other functional interfaces, {@code ObjIntConsumer} is + * expected to operate via side-effects. * - * @param Type of reference argument to {@code accept()} + *

                              This is a functional interface + * whose functional method is {@link #accept(Object, int)}. + * + * @param the type of the object argument to the operation * * @see BiConsumer * @since 1.8 @@ -39,10 +43,10 @@ package java.util.function; public interface ObjIntConsumer { /** - * Accept a set of input values. + * Performs this operation on the given arguments. * - * @param t an input object - * @param value an input value + * @param t the first input argument + * @param value the second input argument */ void accept(T t, int value); } diff --git a/jdk/src/share/classes/java/util/function/ObjLongConsumer.java b/jdk/src/share/classes/java/util/function/ObjLongConsumer.java index f90a4f84c77..f40eea2c0f8 100644 --- a/jdk/src/share/classes/java/util/function/ObjLongConsumer.java +++ b/jdk/src/share/classes/java/util/function/ObjLongConsumer.java @@ -25,12 +25,16 @@ package java.util.function; /** - * An operation which accepts an object reference and a long, and returns no - * result. This is the {@code (reference, long)} specialization of - * {@link BiConsumer}. Unlike most other functional interfaces, - * {@code ObjLongConsumer} is expected to operate via side-effects. + * Represents an operation that accepts an object-valued and a + * {@code long}-valued argument, and returns no result. This is the + * {@code (reference, long)} specialization of {@link BiConsumer}. + * Unlike most other functional interfaces, {@code ObjLongConsumer} is + * expected to operate via side-effects. * - * @param Type of reference argument to {@code accept()} + *

                              This is a functional interface + * whose functional method is {@link #accept(Object, long)}. + * + * @param the type of the object argument to the operation * * @see BiConsumer * @since 1.8 @@ -39,10 +43,10 @@ package java.util.function; public interface ObjLongConsumer { /** - * Accept a set of input values. + * Performs this operation on the given arguments. * - * @param t an input object - * @param value an input value + * @param t the first input argument + * @param value the second input argument */ void accept(T t, long value); } diff --git a/jdk/src/share/classes/java/util/function/Predicate.java b/jdk/src/share/classes/java/util/function/Predicate.java index ac207a3d593..e2f448b1674 100644 --- a/jdk/src/share/classes/java/util/function/Predicate.java +++ b/jdk/src/share/classes/java/util/function/Predicate.java @@ -27,9 +27,12 @@ package java.util.function; import java.util.Objects; /** - * Determines if the input object matches some criteria. + * Represents a predicate (boolean-valued function) of one argument. * - * @param the type of argument to {@code test} + *

                              This is a functional interface + * whose functional method is {@link #test(Object)}. + * + * @param the type of the input to the predicate * * @since 1.8 */ @@ -37,76 +40,80 @@ import java.util.Objects; public interface Predicate { /** - * Returns {@code true} if the input object matches some criteria. + * Evaluates this predicate on the given argument. * - * @param t the input object - * @return {@code true} if the input object matches some criteria, otherwise - * {@code false} + * @param t the input argument + * @return {@code true} if the input argument matches the predicate, + * otherwise {@code false} */ boolean test(T t); /** - * Returns a predicate which evaluates to {@code true} only if this - * predicate and the provided predicate both evaluate to {@code true}. If - * this predicate returns {@code false} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * AND of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code false}, then the {@code other} + * predicate is not evaluated. * - *

                              Any exceptions thrown by either {@code test} method are relayed - * to the caller; if performing first operation throws an exception, the - * second operation will not be performed. + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. * - * @param p a predicate which will be logically-ANDed with this predicate - * @return a new predicate which returns {@code true} only if both - * predicates return {@code true} - * @throws NullPointerException if p is null + * @param other a predicate that will be logically-ANDed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * AND of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default Predicate and(Predicate p) { - Objects.requireNonNull(p); - return (t) -> test(t) && p.test(t); + default Predicate and(Predicate other) { + Objects.requireNonNull(other); + return (t) -> test(t) && other.test(t); } /** - * Returns a predicate which negates the result of this predicate. - * - * @return a new predicate who's result is always the opposite of this + * Returns a predicate that represents the logical negation of this * predicate. + * + * @return a predicate that represents the logical negation of this + * predicate */ default Predicate negate() { return (t) -> !test(t); } /** - * Returns a predicate which evaluates to {@code true} if either this - * predicate or the provided predicate evaluates to {@code true}. If this - * predicate returns {@code true} then the remaining predicate is not - * evaluated. + * Returns a composed predicate that represents a short-circuiting logical + * OR of this predicate and another. When evaluating the composed + * predicate, if this predicate is {@code true}, then the {@code other} + * predicate is not evaluated. * - *

                              Any exceptions thrown by either {@code test} method are relayed - * to the caller; if performing first operation throws an exception, the - * second operation will not be performed. + *

                              Any exceptions thrown during evaluation of either predicate are relayed + * to the caller; if evaluation of this predicate throws an exception, the + * {@code other} predicate will not be evaluated. * - * @param p a predicate which will be logically-ORed with this predicate - * @return a new predicate which returns {@code true} if either predicate - * returns {@code true} - * @throws NullPointerException if p is null + * @param other a predicate that will be logically-ORed with this + * predicate + * @return a composed predicate that represents the short-circuiting logical + * OR of this predicate and the {@code other} predicate + * @throws NullPointerException if other is null */ - default Predicate or(Predicate p) { - Objects.requireNonNull(p); - return (t) -> test(t) || p.test(t); + default Predicate or(Predicate other) { + Objects.requireNonNull(other); + return (t) -> test(t) || other.test(t); } /** - * Returns a predicate who's result matches - * {@code Objects.equals(target, t)}. + * Returns a predicate that tests if two arguments are equal according + * to {@link Objects#equals(Object, Object)}. * - * @param the type of values evaluated by the predicate - * @param target the target value to be compared for equality - * @return a predicate who's result matches - * {@code Objects.equals(target, t)} + * @param the type of arguments to the predicate + * @param targetRef the object reference with which to compare for equality, + * which may be {@code null} + * @return a predicate that tests if two arguments are equal according + * to {@link Objects#equals(Object, Object)} */ - static Predicate isEqual(Object target) { - return (null == target) + static Predicate isEqual(Object targetRef) { + return (null == targetRef) ? Objects::isNull - : object -> target.equals(object); + : object -> targetRef.equals(object); } } diff --git a/jdk/src/share/classes/java/util/function/Supplier.java b/jdk/src/share/classes/java/util/function/Supplier.java index 728994b17cf..b87777e882a 100644 --- a/jdk/src/share/classes/java/util/function/Supplier.java +++ b/jdk/src/share/classes/java/util/function/Supplier.java @@ -25,10 +25,15 @@ package java.util.function; /** - * A supplier of objects. The result objects are either created during the - * invocation of {@link #get} or by some prior action. + * Represents a supplier of results. * - * @param The type of objects returned by {@code get} + *

                              There is no requirement that a new or distinct result be returned each + * time the supplier is invoked. + * + *

                              This is a functional interface + * whose functional method is {@link #get()}. + * + * @param the type of results supplied by this supplier * * @since 1.8 */ @@ -36,9 +41,9 @@ package java.util.function; public interface Supplier { /** - * Returns an object. + * Gets a result. * - * @return an object + * @return a result */ T get(); } diff --git a/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java b/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java index bd82422b9ab..d0efceef54e 100644 --- a/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java +++ b/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java @@ -25,13 +25,15 @@ package java.util.function; /** - * Apply a function to the input arguments, yielding an appropriate result. - * This is the {@code double}-bearing specialization for {@link BiFunction}. + * Represents a function that accepts two arguments and produces a double-valued + * result. This is the {@code double}-producing primitive specialization for + * {@link BiFunction}. * - * @param the type of the first argument to the {@code applyAsDouble} - * operation. - * @param the type of the second argument to the {@code applyAsDouble} - * operation. + *

                              This is a functional interface + * whose functional method is {@link #applyAsDouble(Object, Object)}. + * + * @param the type of the first argument to the function + * @param the type of the second argument to the function * * @see BiFunction * @since 1.8 @@ -40,11 +42,11 @@ package java.util.function; public interface ToDoubleBiFunction { /** - * Compute the result of applying the function to the input arguments + * Applies this function to the given arguments. * - * @param t an input object - * @param u an input object - * @return the function result value + * @param t the first function argument + * @param u the second function argument + * @return the function result */ double applyAsDouble(T t, U u); } diff --git a/jdk/src/share/classes/java/util/function/ToDoubleFunction.java b/jdk/src/share/classes/java/util/function/ToDoubleFunction.java index c63d984a7ed..29bf9881387 100644 --- a/jdk/src/share/classes/java/util/function/ToDoubleFunction.java +++ b/jdk/src/share/classes/java/util/function/ToDoubleFunction.java @@ -25,10 +25,13 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code double}-bearing specialization for {@link Function}. + * Represents a function that produces a double-valued result. This is the + * {@code double}-producing primitive specialization for {@link Function}. * - * @param the type of input objects to the function + *

                              This is a functional interface + * whose functional method is {@link #applyAsDouble(Object)}. + * + * @param the type of the input to the function * * @see Function * @since 1.8 @@ -37,10 +40,10 @@ package java.util.function; public interface ToDoubleFunction { /** - * Compute the result of applying the function to the input argument + * Applies this function to the given argument. * - * @param t the input object - * @return the function result value + * @param value the function argument + * @return the function result */ - double applyAsDouble(T t); + double applyAsDouble(T value); } diff --git a/jdk/src/share/classes/java/util/function/ToIntBiFunction.java b/jdk/src/share/classes/java/util/function/ToIntBiFunction.java index 3fc6d560030..e3109282569 100644 --- a/jdk/src/share/classes/java/util/function/ToIntBiFunction.java +++ b/jdk/src/share/classes/java/util/function/ToIntBiFunction.java @@ -25,13 +25,15 @@ package java.util.function; /** - * Apply a function to the input arguments, yielding an appropriate result. - * This is the {@code int}-bearing specialization for {@link BiFunction}. + * Represents a function that accepts two arguments and produces an int-valued + * result. This is the {@code int}-producing primitive specialization for + * {@link BiFunction}. * - * @param the type of the first argument to the {@code applyAsInt} - * operation - * @param the type of the second argument to the {@code applyAsInt} - * operation + *

                              This is a functional interface + * whose functional method is {@link #applyAsInt(Object, Object)}. + * + * @param the type of the first argument to the function + * @param the type of the second argument to the function * * @see BiFunction * @since 1.8 @@ -40,11 +42,11 @@ package java.util.function; public interface ToIntBiFunction { /** - * Compute the result of applying the function to the input arguments + * Applies this function to the given arguments. * - * @param t an input object - * @param u an input object - * @return the function result value + * @param t the first function argument + * @param u the second function argument + * @return the function result */ int applyAsInt(T t, U u); } diff --git a/jdk/src/share/classes/java/util/function/ToIntFunction.java b/jdk/src/share/classes/java/util/function/ToIntFunction.java index c3fd2f7004f..5768242d1b4 100644 --- a/jdk/src/share/classes/java/util/function/ToIntFunction.java +++ b/jdk/src/share/classes/java/util/function/ToIntFunction.java @@ -25,10 +25,13 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code int}-bearing specialization for {@link Function}. + * Represents a function that produces an int-valued result. This is the + * {@code int}-producing primitive specialization for {@link Function}. * - * @param the type of input objects to the function + *

                              This is a functional interface + * whose functional method is {@link #applyAsInt(Object)}. + * + * @param the type of the input to the function * * @see Function * @since 1.8 @@ -37,10 +40,10 @@ package java.util.function; public interface ToIntFunction { /** - * Compute the result of applying the function to the input arguments + * Applies this function to the given argument. * - * @param t the input object - * @return the function result value + * @param value the function argument + * @return the function result */ - int applyAsInt(T t); + int applyAsInt(T value); } diff --git a/jdk/src/share/classes/java/util/function/ToLongBiFunction.java b/jdk/src/share/classes/java/util/function/ToLongBiFunction.java index abf6f7851d1..8b5ed7e533d 100644 --- a/jdk/src/share/classes/java/util/function/ToLongBiFunction.java +++ b/jdk/src/share/classes/java/util/function/ToLongBiFunction.java @@ -25,13 +25,15 @@ package java.util.function; /** - * Apply a function to the input arguments, yielding an appropriate result. - * This is the {@code long}-bearing specialization for {@link BiFunction}. + * Represents a function that accepts two arguments and produces a long-valued + * result. This is the {@code long}-producing primitive specialization for + * {@link BiFunction}. * - * @param the type of the first argument to the {@code applyAsLong} - * operation. - * @param the type of the second argument to the {@code applyAsLong} - * operation. + *

                              This is a functional interface + * whose functional method is {@link #applyAsLong(Object, Object)}. + * + * @param the type of the first argument to the function + * @param the type of the second argument to the function * * @see BiFunction * @since 1.8 @@ -40,11 +42,11 @@ package java.util.function; public interface ToLongBiFunction { /** - * Compute the result of applying the function to the input arguments. + * Applies this function to the given arguments. * - * @param t an input object - * @param u an input object - * @return the function result value + * @param t the first function argument + * @param u the second function argument + * @return the function result */ long applyAsLong(T t, U u); } diff --git a/jdk/src/share/classes/java/util/function/ToLongFunction.java b/jdk/src/share/classes/java/util/function/ToLongFunction.java index 4489c6fa655..eefb6178bd5 100644 --- a/jdk/src/share/classes/java/util/function/ToLongFunction.java +++ b/jdk/src/share/classes/java/util/function/ToLongFunction.java @@ -25,10 +25,13 @@ package java.util.function; /** - * Apply a function to the input argument, yielding an appropriate result. - * This is the {@code long}-bearing specialization for {@link Function}. + * Represents a function that produces a long-valued result. This is the + * {@code long}-producing primitive specialization for {@link Function}. * - * @param the type of input objects to the function + *

                              This is a functional interface + * whose functional method is {@link #applyAsLong(Object)}. + * + * @param the type of the input to the function * * @see Function * @since 1.8 @@ -37,10 +40,10 @@ package java.util.function; public interface ToLongFunction { /** - * Compute the result of applying the function to the input arguments. + * Applies this function to the given argument. * - * @param t the input object - * @return the function result value + * @param value the function argument + * @return the function result */ - long applyAsLong(T t); + long applyAsLong(T value); } diff --git a/jdk/src/share/classes/java/util/function/UnaryOperator.java b/jdk/src/share/classes/java/util/function/UnaryOperator.java index e7794ca19e5..c4aa749a68a 100644 --- a/jdk/src/share/classes/java/util/function/UnaryOperator.java +++ b/jdk/src/share/classes/java/util/function/UnaryOperator.java @@ -25,11 +25,14 @@ package java.util.function; /** - * An operation upon a single operand yielding a result. The operand and the - * result are of the same type. This is a specialization of {@code Function} for + * Represents an operation on a single operand that produces a result of the + * same type as its operand. This is a specialization of {@code Function} for * the case where the operand and result are of the same type. * - * @param the type of operand to {@code apply} and of the result + *

                              This is a functional interface + * whose functional method is {@link #apply(Object)}. + * + * @param the type of the operand and result of the operator * * @see Function * @since 1.8 @@ -38,10 +41,10 @@ package java.util.function; public interface UnaryOperator extends Function { /** - * Returns a unary operator that provides its input value as the result. + * Returns a unary operator that always returns its input argument. * - * @param the type of the input and output objects to the function - * @return a unary operator that provides its input value as the result + * @param the type of the input and output of the operator + * @return a unary operator that always returns its input argument */ static UnaryOperator identity() { return t -> t; diff --git a/jdk/src/share/classes/java/util/function/package-info.java b/jdk/src/share/classes/java/util/function/package-info.java index 36eda330d19..158d1f0212d 100644 --- a/jdk/src/share/classes/java/util/function/package-info.java +++ b/jdk/src/share/classes/java/util/function/package-info.java @@ -25,56 +25,82 @@ /** * Functional interfaces provide target types for lambda expressions - * and method references. Each functional interface has a single abstract method + * and method references. Each functional interface has a single abstract + * method, called the functional method for that functional interface, * to which the lambda expression's parameter and return types are matched or - * adapted. Functional interfaces can provide a target type in multiple contexts, - * such as assignment context, method invocation, or cast context: + * adapted. Functional interfaces can provide a target type in multiple + * contexts, such as assignment context, method invocation, or cast context: * - *

                              - *     Predicate<String> p = String::isEmpty;
                              + * 
                              {@code
                              + *     // Assignment context
                              + *     Predicate p = String::isEmpty;
                                *
                              + *     // Method invocation context
                                *     stream.filter(e -> e.getSize() > 10)...
                                *
                              + *     // Cast context
                                *     stream.map((ToIntFunction) e -> e.getSize())...
                              - * 
                              + * }
                              * - *

                              The interfaces in this package are functional interfaces used by the JDK, - * and are available to be used by user code as well. While they do not identify - * a complete set of function shapes to which lambda expressions might be adapted, - * they provide enough to cover common requirements. + *

                              The interfaces in this package are general purpose functional interfaces + * used by the JDK, and are available to be used by user code as well. While + * they do not identify a complete set of function shapes to which lambda + * expressions might be adapted, they provide enough to cover common + * requirements. Other functional interfaces provided for specific purposes, + * such as {@link java.io.FileFilter}, are defined in the packages where they + * are used. * - *

                              The interfaces in this package are annotated with @{link FunctionalInterface}. - * This annotation is not a requirement for the compiler to recognize an interface - * as a functional interface, but merely an aid to capture design intent and enlist the - * help of the compiler in identifying accidental violations of design intent. + *

                              The interfaces in this package are annotated with + * {@link java.lang.FunctionalInterface}. This annotation is not a requirement + * for the compiler to recognize an interface as a functional interface, but + * merely an aid to capture design intent and enlist the help of the compiler in + * identifying accidental violations of design intent. * - *

                              The functional interfaces in this package follow an extensible naming convention, - * as follows: + *

                              Functional interfaces often represent abstract concepts like functions, + * actions, or predicates. In documenting functional interfaces, or referring + * to variables typed as functional interfaces, it is common to refer directly + * to those abstract concepts, for example using "this function" instead of + * "the function represented by this object". + * + *

                              The functional interfaces in this package follow an extensible naming + * convention, as follows: * *

                                - *
                              • There are several basic function shapes, including {@link java.util.function.Function} ({@code T -> R}), - * {@link java.util.function.Consumer} ({@code T -> void}), - * {@link java.util.function.Predicate} ({@code T -> boolean}), - * and {@link java.util.function.Supplier} ({@code () -> T}). + *
                              • There are several basic function shapes, including + * {@link java.util.function.Function} (unary function from {@code T} to {@code R}), + * {@link java.util.function.Consumer} (unary function from {@code T} to {@code void}), + * {@link java.util.function.Predicate} (unary function from {@code T} to {@code boolean}), + * and {@link java.util.function.Supplier} (nilary function to {@code R}). *
                              • - *
                              • Function shapes have a natural arity based on how they are most commonly used. - * The basic shapes can be modified by an arity prefix to indicate a different arity, - * such as {@link java.util.function.BiFunction} ({@code (T, U) -> R}). + * + *
                              • Function shapes have a natural arity based on how they are most + * commonly used. The basic shapes can be modified by an arity prefix to + * indicate a different arity, such as + * {@link java.util.function.BiFunction} (binary function from {@code T} and + * {@code U} to {@code R}). *
                              • - *
                              • There are additional derived function shapes which extend the basic function - * shapes, including {@link java.util.function.UnaryOperator} (extends {@code Function}) and - * {@link java.util.function.BinaryOperator} (extends {@code BiFunction}). + * + *
                              • There are additional derived function shapes which extend the basic + * function shapes, including {@link java.util.function.UnaryOperator} + * (extends {@code Function}) and {@link java.util.function.BinaryOperator} + * (extends {@code BiFunction}). *
                              • - *
                              • Type parameters of functional interfaces can be specialized to primitives with - * additional type prefixes. To specialize the return type for a type that has both - * generic return type and generic arguments, we prefix {@code ToXxx}, as in - * {@link java.util.function.ToIntFunction}. Otherwise, type arguments are specialized left-to-right, - * as in {@link java.util.function.DoubleConsumer} or {@link java.util.function.ObjIntConsumer}. - * (The type prefix {@code Obj} is used to indicate that we don't want to specialize this parameter, - * but want to move on to the next parameter.) These schemes can be combined as in {@code IntToDoubleFunction}. + * + *
                              • Type parameters of functional interfaces can be specialized to + * primitives with additional type prefixes. To specialize the return type + * for a type that has both generic return type and generic arguments, we + * prefix {@code ToXxx}, as in {@link java.util.function.ToIntFunction}. + * Otherwise, type arguments are specialized left-to-right, as in + * {@link java.util.function.DoubleConsumer} + * or {@link java.util.function.ObjIntConsumer}. + * (The type prefix {@code Obj} is used to indicate that we don't want to + * specialize this parameter, but want to move on to the next parameter, + * as in {@link java.util.function.ObjIntConsumer}.) + * These schemes can be combined, as in {@code IntToDoubleFunction}. *
                              • - *
                              • If there are specialization prefixes for all arguments, the arity prefix may be left - * out (as in {@link java.util.function.ObjIntConsumer}). + * + *
                              • If there are specialization prefixes for all arguments, the arity + * prefix may be left out (as in {@link java.util.function.ObjIntConsumer}). *
                              • *
                              * diff --git a/jdk/src/share/classes/java/util/jar/Attributes.java b/jdk/src/share/classes/java/util/jar/Attributes.java index 18ea64293e5..514018391cb 100644 --- a/jdk/src/share/classes/java/util/jar/Attributes.java +++ b/jdk/src/share/classes/java/util/jar/Attributes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -527,7 +527,7 @@ public class Attributes implements Map, Cloneable { * Name object for Manifest-Version * manifest attribute. This attribute indicates the version number * of the manifest standard to which a JAR file's manifest conforms. - * @see + * @see * Manifest and Signature Specification */ public static final Name MANIFEST_VERSION = new Name("Manifest-Version"); @@ -535,7 +535,7 @@ public class Attributes implements Map, Cloneable { /** * Name object for Signature-Version * manifest attribute used when signing JAR files. - * @see + * @see * Manifest and Signature Specification */ public static final Name SIGNATURE_VERSION = new Name("Signature-Version"); diff --git a/jdk/src/share/classes/java/util/jar/JarEntry.java b/jdk/src/share/classes/java/util/jar/JarEntry.java index 0b494461739..b0e6841bf83 100644 --- a/jdk/src/share/classes/java/util/jar/JarEntry.java +++ b/jdk/src/share/classes/java/util/jar/JarEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,6 +81,7 @@ class JarEntry extends ZipEntry { * * @return the Manifest Attributes for this * entry, or null if none + * @throws IOException if an I/O error has occurred */ public Attributes getAttributes() throws IOException { return attr; diff --git a/jdk/src/share/classes/java/util/jar/JarFile.java b/jdk/src/share/classes/java/util/jar/JarFile.java index f8deb7643ac..6759a28ccba 100644 --- a/jdk/src/share/classes/java/util/jar/JarFile.java +++ b/jdk/src/share/classes/java/util/jar/JarFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -168,6 +168,7 @@ class JarFile extends ZipFile { * * @throws IllegalStateException * may be thrown if the jar file has been closed + * @throws IOException if an I/O error has occurred */ public Manifest getManifest() throws IOException { return getManifestFromReference(); diff --git a/jdk/src/share/classes/java/util/logging/XMLFormatter.java b/jdk/src/share/classes/java/util/logging/XMLFormatter.java index 6b0a58a7130..d32d978dbe5 100644 --- a/jdk/src/share/classes/java/util/logging/XMLFormatter.java +++ b/jdk/src/share/classes/java/util/logging/XMLFormatter.java @@ -47,7 +47,7 @@ public class XMLFormatter extends Formatter { private LogManager manager = LogManager.getLogManager(); // Append a two digit number. - private void a2(StringBuffer sb, int x) { + private void a2(StringBuilder sb, int x) { if (x < 10) { sb.append('0'); } @@ -55,25 +55,26 @@ public class XMLFormatter extends Formatter { } // Append the time and date in ISO 8601 format - private void appendISO8601(StringBuffer sb, long millis) { - Date date = new Date(millis); - sb.append(date.getYear() + 1900); + private void appendISO8601(StringBuilder sb, long millis) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTimeInMillis(millis); + sb.append(cal.get(Calendar.YEAR) + 1900); sb.append('-'); - a2(sb, date.getMonth() + 1); + a2(sb, cal.get(Calendar.MONTH) + 1); sb.append('-'); - a2(sb, date.getDate()); + a2(sb, cal.get(Calendar.DAY_OF_MONTH)); sb.append('T'); - a2(sb, date.getHours()); + a2(sb, cal.get(Calendar.HOUR_OF_DAY)); sb.append(':'); - a2(sb, date.getMinutes()); + a2(sb, cal.get(Calendar.MINUTE)); sb.append(':'); - a2(sb, date.getSeconds()); + a2(sb, cal.get(Calendar.SECOND)); } - // Append to the given StringBuffer an escaped version of the + // Append to the given StringBuilder an escaped version of the // given text string where XML special characters have been escaped. // For a null string we append "" - private void escape(StringBuffer sb, String text) { + private void escape(StringBuilder sb, String text) { if (text == null) { text = ""; } @@ -102,7 +103,7 @@ public class XMLFormatter extends Formatter { * @return a formatted log record */ public String format(LogRecord record) { - StringBuffer sb = new StringBuffer(500); + StringBuilder sb = new StringBuilder(500); sb.append("\n"); sb.append(" "); @@ -224,7 +225,7 @@ public class XMLFormatter extends Formatter { * @return a valid XML string */ public String getHead(Handler h) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); String encoding; sb.append("> * Backlink to the head of the pipeline chain (self if this is the source * stage). */ + @SuppressWarnings("rawtypes") private final AbstractPipeline sourceStage; /** * The "upstream" pipeline, or null if this is the source stage. */ + @SuppressWarnings("rawtypes") private final AbstractPipeline previousStage; /** @@ -92,6 +94,7 @@ abstract class AbstractPipeline> * The next stage in the pipeline, or null if this is the last stage. * Effectively final at the point of linking to the next pipeline. */ + @SuppressWarnings("rawtypes") private AbstractPipeline nextStage; /** @@ -222,8 +225,8 @@ abstract class AbstractPipeline> linkedOrConsumed = true; return isParallel() - ? (R) terminalOp.evaluateParallel(this, sourceSpliterator(terminalOp.getOpFlags())) - : (R) terminalOp.evaluateSequential(this, sourceSpliterator(terminalOp.getOpFlags())); + ? terminalOp.evaluateParallel(this, sourceSpliterator(terminalOp.getOpFlags())) + : terminalOp.evaluateSequential(this, sourceSpliterator(terminalOp.getOpFlags())); } /** @@ -232,6 +235,7 @@ abstract class AbstractPipeline> * @param generator the array generator to be used to create array instances * @return a flat array-backed Node that holds the collected output elements */ + @SuppressWarnings("unchecked") final Node evaluateToArrayNode(IntFunction generator) { if (linkedOrConsumed) throw new IllegalStateException("stream has already been operated upon"); @@ -256,6 +260,7 @@ abstract class AbstractPipeline> * @throws IllegalStateException if this pipeline stage is not the source * stage. */ + @SuppressWarnings("unchecked") final Spliterator sourceStageSpliterator() { if (this != sourceStage) throw new IllegalStateException(); @@ -265,11 +270,13 @@ abstract class AbstractPipeline> linkedOrConsumed = true; if (sourceStage.sourceSpliterator != null) { + @SuppressWarnings("unchecked") Spliterator s = sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; return s; } else if (sourceStage.sourceSupplier != null) { + @SuppressWarnings("unchecked") Spliterator s = (Spliterator) sourceStage.sourceSupplier.get(); sourceStage.sourceSupplier = null; return s; @@ -282,12 +289,14 @@ abstract class AbstractPipeline> // BaseStream @Override + @SuppressWarnings("unchecked") public final S sequential() { sourceStage.parallel = false; return (S) this; } @Override + @SuppressWarnings("unchecked") public final S parallel() { sourceStage.parallel = true; return (S) this; @@ -295,6 +304,7 @@ abstract class AbstractPipeline> // Primitive specialization use co-variant overrides, hence is not final @Override + @SuppressWarnings("unchecked") public Spliterator spliterator() { if (linkedOrConsumed) throw new IllegalStateException("stream has already been operated upon"); @@ -302,12 +312,14 @@ abstract class AbstractPipeline> if (this == sourceStage) { if (sourceStage.sourceSpliterator != null) { - Spliterator s = sourceStage.sourceSpliterator; + @SuppressWarnings("unchecked") + Spliterator s = (Spliterator) sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; return s; } else if (sourceStage.sourceSupplier != null) { - Supplier> s = sourceStage.sourceSupplier; + @SuppressWarnings("unchecked") + Supplier> s = (Supplier>) sourceStage.sourceSupplier; sourceStage.sourceSupplier = null; return lazySpliterator(s); } @@ -349,10 +361,11 @@ abstract class AbstractPipeline> * @param terminalFlags Operation flags for the terminal operation */ private void parallelPrepare(int terminalFlags) { + @SuppressWarnings("rawtypes") AbstractPipeline backPropagationHead = sourceStage; if (sourceStage.sourceAnyStateful) { int depth = 1; - for (AbstractPipeline u = sourceStage, p = sourceStage.nextStage; + for ( @SuppressWarnings("rawtypes") AbstractPipeline u = sourceStage, p = sourceStage.nextStage; p != null; u = p, p = p.nextStage) { int thisOpFlags = p.sourceOrOpFlags; @@ -383,7 +396,7 @@ abstract class AbstractPipeline> // Apply the upstream terminal flags if (terminalFlags != 0) { int upstreamTerminalFlags = terminalFlags & StreamOpFlag.UPSTREAM_TERMINAL_OP_MASK; - for (AbstractPipeline p = backPropagationHead; p.nextStage != null; p = p.nextStage) { + for ( @SuppressWarnings("rawtypes") AbstractPipeline p = backPropagationHead; p.nextStage != null; p = p.nextStage) { p.combinedFlags = StreamOpFlag.combineOpFlags(upstreamTerminalFlags, p.combinedFlags); } @@ -398,6 +411,7 @@ abstract class AbstractPipeline> * of all computations up to and including the most recent stateful * operation. */ + @SuppressWarnings("unchecked") private Spliterator sourceSpliterator(int terminalFlags) { // Get the source spliterator of the pipeline Spliterator spliterator = null; @@ -421,7 +435,7 @@ abstract class AbstractPipeline> // Adapt the source spliterator, evaluating each stateful op // in the pipeline up to and including this pipeline stage - for (AbstractPipeline u = sourceStage, p = sourceStage.nextStage, e = this; + for ( @SuppressWarnings("rawtypes") AbstractPipeline u = sourceStage, p = sourceStage.nextStage, e = this; u != e; u = p, p = p.nextStage) { @@ -442,6 +456,7 @@ abstract class AbstractPipeline> @Override final StreamShape getSourceShape() { + @SuppressWarnings("rawtypes") AbstractPipeline p = AbstractPipeline.this; while (p.depth > 0) { p = p.previousStage; @@ -475,7 +490,9 @@ abstract class AbstractPipeline> } @Override + @SuppressWarnings("unchecked") final void copyIntoWithCancel(Sink wrappedSink, Spliterator spliterator) { + @SuppressWarnings({"rawtypes","unchecked"}) AbstractPipeline p = AbstractPipeline.this; while (p.depth > 0) { p = p.previousStage; @@ -495,16 +512,18 @@ abstract class AbstractPipeline> } @Override + @SuppressWarnings("unchecked") final Sink wrapSink(Sink sink) { Objects.requireNonNull(sink); - for (AbstractPipeline p=AbstractPipeline.this; p.depth > 0; p=p.previousStage) { + for ( @SuppressWarnings("rawtypes") AbstractPipeline p=AbstractPipeline.this; p.depth > 0; p=p.previousStage) { sink = p.opWrapSink(p.previousStage.combinedFlags, sink); } return (Sink) sink; } @Override + @SuppressWarnings("unchecked") final Spliterator wrapSpliterator(Spliterator sourceSpliterator) { if (depth == 0) { return (Spliterator) sourceSpliterator; @@ -591,16 +610,19 @@ abstract class AbstractPipeline> /** * Make a node builder compatible with this stream shape. * - * @param exactSizeIfKnown if {@literal >=0}, then a node builder will be created that - * has a fixed capacity of at most sizeIfKnown elements. If {@literal < 0}, - * then the node builder has an unfixed capacity. A fixed capacity node - * builder will throw exceptions if an element is added after builder has - * reached capacity, or is built before the builder has reached capacity. + * @param exactSizeIfKnown if {@literal >=0}, then a node builder will be + * created that has a fixed capacity of at most sizeIfKnown elements. If + * {@literal < 0}, then the node builder has an unfixed capacity. A fixed + * capacity node builder will throw exceptions if an element is added after + * builder has reached capacity, or is built before the builder has reached + * capacity. + * * @param generator the array generator to be used to create instances of a * T[] array. For implementations supporting primitive nodes, this parameter * may be ignored. * @return a node builder */ + @Override abstract Node.Builder makeNodeBuilder(long exactSizeIfKnown, IntFunction generator); @@ -679,6 +701,7 @@ abstract class AbstractPipeline> * @param spliterator the source {@code Spliterator} * @return a {@code Spliterator} describing the result of the evaluation */ + @SuppressWarnings("unchecked") Spliterator opEvaluateParallelLazy(PipelineHelper helper, Spliterator spliterator) { return opEvaluateParallel(helper, spliterator, i -> (E_OUT[]) new Object[i]).spliterator(); diff --git a/jdk/src/share/classes/java/util/stream/AbstractShortCircuitTask.java b/jdk/src/share/classes/java/util/stream/AbstractShortCircuitTask.java index 7a102e80d8e..bbf09f03b14 100644 --- a/jdk/src/share/classes/java/util/stream/AbstractShortCircuitTask.java +++ b/jdk/src/share/classes/java/util/stream/AbstractShortCircuitTask.java @@ -39,6 +39,7 @@ import java.util.concurrent.atomic.AtomicReference; * @param type of child and sibling tasks * @since 1.8 */ +@SuppressWarnings("serial") abstract class AbstractShortCircuitTask> extends AbstractTask { @@ -219,7 +220,8 @@ abstract class AbstractShortCircuitTask * + *

                              Serialization is not supported as there is no intention to serialize + * tasks managed by stream ops. + * * @param Type of elements input to the pipeline * @param Type of elements output from the pipeline * @param Type of intermediate result, which may be different from operation @@ -80,6 +83,7 @@ import java.util.concurrent.ForkJoinPool; * @param Type of parent, child and sibling tasks * @since 1.8 */ +@SuppressWarnings("serial") abstract class AbstractTask> extends CountedCompleter { diff --git a/jdk/src/share/classes/java/util/stream/Collector.java b/jdk/src/share/classes/java/util/stream/Collector.java index 71bb2276f7b..49629176032 100644 --- a/jdk/src/share/classes/java/util/stream/Collector.java +++ b/jdk/src/share/classes/java/util/stream/Collector.java @@ -25,40 +25,45 @@ package java.util.stream; import java.util.Collections; +import java.util.EnumSet; import java.util.Set; -import java.util.function.BiFunction; +import java.util.function.BiConsumer; import java.util.function.BinaryOperator; +import java.util.function.Function; import java.util.function.Supplier; /** * A reduction operation that - * supports folding input elements into a cumulative result. The result may be - * a value or may be a mutable result container. Examples of operations - * accumulating results into a mutable result container include: accumulating - * input elements into a {@code Collection}; concatenating strings into a - * {@code StringBuilder}; computing summary information about elements such as - * sum, min, max, or average; computing "pivot table" summaries such as "maximum - * valued transaction by seller", etc. Reduction operations can be performed - * either sequentially or in parallel. + * folds input elements into a mutable result container, optionally transforming + * the accumulated result into a final representation after all input elements + * have been processed. + * + *

                              Examples of mutable reduction operations include: + * accumulating elements into a {@code Collection}; concatenating + * strings using a {@code StringBuilder}; computing summary information about + * elements such as sum, min, max, or average; computing "pivot table" summaries + * such as "maximum valued transaction by seller", etc. Reduction operations + * can be performed either sequentially or in parallel. * *

                              The following are examples of using the predefined {@code Collector} * implementations in {@link Collectors} with the {@code Stream} API to perform * mutable reduction tasks: *

                              {@code
                              - *     // Accumulate elements into a List
                              - *     List list = stream.collect(Collectors.toList());
                              + *     // Accumulate names into a List
                              + *     List list = people.stream().map(Person::getName).collect(Collectors.toList());
                                *
                              - *     // Accumulate elements into a TreeSet
                              - *     Set list = stream.collect(Collectors.toCollection(TreeSet::new));
                              + *     // Accumulate names into a TreeSet
                              + *     Set list = people.stream().map(Person::getName).collect(Collectors.toCollection(TreeSet::new));
                                *
                                *     // Convert elements to strings and concatenate them, separated by commas
                              - *     String joined = stream.map(Object::toString)
                              - *                           .collect(Collectors.toStringJoiner(", "))
                              - *                           .toString();
                              + *     String joined = things.stream()
                              + *                           .map(Object::toString)
                              + *                           .collect(Collectors.joining(", "));
                                *
                                *     // Find highest-paid employee
                                *     Employee highestPaid = employees.stream()
                              - *                                     .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)));
                              + *                                     .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)))
                              + *                                     .get();
                                *
                                *     // Group employees by department
                                *     Map> byDept
                              @@ -66,7 +71,7 @@ import java.util.function.Supplier;
                                *                    .collect(Collectors.groupingBy(Employee::getDepartment));
                                *
                                *     // Find highest-paid employee by department
                              - *     Map highestPaidByDept
                              + *     Map> highestPaidByDept
                                *         = employees.stream()
                                *                    .collect(Collectors.groupingBy(Employee::getDepartment,
                                *                                                   Collectors.maxBy(Comparators.comparing(Employee::getSalary))));
                              @@ -74,43 +79,42 @@ import java.util.function.Supplier;
                                *     // Partition students into passing and failing
                                *     Map> passingFailing =
                                *         students.stream()
                              - *                 .collect(Collectors.partitioningBy(s -> s.getGrade() >= PASS_THRESHOLD);
                              + *                 .collect(Collectors.partitioningBy(s -> s.getGrade() >= PASS_THRESHOLD));
                                *
                                * }
                              * - *

                              A {@code Collector} is specified by three functions that work together to - * manage a result or result container. They are: creation of an initial - * result, incorporating a new data element into a result, and combining two - * results into one. The last function -- combining two results into one -- is - * used during parallel operations, where subsets of the input are accumulated - * in parallel, and then the subresults merged into a combined result. The - * result may be a mutable container or a value. If the result is mutable, the - * accumulation and combination functions may either mutate their left argument - * and return that (such as adding elements to a collection), or return a new - * result, in which case it should not perform any mutation. + *

                              A {@code Collector} is specified by four functions that work together to + * accumulate entries into a mutable result container, and optionally perform + * a final transform on the result. They are: creation of a new result container, + * incorporating a new data element into a result container, combining two + * result containers into one, and performing a final transform on the container. + * The combiner function is used during parallel operations, where + * subsets of the input are accumulated into separate result + * containers, and then the subresults merged into a combined result. The + * combiner function may merge one set of subresults into the other and return + * that, or it may return a new object to describe the combined results. * - *

                              Collectors also have a set of characteristics, including - * {@link Characteristics#CONCURRENT} and - * {@link Characteristics#STRICTLY_MUTATIVE}. These characteristics provide + *

                              Collectors also have a set of characteristics, such as + * {@link Characteristics#CONCURRENT}. These characteristics provide * hints that can be used by a reduction implementation to provide better * performance. * *

                              Libraries that implement reduction based on {@code Collector}, such as * {@link Stream#collect(Collector)}, must adhere to the following constraints: *

                              *

                              *


                              *

                              Service Formatted Print Data

                              @@ -545,7 +545,7 @@ public class DocFlavor implements Serializable, Cloneable { * the match. * @return String representing a mime parameter, or * null if that parameter is not in the mime type string. - * @exception throws NullPointerException if paramName is null. + * @exception NullPointerException if paramName is null. */ public String getParameter(String paramName) { return diff --git a/jdk/src/share/classes/javax/print/MultiDocPrintJob.java b/jdk/src/share/classes/javax/print/MultiDocPrintJob.java index 24a23a14105..07863ae7e85 100644 --- a/jdk/src/share/classes/javax/print/MultiDocPrintJob.java +++ b/jdk/src/share/classes/javax/print/MultiDocPrintJob.java @@ -47,7 +47,7 @@ public interface MultiDocPrintJob extends DocPrintJob { * PrintJobListener. * * @param multiDoc The documents to be printed. ALL must be a flavor - * supported by the PrintJob & PrintService. + * supported by the PrintJob {@literal &} PrintService. * * @param attributes The job attributes to be applied to this print job. * If this parameter is null then the default attributes are used. diff --git a/jdk/src/share/classes/javax/print/PrintService.java b/jdk/src/share/classes/javax/print/PrintService.java index f221fc5d246..04ad21345f5 100644 --- a/jdk/src/share/classes/javax/print/PrintService.java +++ b/jdk/src/share/classes/javax/print/PrintService.java @@ -40,7 +40,7 @@ import javax.print.event.PrintServiceAttributeListener; * a printer's supported attributes. *

                              * Example: - *

                              + *   
                              {@code
                                *   DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
                                *   PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
                                *   aset.add(MediaSizeName.ISO_A4);
                              @@ -56,7 +56,7 @@ import javax.print.event.PrintServiceAttributeListener;
                                *        } catch (PrintException e) {
                                *        }
                                *   }
                              - *   
                              + * }
                              */ public interface PrintService { diff --git a/jdk/src/share/classes/javax/print/ServiceUI.java b/jdk/src/share/classes/javax/print/ServiceUI.java index 7a9dee8c411..38439cc27a6 100644 --- a/jdk/src/share/classes/javax/print/ServiceUI.java +++ b/jdk/src/share/classes/javax/print/ServiceUI.java @@ -118,7 +118,7 @@ public class ServiceUI { * any changes made by the user. * * A typical basic usage of this method may be : - *
                              +     * 
                              {@code
                                    * PrintService[] services = PrintServiceLookup.lookupPrintServices(
                                    *                            DocFlavor.INPUT_STREAM.JPEG, null);
                                    * PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
                              @@ -131,7 +131,7 @@ public class ServiceUI {
                                    *     ... print ...
                                    *    }
                                    * }
                              -     * 
                              + * }
                              *

                              * @param gc used to select screen. null means primary or default screen. diff --git a/jdk/src/share/classes/javax/print/ServiceUIFactory.java b/jdk/src/share/classes/javax/print/ServiceUIFactory.java index 820acfa1cdd..e8cd0675ace 100644 --- a/jdk/src/share/classes/javax/print/ServiceUIFactory.java +++ b/jdk/src/share/classes/javax/print/ServiceUIFactory.java @@ -39,8 +39,8 @@ package javax.print; * initialize services only when needed without any API dependencies * except in an environment in which they are used. *

                              - * Swing UIs are preferred as they provide a more consistent L&F and - * can support accessibility APIs. + * Swing UIs are preferred as they provide a more consistent {@literal L&F} + * and can support accessibility APIs. *

                              * Example usage: *

                              diff --git a/jdk/src/share/classes/javax/print/attribute/AttributeSet.java b/jdk/src/share/classes/javax/print/attribute/AttributeSet.java
                              index a00d4789cf5..0f90dbdeacd 100644
                              --- a/jdk/src/share/classes/javax/print/attribute/AttributeSet.java
                              +++ b/jdk/src/share/classes/javax/print/attribute/AttributeSet.java
                              @@ -42,7 +42,7 @@ package javax.print.attribute;
                                * class rather than the attribute object's class itself. An attribute
                                * object's
                                * category is determined by calling the {@link Attribute#getCategory()
                              - * getCategory()} method defined in interface {@link Attribute
                              + * getCategory()} method defined in interface {@link Attribute
                                * Attribute}.
                                * 

                              * The interfaces of an AttributeSet resemble those of the Java Collections @@ -217,7 +217,7 @@ public interface AttributeSet { /** * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the = - * {@link #add(Attribute) add(Attribute)} + * {@link #add(Attribute) add(Attribute)} * operation had been applied to this attribute set successively with each * element from the specified set. * The behavior of the addAll(AttributeSet) @@ -301,7 +301,7 @@ public interface AttributeSet { * This ensures that t1.equals(t2) implies that * t1.hashCode()==t2.hashCode() for any two attribute sets * t1 and t2, as required by the general contract of - * {@link java.lang.Object#hashCode() Object.hashCode()}. + * {@link java.lang.Object#hashCode() Object.hashCode()}. * * @return The hash code value for this attribute set. */ diff --git a/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java b/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java index a552436ef97..175281c07bf 100644 --- a/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java @@ -36,9 +36,9 @@ import java.util.Date; *

                              * Under the hood, a date-time attribute is stored as a value of class * java.util.Date. You can get a date-time attribute's Date value by - * calling {@link #getValue() getValue()}. A date-time attribute's + * calling {@link #getValue() getValue()}. A date-time attribute's * Date value is established when it is constructed (see {@link - * #DateTimeSyntax(Date) DateTimeSyntax(Date)}). Once + * #DateTimeSyntax(Date) DateTimeSyntax(Date)}). Once * constructed, a date-time attribute's value is immutable. *

                              * To construct a date-time attribute from separate values of the year, month, diff --git a/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java index 7091a0cd92c..4cb3d413ca9 100644 --- a/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java @@ -37,8 +37,8 @@ package javax.print.attribute; * constructors and mutating operations guarantee an additional invariant, * namely that all attribute values in the DocAttributeSet must be instances * of interface {@link DocAttribute DocAttribute}. - * The {@link #add(Attribute) add(Attribute)}, and - * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations + * The {@link #add(Attribute) add(Attribute)}, and + * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. *

                              * @@ -74,7 +74,7 @@ public interface DocAttributeSet extends AttributeSet { /** * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} + * {@link #add(Attribute) add(Attribute)} * operation had been applied to this attribute set successively with * each element from the specified set. If none of the categories in the * specified set are the same as any categories in this attribute set, diff --git a/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java b/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java index f1dbf8249e6..9847004b36e 100644 --- a/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java @@ -81,15 +81,15 @@ import java.io.Serializable; * for identical objects (==). *

                              * You can convert an enumeration value to a string by calling {@link - * #toString() toString()}. The string is obtained from a table + * #toString() toString()}. The string is obtained from a table * supplied by the enumeration class. *

                              * Under the hood, an enumeration value is just an integer, a different integer * for each enumeration value within an enumeration class. You can get an * enumeration value's integer value by calling {@link #getValue() - * getValue()}. An enumeration value's integer value is established + * getValue()}. An enumeration value's integer value is established * when it is constructed (see {@link #EnumSyntax(int) - * EnumSyntax(int)}). Since the constructor is protected, the only + * EnumSyntax(int)}). Since the constructor is protected, the only * possible enumeration values are the singleton objects declared in the * enumeration class; additional enumeration values cannot be created at run * time. @@ -170,10 +170,10 @@ public abstract class EnumSyntax implements Serializable, Cloneable { * * @return The enumeration singleton value stored at index * i-L in the enumeration value table returned by - * {@link #getEnumValueTable() getEnumValueTable()}, + * {@link #getEnumValueTable() getEnumValueTable()}, * where i is this enumeration value's integer value and * L is the value returned by {@link #getOffset() - * getOffset()}. + * getOffset()}. * * @throws ObjectStreamException if the stream can't be deserialised * @throws InvalidObjectException @@ -220,18 +220,18 @@ public abstract class EnumSyntax implements Serializable, Cloneable { * Returns the string table for this enumeration value's enumeration class. * The enumeration class's integer values are assumed to lie in the range * L..L+N-1, where L is the value returned by - * {@link #getOffset() getOffset()} and N is the length + * {@link #getOffset() getOffset()} and N is the length * of the string table. The element in the string table at index * i-L is the value returned by {@link #toString() - * toString()} for the enumeration value whose integer value + * toString()} for the enumeration value whose integer value * is i. If an integer within the above range is not used by any * enumeration value, leave the corresponding table element null. *

                              * The default implementation returns null. If the enumeration class (a * subclass of class EnumSyntax) does not override this method to return a * non-null string table, and the subclass does not override the {@link - * #toString() toString()} method, the base class {@link - * #toString() toString()} method will return just a string + * #toString() toString()} method, the base class {@link + * #toString() toString()} method will return just a string * representation of this enumeration value's integer value. * @return the string table */ @@ -243,11 +243,11 @@ public abstract class EnumSyntax implements Serializable, Cloneable { * Returns the enumeration value table for this enumeration value's * enumeration class. The enumeration class's integer values are assumed to * lie in the range L..L+N-1, where L is the - * value returned by {@link #getOffset() getOffset()} and + * value returned by {@link #getOffset() getOffset()} and * N is the length of the enumeration value table. The element in the * enumeration value table at index i-L is the enumeration * value object whose integer value is i; the {@link #readResolve() - * readResolve()} method needs this to preserve singleton + * readResolve()} method needs this to preserve singleton * semantics during deserialization of an enumeration instance. If an * integer within the above range is not used by any enumeration value, * leave the corresponding table element null. @@ -255,8 +255,8 @@ public abstract class EnumSyntax implements Serializable, Cloneable { * The default implementation returns null. If the enumeration class (a * subclass of class EnumSyntax) does not override this method to return * a non-null enumeration value table, and the subclass does not override - * the {@link #readResolve() readResolve()} method, the base - * class {@link #readResolve() readResolve()} method will throw + * the {@link #readResolve() readResolve()} method, the base + * class {@link #readResolve() readResolve()} method will throw * an exception whenever an enumeration instance is deserialized from an * object input stream. * @return the value table diff --git a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java index e3ab3db11f1..f8d9aa99298 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java @@ -388,7 +388,7 @@ public class HashAttributeSet implements AttributeSet, Serializable { /** * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} + * {@link #add(Attribute) add(Attribute)} * operation had been applied to this attribute set successively with * each element from the specified set. * The behavior of the addAll(AttributeSet) @@ -512,7 +512,7 @@ public class HashAttributeSet implements AttributeSet, Serializable { * This ensures that t1.equals(t2) implies that * t1.hashCode()==t2.hashCode() for any two attribute sets * t1 and t2, as required by the general contract of - * {@link java.lang.Object#hashCode() Object.hashCode()}. + * {@link java.lang.Object#hashCode() Object.hashCode()}. * * @return The hash code value for this attribute set. */ diff --git a/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java b/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java index 95463e69f8b..81ffff90f86 100644 --- a/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java @@ -33,9 +33,9 @@ import java.io.Serializable; *

                              * Under the hood, an integer attribute is just an integer. You can get an * integer attribute's integer value by calling {@link #getValue() - * getValue()}. An integer attribute's integer value is + * getValue()}. An integer attribute's integer value is * established when it is constructed (see {@link #IntegerSyntax(int) - * IntegerSyntax(int)}). Once constructed, an integer attribute's + * IntegerSyntax(int)}). Once constructed, an integer attribute's * value is immutable. *

                              * diff --git a/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java index fba253b73da..e81511f71eb 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java @@ -36,8 +36,8 @@ package javax.print.attribute; * constructors and mutating operations guarantee an additional invariant, * namely that all attribute values in the PrintJobAttributeSet must be * instances of interface {@link PrintJobAttribute PrintJobAttribute}. - * The {@link #add(Attribute) add(Attribute)}, and - * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations + * The {@link #add(Attribute) add(Attribute)}, and + * {@link #addAll(AttributeSet) >addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. *

                              * @@ -72,7 +72,7 @@ public interface PrintJobAttributeSet extends AttributeSet { /** * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} + * {@link #add(Attribute) add(Attribute)} * operation had been applied to this attribute set successively with * each element from the specified set. If none of the categories in the * specified set are the same as any categories in this attribute set, diff --git a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java index dc78f25a2db..6f4c285563f 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java @@ -37,8 +37,8 @@ package javax.print.attribute; * constructors and mutating operations guarantee an additional invariant, * namely that all attribute values in the PrintRequestAttributeSet must be * instances of interface {@link PrintRequestAttribute PrintRequestAttribute}. - * The {@link #add(Attribute) add(Attribute)}, and - * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations + * The {@link #add(Attribute) add(Attribute)}, and + * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. *

                              * @@ -73,7 +73,7 @@ public interface PrintRequestAttributeSet extends AttributeSet { /** * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} + * {@link #add(Attribute) add(Attribute)} * operation had been applied to this attribute set successively with * each element from the specified set. If none of the categories in the * specified set are the same as any categories in this attribute set, diff --git a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java index 164f2d310b1..f7c111c9275 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java @@ -39,8 +39,8 @@ package javax.print.attribute; * invariant, * namely that all attribute values in the PrintServiceAttributeSet must be * instances of interface {@link PrintServiceAttribute PrintServiceAttribute}. - * The {@link #add(Attribute) add(Attribute)}, and - * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations + * The {@link #add(Attribute) add(Attribute)}, and + * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. *

                              * @@ -77,7 +77,7 @@ public interface PrintServiceAttributeSet extends AttributeSet { /** * Adds all of the elements in the specified set to this attribute. * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} + * {@link #add(Attribute) add(Attribute)} * operation had been applied to this attribute set successively with * each element from the specified set. If none of the categories in the * specified set are the same as any categories in this attribute set, diff --git a/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java b/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java index 5b8ca2c8194..a4a103a438d 100644 --- a/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java @@ -39,7 +39,7 @@ import java.io.Serializable; * resolution attribute's values, indicating the units in which the values are * to be returned. The two most common resolution units are dots per inch (dpi) * and dots per centimeter (dpcm), and exported constants {@link #DPI - * DPI} and {@link #DPCM DPCM} are provided for + * DPI} and {@link #DPCM DPCM} are provided for * indicating those units. *

                              * Once constructed, a resolution attribute's value is immutable. @@ -68,9 +68,9 @@ import java.io.Serializable; * done, which would not be guaranteed if a floating point representation were * used. *

                              - * The exported constant {@link #DPI DPI} is actually the + * The exported constant {@link #DPI DPI} is actually the * conversion factor by which to multiply a value in dpi to get the value in - * dphi. Likewise, the exported constant {@link #DPCM DPCM} is the + * dphi. Likewise, the exported constant {@link #DPCM DPCM} is the * conversion factor by which to multiply a value in dpcm to get the value in * dphi. A client can specify a resolution value in units other than dpi or dpcm * by supplying its own conversion factor. However, since the internal units of @@ -120,12 +120,12 @@ public abstract class ResolutionSyntax implements Serializable, Cloneable { * @param feedResolution * Feed direction resolution. * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or - * {@link #DPCM DPCM}. + * Unit conversion factor, e.g. {@link #DPI DPI} or + * {@link #DPCM DPCM}. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if crossFeedResolution < - * 1 or feedResolution < 1 or units < 1. + * (unchecked exception) Thrown if {@code crossFeedResolution < 1} + * or {@code feedResolution < 1} or {@code units < 1}. */ public ResolutionSyntax(int crossFeedResolution, int feedResolution, int units) { @@ -172,14 +172,14 @@ public abstract class ResolutionSyntax implements Serializable, Cloneable { * The values are rounded to the nearest integer. * * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or - * {@link #DPCM DPCM}. + * Unit conversion factor, e.g. {@link #DPI DPI} or + * {@link #DPCM DPCM}. * * @return A two-element array with the cross feed direction resolution * at index 0 and the feed direction resolution at index 1. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public int[] getResolution(int units) { return new int[] { getCrossFeedResolution(units), @@ -192,13 +192,13 @@ public abstract class ResolutionSyntax implements Serializable, Cloneable { * the given units. The value is rounded to the nearest integer. * * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or - * {@link #DPCM DPCM}. + * Unit conversion factor, e.g. {@link #DPI DPI} or + * {@link #DPCM DPCM}. * * @return Cross feed direction resolution. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public int getCrossFeedResolution(int units) { return convertFromDphi (crossFeedResolution, units); @@ -209,13 +209,13 @@ public abstract class ResolutionSyntax implements Serializable, Cloneable { * given units. The value is rounded to the nearest integer. * * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or {@link - * #DPCM DPCM}. + * Unit conversion factor, e.g. {@link #DPI DPI} or {@link + * #DPCM DPCM}. * * @return Feed direction resolution. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public int getFeedResolution(int units) { return convertFromDphi (feedResolution, units); @@ -229,8 +229,8 @@ public abstract class ResolutionSyntax implements Serializable, Cloneable { * rounded to the nearest integer. * * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or {@link - * #DPCM DPCM}. + * Unit conversion factor, e.g. {@link #DPI CODE>DPI} or {@link + * #DPCM DPCM}. * @param unitsName * Units name string, e.g. "dpi" or "dpcm". If * null, no units name is appended to the result. @@ -238,7 +238,7 @@ public abstract class ResolutionSyntax implements Serializable, Cloneable { * @return String version of this resolution attribute. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public String toString(int units, String unitsName) { StringBuffer result = new StringBuffer(); diff --git a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java index f1f590a2452..e8b43a6a5e7 100644 --- a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java @@ -38,8 +38,8 @@ import java.io.Serializable; * values are measured. Methods are provided to return a two-dimensional size * attribute's values, indicating the units in which the values are to be * returned. The two most common size units are inches (in) and millimeters - * (mm), and exported constants {@link #INCH INCH} and {@link #MM - * MM} are provided for indicating those units. + * (mm), and exported constants {@link #INCH INCH} and {@link #MM + * MM} are provided for indicating those units. *

                              * Once constructed, a two-dimensional size attribute's value is immutable. *

                              @@ -66,9 +66,9 @@ import java.io.Serializable; * units, you have to search for a media size of 215.9 x 279.4 mm; rounding off * to an integral 216 x 279 mm will not match. *

                              - * The exported constant {@link #INCH INCH} is actually the + * The exported constant {@link #INCH INCH} is actually the * conversion factor by which to multiply a value in inches to get the value in - * µm. Likewise, the exported constant {@link #MM MM} is the + * µm. Likewise, the exported constant {@link #MM MM} is the * conversion factor by which to multiply a value in mm to get the value in * µm. A client can specify a resolution value in units other than inches * or mm by supplying its own conversion factor. However, since the internal @@ -117,12 +117,12 @@ public abstract class Size2DSyntax implements Serializable, Cloneable { * @param x X dimension. * @param y Y dimension. * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. + * Unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM}. * * @exception IllegalArgumentException - * (Unchecked exception) Thrown if x < 0 or y - * < 0 or units < 1. + * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or + * {@code units < 1}. */ protected Size2DSyntax(float x, float y, int units) { if (x < 0.0f) { @@ -145,12 +145,12 @@ public abstract class Size2DSyntax implements Serializable, Cloneable { * @param x X dimension. * @param y Y dimension. * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. + * Unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM}. * * @exception IllegalArgumentException - * (Unchecked exception) Thrown if x < 0 or y - * < 0 or units < 1. + * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} + * or {@code units < 1}. */ protected Size2DSyntax(int x, int y, int units) { if (x < 0) { @@ -193,14 +193,13 @@ public abstract class Size2DSyntax implements Serializable, Cloneable { * as floating-point values. * * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. + * Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}. * * @return A two-element array with the X dimension at index 0 and the Y * dimension at index 1. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public float[] getSize(int units) { return new float[] {getX(units), getY(units)}; @@ -211,13 +210,12 @@ public abstract class Size2DSyntax implements Serializable, Cloneable { * units as a floating-point value. * * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. + * Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}. * * @return X dimension. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public float getX(int units) { return convertFromMicrometers(x, units); @@ -228,13 +226,12 @@ public abstract class Size2DSyntax implements Serializable, Cloneable { * units as a floating-point value. * * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. + * Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}. * * @return Y dimension. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public float getY(int units) { return convertFromMicrometers(y, units); @@ -248,16 +245,16 @@ public abstract class Size2DSyntax implements Serializable, Cloneable { * floating point. * * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. + * Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}. + * * @param unitsName - * Units name string, e.g. "in" or "mm". If + * Units name string, e.g. {@code in} or {@code mm}. If * null, no units name is appended to the result. * * @return String version of this two-dimensional size attribute. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public String toString(int units, String unitsName) { StringBuffer result = new StringBuffer(); diff --git a/jdk/src/share/classes/javax/print/attribute/standard/Chromaticity.java b/jdk/src/share/classes/javax/print/attribute/standard/Chromaticity.java index a605c9cf699..8e29e972b36 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/Chromaticity.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/Chromaticity.java @@ -40,11 +40,11 @@ import javax.print.attribute.PrintJobAttribute; * can be verified to support color printing. *

                              * The table below shows the effects of specifying a Chromaticity attribute of - * {@link #MONOCHROME MONOCHROME} or {@link #COLOR - * COLOR} for a monochrome or color document. + * {@link #MONOCHROME MONOCHROME} or {@link #COLOR COLOR} + * for a monochrome or color document. *

                              * - * + * * @@ -57,7 +57,7 @@ import javax.print.attribute.PrintJobAttribute; * * * * * * * * * * * * @@ -60,13 +60,13 @@ import javax.print.attribute.PrintJobAttribute; *   * * * * * * * * * * * * * * * * * * * * * *
                              * Chromaticity
                              Attribute *
                              - * {@link #MONOCHROME MONOCHROME} + * {@link #MONOCHROME MONOCHROME} * * Printed as is, in monochrome @@ -68,7 +68,7 @@ import javax.print.attribute.PrintJobAttribute; *
                              - * {@link #COLOR COLOR} + * {@link #COLOR COLOR} * * Printed as is, in monochrome diff --git a/jdk/src/share/classes/javax/print/attribute/standard/Compression.java b/jdk/src/share/classes/javax/print/attribute/standard/Compression.java index 19c94b45f4e..5679a73f850 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/Compression.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/Compression.java @@ -34,7 +34,7 @@ import javax.print.attribute.DocAttribute; * print data (the doc), not of the Print Job. If a Compression attribute is not * specified for a doc, the printer assumes the doc's print data is uncompressed * (i.e., the default Compression value is always {@link #NONE - * NONE}). + * NONE}). *

                              * IPP Compatibility: The category name returned by * getName() is the IPP attribute name. The enumeration's diff --git a/jdk/src/share/classes/javax/print/attribute/standard/Finishings.java b/jdk/src/share/classes/javax/print/attribute/standard/Finishings.java index cebbf7b6f2a..3f09cd9088f 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/Finishings.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/Finishings.java @@ -46,13 +46,13 @@ import javax.print.attribute.PrintJobAttribute; *   *

                              - * {@link #NONE NONE} + * {@link #NONE NONE} * - * {@link #STAPLE STAPLE} + * {@link #STAPLE STAPLE} * - * {@link #EDGE_STITCH EDGE_STITCH} + * {@link #EDGE_STITCH EDGE_STITCH} *
                              - * {@link #BIND BIND} + * {@link #BIND BIND} * - * {@link #SADDLE_STITCH SADDLE_STITCH} + * {@link #SADDLE_STITCH SADDLE_STITCH} * - * {@link #COVER COVER} + * {@link #COVER COVER} * *   @@ -82,13 +82,13 @@ import javax.print.attribute.PrintJobAttribute; *   * - * {@link #STAPLE_TOP_LEFT STAPLE_TOP_LEFT} + * {@link #STAPLE_TOP_LEFT STAPLE_TOP_LEFT} * - * {@link #EDGE_STITCH_LEFT EDGE_STITCH_LEFT} + * {@link #EDGE_STITCH_LEFT EDGE_STITCH_LEFT} * - * {@link #STAPLE_DUAL_LEFT STAPLE_DUAL_LEFT} + * {@link #STAPLE_DUAL_LEFT STAPLE_DUAL_LEFT} * *   @@ -99,13 +99,13 @@ import javax.print.attribute.PrintJobAttribute; *   * - * {@link #STAPLE_BOTTOM_LEFT STAPLE_BOTTOM_LEFT} + * {@link #STAPLE_BOTTOM_LEFT STAPLE_BOTTOM_LEFT} * - * {@link #EDGE_STITCH_TOP EDGE_STITCH_TOP} + * {@link #EDGE_STITCH_TOP EDGE_STITCH_TOP} * - * {@link #STAPLE_DUAL_TOP STAPLE_DUAL_TOP} + * {@link #STAPLE_DUAL_TOP STAPLE_DUAL_TOP} * *   @@ -116,13 +116,13 @@ import javax.print.attribute.PrintJobAttribute; *   * - * {@link #STAPLE_TOP_RIGHT STAPLE_TOP_RIGHT} + * {@link #STAPLE_TOP_RIGHT STAPLE_TOP_RIGHT} * - * {@link #EDGE_STITCH_RIGHT EDGE_STITCH_RIGHT} + * {@link #EDGE_STITCH_RIGHT EDGE_STITCH_RIGHT} * - * {@link #STAPLE_DUAL_RIGHT STAPLE_DUAL_RIGHT} + * {@link #STAPLE_DUAL_RIGHT STAPLE_DUAL_RIGHT} * *   @@ -133,13 +133,13 @@ import javax.print.attribute.PrintJobAttribute; *   * - * {@link #STAPLE_BOTTOM_RIGHT STAPLE_BOTTOM_RIGHT} + * {@link #STAPLE_BOTTOM_RIGHT STAPLE_BOTTOM_RIGHT} * - * {@link #EDGE_STITCH_BOTTOM EDGE_STITCH_BOTTOM} + * {@link #EDGE_STITCH_BOTTOM EDGE_STITCH_BOTTOM} * - * {@link #STAPLE_DUAL_BOTTOM STAPLE_DUAL_BOTTOM} + * {@link #STAPLE_DUAL_BOTTOM STAPLE_DUAL_BOTTOM} * *   @@ -147,16 +147,16 @@ import javax.print.attribute.PrintJobAttribute; *
                              *

                              - * The STAPLE_XXX values are specified with respect to the + * The STAPLE_XXX values are specified with respect to the * document as if the document were a portrait document. If the document is * actually a landscape or a reverse-landscape document, the client supplies the * appropriate transformed value. For example, to position a staple in the upper * left hand corner of a landscape document when held for reading, the client - * supplies the STAPLE_BOTTOM_LEFT value (since landscape is + * supplies the STAPLE_BOTTOM_LEFT value (since landscape is * defined as a +90 degree rotation from portrait, i.e., anti-clockwise). On the * other hand, to position a staple in the upper left hand corner of a * reverse-landscape document when held for reading, the client supplies the - * STAPLE_TOP_RIGHT value (since reverse-landscape is defined as a + * STAPLE_TOP_RIGHT value (since reverse-landscape is defined as a * -90 degree rotation from portrait, i.e., clockwise). *

                              * The angle (vertical, horizontal, angled) of each staple with respect to the diff --git a/jdk/src/share/classes/javax/print/attribute/standard/JobKOctets.java b/jdk/src/share/classes/javax/print/attribute/standard/JobKOctets.java index 8f29b7b2c66..f5b16307df9 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/JobKOctets.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/JobKOctets.java @@ -67,7 +67,7 @@ import javax.print.attribute.PrintJobAttribute; * shown in the table below. *

                              * - * + * * * * diff --git a/jdk/src/share/classes/javax/print/attribute/standard/MediaPrintableArea.java b/jdk/src/share/classes/javax/print/attribute/standard/MediaPrintableArea.java index dbb50f633cc..a800f7c6c42 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/MediaPrintableArea.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/MediaPrintableArea.java @@ -62,7 +62,7 @@ import javax.print.attribute.PrintRequestAttribute; * The (x,y) origin is positioned at the top-left of the paper in portrait * mode regardless of the orientation specified in the requesting context. * For example a printable area for A4 paper in portrait or landscape - * orientation will have height > width. + * orientation will have height {@literal >} width. *

                              * A printable area attribute's values are stored * internally as integers in units of micrometers (µm), where 1 micrometer @@ -107,9 +107,9 @@ public final class MediaPrintableArea * @param units in which the values are expressed. * * @exception IllegalArgumentException - * Thrown if x < 0 or y < 0 - * or w <= 0 or h <= 0 or - * units < 1. + * Thrown if {@code x < 0} or {@code y < 0} + * or {@code w <= 0} or {@code h <= 0} or + * {@code units < 1}. */ public MediaPrintableArea(float x, float y, float w, float h, int units) { if ((x < 0.0) || (y < 0.0) || (w <= 0.0) || (h <= 0.0) || @@ -133,9 +133,9 @@ public final class MediaPrintableArea * @param units in which the values are expressed. * * @exception IllegalArgumentException - * Thrown if x < 0 or y < 0 - * or w <= 0 or h <= 0 or - * units < 1. + * Thrown if {@code x < 0} or {@code y < 0} + * or {@code w <= 0} or {@code h <= 0} or + * {@code units < 1}. */ public MediaPrintableArea(int x, int y, int w, int h, int units) { if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || @@ -159,7 +159,7 @@ public final class MediaPrintableArea * @return printable area as array of x, y, w, h in the specified units. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public float[] getPrintableArea(int units) { return new float[] { getX(units), getY(units), @@ -177,7 +177,7 @@ public final class MediaPrintableArea * specified units. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public float getX(int units) { return convertFromMicrometers(x, units); @@ -194,7 +194,7 @@ public final class MediaPrintableArea * specified units. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public float getY(int units) { return convertFromMicrometers(y, units); @@ -209,7 +209,7 @@ public final class MediaPrintableArea * @return width of the printable area in the specified units. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public float getWidth(int units) { return convertFromMicrometers(w, units); @@ -224,7 +224,7 @@ public final class MediaPrintableArea * @return height of the printable area in the specified units. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public float getHeight(int units) { return convertFromMicrometers(h, units); @@ -301,7 +301,7 @@ public final class MediaPrintableArea * @return String version of this two-dimensional size attribute. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if units < 1. + * (unchecked exception) Thrown if {@code units < 1}. */ public String toString(int units, String unitsName) { if (unitsName == null) { diff --git a/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java b/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java index 9f35e34a23a..1d6677fb674 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java @@ -45,7 +45,7 @@ import javax.print.attribute.Attribute; * MediaSize.getMediaSizeForName(MediaSizeName) * to find the physical dimensions of the MediaSizeName instances * enumerated in this API. This is useful for clients which need this - * information to format & paginate printing. + * information to format {@literal &} paginate printing. *

                              * * @author Phil Race, Alan Kaminsky @@ -71,8 +71,8 @@ public class MediaSize extends Size2DSyntax implements Attribute { * Size2DSyntax.MM. * * @exception IllegalArgumentException - * (Unchecked exception) Thrown if x < 0 or y - * < 0 or units < 1 or x > y. + * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or + * {@code units < 1} or {@code x > y}. */ public MediaSize(float x, float y,int units) { super (x, y, units); @@ -92,8 +92,8 @@ public class MediaSize extends Size2DSyntax implements Attribute { * Size2DSyntax.MM. * * @exception IllegalArgumentException - * (Unchecked exception) Thrown if x < 0 or y - * < 0 or units < 1 or x > y. + * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or + * {@code units < 1} or {@code x > y}. */ public MediaSize(int x, int y,int units) { super (x, y, units); @@ -115,8 +115,8 @@ public class MediaSize extends Size2DSyntax implements Attribute { * @param media a media name to associate with this MediaSize * * @exception IllegalArgumentException - * (Unchecked exception) Thrown if x < 0 or y - * < 0 or units < 1 or x > y. + * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or + * {@code units < 1} or {@code x > y}. */ public MediaSize(float x, float y,int units, MediaSizeName media) { super (x, y, units); @@ -141,8 +141,8 @@ public class MediaSize extends Size2DSyntax implements Attribute { * @param media a media name to associate with this MediaSize * * @exception IllegalArgumentException - * (Unchecked exception) Thrown if x < 0 or y - * < 0 or units < 1 or x > y. + * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or + * {@code units < 1} or {@code x > y}. */ public MediaSize(int x, int y,int units, MediaSizeName media) { super (x, y, units); @@ -194,7 +194,8 @@ public class MediaSize extends Size2DSyntax implements Attribute { * Unit conversion factor, e.g. Size2DSyntax.INCH or * Size2DSyntax.MM * @return MediaSizeName matching these dimensions, or null. - * @exception IllegalArgumentException if x <= 0, y <= 0, or units < 1 + * @exception IllegalArgumentException if {@code x <= 0}, + * {@code y <= 0}, or {@code units < 1}. * */ public static MediaSizeName findMedia(float x, float y, int units) { diff --git a/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java b/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java index 0ac7c93c8ce..88e3a445cd0 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java @@ -56,56 +56,56 @@ public final class PresentationDirection extends EnumSyntax /** * Pages are laid out in columns starting at the top left, - * proceeeding towards the bottom & right. + * proceeeding towards the bottom {@literal &} right. */ public static final PresentationDirection TOBOTTOM_TORIGHT = new PresentationDirection(0); /** * Pages are laid out in columns starting at the top right, - * proceeeding towards the bottom & left. + * proceeeding towards the bottom {@literal &} left. */ public static final PresentationDirection TOBOTTOM_TOLEFT = new PresentationDirection(1); /** * Pages are laid out in columns starting at the bottom left, - * proceeeding towards the top & right. + * proceeeding towards the top {@literal &} right. */ public static final PresentationDirection TOTOP_TORIGHT = new PresentationDirection(2); /** * Pages are laid out in columns starting at the bottom right, - * proceeeding towards the top & left. + * proceeeding towards the top {@literal &} left. */ public static final PresentationDirection TOTOP_TOLEFT = new PresentationDirection(3); /** * Pages are laid out in rows starting at the top left, - * proceeeding towards the right & bottom. + * proceeeding towards the right {@literal &} bottom. */ public static final PresentationDirection TORIGHT_TOBOTTOM = new PresentationDirection(4); /** * Pages are laid out in rows starting at the bottom left, - * proceeeding towards the right & top. + * proceeeding towards the right {@literal &} top. */ public static final PresentationDirection TORIGHT_TOTOP = new PresentationDirection(5); /** * Pages are laid out in rows starting at the top right, - * proceeeding towards the left & bottom. + * proceeeding towards the left {@literal &} bottom. */ public static final PresentationDirection TOLEFT_TOBOTTOM = new PresentationDirection(6); /** * Pages are laid out in rows starting at the bottom right, - * proceeeding towards the left & top. + * proceeeding towards the left {@literal &} top. */ public static final PresentationDirection TOLEFT_TOTOP = new PresentationDirection(7); diff --git a/jdk/src/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java b/jdk/src/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java index a6be2838a27..8d507d54389 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java @@ -40,7 +40,7 @@ import javax.print.attribute.PrintServiceAttribute; * details on color support). The information is intended to be germane to * this kind of printer without regard to site specific modifications or * services. - *

                              * In contrast, the {@link PrinterMoreInfo PrinterMoreInfo} attribute is used * to find out more information about this specific printer rather than this * general kind of printer. diff --git a/jdk/src/share/classes/javax/print/attribute/standard/PrinterResolution.java b/jdk/src/share/classes/javax/print/attribute/standard/PrinterResolution.java index 8ca5100c48a..e4ad0486496 100644 --- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterResolution.java +++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterResolution.java @@ -84,11 +84,11 @@ public final class PrinterResolution extends ResolutionSyntax * Feed direction resolution. * @param units * Unit conversion factor, e.g. ResolutionSyntax.DPI - * or ResolutionSyntax.>DPCM. + * or ResolutionSyntax.DPCM. * * @exception IllegalArgumentException - * (unchecked exception) Thrown if crossFeedResolution < - * 1 or feedResolution < 1 or units < 1. + * (unchecked exception) Thrown if {@code crossFeedResolution < 1} or + * {@code feedResolution < 1} or {@code units < 1}. */ public PrinterResolution(int crossFeedResolution, int feedResolution, int units) { diff --git a/jdk/src/share/classes/javax/sound/midi/MetaMessage.java b/jdk/src/share/classes/javax/sound/midi/MetaMessage.java index b7c235565f3..6378435acc7 100644 --- a/jdk/src/share/classes/javax/sound/midi/MetaMessage.java +++ b/jdk/src/share/classes/javax/sound/midi/MetaMessage.java @@ -149,7 +149,7 @@ public class MetaMessage extends MidiMessage { * @param data the data bytes in the MIDI message * @param length the number of bytes in the data * byte array - * @throws InvalidMidiDataException if the + * @throws InvalidMidiDataException if the * parameter values do not specify a valid MIDI meta message */ public void setMessage(int type, byte[] data, int length) throws InvalidMidiDataException { diff --git a/jdk/src/share/classes/javax/sound/midi/MidiDevice.java b/jdk/src/share/classes/javax/sound/midi/MidiDevice.java index 75d6638f681..be950e8aa48 100644 --- a/jdk/src/share/classes/javax/sound/midi/MidiDevice.java +++ b/jdk/src/share/classes/javax/sound/midi/MidiDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,13 +86,13 @@ import java.util.List; * To detect if a MidiDevice represents a hardware MIDI port, the * following programming technique can be used: * - *

                              + * 
                              {@code
                                * MidiDevice device = ...;
                                * if ( ! (device instanceof Sequencer) && ! (device instanceof Synthesizer)) {
                                *   // we're now sure that device represents a MIDI port
                                *   // ...
                                * }
                              - * 
                              + * }
                              * *

                              * A MidiDevice includes a {@link MidiDevice.Info} object diff --git a/jdk/src/share/classes/javax/sound/midi/MidiDeviceReceiver.java b/jdk/src/share/classes/javax/sound/midi/MidiDeviceReceiver.java index 9ea1df7c38e..550c7a4ccb8 100644 --- a/jdk/src/share/classes/javax/sound/midi/MidiDeviceReceiver.java +++ b/jdk/src/share/classes/javax/sound/midi/MidiDeviceReceiver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,9 @@ package javax.sound.midi; * @since 1.7 */ public interface MidiDeviceReceiver extends Receiver { - /** Obtains a MidiDevice object which is an owner of this Receiver. + /** + * Obtains a MidiDevice object which is an owner of this Receiver. + * @return a MidiDevice object which is an owner of this Receiver */ public MidiDevice getMidiDevice(); } diff --git a/jdk/src/share/classes/javax/sound/midi/MidiDeviceTransmitter.java b/jdk/src/share/classes/javax/sound/midi/MidiDeviceTransmitter.java index b6a827188e2..730628c5e8d 100644 --- a/jdk/src/share/classes/javax/sound/midi/MidiDeviceTransmitter.java +++ b/jdk/src/share/classes/javax/sound/midi/MidiDeviceTransmitter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,9 @@ package javax.sound.midi; */ public interface MidiDeviceTransmitter extends Transmitter { - /** Obtains a MidiDevice object which is an owner of this Transmitter. + /** + * Obtains a MidiDevice object which is an owner of this Transmitter. + * @return a MidiDevice object which is an owner of this Transmitter */ public MidiDevice getMidiDevice(); } diff --git a/jdk/src/share/classes/javax/sound/midi/MidiFileFormat.java b/jdk/src/share/classes/javax/sound/midi/MidiFileFormat.java index 4c399dbbe72..1d4669a2458 100644 --- a/jdk/src/share/classes/javax/sound/midi/MidiFileFormat.java +++ b/jdk/src/share/classes/javax/sound/midi/MidiFileFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,6 +50,7 @@ import java.util.Map; * be used in implementations: * *

                              Representation ClassDocument Size
                              + * * * diff --git a/jdk/src/share/classes/javax/sound/midi/MidiMessage.java b/jdk/src/share/classes/javax/sound/midi/MidiMessage.java index 244757f27d7..7cc840bd775 100644 --- a/jdk/src/share/classes/javax/sound/midi/MidiMessage.java +++ b/jdk/src/share/classes/javax/sound/midi/MidiMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,7 +55,7 @@ package javax.sound.midi; * processing MIDI data that originated outside Java Sound and now * is encoded as signed bytes, the bytes can * can be converted to integers using this conversion: - *
                              int i = (int)(byte & 0xFF)
                              + *
                              {@code int i = (int)(byte & 0xFF)}
                              *

                              * If you simply need to pass a known MIDI byte value as a method parameter, * it can be expressed directly as an integer, using (for example) decimal or @@ -118,6 +118,10 @@ public abstract class MidiMessage implements Cloneable { * method is called by concrete subclasses, which should * ensure that the data array specifies a complete, valid MIDI * message. + * + * @param data the data bytes in the MIDI message + * @param length the number of bytes in the data byte array + * @throws InvalidMidiDataException if the parameter values do not specify a valid MIDI meta message */ protected void setMessage(byte[] data, int length) throws InvalidMidiDataException { if (length < 0 || (length > 0 && length > data.length)) { diff --git a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java index 9d6763a6406..4e390f11998 100644 --- a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java +++ b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,6 +80,7 @@ import com.sun.media.sound.MidiDeviceTransmitterEnvelope; * consider them: * *

                              MIDI File Format Properties
                              Property keyValue type
                              + * * * * @@ -425,6 +426,8 @@ public class MidiSystem { * it is used to identify the default sequencer. * For details, refer to the {@link MidiSystem class description}. * + * @param connected whether or not the returned {@code Sequencer} + * is connected to the default {@code Synthesizer} * @return the default sequencer * @throws MidiUnavailableException if the sequencer is not * available due to resource restrictions, diff --git a/jdk/src/share/classes/javax/sound/midi/ShortMessage.java b/jdk/src/share/classes/javax/sound/midi/ShortMessage.java index f2ccdd23f94..1445201f3fe 100644 --- a/jdk/src/share/classes/javax/sound/midi/ShortMessage.java +++ b/jdk/src/share/classes/javax/sound/midi/ShortMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -283,7 +283,7 @@ public class ShortMessage extends MidiMessage { /** * Sets the parameters for a MIDI message that takes no data bytes. * @param status the MIDI status byte - * @throws InvalidMidiDataException if status does not + * @throws InvalidMidiDataException if status does not * specify a valid MIDI status byte for a message that requires no data bytes. * @see #setMessage(int, int, int) * @see #setMessage(int, int, int, int) @@ -307,7 +307,7 @@ public class ShortMessage extends MidiMessage { * @param status the MIDI status byte * @param data1 the first data byte * @param data2 the second data byte - * @throws InvalidMidiDataException if the + * @throws InvalidMidiDataException if the * the status byte, or all data bytes belonging to the message, do * not specify a valid MIDI message. * @see #setMessage(int, int, int, int) @@ -357,7 +357,7 @@ public class ShortMessage extends MidiMessage { * @param channel the channel associated with the message * @param data1 the first data byte * @param data2 the second data byte - * @throws InvalidMidiDataException if the + * @throws InvalidMidiDataException if the * status byte or all data bytes belonging to the message, do * not specify a valid MIDI message * @@ -397,6 +397,7 @@ public class ShortMessage extends MidiMessage { * Obtains the MIDI command associated with this event. This method * assumes that the event is a MIDI channel message; if not, the return * value will not be meaningful. + * @return the MIDI command associated with this event * @see #setMessage(int, int, int, int) */ public int getCommand() { @@ -450,7 +451,7 @@ public class ShortMessage extends MidiMessage { * status byte value. * @param status status byte value, which must represent a short MIDI message * @return data length in bytes (0, 1, or 2) - * @throws InvalidMidiDataException if the + * @throws InvalidMidiDataException if the * status argument does not represent the status byte for any * short message */ diff --git a/jdk/src/share/classes/javax/sound/midi/Synthesizer.java b/jdk/src/share/classes/javax/sound/midi/Synthesizer.java index f9701c62c43..6740479b389 100644 --- a/jdk/src/share/classes/javax/sound/midi/Synthesizer.java +++ b/jdk/src/share/classes/javax/sound/midi/Synthesizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -170,7 +170,7 @@ public interface Synthesizer extends MidiDevice { * already had been), false if the instrument could not be * loaded (for example, if the synthesizer has insufficient * memory to load it) - * @throws IllegalArgumentException if this + * @throws IllegalArgumentException if this * Synthesizer doesn't support the specified instrument's * soundbank * @see #unloadInstrument @@ -186,7 +186,7 @@ public interface Synthesizer extends MidiDevice { /** * Unloads a particular instrument. * @param instrument instrument to unload - * @throws IllegalArgumentException if this + * @throws IllegalArgumentException if this * Synthesizer doesn't support the specified instrument's * soundbank * @see #loadInstrument @@ -214,10 +214,10 @@ public interface Synthesizer extends MidiDevice { * of the old instrument, it should be loaded into the synthesizer * @return true if the instrument succeessfully remapped, * false if feature is not implemented by synthesizer - * @throws IllegalArgumentException if instrument + * @throws IllegalArgumentException if instrument * from or instrument to aren't supported by * synthesizer or if instrument to is not loaded - * @throws NullPointerException if from or + * @throws NullPointerException if from or * to parameters have null value * @see #loadInstrument * @see #loadInstruments diff --git a/jdk/src/share/classes/javax/sound/midi/SysexMessage.java b/jdk/src/share/classes/javax/sound/midi/SysexMessage.java index c86519bff34..ae4e418e8e6 100644 --- a/jdk/src/share/classes/javax/sound/midi/SysexMessage.java +++ b/jdk/src/share/classes/javax/sound/midi/SysexMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -204,6 +204,7 @@ public class SysexMessage extends MidiMessage { * @param data the system exclusive message data * @param length the length of the valid message data in * the array + * @throws InvalidMidiDataException if the status byte is invalid for a sysex message */ public void setMessage(int status, byte[] data, int length) throws InvalidMidiDataException { if ( (status != 0xF0) && (status != 0xF7) ) { diff --git a/jdk/src/share/classes/javax/sound/midi/Track.java b/jdk/src/share/classes/javax/sound/midi/Track.java index ad1ff52d202..4e54a8aa3dd 100644 --- a/jdk/src/share/classes/javax/sound/midi/Track.java +++ b/jdk/src/share/classes/javax/sound/midi/Track.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -211,10 +211,11 @@ public class Track { /** * Obtains the event at the specified index. * @param index the location of the desired event in the event vector - * @throws ArrayIndexOutOfBoundsException if the + * @throws ArrayIndexOutOfBoundsException if the * specified index is negative or not less than the current size of * this track. * @see #size + * @return the event at the specified index */ public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException { try { diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java index 30fe82be365..d1216e207a7 100644 --- a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java +++ b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,6 +57,7 @@ import java.util.Map; * be used in implementations: * *
                              MIDI System Property Keys
                              Property KeyInterface
                              + * * * * diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java index 7457f8220eb..2e679784ea3 100644 --- a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java +++ b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,6 +85,7 @@ import java.util.Map; * service providers should use, if applicable: * *
                              Audio File Format Property Keys
                              Property keyValue type
                              + * * * * diff --git a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java index cf06ca25741..6c8bfaf9f5e 100644 --- a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java +++ b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,6 +75,7 @@ import com.sun.media.sound.JDK13Services; * consider them: * *
                              Audio Format Property Keys
                              Property keyValue type
                              + * * * * diff --git a/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java b/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java index 047b2f00803..e48e06c339c 100644 --- a/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java +++ b/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,6 +125,7 @@ public abstract class BooleanControl extends Control { /** * Obtains the label for the specified state. + * @param state the state whose label will be returned * @return the label for the specified state, such as "true" or "on" * for true, or "false" or "off" for false. */ diff --git a/jdk/src/share/classes/javax/sound/sampled/Mixer.java b/jdk/src/share/classes/javax/sound/sampled/Mixer.java index c4d0ccbef03..755ab913342 100644 --- a/jdk/src/share/classes/javax/sound/sampled/Mixer.java +++ b/jdk/src/share/classes/javax/sound/sampled/Mixer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -133,6 +133,8 @@ public interface Mixer extends Line { * DataLine. * * @param info describes the desired line + * @return a line that is available for use and that matches the description + * in the specified {@code Line.Info} object * @throws LineUnavailableException if a matching line * is not available due to resource restrictions * @throws IllegalArgumentException if this mixer does diff --git a/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java b/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java index 194582f17dd..a27184a0b87 100644 --- a/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java +++ b/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,6 +116,7 @@ public abstract class FormatConversionProvider { * given a particular source format. * If no target format encodings are supported for this source format, * an array of length 0 is returned. + * @param sourceFormat format of the incoming data * @return array of supported target format encodings. */ public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat); @@ -146,6 +147,8 @@ public abstract class FormatConversionProvider { * supported by the format converter * If no target formats with the specified encoding are supported * for this source format, an array of length 0 is returned. + * @param targetEncoding desired encoding of the stream after processing + * @param sourceFormat format of the incoming data * @return array of supported target formats. */ public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat); diff --git a/jdk/src/share/classes/javax/swing/JFileChooser.java b/jdk/src/share/classes/javax/swing/JFileChooser.java index d30c69675ae..e053b7af081 100644 --- a/jdk/src/share/classes/javax/swing/JFileChooser.java +++ b/jdk/src/share/classes/javax/swing/JFileChooser.java @@ -1149,9 +1149,10 @@ public class JFileChooser extends JComponent implements Accessible { int index = filters.indexOf(f); if (index >= 0) { if(getFileFilter() == f) { - if (isAcceptAllFileFilterUsed()) { + FileFilter aaff = getAcceptAllFileFilter(); + if (isAcceptAllFileFilterUsed() && (aaff != f)) { // choose default filter if it is used - setFileFilter(getAcceptAllFileFilter()); + setFileFilter(aaff); } else if (index > 0) { // choose the first filter, because it is not removed diff --git a/jdk/src/share/classes/javax/swing/SwingWorker.java b/jdk/src/share/classes/javax/swing/SwingWorker.java index 294808188cd..f7b343d8e44 100644 --- a/jdk/src/share/classes/javax/swing/SwingWorker.java +++ b/jdk/src/share/classes/javax/swing/SwingWorker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -405,6 +405,7 @@ public abstract class SwingWorker implements RunnableFuture { * */ @SafeVarargs + @SuppressWarnings("varargs") // Passing chunks to add is safe protected final void publish(V... chunks) { synchronized (this) { if (doProcess == null) { diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java index f1a9b15f862..e1af32f73ef 100644 --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java @@ -344,7 +344,8 @@ public class SynthTreeUI extends BasicTreeUI configureRenderer(cellContext); while (!done && paintingEnumerator.hasMoreElements()) { path = (TreePath)paintingEnumerator.nextElement(); - if (path != null) { + bounds = getPathBounds(tree, path); + if ((path != null) && (bounds != null)) { isLeaf = treeModel.isLeaf(path.getLastPathComponent()); if (isLeaf) { isExpanded = hasBeenExpanded = false; @@ -353,7 +354,6 @@ public class SynthTreeUI extends BasicTreeUI isExpanded = treeState.getExpandedState(path); hasBeenExpanded = tree.hasBeenExpanded(path); } - bounds = getPathBounds(tree, path); rowBounds.y = bounds.y; rowBounds.height = bounds.height; paintRow(renderer, dtcr, context, cellContext, g, @@ -383,7 +383,8 @@ public class SynthTreeUI extends BasicTreeUI paintingEnumerator = treeState.getVisiblePathsFrom(initialPath); while (!done && paintingEnumerator.hasMoreElements()) { path = (TreePath)paintingEnumerator.nextElement(); - if (path != null) { + bounds = getPathBounds(tree, path); + if ((path != null) && (bounds != null)) { isLeaf = treeModel.isLeaf(path.getLastPathComponent()); if (isLeaf) { isExpanded = hasBeenExpanded = false; @@ -392,7 +393,6 @@ public class SynthTreeUI extends BasicTreeUI isExpanded = treeState.getExpandedState(path); hasBeenExpanded = tree.hasBeenExpanded(path); } - bounds = getPathBounds(tree, path); // See if the vertical line to the parent has been drawn. parentPath = path.getParentPath(); if (parentPath != null) { diff --git a/jdk/src/share/classes/javax/swing/text/GlyphView.java b/jdk/src/share/classes/javax/swing/text/GlyphView.java index 624f737b376..a0ca975c2c3 100644 --- a/jdk/src/share/classes/javax/swing/text/GlyphView.java +++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -514,7 +514,7 @@ public class GlyphView extends View implements TabableView, Cloneable { int x1 = x0 + (int) painter.getSpan(this, p0, p1, getTabExpander(), x0); // calculate y coordinate - int y = alloc.y + alloc.height - (int) painter.getDescent(this); + int y = alloc.y + (int)(painter.getHeight(this) - painter.getDescent(this)); if (underline) { int yTmp = y + 1; g.drawLine(x0, yTmp, x1, yTmp); diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java index 97554e4d200..ec6e9c6b722 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java @@ -75,7 +75,10 @@ public abstract class ApacheCanonicalizer extends TransformService { throw new ClassCastException ("context must be of type DOMCryptoContext"); } - if (parent == null || !(parent instanceof javax.xml.crypto.dom.DOMStructure)) { + if (parent == null) { + throw new NullPointerException(); + } + if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) { throw new ClassCastException("parent must be of type DOMStructure"); } transformElem = (Element) @@ -90,7 +93,10 @@ public abstract class ApacheCanonicalizer extends TransformService { throw new ClassCastException ("context must be of type DOMCryptoContext"); } - if (parent == null || !(parent instanceof javax.xml.crypto.dom.DOMStructure)) { + if (parent == null) { + throw new NullPointerException(); + } + if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) { throw new ClassCastException("parent must be of type DOMStructure"); } transformElem = (Element) diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java index 7df11e6204a..aac051804b0 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java @@ -76,7 +76,10 @@ public abstract class ApacheTransform extends TransformService { throw new ClassCastException ("context must be of type DOMCryptoContext"); } - if (parent == null || !(parent instanceof javax.xml.crypto.dom.DOMStructure)) { + if (parent == null) { + throw new NullPointerException(); + } + if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) { throw new ClassCastException("parent must be of type DOMStructure"); } transformElem = (Element) @@ -91,7 +94,10 @@ public abstract class ApacheTransform extends TransformService { throw new ClassCastException ("context must be of type DOMCryptoContext"); } - if (parent == null || !(parent instanceof javax.xml.crypto.dom.DOMStructure)) { + if (parent == null) { + throw new NullPointerException(); + } + if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) { throw new ClassCastException("parent must be of type DOMStructure"); } transformElem = (Element) diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java index 9ebf06c2afb..782fd2d6a00 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java @@ -218,9 +218,11 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue { ("unable to create RSA KeyFactory: " + e.getMessage()); } } - Element modulusElem = DOMUtils.getFirstChildElement(kvtElem); + Element modulusElem = DOMUtils.getFirstChildElement(kvtElem, + "Modulus"); modulus = new DOMCryptoBinary(modulusElem.getFirstChild()); - Element exponentElem = DOMUtils.getNextSiblingElement(modulusElem); + Element exponentElem = DOMUtils.getNextSiblingElement(modulusElem, + "Exponent"); exponent = new DOMCryptoBinary(exponentElem.getFirstChild()); RSAPublicKeySpec spec = new RSAPublicKeySpec(modulus.getBigNum(), exponent.getBigNum()); @@ -289,13 +291,13 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue { // check for P and Q if (curElem.getLocalName().equals("P")) { p = new DOMCryptoBinary(curElem.getFirstChild()); - curElem = DOMUtils.getNextSiblingElement(curElem); + curElem = DOMUtils.getNextSiblingElement(curElem, "Q"); q = new DOMCryptoBinary(curElem.getFirstChild()); curElem = DOMUtils.getNextSiblingElement(curElem); } if (curElem.getLocalName().equals("G")) { g = new DOMCryptoBinary(curElem.getFirstChild()); - curElem = DOMUtils.getNextSiblingElement(curElem); + curElem = DOMUtils.getNextSiblingElement(curElem, "Y"); } y = new DOMCryptoBinary(curElem.getFirstChild()); curElem = DOMUtils.getNextSiblingElement(curElem); @@ -460,7 +462,7 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue { } else { throw new MarshalException("Invalid ECKeyValue"); } - curElem = DOMUtils.getNextSiblingElement(curElem); + curElem = DOMUtils.getNextSiblingElement(curElem, "PublicKey"); ECPoint ecPoint = null; try { Object[] args = new Object[] { Base64.decode(curElem), diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java index e8f41ef4e06..96e2a8b6bd0 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java @@ -101,20 +101,24 @@ public final class DOMManifest extends DOMStructure implements Manifest { boolean secVal = Utils.secureValidation(context); - Element refElem = DOMUtils.getFirstChildElement(manElem); + Element refElem = DOMUtils.getFirstChildElement(manElem, "Reference"); List refs = new ArrayList(); + refs.add(new DOMReference(refElem, context, provider)); - int refCount = 0; + refElem = DOMUtils.getNextSiblingElement(refElem); while (refElem != null) { + String localName = refElem.getLocalName(); + if (!localName.equals("Reference")) { + throw new MarshalException("Invalid element name: " + + localName + ", expected Reference"); + } refs.add(new DOMReference(refElem, context, provider)); - refElem = DOMUtils.getNextSiblingElement(refElem); - - refCount++; - if (secVal && (refCount > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) { + if (secVal && (refs.size() > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) { String error = "A maxiumum of " + DOMSignedInfo.MAXIMUM_REFERENCE_COUNT + " " + "references per Manifest are allowed with secure validation"; throw new MarshalException(error); } + refElem = DOMUtils.getNextSiblingElement(refElem); } this.references = Collections.unmodifiableList(refs); } diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java index 132497838e3..f80df4dac42 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java @@ -204,23 +204,33 @@ public final class DOMReference extends DOMStructure Element nextSibling = DOMUtils.getFirstChildElement(refElem); List transforms = new ArrayList(5); if (nextSibling.getLocalName().equals("Transforms")) { - Element transformElem = DOMUtils.getFirstChildElement(nextSibling); - - int transformCount = 0; + Element transformElem = DOMUtils.getFirstChildElement(nextSibling, + "Transform"); + transforms.add(new DOMTransform(transformElem, context, provider)); + transformElem = DOMUtils.getNextSiblingElement(transformElem); while (transformElem != null) { + String localName = transformElem.getLocalName(); + if (!localName.equals("Transform")) { + throw new MarshalException( + "Invalid element name: " + localName + + ", expected Transform"); + } transforms.add (new DOMTransform(transformElem, context, provider)); - transformElem = DOMUtils.getNextSiblingElement(transformElem); - - transformCount++; - if (secVal && (transformCount > MAXIMUM_TRANSFORM_COUNT)) { + if (secVal && (transforms.size() > MAXIMUM_TRANSFORM_COUNT)) { String error = "A maxiumum of " + MAXIMUM_TRANSFORM_COUNT + " " + "transforms per Reference are allowed with secure validation"; throw new MarshalException(error); } + transformElem = DOMUtils.getNextSiblingElement(transformElem); } nextSibling = DOMUtils.getNextSiblingElement(nextSibling); } + if (!nextSibling.getLocalName().equals("DigestMethod")) { + throw new MarshalException("Invalid element name: " + + nextSibling.getLocalName() + + ", expected DigestMethod"); + } // unmarshal DigestMethod Element dmElem = nextSibling; @@ -234,13 +244,19 @@ public final class DOMReference extends DOMStructure } // unmarshal DigestValue + Element dvElem = DOMUtils.getNextSiblingElement(dmElem, "DigestValue"); try { - Element dvElem = DOMUtils.getNextSiblingElement(dmElem); this.digestValue = Base64.decode(dvElem); } catch (Base64DecodingException bde) { throw new MarshalException(bde); } + // check for extra elements + if (DOMUtils.getNextSiblingElement(dvElem) != null) { + throw new MarshalException( + "Unexpected element after DigestValue element"); + } + // unmarshal attributes this.uri = DOMUtils.getAttributeValue(refElem, "URI"); diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java index 001126a6336..1d77f82906e 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java @@ -136,21 +136,30 @@ public final class DOMRetrievalMethod extends DOMStructure List transforms = new ArrayList(); Element transformsElem = DOMUtils.getFirstChildElement(rmElem); - int transformCount = 0; if (transformsElem != null) { + String localName = transformsElem.getLocalName(); + if (!localName.equals("Transforms")) { + throw new MarshalException("Invalid element name: " + + localName + ", expected Transforms"); + } Element transformElem = - DOMUtils.getFirstChildElement(transformsElem); + DOMUtils.getFirstChildElement(transformsElem, "Transform"); + transforms.add(new DOMTransform(transformElem, context, provider)); + transformElem = DOMUtils.getNextSiblingElement(transformElem); while (transformElem != null) { + String name = transformElem.getLocalName(); + if (!name.equals("Transform")) { + throw new MarshalException("Invalid element name: " + + name + ", expected Transform"); + } transforms.add (new DOMTransform(transformElem, context, provider)); - transformElem = DOMUtils.getNextSiblingElement(transformElem); - - transformCount++; - if (secVal && (transformCount > DOMReference.MAXIMUM_TRANSFORM_COUNT)) { + if (secVal && (transforms.size() > DOMReference.MAXIMUM_TRANSFORM_COUNT)) { String error = "A maxiumum of " + DOMReference.MAXIMUM_TRANSFORM_COUNT + " " + "transforms per Reference are allowed with secure validation"; throw new MarshalException(error); } + transformElem = DOMUtils.getNextSiblingElement(transformElem); } } if (transforms.isEmpty()) { diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java index ecfa41a11bc..dc2500b4532 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java @@ -109,6 +109,11 @@ public final class DOMSignatureProperties extends DOMStructure for (int i = 0; i < length; i++) { Node child = nodes.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { + String name = child.getLocalName(); + if (!name.equals("SignatureProperty")) { + throw new MarshalException("Invalid element name: " + name + + ", expected SignatureProperty"); + } properties.add(new DOMSignatureProperty((Element)child, context)); } diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java index fea139be24f..9aacfb5c7fb 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java @@ -150,11 +150,14 @@ public final class DOMSignedInfo extends DOMStructure implements SignedInfo { id = DOMUtils.getAttributeValue(siElem, "Id"); // unmarshal CanonicalizationMethod - Element cmElem = DOMUtils.getFirstChildElement(siElem); - canonicalizationMethod = new DOMCanonicalizationMethod(cmElem, context, provider); + Element cmElem = DOMUtils.getFirstChildElement(siElem, + "CanonicalizationMethod"); + canonicalizationMethod = new DOMCanonicalizationMethod(cmElem, context, + provider); // unmarshal SignatureMethod - Element smElem = DOMUtils.getNextSiblingElement(cmElem); + Element smElem = DOMUtils.getNextSiblingElement(cmElem, + "SignatureMethod"); signatureMethod = DOMSignatureMethod.unmarshal(smElem); boolean secVal = Utils.secureValidation(context); @@ -169,19 +172,24 @@ public final class DOMSignedInfo extends DOMStructure implements SignedInfo { // unmarshal References ArrayList refList = new ArrayList(5); - Element refElem = DOMUtils.getNextSiblingElement(smElem); + Element refElem = DOMUtils.getNextSiblingElement(smElem, "Reference"); + refList.add(new DOMReference(refElem, context, provider)); - int refCount = 0; + refElem = DOMUtils.getNextSiblingElement(refElem); while (refElem != null) { + String name = refElem.getLocalName(); + if (!name.equals("Reference")) { + throw new MarshalException("Invalid element name: " + + name + ", expected Reference"); + } refList.add(new DOMReference(refElem, context, provider)); - refElem = DOMUtils.getNextSiblingElement(refElem); - refCount++; - if (secVal && (refCount > MAXIMUM_REFERENCE_COUNT)) { + if (secVal && (refList.size() > MAXIMUM_REFERENCE_COUNT)) { String error = "A maxiumum of " + MAXIMUM_REFERENCE_COUNT + " " + "references per Manifest are allowed with secure validation"; throw new MarshalException(error); } + refElem = DOMUtils.getNextSiblingElement(refElem); } references = Collections.unmodifiableList(refList); } diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java index c55a13ae323..300f777154f 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java @@ -131,6 +131,36 @@ public class DOMUtils { return (Element)child; } + /** + * Returns the first child element of the specified node and checks that + * the local name is equal to {@code localName}. + * + * @param node the node + * @return the first child element of the specified node + * @throws NullPointerException if {@code node == null} + * @throws MarshalException if no such element or the local name is not + * equal to {@code localName} + */ + public static Element getFirstChildElement(Node node, String localName) + throws MarshalException + { + return verifyElement(getFirstChildElement(node), localName); + } + + private static Element verifyElement(Element elem, String localName) + throws MarshalException + { + if (elem == null) { + throw new MarshalException("Missing " + localName + " element"); + } + String name = elem.getLocalName(); + if (!name.equals(localName)) { + throw new MarshalException("Invalid element name: " + + name + ", expected " + localName); + } + return elem; + } + /** * Returns the last child element of the specified node, or null if there * is no such element. @@ -165,6 +195,22 @@ public class DOMUtils { return (Element)sibling; } + /** + * Returns the next sibling element of the specified node and checks that + * the local name is equal to {@code localName}. + * + * @param node the node + * @return the next sibling element of the specified node + * @throws NullPointerException if {@code node == null} + * @throws MarshalException if no such element or the local name is not + * equal to {@code localName} + */ + public static Element getNextSiblingElement(Node node, String localName) + throws MarshalException + { + return verifyElement(getNextSiblingElement(node), localName); + } + /** * Returns the attribute value for the attribute with the specified name. * Returns null if there is no such attribute, or diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java index 318d9cfe886..9b008bc912f 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java @@ -80,9 +80,11 @@ public final class DOMX509IssuerSerial extends DOMStructure * * @param isElem an X509IssuerSerial element */ - public DOMX509IssuerSerial(Element isElem) { - Element iNElem = DOMUtils.getFirstChildElement(isElem); - Element sNElem = DOMUtils.getNextSiblingElement(iNElem); + public DOMX509IssuerSerial(Element isElem) throws MarshalException { + Element iNElem = DOMUtils.getFirstChildElement(isElem, + "X509IssuerName"); + Element sNElem = DOMUtils.getNextSiblingElement(iNElem, + "X509SerialNumber"); issuerName = iNElem.getFirstChild().getNodeValue(); serialNumber = new BigInteger(sNElem.getFirstChild().getNodeValue()); } diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java index ebd41baae2a..32c1dcf06c0 100644 --- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java +++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java @@ -141,11 +141,13 @@ public final class DOMXMLSignature extends DOMStructure id = DOMUtils.getAttributeValue(localSigElem, "Id"); // unmarshal SignedInfo - Element siElem = DOMUtils.getFirstChildElement(localSigElem); + Element siElem = DOMUtils.getFirstChildElement(localSigElem, + "SignedInfo"); si = new DOMSignedInfo(siElem, context, provider); // unmarshal SignatureValue - Element sigValElem = DOMUtils.getNextSiblingElement(siElem); + Element sigValElem = DOMUtils.getNextSiblingElement(siElem, + "SignatureValue"); sv = new DOMSignatureValue(sigValElem, context); // unmarshal KeyInfo, if specified @@ -161,6 +163,11 @@ public final class DOMXMLSignature extends DOMStructure } else { List tempObjects = new ArrayList(); while (nextSibling != null) { + String name = nextSibling.getLocalName(); + if (!name.equals("Object")) { + throw new MarshalException("Invalid element name: " + name + + ", expected KeyInfo or Object"); + } tempObjects.add(new DOMXMLObject(nextSibling, context, provider)); nextSibling = DOMUtils.getNextSiblingElement(nextSibling); diff --git a/jdk/src/share/classes/sun/awt/AppContext.java b/jdk/src/share/classes/sun/awt/AppContext.java index 4af13ce5703..d4ed6525ad8 100644 --- a/jdk/src/share/classes/sun/awt/AppContext.java +++ b/jdk/src/share/classes/sun/awt/AppContext.java @@ -310,11 +310,13 @@ public final class AppContext { // and excludes applets because by the time applet starts // a number of contexts have already been created by the plugin. if (numAppContexts.get() == 0) { - // This check is not necessary, its purpose is to help - // Plugin devs to catch all the cases of main AC creation. if (System.getProperty("javaplugin.version") == null && System.getProperty("javawebstart.version") == null) { initMainAppContext(); + } else if (System.getProperty("javafx.version") != null && + threadGroup.getParent() != null) { + // Swing inside JavaFX case + SunToolkit.createNewAppContext(); } } diff --git a/jdk/src/share/classes/sun/font/TrueTypeFont.java b/jdk/src/share/classes/sun/font/TrueTypeFont.java index 5a3180e1546..e5b6ffd4860 100644 --- a/jdk/src/share/classes/sun/font/TrueTypeFont.java +++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java @@ -547,6 +547,17 @@ public class TrueTypeFont extends FileFont { throw new FontFormatException("bad table, tag="+table.tag); } } + + if (getDirectoryEntry(headTag) == null) { + throw new FontFormatException("missing head table"); + } + if (getDirectoryEntry(maxpTag) == null) { + throw new FontFormatException("missing maxp table"); + } + if (getDirectoryEntry(hmtxTag) != null + && getDirectoryEntry(hheaTag) == null) { + throw new FontFormatException("missing hhea table"); + } initNames(); } catch (Exception e) { if (FontUtilities.isLogging()) { diff --git a/jdk/src/share/classes/sun/invoke/anon/ConstantPoolPatch.java b/jdk/src/share/classes/sun/invoke/anon/ConstantPoolPatch.java index 259d4b2336e..b4fde055034 100644 --- a/jdk/src/share/classes/sun/invoke/anon/ConstantPoolPatch.java +++ b/jdk/src/share/classes/sun/invoke/anon/ConstantPoolPatch.java @@ -418,7 +418,7 @@ public class ConstantPoolPatch { private static final Map, Byte> CONSTANT_VALUE_CLASS_TAG = new IdentityHashMap, Byte>(); - private static final Class[] CONSTANT_VALUE_CLASS = new Class[16]; + private static final Class[] CONSTANT_VALUE_CLASS = new Class[16]; static { Object[][] values = { {Integer.class, CONSTANT_Integer}, diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/AuthCacheValue.java b/jdk/src/share/classes/sun/net/www/protocol/http/AuthCacheValue.java index d2c003ee2bb..1ebef35e592 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/http/AuthCacheValue.java +++ b/jdk/src/share/classes/sun/net/www/protocol/http/AuthCacheValue.java @@ -37,6 +37,8 @@ import java.net.PasswordAuthentication; public abstract class AuthCacheValue implements Serializable { + static final long serialVersionUID = 735249334068211611L; + public enum Type { Proxy, Server diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java b/jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java index 23e84ba4462..e44bb3d76e7 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java +++ b/jdk/src/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java @@ -51,6 +51,8 @@ import sun.net.www.HeaderParser; public abstract class AuthenticationInfo extends AuthCacheValue implements Cloneable { + static final long serialVersionUID = -2588378268010453259L; + // Constants saying what kind of authroization this is. This determines // the namespace in the hash table lookup. public static final char SERVER_AUTHENTICATION = 's'; diff --git a/jdk/src/share/classes/sun/print/PSPrinterJob.java b/jdk/src/share/classes/sun/print/PSPrinterJob.java index 5344ba8bb08..c4bcc23aa02 100644 --- a/jdk/src/share/classes/sun/print/PSPrinterJob.java +++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java @@ -59,6 +59,8 @@ import javax.print.PrintService; import javax.print.StreamPrintService; import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.PrintServiceAttributeSet; +import javax.print.attribute.standard.PrinterName; import javax.print.attribute.standard.Chromaticity; import javax.print.attribute.standard.Copies; import javax.print.attribute.standard.Destination; @@ -766,8 +768,9 @@ public class PSPrinterJob extends RasterPrinterJob { } } if (mDestType == RasterPrinterJob.PRINTER) { - if (getPrintService() != null) { - mDestination = getPrintService().getName(); + PrintService pServ = getPrintService(); + if (pServ != null) { + mDestination = pServ.getName(); } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); diff --git a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java index 341f2033f64..2dc978a4dea 100644 --- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java +++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java @@ -88,6 +88,7 @@ public class AnnotationParser { * @param selectAnnotationClasses an array of annotation types to select when parsing */ @SafeVarargs + @SuppressWarnings("varargs") // selectAnnotationClasses is used safely static Map, Annotation> parseSelectAnnotations( byte[] rawAnnotations, ConstantPool constPool, diff --git a/jdk/src/share/classes/sun/rmi/runtime/Log.java b/jdk/src/share/classes/sun/rmi/runtime/Log.java index 7a1b0982fba..62d03614dfe 100644 --- a/jdk/src/share/classes/sun/rmi/runtime/Log.java +++ b/jdk/src/share/classes/sun/rmi/runtime/Log.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,6 +61,7 @@ import java.util.HashMap; * @author Laird Dornin * @since 1.4 */ +@SuppressWarnings("deprecation") public abstract class Log { /** Logger re-definition of old RMI log values */ diff --git a/jdk/src/share/classes/sun/rmi/server/ActivatableRef.java b/jdk/src/share/classes/sun/rmi/server/ActivatableRef.java index 6224ff35655..7e6668c389e 100644 --- a/jdk/src/share/classes/sun/rmi/server/ActivatableRef.java +++ b/jdk/src/share/classes/sun/rmi/server/ActivatableRef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,7 @@ import java.rmi.server.RemoteObjectInvocationHandler; import java.rmi.server.RemoteRef; import java.rmi.server.RemoteStub; +@SuppressWarnings("deprecation") public class ActivatableRef implements RemoteRef { private static final long serialVersionUID = 7579060052569229166L; diff --git a/jdk/src/share/classes/sun/rmi/server/Dispatcher.java b/jdk/src/share/classes/sun/rmi/server/Dispatcher.java index 947aa4176e2..a2ec6dcf264 100644 --- a/jdk/src/share/classes/sun/rmi/server/Dispatcher.java +++ b/jdk/src/share/classes/sun/rmi/server/Dispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ import java.rmi.server.RemoteCall; * The Dispatcher interface allows the transport to make * the upcall to the server side remote reference. */ +@SuppressWarnings("deprecation") public interface Dispatcher { /** diff --git a/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java b/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java index 7830ed354bb..c35da195ad2 100644 --- a/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java +++ b/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,6 +67,7 @@ import sun.security.action.GetPropertyAction; * @author Peter Jones * @author Laird Dornin */ +@SuppressWarnings("deprecation") public final class LoaderHandler { /** RMI class loader log level */ diff --git a/jdk/src/share/classes/sun/rmi/server/UnicastRef.java b/jdk/src/share/classes/sun/rmi/server/UnicastRef.java index 3ea4bd34ce5..9b95724094a 100644 --- a/jdk/src/share/classes/sun/rmi/server/UnicastRef.java +++ b/jdk/src/share/classes/sun/rmi/server/UnicastRef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,8 @@ import sun.security.action.GetBooleanAction; * NOTE: There is a JDK-internal dependency on the existence of this * class's getLiveRef method (as it is inherited by UnicastRef2) in * the implementation of javax.management.remote.rmi.RMIConnector. - **/ + */ +@SuppressWarnings("deprecation") public class UnicastRef implements RemoteRef { /** diff --git a/jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java b/jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java index b47b4ed6e20..180a6252304 100644 --- a/jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java +++ b/jdk/src/share/classes/sun/rmi/server/UnicastServerRef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,6 +67,7 @@ import sun.security.action.GetBooleanAction; * @author Roger Riggs * @author Peter Jones */ +@SuppressWarnings("deprecation") public class UnicastServerRef extends UnicastRef implements ServerRef, Dispatcher { diff --git a/jdk/src/share/classes/sun/rmi/server/Util.java b/jdk/src/share/classes/sun/rmi/server/Util.java index 0f6c7ddee50..0f82a84c9b1 100644 --- a/jdk/src/share/classes/sun/rmi/server/Util.java +++ b/jdk/src/share/classes/sun/rmi/server/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,6 +64,7 @@ import sun.security.action.GetPropertyAction; * A utility class with static methods for creating stubs/proxies and * skeletons for remote objects. */ +@SuppressWarnings("deprecation") public final class Util { /** "server" package log level */ diff --git a/jdk/src/share/classes/sun/rmi/transport/DGCImpl.java b/jdk/src/share/classes/sun/rmi/transport/DGCImpl.java index b5ce50cacc7..88ac91b648d 100644 --- a/jdk/src/share/classes/sun/rmi/transport/DGCImpl.java +++ b/jdk/src/share/classes/sun/rmi/transport/DGCImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,6 +59,7 @@ import sun.security.action.GetPropertyAction; * * @author Ann Wollrath */ +@SuppressWarnings("deprecation") final class DGCImpl implements DGC { /* dgc system log */ diff --git a/jdk/src/share/classes/sun/rmi/transport/StreamRemoteCall.java b/jdk/src/share/classes/sun/rmi/transport/StreamRemoteCall.java index 5971405d970..915ed6f9262 100644 --- a/jdk/src/share/classes/sun/rmi/transport/StreamRemoteCall.java +++ b/jdk/src/share/classes/sun/rmi/transport/StreamRemoteCall.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,7 @@ import sun.rmi.transport.tcp.TCPEndpoint; * * @author Ann Wollrath */ +@SuppressWarnings("deprecation") public class StreamRemoteCall implements RemoteCall { private ConnectionInputStream in = null; private ConnectionOutputStream out = null; diff --git a/jdk/src/share/classes/sun/rmi/transport/Transport.java b/jdk/src/share/classes/sun/rmi/transport/Transport.java index 286682dff8a..217c93682bd 100644 --- a/jdk/src/share/classes/sun/rmi/transport/Transport.java +++ b/jdk/src/share/classes/sun/rmi/transport/Transport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,7 @@ import sun.rmi.server.UnicastServerRef; * * @author Ann Wollrath */ +@SuppressWarnings("deprecation") public abstract class Transport { /** "transport" package log level */ diff --git a/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java b/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java index d3dbf6f1da4..e77e224597f 100644 --- a/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java +++ b/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,7 @@ import sun.security.action.GetLongAction; * connect to the same host will automatically use the same * mechanism. */ +@SuppressWarnings("deprecation") public class RMIMasterSocketFactory extends RMISocketFactory { /** "proxy" package log level */ diff --git a/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java b/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java index b12809a26bf..d1b6cbf7e15 100644 --- a/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java +++ b/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ import sun.rmi.runtime.Log; * * @author Peter Jones */ +@SuppressWarnings("deprecation") final class ConnectionMultiplexer { /** "multiplex" log level */ diff --git a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java index 54d6d21d9e6..24655c2f0b5 100644 --- a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java +++ b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,6 +84,7 @@ import sun.security.action.GetPropertyAction; * @author Ann Wollrath * @author Peter Jones */ +@SuppressWarnings("deprecation") public class TCPTransport extends Transport { /* tcp package log */ diff --git a/jdk/src/share/classes/sun/security/ec/ECDSASignature.java b/jdk/src/share/classes/sun/security/ec/ECDSASignature.java index c831259f5ad..1e80694207e 100644 --- a/jdk/src/share/classes/sun/security/ec/ECDSASignature.java +++ b/jdk/src/share/classes/sun/security/ec/ECDSASignature.java @@ -323,6 +323,7 @@ abstract class ECDSASignature extends SignatureSpi { // set parameter, not supported. See JCA doc @Override + @Deprecated protected void engineSetParameter(String param, Object value) throws InvalidParameterException { throw new UnsupportedOperationException("setParameter() not supported"); @@ -330,6 +331,7 @@ abstract class ECDSASignature extends SignatureSpi { // get parameter, not supported. See JCA doc @Override + @Deprecated protected Object engineGetParameter(String param) throws InvalidParameterException { throw new UnsupportedOperationException("getParameter() not supported"); diff --git a/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java b/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java index 0a9e3a5dbea..d847b104955 100644 --- a/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java +++ b/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -310,7 +310,8 @@ public class PKCS9Attribute implements DerEncoder { private static final Byte[][] PKCS9_VALUE_TAGS = { null, {new Byte(DerValue.tag_IA5String)}, // EMailAddress - {new Byte(DerValue.tag_IA5String)}, // UnstructuredName + {new Byte(DerValue.tag_IA5String), // UnstructuredName + new Byte(DerValue.tag_PrintableString)}, {new Byte(DerValue.tag_ObjectId)}, // ContentType {new Byte(DerValue.tag_OctetString)}, // MessageDigest {new Byte(DerValue.tag_UtcTime)}, // SigningTime diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java b/jdk/src/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java index 8f75b1ec37e..86bee16a72f 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java +++ b/jdk/src/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,10 +96,15 @@ final class P11TlsPrfGenerator extends KeyGeneratorSpi { } } - // SecretKeySpec does not allow zero length keys, so we define our own class. + // SecretKeySpec does not allow zero length keys, so we define our + // own class. + // + // As an anonymous class cannot make any guarantees about serialization + // compatibility, it is nonsensical for an anonymous class to define a + // serialVersionUID. Suppress warnings relative to missing serialVersionUID + // field in the anonymous subclass of serializable SecretKey. + @SuppressWarnings("serial") private static final SecretKey NULL_KEY = new SecretKey() { - private static final long serialVersionUID = -8090049519656411362L; - public byte[] getEncoded() { return new byte[0]; } diff --git a/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java b/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java index 32f1da53afa..35564498c0e 100644 --- a/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java +++ b/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java @@ -775,7 +775,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { } } if (params != null) { - if (algorithm.equals(pbes2_OID)) { + if (algorithm.equals((Object)pbes2_OID)) { algParams = AlgorithmParameters.getInstance("PBES2"); } else { algParams = AlgorithmParameters.getInstance("PBE"); @@ -912,7 +912,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm, AlgorithmParameters algParams) throws NoSuchAlgorithmException { // Check for PBES2 algorithms - if (algorithm.equals(pbes2_OID) && algParams != null) { + if (algorithm.equals((Object)pbes2_OID) && algParams != null) { return algParams.toString(); } return algorithm.toString(); @@ -1921,7 +1921,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { } safeContentsData = safeContents.getData(); - } else if (contentType.equals(ContentInfo.ENCRYPTED_DATA_OID)) { + } else if (contentType.equals((Object)ContentInfo.ENCRYPTED_DATA_OID)) { if (password == null) { continue; } diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java index ca82ef598a0..2c375a869b7 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java @@ -255,7 +255,9 @@ public final class OCSP { } response = Arrays.copyOf(response, total); } catch (IOException ioe) { - throw new NetworkFailureException(ioe); + throw new CertPathValidatorException( + "Unable to determine revocation status due to network error", + ioe, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS); } finally { if (in != null) { try { @@ -355,17 +357,4 @@ public final class OCSP { */ Map getSingleExtensions(); } - - static class NetworkFailureException extends CertPathValidatorException { - private static final long serialVersionUID = 0l; - - NetworkFailureException(Throwable t) { - super(t); - } - - @Override - public CertPathValidatorException.Reason getReason() { - return BasicReason.UNDETERMINED_REVOCATION_STATUS; - } - } } diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java index 1d84a4c1449..5580dc70b88 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java @@ -30,6 +30,7 @@ import java.security.*; import java.security.cert.CertificateException; import java.security.cert.CertificateParsingException; import java.security.cert.CertPathValidatorException; +import java.security.cert.CertPathValidatorException.BasicReason; import java.security.cert.CRLReason; import java.security.cert.TrustAnchor; import java.security.cert.X509Certificate; @@ -121,8 +122,8 @@ public final class OCSPResponse { public enum ResponseStatus { SUCCESSFUL, // Response has valid confirmations - MALFORMED_REQUEST, // Illegal confirmation request - INTERNAL_ERROR, // Internal error in issuer + MALFORMED_REQUEST, // Illegal request + INTERNAL_ERROR, // Internal error in responder TRY_LATER, // Try again later UNUSED, // is not used SIG_REQUIRED, // Must sign the request @@ -381,9 +382,18 @@ public final class OCSPResponse { Date date, byte[] nonce) throws CertPathValidatorException { - if (responseStatus != ResponseStatus.SUCCESSFUL) { - throw new CertPathValidatorException - ("OCSP response error: " + responseStatus); + switch (responseStatus) { + case SUCCESSFUL: + break; + case UNAUTHORIZED: + case TRY_LATER: + case INTERNAL_ERROR: + throw new CertPathValidatorException( + "OCSP response error: " + responseStatus, null, null, -1, + BasicReason.UNDETERMINED_REVOCATION_STATUS); + default: + throw new CertPathValidatorException("OCSP response error: " + + responseStatus); } // Check that the response includes a response for all of the diff --git a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java index 057e99e4070..728bc19f5db 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -193,10 +193,15 @@ public final class PKIXCertPathValidator extends CertPathValidatorSpi { List checkers = params.certPathCheckers(); for (PKIXCertPathChecker checker : checkers) { if (checker instanceof PKIXRevocationChecker) { + if (revCheckerAdded) { + throw new CertPathValidatorException( + "Only one PKIXRevocationChecker can be specified"); + } revCheckerAdded = true; // if it's our own, initialize it - if (checker instanceof RevocationChecker) + if (checker instanceof RevocationChecker) { ((RevocationChecker)checker).init(anchor, params); + } } } // only add a RevocationChecker if revocation is enabled and diff --git a/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java b/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java index 1ec6147cb36..c51500308ae 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import java.security.PublicKey; import java.security.cert.CertificateException; import java.security.cert.CertPathValidatorException; import java.security.cert.PKIXCertPathChecker; +import java.security.cert.PKIXRevocationChecker; import java.security.cert.TrustAnchor; import java.security.cert.X509Certificate; import java.util.ArrayList; @@ -235,9 +236,16 @@ class ReverseState implements State { for (PKIXCertPathChecker checker : userCheckers) { if (checker instanceof AlgorithmChecker) { ((AlgorithmChecker)checker).trySetTrustAnchor(anchor); - } else if (checker instanceof RevocationChecker) { - ((RevocationChecker)checker).init(anchor, buildParams); - ((RevocationChecker)checker).init(false); + } else if (checker instanceof PKIXRevocationChecker) { + if (revCheckerAdded) { + throw new CertPathValidatorException( + "Only one PKIXRevocationChecker can be specified"); + } + // if it's our own, initialize it + if (checker instanceof RevocationChecker) { + ((RevocationChecker)checker).init(anchor, buildParams); + } + ((PKIXRevocationChecker)checker).init(false); revCheckerAdded = true; } } diff --git a/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java index 98d8a9d2272..0aad090a8b0 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java @@ -38,14 +38,7 @@ import java.security.Security; import java.security.cert.CertPathValidatorException.BasicReason; import java.security.cert.Extension; import java.security.cert.*; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import javax.security.auth.x500.X500Principal; import static sun.security.provider.certpath.OCSP.*; @@ -70,13 +63,16 @@ class RevocationChecker extends PKIXRevocationChecker { private Map ocspResponses; private List ocspExtensions; private boolean legacy; + private LinkedList softFailExceptions = + new LinkedList<>(); // state variables private X509Certificate issuerCert; private PublicKey prevPubKey; private boolean crlSignFlag; + private int certIndex; - private enum Mode { PREFER_OCSP, PREFER_CRLS, ONLY_CRLS }; + private enum Mode { PREFER_OCSP, PREFER_CRLS, ONLY_CRLS, ONLY_OCSP }; private Mode mode = Mode.PREFER_OCSP; private static class RevocationProperties { @@ -104,9 +100,9 @@ class RevocationChecker extends PKIXRevocationChecker { throws CertPathValidatorException { RevocationProperties rp = getRevocationProperties(); - URI uri = getOCSPResponder(); + URI uri = getOcspResponder(); responderURI = (uri == null) ? toURI(rp.ocspUrl) : uri; - X509Certificate cert = getOCSPResponderCert(); + X509Certificate cert = getOcspResponderCert(); responderCert = (cert == null) ? getResponderCert(rp, params.trustAnchors(), params.certStores()) @@ -117,31 +113,38 @@ class RevocationChecker extends PKIXRevocationChecker { case ONLY_END_ENTITY: case PREFER_CRLS: case SOFT_FAIL: + case NO_FALLBACK: break; default: throw new CertPathValidatorException( "Unrecognized revocation parameter option: " + option); } } + softFail = options.contains(Option.SOFT_FAIL); // set mode, only end entity flag if (legacy) { mode = (rp.ocspEnabled) ? Mode.PREFER_OCSP : Mode.ONLY_CRLS; onlyEE = rp.onlyEE; } else { - if (options.contains(Option.PREFER_CRLS)) { + if (options.contains(Option.NO_FALLBACK)) { + if (options.contains(Option.PREFER_CRLS)) { + mode = Mode.ONLY_CRLS; + } else { + mode = Mode.ONLY_OCSP; + } + } else if (options.contains(Option.PREFER_CRLS)) { mode = Mode.PREFER_CRLS; } onlyEE = options.contains(Option.ONLY_END_ENTITY); } - softFail = options.contains(Option.SOFT_FAIL); if (legacy) { crlDP = rp.crlDPEnabled; } else { crlDP = true; } - ocspResponses = getOCSPResponses(); - ocspExtensions = getOCSPExtensions(); + ocspResponses = getOcspResponses(); + ocspExtensions = getOcspExtensions(); this.anchor = anchor; this.params = params; @@ -297,14 +300,19 @@ class RevocationChecker extends PKIXRevocationChecker { if (forward) { throw new CertPathValidatorException("forward checking not supported"); - } else { - if (anchor != null) { - issuerCert = anchor.getTrustedCert(); - prevPubKey = (issuerCert != null) ? issuerCert.getPublicKey() - : anchor.getCAPublicKey(); - } - crlSignFlag = true; } + if (anchor != null) { + issuerCert = anchor.getTrustedCert(); + prevPubKey = (issuerCert != null) ? issuerCert.getPublicKey() + : anchor.getCAPublicKey(); + } + crlSignFlag = true; + if (params.certPath() != null) { + certIndex = params.certPath().getCertificates().size() - 1; + } else { + certIndex = -1; + } + softFailExceptions.clear(); } @Override @@ -317,28 +325,35 @@ class RevocationChecker extends PKIXRevocationChecker { return null; } + @Override + public List getSoftFailExceptions() { + return Collections.unmodifiableList(softFailExceptions); + } + @Override public void check(Certificate cert, Collection unresolvedCritExts) throws CertPathValidatorException { - X509Certificate xcert = (X509Certificate)cert; - if (onlyEE && xcert.getBasicConstraints() != -1) { - if (debug != null) { - debug.println("Skipping revocation check, not end entity cert"); - } - } else { - check(xcert, unresolvedCritExts, prevPubKey, crlSignFlag); - } - updateState(xcert); + check((X509Certificate)cert, unresolvedCritExts, + prevPubKey, crlSignFlag); } - void check(X509Certificate xcert, Collection unresolvedCritExts, - PublicKey pubKey, boolean crlSignFlag) + private void check(X509Certificate xcert, + Collection unresolvedCritExts, + PublicKey pubKey, boolean crlSignFlag) throws CertPathValidatorException { try { + if (onlyEE && xcert.getBasicConstraints() != -1) { + if (debug != null) { + debug.println("Skipping revocation check, not end " + + "entity cert"); + } + return; + } switch (mode) { case PREFER_OCSP: + case ONLY_OCSP: checkOCSP(xcert, unresolvedCritExts); break; case PREFER_CRLS: @@ -351,14 +366,17 @@ class RevocationChecker extends PKIXRevocationChecker { if (e.getReason() == BasicReason.REVOKED) { throw e; } + boolean eSoftFail = isSoftFailException(e); + if (eSoftFail) { + if (mode == Mode.ONLY_OCSP || mode == Mode.ONLY_CRLS) { + return; + } + } else { + if (mode == Mode.ONLY_OCSP || mode == Mode.ONLY_CRLS) { + throw e; + } + } CertPathValidatorException cause = e; - if (softFail && e instanceof NetworkFailureException) { - if (mode == Mode.ONLY_CRLS) return; - } - // Rethrow the exception if ONLY_CRLS - if (mode == Mode.ONLY_CRLS) { - throw e; - } // Otherwise, failover if (debug != null) { debug.println("RevocationChecker.check() " + e.getMessage()); @@ -382,22 +400,35 @@ class RevocationChecker extends PKIXRevocationChecker { if (x.getReason() == BasicReason.REVOKED) { throw x; } - if (cause != null) { - if (softFail && cause instanceof NetworkFailureException) { - return; - } else { - cause.addSuppressed(x); + if (!isSoftFailException(x)) { + cause.addSuppressed(x); + throw cause; + } else { + // only pass if both exceptions were soft failures + if (!eSoftFail) { throw cause; } } - if (softFail && x instanceof NetworkFailureException) { - return; - } - throw x; } + } finally { + updateState(xcert); } } + private boolean isSoftFailException(CertPathValidatorException e) { + if (softFail && + e.getReason() == BasicReason.UNDETERMINED_REVOCATION_STATUS) + { + // recreate exception with correct index + CertPathValidatorException e2 = new CertPathValidatorException( + e.getMessage(), e.getCause(), params.certPath(), certIndex, + e.getReason()); + softFailExceptions.addFirst(e2); + return true; + } + return false; + } + private void updateState(X509Certificate cert) throws CertPathValidatorException { @@ -411,6 +442,9 @@ class RevocationChecker extends PKIXRevocationChecker { } prevPubKey = pubKey; crlSignFlag = certCanSignCrl(cert); + if (certIndex > 0) { + certIndex--; + } } // Maximum clock skew in milliseconds (15 minutes) allowed when checking @@ -446,8 +480,8 @@ class RevocationChecker extends PKIXRevocationChecker { " circular dependency"); } throw new CertPathValidatorException - ("Could not determine revocation status", null, null, -1, - BasicReason.UNDETERMINED_REVOCATION_STATUS); + ("Could not determine revocation status", null, null, -1, + BasicReason.UNDETERMINED_REVOCATION_STATUS); } Set possibleCRLs = new HashSet<>(); @@ -457,7 +491,7 @@ class RevocationChecker extends PKIXRevocationChecker { CertPathHelper.setDateAndTime(sel, params.date(), MAX_CLOCK_SKEW); // First, check user-specified CertStores - NetworkFailureException nfe = null; + CertPathValidatorException networkFailureException = null; for (CertStore store : certStores) { try { for (CRL crl : store.getCRLs(sel)) { @@ -468,10 +502,13 @@ class RevocationChecker extends PKIXRevocationChecker { debug.println("RevocationChecker.checkCRLs() " + "CertStoreException: " + e.getMessage()); } - if (softFail && nfe == null && + if (networkFailureException == null && CertStoreHelper.isCausedByNetworkIssue(store.getType(),e)) { // save this exception, we may need to throw it later - nfe = new NetworkFailureException(e); + networkFailureException = new CertPathValidatorException( + "Unable to determine revocation status due to " + + "network error", e, null, -1, + BasicReason.UNDETERMINED_REVOCATION_STATUS); } } } @@ -508,14 +545,17 @@ class RevocationChecker extends PKIXRevocationChecker { approvedCRLs.addAll(DistributionPointFetcher.getCRLs( sel, signFlag, prevKey, params.sigProvider(), certStores, - reasonsMask, anchors, params.date())); + reasonsMask, anchors, null)); } } catch (CertStoreException e) { - if (softFail && e instanceof CertStoreTypeException) { + if (e instanceof CertStoreTypeException) { CertStoreTypeException cste = (CertStoreTypeException)e; if (CertStoreHelper.isCausedByNetworkIssue(cste.getType(), e)) { - throw new NetworkFailureException(e); + throw new CertPathValidatorException( + "Unable to determine revocation status due to " + + "network error", e, null, -1, + BasicReason.UNDETERMINED_REVOCATION_STATUS); } } throw new CertPathValidatorException(e); @@ -531,26 +571,26 @@ class RevocationChecker extends PKIXRevocationChecker { stackedCerts); return; } catch (CertPathValidatorException cpve) { - if (nfe != null) { + if (networkFailureException != null) { // if a network issue previously prevented us from // retrieving a CRL from one of the user-specified - // CertStores and SOFT_FAIL is enabled, throw it now - // so it can be handled appropriately - throw nfe; + // CertStores, throw it now so it can be handled + // appropriately + throw networkFailureException; } throw cpve; } } else { - if (nfe != null) { + if (networkFailureException != null) { // if a network issue previously prevented us from // retrieving a CRL from one of the user-specified - // CertStores and SOFT_FAIL is enabled, throw it now - // so it can be handled appropriately - throw nfe; + // CertStores, throw it now so it can be handled + // appropriately + throw networkFailureException; } - throw new CertPathValidatorException - ("Could not determine revocation status", null, null, -1, - BasicReason.UNDETERMINED_REVOCATION_STATUS); + throw new CertPathValidatorException( + "Could not determine revocation status", null, null, -1, + BasicReason.UNDETERMINED_REVOCATION_STATUS); } } } @@ -595,14 +635,9 @@ class RevocationChecker extends PKIXRevocationChecker { unresCritExts.remove(ReasonCode_Id.toString()); unresCritExts.remove(CertificateIssuer_Id.toString()); if (!unresCritExts.isEmpty()) { - if (debug != null) { - debug.println("Unrecognized " - + "critical extension(s) in revoked CRL entry: " - + unresCritExts); - } - throw new CertPathValidatorException - ("Could not determine revocation status", null, null, - -1, BasicReason.UNDETERMINED_REVOCATION_STATUS); + throw new CertPathValidatorException( + "Unrecognized critical extension(s) in revoked " + + "CRL entry"); } } @@ -610,11 +645,14 @@ class RevocationChecker extends PKIXRevocationChecker { if (reasonCode == null) { reasonCode = CRLReason.UNSPECIFIED; } - Throwable t = new CertificateRevokedException - (entry.getRevocationDate(), reasonCode, - crl.getIssuerX500Principal(), entry.getExtensions()); - throw new CertPathValidatorException(t.getMessage(), t, - null, -1, BasicReason.REVOKED); + Date revocationDate = entry.getRevocationDate(); + if (revocationDate.before(params.date())) { + Throwable t = new CertificateRevokedException( + revocationDate, reasonCode, + crl.getIssuerX500Principal(), entry.getExtensions()); + throw new CertPathValidatorException( + t.getMessage(), t, null, -1, BasicReason.REVOKED); + } } } } @@ -630,9 +668,6 @@ class RevocationChecker extends PKIXRevocationChecker { throw new CertPathValidatorException(ce); } - URI responderURI = (this.responderURI != null) - ? this.responderURI : getOCSPServerURI(currCert); - X509Certificate respCert = (responderCert == null) ? issuerCert : responderCert; @@ -671,23 +706,38 @@ class RevocationChecker extends PKIXRevocationChecker { params.date(), nonce); } else { + URI responderURI = (this.responderURI != null) + ? this.responderURI + : OCSP.getResponderURI(currCert); + if (responderURI == null) { + throw new CertPathValidatorException( + "Certificate does not specify OCSP responder", null, + null, -1); + } + response = OCSP.check(Collections.singletonList(certId), - responderURI, respCert, params.date(), + responderURI, respCert, null, ocspExtensions); } } catch (IOException e) { - throw new CertPathValidatorException(e); + throw new CertPathValidatorException( + "Unable to determine revocation status due to network error", + e, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS); } RevocationStatus rs = (RevocationStatus)response.getSingleResponse(certId); RevocationStatus.CertStatus certStatus = rs.getCertStatus(); if (certStatus == RevocationStatus.CertStatus.REVOKED) { - Throwable t = new CertificateRevokedException( - rs.getRevocationTime(), rs.getRevocationReason(), - respCert.getSubjectX500Principal(), rs.getSingleExtensions()); - throw new CertPathValidatorException(t.getMessage(), t, null, - -1, BasicReason.REVOKED); + Date revocationTime = rs.getRevocationTime(); + if (revocationTime.before(params.date())) { + Throwable t = new CertificateRevokedException( + revocationTime, rs.getRevocationReason(), + respCert.getSubjectX500Principal(), + rs.getSingleExtensions()); + throw new CertPathValidatorException(t.getMessage(), t, null, + -1, BasicReason.REVOKED); + } } else if (certStatus == RevocationStatus.CertStatus.UNKNOWN) { throw new CertPathValidatorException( "Certificate's revocation status is unknown", null, @@ -711,34 +761,6 @@ class RevocationChecker extends PKIXRevocationChecker { return hexNumber.toString(); } - private static URI getOCSPServerURI(X509CertImpl cert) - throws CertPathValidatorException - { - // Examine the certificate's AuthorityInfoAccess extension - AuthorityInfoAccessExtension aia = - cert.getAuthorityInfoAccessExtension(); - if (aia == null) { - throw new CertPathValidatorException( - "Must specify the location of an OCSP Responder"); - } - - List descriptions = aia.getAccessDescriptions(); - for (AccessDescription description : descriptions) { - if (description.getAccessMethod().equals((Object) - AccessDescription.Ad_OCSP_Id)) { - - GeneralName generalName = description.getAccessLocation(); - if (generalName.getType() == GeneralNameInterface.NAME_URI) { - URIName uri = (URIName)generalName.getName(); - return uri.getURI(); - } - } - } - - throw new CertPathValidatorException( - "Cannot find the location of the OCSP Responder"); - } - /** * Checks that a cert can be used to verify a CRL. * @@ -870,8 +892,8 @@ class RevocationChecker extends PKIXRevocationChecker { " circular dependency"); } throw new CertPathValidatorException - ("Could not determine revocation status", null, null, - -1, BasicReason.UNDETERMINED_REVOCATION_STATUS); + ("Could not determine revocation status", null, null, -1, + BasicReason.UNDETERMINED_REVOCATION_STATUS); } // Try to find another key that might be able to sign @@ -1067,6 +1089,15 @@ class RevocationChecker extends PKIXRevocationChecker { } } + @Override + public RevocationChecker clone() { + RevocationChecker copy = (RevocationChecker)super.clone(); + // we don't deep-copy the exceptions, but that is ok because they + // are never modified after they are instantiated + copy.softFailExceptions = new LinkedList<>(softFailExceptions); + return copy; + } + /* * This inner class extends the X509CertSelector to add an additional * check to make sure the subject public key isn't on a particular list. diff --git a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java index 33c1d8b98aa..9c39fb6ef4d 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -422,7 +422,6 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { buildParams.anyPolicyInhibited(), buildParams.policyQualifiersRejected(), rootNode); - checkers.add(policyChecker); // add the algorithm checker @@ -455,11 +454,16 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi { List ckrs = buildParams.certPathCheckers(); for (PKIXCertPathChecker ckr : ckrs) { if (ckr instanceof PKIXRevocationChecker) { + if (revCheckerAdded) { + throw new CertPathValidatorException( + "Only one PKIXRevocationChecker can be specified"); + } revCheckerAdded = true; // if it's our own, initialize it - if (ckr instanceof RevocationChecker) + if (ckr instanceof RevocationChecker) { ((RevocationChecker)ckr).init(builder.trustAnchor, buildParams); + } } } // only add a RevocationChecker if revocation is enabled and diff --git a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java index ffa8f4528e8..dfe612966e0 100644 --- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java +++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java @@ -169,7 +169,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { /* * Drives the protocol state machine. */ - private int connectionState; + private volatile int connectionState; /* * Flag indicating if the next record we receive MUST be a Finished @@ -1467,7 +1467,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { */ @Override public boolean isClosed() { - return getConnectionState() == cs_APP_CLOSED; + return connectionState == cs_APP_CLOSED; } /** diff --git a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java index c5ed6b1facf..72ce4617bf6 100644 --- a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java +++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java @@ -291,7 +291,8 @@ public class Main { String flags = args[n]; String modifier = null; - if (flags.charAt(0) == '-') { + + if (flags.startsWith("-")) { int pos = flags.indexOf(':'); if (pos > 0) { modifier = flags.substring(pos+1); @@ -299,7 +300,14 @@ public class Main { } } - if (collator.compare(flags, "-keystore") == 0) { + if (!flags.startsWith("-")) { + if (jarfile == null) { + jarfile = flags; + } else { + alias = flags; + ckaliases.add(alias); + } + } else if (collator.compare(flags, "-keystore") == 0) { if (++n == args.length) usageNoArg(); keystore = args[n]; } else if (collator.compare(flags, "-storepass") ==0) { @@ -380,18 +388,9 @@ public class Main { collator.compare(flags, "-help") == 0) { fullusage(); } else { - if (!flags.startsWith("-")) { - if (jarfile == null) { - jarfile = flags; - } else { - alias = flags; - ckaliases.add(alias); - } - } else { - System.err.println( - rb.getString("Illegal.option.") + flags); - usage(); - } + System.err.println( + rb.getString("Illegal.option.") + flags); + usage(); } } diff --git a/jdk/src/share/classes/sun/security/tools/keytool/Main.java b/jdk/src/share/classes/sun/security/tools/keytool/Main.java index c8e96eb6d65..02ea1d0497f 100644 --- a/jdk/src/share/classes/sun/security/tools/keytool/Main.java +++ b/jdk/src/share/classes/sun/security/tools/keytool/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2198,8 +2198,15 @@ public final class Main { printExtensions(rb.getString("Extension.Request."), exts, out); } } else { - out.println(attr.getAttributeId()); - out.println(attr.getAttributeValue()); + out.println("Attribute: " + attr.getAttributeId()); + PKCS9Attribute pkcs9Attr = + new PKCS9Attribute(attr.getAttributeId(), + attr.getAttributeValue()); + out.print(pkcs9Attr.getName() + ": "); + Object attrVal = attr.getAttributeValue(); + out.println(attrVal instanceof String[] ? + Arrays.toString((String[]) attrVal) : + attrVal); } } if (debug) { diff --git a/jdk/src/share/classes/sun/swing/AccumulativeRunnable.java b/jdk/src/share/classes/sun/swing/AccumulativeRunnable.java index a1712731524..ac57e6d2115 100644 --- a/jdk/src/share/classes/sun/swing/AccumulativeRunnable.java +++ b/jdk/src/share/classes/sun/swing/AccumulativeRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -121,6 +121,7 @@ public abstract class AccumulativeRunnable implements Runnable { * @param args the arguments to accumulate */ @SafeVarargs + @SuppressWarnings("varargs") // Copying args is safe public final synchronized void add(T... args) { boolean isSubmitted = true; if (arguments == null) { diff --git a/jdk/src/share/classes/sun/swing/JLightweightFrame.java b/jdk/src/share/classes/sun/swing/JLightweightFrame.java index a9ac4371cc1..36bb1c351b7 100644 --- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java +++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java @@ -29,12 +29,18 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; +import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; +import java.awt.event.ComponentListener; +import java.awt.event.ContainerEvent; +import java.awt.event.ContainerListener; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.security.AccessController; import javax.swing.JLayeredPane; @@ -80,6 +86,8 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan private boolean copyBufferEnabled; private int[] copyBuffer; + private PropertyChangeListener layoutSizeListener; + /** * Constructs a new, initially invisible {@code JLightweightFrame} * instance. @@ -94,6 +102,23 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan if (getGraphicsConfiguration().isTranslucencyCapable()) { setBackground(new Color(0, 0, 0, 0)); } + + layoutSizeListener = new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent e) { + Dimension d = (Dimension)e.getNewValue(); + + if ("preferredSize".equals(e.getPropertyName())) { + content.preferredSizeChanged(d.width, d.height); + + } else if ("maximumSize".equals(e.getPropertyName())) { + content.maximumSizeChanged(d.width, d.height); + + } else if ("minimumSize".equals(e.getPropertyName())) { + content.minimumSizeChanged(d.width, d.height); + } + } + }; } /** @@ -104,10 +129,23 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan * * @param content the {@link LightweightContent} instance */ - public void setContent(LightweightContent content) { + public void setContent(final LightweightContent content) { + if (content == null) { + System.err.println("JLightweightFrame.setContent: content may not be null!"); + return; + } this.content = content; this.component = content.getComponent(); + Dimension d = this.component.getPreferredSize(); + content.preferredSizeChanged(d.width, d.height); + + d = this.component.getMaximumSize(); + content.maximumSizeChanged(d.width, d.height); + + d = this.component.getMinimumSize(); + content.minimumSizeChanged(d.width, d.height); + initInterior(); } @@ -202,6 +240,25 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan contentPane.setLayout(new BorderLayout()); contentPane.add(component); setContentPane(contentPane); + + contentPane.addContainerListener(new ContainerListener() { + @Override + public void componentAdded(ContainerEvent e) { + Component c = JLightweightFrame.this.component; + if (e.getChild() == c) { + c.addPropertyChangeListener("preferredSize", layoutSizeListener); + c.addPropertyChangeListener("maximumSize", layoutSizeListener); + c.addPropertyChangeListener("minimumSize", layoutSizeListener); + } + } + @Override + public void componentRemoved(ContainerEvent e) { + Component c = JLightweightFrame.this.component; + if (e.getChild() == c) { + c.removePropertyChangeListener(layoutSizeListener); + } + } + }); } @SuppressWarnings("deprecation") diff --git a/jdk/src/share/classes/sun/swing/LightweightContent.java b/jdk/src/share/classes/sun/swing/LightweightContent.java index 2d443fba23c..256262dded1 100644 --- a/jdk/src/share/classes/sun/swing/LightweightContent.java +++ b/jdk/src/share/classes/sun/swing/LightweightContent.java @@ -161,4 +161,22 @@ public interface LightweightContent { * application that the frame has ungrabbed focus. */ public void focusUngrabbed(); + + /** + * {@code JLightweightFrame} calls this method to notify the client + * application that the content preferred size has changed. + */ + public void preferredSizeChanged(int width, int height); + + /** + * {@code JLightweightFrame} calls this method to notify the client + * application that the content maximum size has changed. + */ + public void maximumSizeChanged(int width, int height); + + /** + * {@code JLightweightFrame} calls this method to notify the client + * application that the content minimum size has changed. + */ + public void minimumSizeChanged(int width, int height); } diff --git a/jdk/src/share/classes/sun/tools/asm/Assembler.java b/jdk/src/share/classes/sun/tools/asm/Assembler.java index 1bf406e182e..b4fc8b1d290 100644 --- a/jdk/src/share/classes/sun/tools/asm/Assembler.java +++ b/jdk/src/share/classes/sun/tools/asm/Assembler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,9 +91,9 @@ class Assembler implements Constants { add(new Instruction(where, opc, flagNoCovered)); } - static Vector SourceClassList = new Vector(); + static Vector SourceClassList = new Vector<>(); - static Vector TmpCovTable = new Vector(); + static Vector TmpCovTable = new Vector<>(); static int[] JcovClassCountArray = new int[CT_LAST_KIND + 1]; @@ -177,8 +177,8 @@ class Assembler implements Constants { case opc_lookupswitch: { SwitchData sw = (SwitchData)inst.value; optimize(env, sw.defaultLabel); - for (Enumeration e = sw.tab.elements() ; e.hasMoreElements();) { - optimize(env, (Label)e.nextElement()); + for (Enumeration" }, + "" }, {"./" + BUG_ID + "/C.html", "

                              isPaused

                              " + NL + "
                              public final double isPaused()
                              " + NL + diff --git a/langtools/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java b/langtools/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java index 65df0626c85..11c3eaba738 100644 --- a/langtools/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java +++ b/langtools/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,11 +23,11 @@ /* * @test - * @bug 4232882 + * @bug 4232882 8014636 * @summary Javadoc strips all of the leading spaces when the comment * does not begin with a star. This RFE allows users to * begin their comment without a leading star without leading - * spaces striped + * spaces stripped * @author jamieh * @library ../lib/ * @build JavadocTester @@ -37,15 +37,15 @@ public class LeadingSpaces extends JavadocTester { - private static final String BUG_ID = "4232882"; + private static final String BUG_ID = "4232882-8014636"; private static final String[][] TEST = { {BUG_ID + FS + "LeadingSpaces.html", -" 1\n" + -" 2\n" + -" 3\n" + -" 4\n" + -" 5\n" + -" 6\n" + +" 1" + NL + +" 2" + NL + +" 3" + NL + +" 4" + NL + +" 5" + NL + +" 6" + NL + " 7"} }; private static final String[][] NEGATED_TEST = NO_TEST; diff --git a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java index 74e81a8ed74..4720fe4d2be 100644 --- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java +++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4732864 6280605 7064544 + * @bug 4732864 6280605 7064544 8014636 * @summary Make sure that you can link from one member to another using * non-qualified name, furthermore, ensure the right one is linked. * @author jamieh @@ -36,7 +36,7 @@ public class TestLinkTaglet extends JavadocTester { //Test information. - private static final String BUG_ID = "4732864-6280605-7064544"; + private static final String BUG_ID = "4732864-6280605-7064544-8014636"; //Javadoc arguments. private static final String[] ARGS = new String[] { @@ -46,16 +46,16 @@ public class TestLinkTaglet extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "C.html", - "Qualified Link:
                              C.InnerC.
                              \n" + - " Unqualified Link1: C.InnerC.
                              \n" + - " Unqualified Link2: C.InnerC.
                              \n" + - " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
                              \n" + - " Unqualified Link: method(C.InnerC, C.InnerC2).
                              \n" + + "Qualified Link: C.InnerC.
                              " + NL + + " Unqualified Link1: C.InnerC.
                              " + NL + + " Unqualified Link2: C.InnerC.
                              " + NL + + " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
                              " + NL + + " Unqualified Link: method(C.InnerC, C.InnerC2).
                              " + NL + " Unqualified Link: method(InnerC, InnerC2).
                              " }, {BUG_ID + FS + "pkg" + FS + "C.InnerC.html", - "Link to member in outer class: C.MEMBER
                              \n" + - " Link to member in inner class: C.InnerC2.MEMBER2
                              \n" + + "Link to member in outer class: C.MEMBER
                              " + NL + + " Link to member in inner class: C.InnerC2.MEMBER2
                              " + NL + " Link to another inner class: C.InnerC2" }, {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html", diff --git a/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java b/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java index bce27a98c00..592dd524d28 100644 --- a/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java +++ b/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8002387 + * @bug 8002387 8014636 * @summary Improve rendered HTML formatting for {@code} * @library ../lib/ * @build JavadocTester TestLiteralCodeInPre @@ -33,7 +33,7 @@ public class TestLiteralCodeInPre extends JavadocTester { //Test information. - private static final String BUG_ID = "8002387"; + private static final String BUG_ID = "8002387-8014636"; private static final String OUTPUT_DIR = BUG_ID; //Javadoc arguments. diff --git a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java index 47873bc3433..4d90d8791fb 100644 --- a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java +++ b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,7 +72,7 @@ public class TestMemberInheritence extends JavadocTester { // Test overriding/implementing methods with generic parameters. {BUG_ID + FS + "pkg" + FS + "BaseClass.html", - "
                              " + NL + "
                              Specified by:
                              " + NL + + "
                              " + NL + "
                              Specified by:
                              " + NL + "
                              " + "getAnnotation in interface " + "" + diff --git a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java index e30f579d4fe..fdbb664deff 100644 --- a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java +++ b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,8 +49,8 @@ public class TestMemberSummary extends JavadocTester { // Check return type in member summary. {BUG_ID + FS + "pkg" + FS + "PublicChild.html", "PublicChild" + NL + - "
                              " + "Foo2> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", - "" + "Foo2> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", - "" + "Foo3>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", - "" + "Foo3>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", - "" + "Foo4>>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "" + "Foo4>>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", "" + NL + "" + NL + "" + NL + "" + NL + "" + NL + "" @@ -698,25 +698,25 @@ public class TestNewLanguageFeatures extends JavadocTester { {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Class Annotation\"," + NL + " required=1994)" + NL + - "public class AnnotationTypeUsage
                              extends java.lang.Object
                              "}, + "public class AnnotationTypeUsage
                              extends java.lang.Object
                              "}, //FIELD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Field Annotation\"," + NL + " required=1994)" + NL + - "public int field"}, + "public int field"}, //CONSTRUCTOR {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Constructor Annotation\"," + NL + " required=1994)" + NL + - "public AnnotationTypeUsage()"}, + "public AnnotationTypeUsage()"}, //METHOD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Method Annotation\"," + NL + " required=1994)" + NL + - "public void method()"}, + "public void method()"}, //================================= // Make sure annotation types do not diff --git a/langtools/test/com/sun/javadoc/testOptions/TestOptions.java b/langtools/test/com/sun/javadoc/testOptions/TestOptions.java new file mode 100644 index 00000000000..1327ff47737 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testOptions/TestOptions.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4749567 + * @summary Test the output for -header and -footer options. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestOptions + * @run main TestOptions + */ + +public class TestOptions extends JavadocTester { + + //Test information. + private static final String BUG_ID = "4749567"; + + //Javadoc arguments. + private static final String[] ARGS = new String[] { + "-d", BUG_ID, "-header", "Test header", "-footer", "Test footer", + "-sourcepath", SRC_DIR, "pkg" + }; + + private static final String[][] TEST = { + {BUG_ID + FS + "pkg" + FS + "package-summary.html", + "
                              Test header
                              "}, + {BUG_ID + FS + "pkg" + FS + "package-summary.html", + "
                              Test footer
                              "} + }; + + private static final String[][] NEGATED_TEST = NO_TEST; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestOptions tester = new TestOptions(); + run(tester, ARGS, TEST, NEGATED_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +} + diff --git a/langtools/test/com/sun/javadoc/testOptions/pkg/Foo.java b/langtools/test/com/sun/javadoc/testOptions/pkg/Foo.java new file mode 100644 index 00000000000..b2a32176bd1 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testOptions/pkg/Foo.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +public class Foo {} + diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java index 7568b0a2516..68999480d44 100644 --- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java +++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,9 +46,9 @@ public class TestOverridenMethodDocCopy extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Description copied from class: " + + "Description copied from class: " + "" + - "BaseClass" + "BaseClass" } }; private static final String[][] NEGATED_TEST = NO_TEST; diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java index aa136d8be91..21a6760d308 100644 --- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java +++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,12 +40,12 @@ public class TestOverridenPrivateMethods extends JavadocTester { private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
                              Overrides:
                              " + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              " + "publicMethod in class " + "BaseClass
                              "}, //The public method in different package should be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
                              Overrides:
                              " + NL + + "
                              Overrides:
                              " + NL + "
                              " + "publicMethod in class " + "BaseClass
                              "}, @@ -55,7 +55,7 @@ public class TestOverridenPrivateMethodsWithPackageFlag extends JavadocTester { //The package private method should be overriden since the base and sub class are in the same //package. {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
                              Overrides:
                              " + NL + + "
                              Overrides:
                              " + NL + "
                              " + "packagePrivateMethod in class " + "BaseClass
                              "} @@ -65,18 +65,18 @@ public class TestOverridenPrivateMethodsWithPackageFlag extends JavadocTester { //The private method in should not be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
                              Overrides:
                              " + NL + + "
                              Overrides:
                              " + NL + "
                              "}, //The private method in different package should not be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
                              Overrides:
                              " + NL + + "
                              Overrides:
                              " + NL + "
                              "}, //The package private method should not be overriden since the base and sub class are in //different packages. {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
                              Overrides:
                              " + NL + + "
                              Overrides:
                              " + NL + "
                              "}, }; diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java index b8b5e7329c4..fbcd30e8b37 100644 --- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java +++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,18 +40,18 @@ public class TestOverridenPrivateMethodsWithPrivateFlag extends JavadocTester { private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
                              Overrides:
                              " + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Overrides:" + NL + + "
                              Overrides:
                              " + NL + "
                              Deprecated." + NL + - "
                              This package is Deprecated.
                              " + "
                              This package is Deprecated." + + "
                              " }, {BUG_ID + "-1" + FS + "deprecated-list.html", "
                            • Deprecated Packages
                            • " diff --git a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java index 9ff91c2d5c9..b6ae263d8a4 100644 --- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java +++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java @@ -112,12 +112,12 @@ public class TestPrivateClasses extends JavadocTester { private static final String[][] NEGATED_TEST1 = { // Should not document that a method overrides method from private class. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "Overrides:"}, + "Overrides:"}, // Should not document that a method specified by private interface. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "Specified by:"}, + "Specified by:"}, {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", - "Specified by:"}, + "Specified by:"}, // Should not mention that any documentation was copied. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", "Description copied from"}, @@ -139,7 +139,7 @@ public class TestPrivateClasses extends JavadocTester { //Do not inherit private interface method with generic parameters. //This method has been implemented. {BUG_ID + "-1" + FS + "pkg2" + FS + "C.html", - "hello"}, + "hello"}, }; // Test output when -private flag is used. @@ -176,14 +176,14 @@ public class TestPrivateClasses extends JavadocTester { }, // Should document that a method overrides method from private class. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "
                              Overrides:
                              " + NL + + "
                              Overrides:
                              " + NL + "
                              " + "methodOverridenFromParent in class " + "" + "PrivateParent
                              "}, // Should document that a method is specified by private interface. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "
                              Specified by:
                              " + NL + + "
                              Specified by:
                              " + NL + "
                              " + "methodInterface in interface " + "" + @@ -227,11 +227,11 @@ public class TestPrivateClasses extends JavadocTester { //Since private flag is used, we can document that private interface method //with generic parameters has been implemented. {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", - "Description copied from interface: " + - "I"}, + "Description copied from interface: " + + "I"}, {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", - "
                              Specified by:
                              " + NL + + "
                              Specified by:
                              " + NL + "
                              hello" + " in interface " + "I" + diff --git a/langtools/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java b/langtools/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java index e8c2d057753..513d738f684 100644 --- a/langtools/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java +++ b/langtools/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,11 +23,9 @@ /* * @test - * @bug 4460354 + * @bug 4460354 8014636 * @summary Test to make sure that relative paths are redirected in the * output so that they are not broken. - * NOTE: these tests have \\n instead of NL because they are user - * generated new lines, not Java generated. * @author jamieh * @library ../lib/ * @build JavadocTester @@ -38,7 +36,7 @@ public class TestRelativeLinks extends JavadocTester { //Test information. - private static final String BUG_ID = "4460354"; + private static final String BUG_ID = "4460354-8014636"; //Javadoc arguments. private static final String[] ARGS = new String[] { @@ -58,7 +56,7 @@ public class TestRelativeLinks extends JavadocTester { {BUG_ID + FS + "pkg" + FS + "package-summary.html", "relative package link"}, {BUG_ID + FS + "pkg" + FS + "C.html", - " relative-multi-line-link."}, //These relative paths should be redirected because they are in different @@ -74,7 +72,7 @@ public class TestRelativeLinks extends JavadocTester { {BUG_ID + FS + "index-all.html", "relative package link"}, {BUG_ID + FS + "index-all.html", - " relative-multi-line-link."}, @@ -92,7 +90,7 @@ public class TestRelativeLinks extends JavadocTester { {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", "relative package link"}, {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", - " relative-multi-line-link."}, //PACKAGE OVERVIEW diff --git a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java index fd026b9ad49..760d24af458 100644 --- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java +++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java @@ -47,9 +47,9 @@ public class TestSerializedFormDeprecationInfo extends JavadocTester { "" + NL + "
                              " + "C1.setUndecorated(boolean)
                              " + NL + ""}, {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + " As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + + "setUndecorated(boolean)." + NL + "
                              This field indicates whether the C1 " + "is undecorated.
                              " + NL + " " + NL + "
                              " + NL + "
                              Since:
                              " + NL + @@ -57,9 +57,9 @@ public class TestSerializedFormDeprecationInfo extends JavadocTester { "" + NL + "
                              " + "C1.setUndecorated(boolean)
                              " + NL + "
                              "}, {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + " As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + + "setUndecorated(boolean)." + NL + "
                              Reads the object stream.
                              " + NL + "
                              " + NL + "
                              Throws:
                              " + NL + "
                              " + "IOException
                              " + NL + @@ -73,15 +73,15 @@ public class TestSerializedFormDeprecationInfo extends JavadocTester { // information if any. private static final String[][] TEST_NOCMNT = { {BUG_ID + FS + "serialized-form.html", "
                              boolean undecorated
                              " + NL + - "
                              Deprecated. " + + "
                              Deprecated. " + "As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean).
                              " + NL + ""}, + "setUndecorated(boolean)
                              .
                              " + NL + ""}, {BUG_ID + FS + "serialized-form.html", "" + - "Deprecated. As of JDK version" + + "Deprecated. As of JDK version" + " 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + ""}}; + "setUndecorated(boolean)." + NL + ""}}; // Test with -nodeprecated option. The serialized-form.html should // ignore the -nodeprecated tag and display the deprecation info. This diff --git a/langtools/test/tools/doclint/AnchorTest2.java b/langtools/test/tools/doclint/AnchorTest2.java new file mode 100644 index 00000000000..7d7441fbd37 --- /dev/null +++ b/langtools/test/tools/doclint/AnchorTest2.java @@ -0,0 +1,20 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8020313 + * @summary doclint doesn't reset HTML anchors correctly + * @build DocLintTester + * @run main DocLintTester -ref AnchorTest2.out AnchorTest2.java AnchorTest2a.java + * @run main DocLintTester -ref AnchorTest2.out AnchorTest2a.java AnchorTest2.java + */ + +/** */ +public class AnchorTest2 { + /** */ + public void a_name_AnchorTest2() { } + + /** */ + public void a_name_AnchorTest2_already_defined() { } + + /** */ + public void a_name_AnchorTest2a_defined_in_other_file() { } +} diff --git a/langtools/test/tools/doclint/AnchorTest2.out b/langtools/test/tools/doclint/AnchorTest2.out new file mode 100644 index 00000000000..a9762949686 --- /dev/null +++ b/langtools/test/tools/doclint/AnchorTest2.out @@ -0,0 +1,4 @@ +AnchorTest2.java:15: error: anchor already defined: AnchorTest2 + /** */ + ^ +1 error diff --git a/langtools/test/tools/doclint/AnchorTest2a.java b/langtools/test/tools/doclint/AnchorTest2a.java new file mode 100644 index 00000000000..3a197138931 --- /dev/null +++ b/langtools/test/tools/doclint/AnchorTest2a.java @@ -0,0 +1,7 @@ +/* /nodynamiccopyright/ */ + +/** + * + */ +public class AnchorTest2a { } + diff --git a/langtools/test/tools/doclint/BadPackageCommentTest.out b/langtools/test/tools/doclint/BadPackageCommentTest.out index 57b4db9c1b2..768d9cb457d 100644 --- a/langtools/test/tools/doclint/BadPackageCommentTest.out +++ b/langtools/test/tools/doclint/BadPackageCommentTest.out @@ -1,3 +1,6 @@ +BadPackageCommentTest.java:13: warning: documentation comment not expected here +package p; +^ BadPackageCommentTest.java:11: error: no tag name after @ * @@@ ^ @@ -8,3 +11,4 @@ BadPackageCommentTest.java:11: error: no tag name after @ * @@@ ^ 3 errors +1 warning diff --git a/langtools/test/tools/doclint/DocLintTester.java b/langtools/test/tools/doclint/DocLintTester.java index 848e284b57d..78c052a695c 100644 --- a/langtools/test/tools/doclint/DocLintTester.java +++ b/langtools/test/tools/doclint/DocLintTester.java @@ -123,7 +123,7 @@ public class DocLintTester { private static final Pattern dirFileLine = Pattern.compile( "(?m)" // multi-line mode + "^(.*?)" // directory part of file name - + "([A-Za-z0-9.]+:[0-9]+:)"); // file name and line number + + "([-A-Za-z0-9.]+:[0-9]+:)"); // file name and line number String removeFileNames(String s) { Matcher m = dirFileLine.matcher(s); diff --git a/langtools/test/tools/doclint/ReferenceTest.java b/langtools/test/tools/doclint/ReferenceTest.java index e25c56c3bdb..57b26aeff24 100644 --- a/langtools/test/tools/doclint/ReferenceTest.java +++ b/langtools/test/tools/doclint/ReferenceTest.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 8004832 + * @bug 8004832 8020556 * @summary Add new doclint package * @build DocLintTester * @run main DocLintTester -Xmsgs:-reference ReferenceTest.java @@ -48,5 +48,11 @@ public class ReferenceTest { * @throws Exception description */ public void exception_not_thrown() { } + + /** + * @param throwable + * @throws T description + */ + public void valid_throws_generic() throws T { } } diff --git a/langtools/test/tools/doclint/packageTests/bad/Test.java b/langtools/test/tools/doclint/packageTests/bad/Test.java new file mode 100644 index 00000000000..83706d30fd5 --- /dev/null +++ b/langtools/test/tools/doclint/packageTests/bad/Test.java @@ -0,0 +1,16 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8020664 8021215 + * @summary doclint gives incorrect warnings on normal package statements + * @library ../.. + * @build DocLintTester + * @run main DocLintTester -ref Test.out Test.java + * @compile/fail/ref=Test.javac.out -XDrawDiagnostics -Werror -Xdoclint:all Test.java + */ + +/** Unexpected comment */ +package bad; + +/** */ +class Test { } + diff --git a/langtools/test/tools/doclint/packageTests/bad/Test.javac.out b/langtools/test/tools/doclint/packageTests/bad/Test.javac.out new file mode 100644 index 00000000000..0967f4de35a --- /dev/null +++ b/langtools/test/tools/doclint/packageTests/bad/Test.javac.out @@ -0,0 +1,4 @@ +Test.java:12:1: compiler.warn.proc.messager: documentation comment not expected here +- compiler.err.warnings.and.werror +1 error +1 warning diff --git a/langtools/test/tools/doclint/packageTests/bad/Test.out b/langtools/test/tools/doclint/packageTests/bad/Test.out new file mode 100644 index 00000000000..76a55121956 --- /dev/null +++ b/langtools/test/tools/doclint/packageTests/bad/Test.out @@ -0,0 +1,4 @@ +Test.java:12: warning: documentation comment not expected here +package bad; +^ +1 warning diff --git a/langtools/test/tools/doclint/packageTests/bad/package-info.java b/langtools/test/tools/doclint/packageTests/bad/package-info.java new file mode 100644 index 00000000000..2653c89b8b5 --- /dev/null +++ b/langtools/test/tools/doclint/packageTests/bad/package-info.java @@ -0,0 +1,12 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8020664 8021215 + * @summary doclint gives incorrect warnings on normal package statements + * @library ../.. + * @build DocLintTester + * @run main DocLintTester -ref package-info.out package-info.java + * @compile/fail/ref=package-info.javac.out -XDrawDiagnostics -Werror -Xdoclint:all package-info.java + */ + +// missing comment +package bad; diff --git a/langtools/test/tools/doclint/packageTests/bad/package-info.javac.out b/langtools/test/tools/doclint/packageTests/bad/package-info.javac.out new file mode 100644 index 00000000000..184eb41d017 --- /dev/null +++ b/langtools/test/tools/doclint/packageTests/bad/package-info.javac.out @@ -0,0 +1,4 @@ +package-info.java:12:1: compiler.warn.proc.messager: no comment +- compiler.err.warnings.and.werror +1 error +1 warning diff --git a/langtools/test/tools/doclint/packageTests/bad/package-info.out b/langtools/test/tools/doclint/packageTests/bad/package-info.out new file mode 100644 index 00000000000..1d07cd65ba0 --- /dev/null +++ b/langtools/test/tools/doclint/packageTests/bad/package-info.out @@ -0,0 +1,4 @@ +package-info.java:12: warning: no comment +package bad; +^ +1 warning diff --git a/langtools/test/tools/doclint/packageTests/good/Test.java b/langtools/test/tools/doclint/packageTests/good/Test.java new file mode 100644 index 00000000000..223d89a3bf3 --- /dev/null +++ b/langtools/test/tools/doclint/packageTests/good/Test.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test /nodynamiccopyright/ + * @bug 8020664 8021215 + * @summary doclint gives incorrect warnings on normal package statements + * @library ../.. + * @build DocLintTester + * @run main DocLintTester Test.java + * @compile -Xdoclint:all Test.java + */ + +// no doc comment +package good; + +/** */ +class Test { } + diff --git a/langtools/test/tools/doclint/packageTests/good/package-info.java b/langtools/test/tools/doclint/packageTests/good/package-info.java new file mode 100644 index 00000000000..d60412d91ee --- /dev/null +++ b/langtools/test/tools/doclint/packageTests/good/package-info.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test /nodynamiccopyright/ + * @bug 8020664 8021215 + * @summary doclint gives incorrect warnings on normal package statements + * @library ../.. + * @build DocLintTester + * @run main DocLintTester package-info.java + * @compile -Xdoclint:all package-info.java + */ + +/** Description. */ +package good; diff --git a/langtools/test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java b/langtools/test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java new file mode 100644 index 00000000000..2e7edbb58b9 --- /dev/null +++ b/langtools/test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java @@ -0,0 +1,46 @@ + +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8020997 + * @summary Cannot compile class with repeating annotation + * @compile CannotCompileRepeatedAnnoTest.java + */ + +import java.lang.annotation.*; + +@Anno(req = true) +@Anno() +public class CannotCompileRepeatedAnnoTest { +} + +@Repeatable(Container.class) +@interface Anno { + boolean req() default false; +} + +@interface Container{ + Anno[] value(); +} diff --git a/langtools/test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java b/langtools/test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java new file mode 100644 index 00000000000..d573dd552a6 --- /dev/null +++ b/langtools/test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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 8022186 + * @summary javac generates dead code if a try with an empty body has a finalizer + */ + +import com.sun.tools.classfile.Attribute; +import com.sun.tools.classfile.ClassFile; +import com.sun.tools.classfile.Code_attribute; +import com.sun.tools.classfile.ConstantPool; +import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info; +import com.sun.tools.classfile.ConstantPool.CPInfo; +import com.sun.tools.classfile.ConstantPool.InvalidIndex; +import com.sun.tools.classfile.Instruction; +import com.sun.tools.classfile.Instruction.KindVisitor; +import com.sun.tools.classfile.Instruction.TypeKind; +import com.sun.tools.classfile.Method; +import com.sun.tools.javac.util.Assert; +import java.io.BufferedInputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class DeadCodeGeneratedForEmptyTryTest { + + public static void main(String[] args) throws Exception { + new DeadCodeGeneratedForEmptyTryTest().run(); + } + + void run() throws Exception { + checkClassFile(Paths.get(System.getProperty("test.classes"), + this.getClass().getName() + "$Test.class")); + } + + int utf8Index; + int numberOfRefToStr = 0; + ConstantPool constantPool; + + void checkClassFile(final Path path) throws Exception { + ClassFile classFile = ClassFile.read( + new BufferedInputStream(Files.newInputStream(path))); + constantPool = classFile.constant_pool; + utf8Index = constantPool.getUTF8Index("STR_TO_LOOK_FOR"); + for (Method method: classFile.methods) { + if (method.getName(constantPool).equals("methodToLookFor")) { + Code_attribute codeAtt = (Code_attribute)method.attributes.get(Attribute.Code); + for (Instruction inst: codeAtt.getInstructions()) { + inst.accept(codeVisitor, null); + } + } + } + Assert.check(numberOfRefToStr == 1, + "There should only be one reference to a CONSTANT_String_info structure in the generated code"); + } + + CodeVisitor codeVisitor = new CodeVisitor(); + + class CodeVisitor implements KindVisitor { + + void checkIndirectRefToString(int cp_index) { + try { + CPInfo cInfo = constantPool.get(cp_index); + if (cInfo instanceof CONSTANT_String_info) { + CONSTANT_String_info strInfo = (CONSTANT_String_info)cInfo; + if (strInfo.string_index == utf8Index) { + numberOfRefToStr++; + } + } + } catch (InvalidIndex ex) { + throw new AssertionError("invalid constant pool index at " + cp_index); + } + } + + @Override + public Void visitNoOperands(Instruction instr, Void p) { + return null; + } + + @Override + public Void visitArrayType(Instruction instr, TypeKind kind, Void p) { + return null; + } + + @Override + public Void visitBranch(Instruction instr, int offset, Void p) { + return null; + } + + @Override + public Void visitConstantPoolRef(Instruction instr, int index, Void p) { + checkIndirectRefToString(index); + return null; + } + + @Override + public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Void p) { + checkIndirectRefToString(index); + return null; + } + + @Override + public Void visitLocal(Instruction instr, int index, Void p) { + return null; + } + + @Override + public Void visitLocalAndValue(Instruction instr, int index, int value, Void p) { + return null; + } + + @Override + public Void visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, Void p) { + return null; + } + + @Override + public Void visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, Void p) { + return null; + } + + @Override + public Void visitValue(Instruction instr, int value, Void p) { + return null; + } + + @Override + public Void visitUnknown(Instruction instr, Void p) { + return null; + } + + } + + public class Test { + void methodToLookFor() { + try { + } finally { + System.out.println("STR_TO_LOOK_FOR"); + } + } + } +} diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/ErasureTest.java b/langtools/test/tools/javac/annotations/typeAnnotations/ErasureTest.java new file mode 100644 index 00000000000..d4131a9b912 --- /dev/null +++ b/langtools/test/tools/javac/annotations/typeAnnotations/ErasureTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8016013 + * @summary Compiler incorrectly treats annotated and unannotated type variable bounds as different types + * @compile -doe ErasureTest.java + */ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER }) +@interface Advanced {} + +class U {} +interface I {} + +class ErasureTest { + void TestMethod(T arg1) { } + public static void main(String argv[]) { + ErasureTest t1 = new ErasureTest(){ + public void TestMethod(T arg1) { } + }; + + ErasureTest t2 = new ErasureTest(){ + public void TestMethod(T arg1) { } + }; + } +} diff --git a/langtools/test/tools/javac/diags/examples/MethodInvokedWithWrongNumberOfArgs.java b/langtools/test/tools/javac/diags/examples/MethodInvokedWithWrongNumberOfArgs.java new file mode 100644 index 00000000000..e4a782b4954 --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/MethodInvokedWithWrongNumberOfArgs.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.method.invoked.with.incorrect.number.arguments +// options: -Xlint:-options -source 6 -target 6 + +class MethodInvokedWithWrongNumberOfArgs { + static java.lang.invoke.MethodHandle getNamedMember; + public static Object getMember(String name, Object rec) throws Throwable { + return getNamedMember.invoke(rec, name); + } +} diff --git a/langtools/test/tools/javac/diags/examples/ReportAccessFragment.java b/langtools/test/tools/javac/diags/examples/ReportAccessFragment.java new file mode 100644 index 00000000000..8acba1d6b66 --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/ReportAccessFragment.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.prob.found.req +// key: compiler.misc.invalid.mref +// key: compiler.misc.report.access + +class ReportAccessFragment { + void test(Object o) { + Runnable r = o::clone; + } +} diff --git a/langtools/test/tools/javac/diags/examples/VarNotIntializedInDefaultConstructor.java b/langtools/test/tools/javac/diags/examples/VarNotIntializedInDefaultConstructor.java new file mode 100644 index 00000000000..91f44a35a9b --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/VarNotIntializedInDefaultConstructor.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.var.not.initialized.in.default.constructor + +class X { + final int j; +} diff --git a/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java b/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java index 57bbe4a92b3..d3f41e44fb7 100644 --- a/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java +++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 6939780 7020044 8009459 + * @bug 6939780 7020044 8009459 8021338 * * @summary add a warning to detect diamond sites * @author mcimadamore @@ -36,4 +36,15 @@ class T6939780 { void gw(Foo fw) { } void gn(Foo fn) { } + + static class Foo2 { + X copy(X t) { + return t; + } + } + + void testReciever() { + Number s = new Foo2().copy(0); + } + } diff --git a/langtools/test/tools/javac/jvm/T8020689.java b/langtools/test/tools/javac/jvm/T8020689.java new file mode 100644 index 00000000000..ce8bcb6a17a --- /dev/null +++ b/langtools/test/tools/javac/jvm/T8020689.java @@ -0,0 +1,36 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8020689 + * @summary Making sure the LineNumberTable entry is correctly generated for the leading method invocation in the else section + * @compile T8020689.java + * @run main T8020689 + */ + +public class T8020689 { + + public static void main(String... args) { + if (args.length > 0) { + a(); + } else { + b(); + } + } + + static void a() { + } + + static void b() { + assertLine(15); + } + + public static void assertLine(int expectedline) { + Exception e = new Exception("expected line#: " + expectedline); + int myline = e.getStackTrace()[2].getLineNumber(); + if( myline != expectedline) { + throw new RuntimeException("Incorrect line number " + + "expected: " + expectedline + + ", got: " + myline, e); + } + System.out.format("Got expected line number %d correct %n", myline); + } +} diff --git a/langtools/test/tools/javac/lambda/8016081/T8016081.java b/langtools/test/tools/javac/lambda/8016081/T8016081.java new file mode 100644 index 00000000000..648955f83cc --- /dev/null +++ b/langtools/test/tools/javac/lambda/8016081/T8016081.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8016081 + * @summary field initialized with lambda in annotation types doesn't compile + * @compile T8016081.java + */ + +class T8016081 { + interface fint { int get(); } + + @interface atype { + fint fld = ()->( fld == null ?0 : 1); + } + + @atype class T {} +} diff --git a/langtools/test/tools/javac/lambda/8020804/T8020804.java b/langtools/test/tools/javac/lambda/8020804/T8020804.java new file mode 100644 index 00000000000..ce8b98e6c11 --- /dev/null +++ b/langtools/test/tools/javac/lambda/8020804/T8020804.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8020804 + * @summary javac crashes when speculative attribution infers intersection type with array component + * @compile T8020804.java + */ + +import java.util.*; + +class T8020804 { + interface Supplier { + D make(); + } + + void m(Object o) { } + void m(char[] c) { } + + > C g(Supplier sc) { return null; } + + void test() { + m(g(LinkedList::new)); + } +} diff --git a/langtools/test/tools/javac/lambda/8020843/T8020843a.java b/langtools/test/tools/javac/lambda/8020843/T8020843a.java new file mode 100644 index 00000000000..1b3e890bcfc --- /dev/null +++ b/langtools/test/tools/javac/lambda/8020843/T8020843a.java @@ -0,0 +1,16 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8020843 + * @summary javac crashes on accessibility check with method reference with typevar receiver + * @compile/fail/ref=T8020843a.out -XDrawDiagnostics T8020843a.java + */ + +class T8020843a { + interface Function { + Y m(X x); + } + + void test(T t) { + Function ss = T::clone; + } +} diff --git a/langtools/test/tools/javac/lambda/8020843/T8020843a.out b/langtools/test/tools/javac/lambda/8020843/T8020843a.out new file mode 100644 index 00000000000..8b89eee32d2 --- /dev/null +++ b/langtools/test/tools/javac/lambda/8020843/T8020843a.out @@ -0,0 +1,2 @@ +T8020843a.java:14:34: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.report.access: clone(), protected, java.lang.Object)) +1 error diff --git a/langtools/test/tools/javac/lambda/8020843/T8020843b.java b/langtools/test/tools/javac/lambda/8020843/T8020843b.java new file mode 100644 index 00000000000..727b2cdebfc --- /dev/null +++ b/langtools/test/tools/javac/lambda/8020843/T8020843b.java @@ -0,0 +1,27 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8020843 + * @summary javac crashes on accessibility check with method reference with typevar receiver + * @compile/fail/ref=T8020843b.out -XDrawDiagnostics T8020843b.java + */ + +class T8020843b { + interface Function { + Y m(X x); + } + + interface BiFunction { + Z m(X x, Y y); + } + + Object m(int i) { return null; } + static Object m(String t) { return null; } + + Object m2(int i) { return null; } + static Object m2(long t) { return null; } + + static void test() { + Function f1 = T8020843b::m; //show bound case diag + BiFunction f2 = T8020843b::m2; //show unbound case diag + } +} diff --git a/langtools/test/tools/javac/lambda/8020843/T8020843b.out b/langtools/test/tools/javac/lambda/8020843/T8020843b.out new file mode 100644 index 00000000000..41b38c80b68 --- /dev/null +++ b/langtools/test/tools/javac/lambda/8020843/T8020843b.out @@ -0,0 +1,3 @@ +T8020843b.java:24:42: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m, T8020843b,{(compiler.misc.inapplicable.method: kindname.method, T8020843b, m(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: T8020843b, int))),(compiler.misc.inapplicable.method: kindname.method, T8020843b, m(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: T8020843b, java.lang.String)))})) +T8020843b.java:25:52: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m2, T8020843b,java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, T8020843b, m2(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, int))),(compiler.misc.inapplicable.method: kindname.method, T8020843b, m2(long), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, long)))})) +2 errors diff --git a/langtools/test/tools/javac/lambda/MethodReference28.out b/langtools/test/tools/javac/lambda/MethodReference28.out index 123cb5170a0..042ade19c13 100644 --- a/langtools/test/tools/javac/lambda/MethodReference28.out +++ b/langtools/test/tools/javac/lambda/MethodReference28.out @@ -9,6 +9,6 @@ MethodReference28.java:45:19: compiler.err.prob.found.req: (compiler.misc.invali MethodReference28.java:46:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))) MethodReference28.java:47:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String)))) MethodReference28.java:52:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer,java.lang.Integer, MethodReference28,int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: MethodReference28, java.lang.Integer)))) -MethodReference28.java:53:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, MethodReference28,int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch))) +MethodReference28.java:53:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, MethodReference28,int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))) MethodReference28.java:54:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m4, java.lang.String[], MethodReference28,int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: MethodReference28, java.lang.String)))) 13 errors diff --git a/langtools/test/tools/javac/positions/TreeEndPosTest.java b/langtools/test/tools/javac/positions/TreeEndPosTest.java new file mode 100644 index 00000000000..961803762e1 --- /dev/null +++ b/langtools/test/tools/javac/positions/TreeEndPosTest.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8017216 8019422 8019421 + * @summary verify start and end positions + * @run main TreeEndPosTest + */ + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import javax.tools.Diagnostic; +import javax.tools.DiagnosticCollector; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileManager; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.ToolProvider; + +public class TreeEndPosTest { + private static JavaFileManager getJavaFileManager(JavaCompiler compiler, + DiagnosticCollector dc) { + return compiler.getStandardFileManager(dc, null, null); + } + + static class JavaSource extends SimpleJavaFileObject { + + final String source; + int startPos; + int endPos; + + private JavaSource(String filename, String source) { + super(URI.create("myfo:/" + filename), JavaFileObject.Kind.SOURCE); + this.source = source; + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source; + } + + static JavaSource createJavaSource(String preamble, String body, + String postamble, String expected) { + JavaSource js = createJavaSource(preamble, body, postamble, -1, -1); + js.startPos = js.source.indexOf(expected); + js.endPos = js.startPos + expected.length(); + return js; + } + + static JavaSource createJavaSource(String body, String expected) { + return createJavaSource(null, body, null, expected); + } + + private static JavaSource createJavaSource(String preamble, String body, + String postamble, int start, int end) { + final String name = "Bug"; + StringBuilder code = new StringBuilder(); + if (preamble != null) { + code.append(preamble); + } + code.append("public class " + name + "{"); + if (body != null) { + code.append(body); + } + code.append("}"); + if (postamble != null) { + code.append(postamble); + } + JavaSource js = new JavaSource(name + ".java", code.toString()); + js.startPos = start; + js.endPos = end; + return js; + } + } + + public static void main(String... args) throws IOException { + testUninitializedVariable(); + testMissingAnnotationValue(); + testFinalVariableWithDefaultConstructor(); + testFinalVariableWithConstructor(); + } + + static void testUninitializedVariable() throws IOException { + compile(JavaSource.createJavaSource("Object o = new A().new B(); class A { }", + "B()")); + } + static void testMissingAnnotationValue() throws IOException { + compile(JavaSource.createJavaSource("@Foo(\"vvvv\")", + null, "@interface Foo { }", "\"vvvv\"")); + } + + static void testFinalVariableWithDefaultConstructor() throws IOException { + compile(JavaSource.createJavaSource("private static final String Foo; public void bar() { }", + "private static final String Foo;")); + } + + static void testFinalVariableWithConstructor() throws IOException { + compile(JavaSource.createJavaSource("public Bug (){} private static final String Foo; public void bar() { }", + "{}")); + } + + static void compile(JavaSource src) throws IOException { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(ba); + File tempDir = new File("."); + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + DiagnosticCollector dc = new DiagnosticCollector(); + JavaFileManager javaFileManager = getJavaFileManager(compiler, dc); + List options = new ArrayList<>(); + options.add("-cp"); + options.add(tempDir.getPath()); + options.add("-d"); + options.add(tempDir.getPath()); + options.add("-XDshouldStopPolicy=GENERATE"); + + List sources = new ArrayList<>(); + sources.add(src); + JavaCompiler.CompilationTask task = + compiler.getTask(writer, javaFileManager, + dc, options, null, + sources); + task.call(); + for (Diagnostic diagnostic : (List) dc.getDiagnostics()) { + long actualStart = diagnostic.getStartPosition(); + long actualEnd = diagnostic.getEndPosition(); + System.out.println("Source: " + src.source); + System.out.println("Diagnostic: " + diagnostic); + System.out.print("Start position: Expected: " + src.startPos); + System.out.println(", Actual: " + actualStart); + System.out.print("End position: Expected: " + src.endPos); + System.out.println(", Actual: " + actualEnd); + if (src.startPos != actualStart || src.endPos != actualEnd) { + throw new RuntimeException("error: trees don't match"); + } + } + } +} diff --git a/langtools/test/tools/javac/processing/model/element/8009367/TestQualifiedNameUsed.java b/langtools/test/tools/javac/processing/model/element/8009367/TestQualifiedNameUsed.java new file mode 100644 index 00000000000..5a8b12de589 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/element/8009367/TestQualifiedNameUsed.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8009367 + * @summary Test that the correct kind of names (binary) are used when comparing + * Class and Symbol for repeatable Classes. + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor TestQualifiedNameUsed p.Q p.QQ p.R p.RR + * @run compile -processor TestQualifiedNameUsed -proc:only TestQualifiedNameUsed.java + */ + +import java.lang.annotation.Repeatable; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import static javax.lang.model.util.ElementFilter.*; + +import com.sun.tools.javac.util.Assert; + +import java.util.Arrays; + +public class TestQualifiedNameUsed extends JavacTestingAbstractProcessor { + @Q + @p.Q + @p.R.Q + public boolean process(Set annotations, + RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + boolean hasRun = false; + for (Element element : roundEnv.getRootElements()) { + for (ExecutableElement e : methodsIn(element.getEnclosedElements())) { + if (e.getSimpleName().contentEquals("value")) + continue; // don't want to look Q.value() in this file + + hasRun = true; + Q[] qs = e.getAnnotationsByType(Q.class); + Assert.check(qs.length == 1); + Assert.check(qs[0] instanceof Q); + + p.Q[] ps = e.getAnnotationsByType(p.Q.class); + Assert.check(ps.length == 1); + Assert.check(ps[0] instanceof p.Q); + + p.R.Q[] rs = e.getAnnotationsByType(p.R.Q.class); + Assert.check(rs.length == 1); + Assert.check(rs[0] instanceof p.R.Q); + } + } + if (!hasRun) throw new RuntimeException("No methods!"); + } + return true; + } +} + +@Repeatable(QQ.class) +@interface Q {} + +@interface QQ { + Q[] value(); +} diff --git a/langtools/test/tools/javac/processing/model/element/8009367/p/Q.java b/langtools/test/tools/javac/processing/model/element/8009367/p/Q.java new file mode 100644 index 00000000000..d41331c8275 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/element/8009367/p/Q.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p; + +import java.lang.annotation.Repeatable; + +@Repeatable(QQ.class) +public @interface Q {} diff --git a/langtools/test/tools/javac/processing/model/element/8009367/p/QQ.java b/langtools/test/tools/javac/processing/model/element/8009367/p/QQ.java new file mode 100644 index 00000000000..e13e8d7ea7f --- /dev/null +++ b/langtools/test/tools/javac/processing/model/element/8009367/p/QQ.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p; + +public @interface QQ { + Q[] value(); +} diff --git a/langtools/test/tools/javac/processing/model/element/8009367/p/R.java b/langtools/test/tools/javac/processing/model/element/8009367/p/R.java new file mode 100644 index 00000000000..da41577be11 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/element/8009367/p/R.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p; + +import java.lang.annotation.Repeatable; + +public class R { + + @Repeatable(RR.class) + public @interface Q {} +} diff --git a/langtools/test/tools/javac/processing/model/element/8009367/p/RR.java b/langtools/test/tools/javac/processing/model/element/8009367/p/RR.java new file mode 100644 index 00000000000..2782d01181b --- /dev/null +++ b/langtools/test/tools/javac/processing/model/element/8009367/p/RR.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package p; + +public @interface RR { + R.Q[] value(); +} diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java index 8844cd1ef10..e1ffd9e03c6 100644 --- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java +++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java @@ -23,12 +23,11 @@ /* * @test - * @bug 8004822 + * @bug 8004822 8007961 * @author mnunez * @summary Language model api test basics for repeating annotations * @library /tools/javac/lib * @library supportingAnnotations - * @ignore 8013407: test failures for repeating annotations * @build JavacTestingAbstractProcessor ElementRepAnnoTester * @compile -processor ElementRepAnnoTester -proc:only * MixRepeatableAndOfficialContainerInheritedA1Test.java diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java index e2141da147d..2a3f8229d1d 100644 --- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java +++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java @@ -23,12 +23,11 @@ /* * @test - * @bug 8004822 + * @bug 8004822 8007961 * @author mnunez * @summary Language model api test basics for repeating annotations * @library /tools/javac/lib * @library supportingAnnotations - * @ignore 8013407: test failures for repeating annotations * @build JavacTestingAbstractProcessor ElementRepAnnoTester * @compile -processor ElementRepAnnoTester -proc:only * MixRepeatableAndOfficialContainerInheritedB1Test.java diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java index fb6efb49775..52b86a799ee 100644 --- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java +++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java @@ -23,12 +23,11 @@ /* * @test - * @bug 8004822 + * @bug 8004822 8007961 * @author mnunez * @summary Language model api test basics for repeating annotations * @library /tools/javac/lib * @library supportingAnnotations - * @ignore 8013407: test failures for repeating annotations * @build JavacTestingAbstractProcessor ElementRepAnnoTester * @compile -processor ElementRepAnnoTester -proc:only * MixRepeatableAndOfficialContainerInheritedB2Test.java diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java index 395a2a64262..124ceea2ca8 100644 --- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java +++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java @@ -23,12 +23,11 @@ /* * @test - * @bug 8004822 + * @bug 8004822 8007961 * @author mnunez * @summary Language model api test basics for repeating annotations * @library /tools/javac/lib * @library supportingAnnotations - * @ignore 8013407: test failures for repeating annotations * @build JavacTestingAbstractProcessor ElementRepAnnoTester * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideATest.java */ diff --git a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java index f16ec7aee73..63570745955 100644 --- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java +++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java @@ -23,12 +23,11 @@ /* * @test - * @bug 8004822 + * @bug 8004822 8007961 * @author mnunez * @summary Language model api test basics for repeating annotations * @library /tools/javac/lib * @library supportingAnnotations - * @ignore 8013407: test failures for repeating annotations * @build JavacTestingAbstractProcessor ElementRepAnnoTester * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideBTest.java */ diff --git a/langtools/test/tools/javac/processing/model/inheritedByType/EnsureOrder.java b/langtools/test/tools/javac/processing/model/inheritedByType/EnsureOrder.java new file mode 100644 index 00000000000..77fcd11ac84 --- /dev/null +++ b/langtools/test/tools/javac/processing/model/inheritedByType/EnsureOrder.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @summary test that order is respected when inheriting both legacy container and single anno + * @bug 8007961 + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor EnsureOrder + * @compile -processor EnsureOrder -proc:only EnsureOrder.java + */ + +import java.util.Set; +import java.lang.annotation.*; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import static javax.lang.model.SourceVersion.*; +import javax.lang.model.element.*; +import javax.lang.model.util.*; +import static javax.lang.model.util.ElementFilter.*; +import static javax.tools.Diagnostic.Kind.*; +import static javax.tools.StandardLocation.*; +import com.sun.tools.javac.util.Assert; + +@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE}) +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Repeatable(Foos.class) +@interface Foo { + int value(); +} + +@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE}) +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@interface Foos { + Foo[] value(); +} + +@Foos({@Foo(0), @Foo(1)}) @Foo(2) +class Base {} + +class Sub extends Base {} + +public class EnsureOrder<@Foos({@Foo(0), @Foo(1)}) @Foo(2)T> extends JavacTestingAbstractProcessor { + public boolean process(Set annotations, + RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + int hasRun = 0; + for (Element element : roundEnv.getRootElements()) { + Name elemName = element.getSimpleName(); + if (elemName.contentEquals("Base")) { + hasRun++; + Foo[] foos = element.getAnnotationsByType(Foo.class); + Assert.check(foos.length == 3); + Assert.check(foos[0].value() == 0); + Assert.check(foos[1].value() == 1); + Assert.check(foos[2].value() == 2); + } + if (elemName.contentEquals("Sub")) { + hasRun++; + Foo[] foos = element.getAnnotationsByType(Foo.class); + Assert.check(foos.length == 3); + Assert.check(foos[0].value() == 0); + Assert.check(foos[1].value() == 1); + Assert.check(foos[2].value() == 2); + } + if (elemName.contentEquals("EnsureOrder")) { + for (TypeParameterElement t : ((TypeElement)element).getTypeParameters()) { + if (t.getSimpleName().contentEquals("T")) { + hasRun++; + Foo[] foos = t.getAnnotationsByType(Foo.class); + Assert.check(foos.length == 3); + Assert.check(foos[0].value() == 0); + Assert.check(foos[1].value() == 1); + Assert.check(foos[2].value() == 2); + } + } + } + } + if (hasRun != 3) + throw new RuntimeException("Couldn't find elements"); + } + return true; + } +} diff --git a/langtools/test/tools/javac/tree/NewArrayPretty.java b/langtools/test/tools/javac/tree/NewArrayPretty.java new file mode 100644 index 00000000000..dbac462d349 --- /dev/null +++ b/langtools/test/tools/javac/tree/NewArrayPretty.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8014826 + * @summary test Pretty print of NewArray + * @author ksrini + */ +import com.sun.source.tree.ClassTree; +import com.sun.source.tree.CompilationUnitTree; +import com.sun.tools.javac.api.JavacTaskImpl; +import com.sun.tools.javac.tree.JCTree; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.ToolProvider; + +public class NewArrayPretty { + private final JavaCompiler tool; + NewArrayPretty() { + tool = ToolProvider.getSystemJavaCompiler(); + } + public static void main(String... args) throws Exception { + NewArrayPretty nap = new NewArrayPretty(); + nap.run("Class[] cls = null"); + nap.run("Class[] cls = new Class[]{Object.class}"); + } + void run(String code) throws IOException { + String src = "public class Test {" + code + ";}"; + + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null, + null, Arrays.asList(new MyFileObject(src))); + + for (CompilationUnitTree cut : ct.parse()) { + JCTree.JCVariableDecl var = + (JCTree.JCVariableDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0); + + if (!code.equals(var.toString())) { + System.err.println("Expected: " + code); + System.err.println("Obtained: " + var.toString()); + throw new RuntimeException("strings do not match!"); + } + } + } +} +class MyFileObject extends SimpleJavaFileObject { + + private String text; + + public MyFileObject(String text) { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + this.text = text; + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return text; + } +} diff --git a/nashorn/.hgtags b/nashorn/.hgtags index 359e57513a3..0c5b8ca45af 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -210,3 +210,6 @@ d6bd440ac5b97bb1205b6c3274569c1cfe626723 jdk8-b96 542b7803f0389a91fab58608a0f46fac0e15d759 jdk8-b98 10a1ab9e20a42d278aa1a89698f2a4cf5883d00d jdk8-b99 598321c438b52d9408a2671fb3fc2b2947d0f654 jdk8-b100 +a302b05d0ee460679501dc01004f70eb395fadf5 jdk8-b101 +e966ff0a3ffef8a687eaf5a14167bb595b623d02 jdk8-b102 +414203de4374e1964a9918c38a95fb245010a9f1 jdk8-b103 diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java index 3425e9fd0c0..69c28b29f53 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java @@ -152,14 +152,14 @@ public class ClassGenerator { } static MethodGenerator makeStaticInitializer(final ClassVisitor cv, final String name) { - final int access = ACC_PUBLIC | ACC_STATIC; + final int access = ACC_PUBLIC | ACC_STATIC; final String desc = DEFAULT_INIT_DESC; final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); return new MethodGenerator(mv, access, name, desc); } static MethodGenerator makeConstructor(final ClassVisitor cv) { - final int access = ACC_PUBLIC; + final int access = 0; final String name = INIT; final String desc = DEFAULT_INIT_DESC; final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null); diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java index e90b53ecb81..7f45eab4fdd 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java @@ -25,6 +25,7 @@ package jdk.nashorn.internal.tools.nasgen; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL; import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER; import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC; @@ -80,7 +81,7 @@ public class ConstructorGenerator extends ClassGenerator { byte[] getClassBytes() { // new class extensing from ScriptObject final String superClass = (constructor != null)? SCRIPTFUNCTIONIMPL_TYPE : SCRIPTOBJECT_TYPE; - cw.visit(V1_7, ACC_PUBLIC | ACC_SUPER, className, null, superClass, null); + cw.visit(V1_7, ACC_FINAL, className, null, superClass, null); if (memberCount > 0) { // add fields emitFields(); diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java index 98048a294b2..8bb1de5c588 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java @@ -25,6 +25,7 @@ package jdk.nashorn.internal.tools.nasgen; +import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL; import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER; import static jdk.internal.org.objectweb.asm.Opcodes.V1_7; @@ -60,7 +61,7 @@ public class PrototypeGenerator extends ClassGenerator { byte[] getClassBytes() { // new class extensing from ScriptObject - cw.visit(V1_7, ACC_PUBLIC | ACC_SUPER, className, null, PROTOTYPEOBJECT_TYPE, null); + cw.visit(V1_7, ACC_FINAL | ACC_SUPER, className, null, PROTOTYPEOBJECT_TYPE, null); if (memberCount > 0) { // add fields emitFields(); diff --git a/nashorn/exclude/exclude_list.txt b/nashorn/exclude/exclude_list.txt new file mode 100644 index 00000000000..89618933148 --- /dev/null +++ b/nashorn/exclude/exclude_list.txt @@ -0,0 +1,4 @@ + + + + diff --git a/nashorn/exclude/exclude_list_cc.txt b/nashorn/exclude/exclude_list_cc.txt new file mode 100644 index 00000000000..a66476b8e16 --- /dev/null +++ b/nashorn/exclude/exclude_list_cc.txt @@ -0,0 +1,6 @@ + + + + + + diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml index 2bda503fd88..9a31be88592 100644 --- a/nashorn/make/build.xml +++ b/nashorn/make/build.xml @@ -47,17 +47,22 @@ - - - - + + + + + + + + + - - - + + + @@ -262,6 +267,11 @@ grant codeBase "file:/${basedir}/test/script/basic/*" { grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" { permission java.util.PropertyPermission "java.security.policy", "read"; }; + +grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { + permission java.lang.RuntimePermission "nashorn.JavaReflection"; +}; + \/ @@ -284,19 +294,6 @@ grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" { - - - - - - - - - - - - - Representation test failed - output differs! @@ -316,6 +313,7 @@ grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" { + diff --git a/nashorn/make/code_coverage.xml b/nashorn/make/code_coverage.xml index dea03099e36..7fe1f3845a1 100644 --- a/nashorn/make/code_coverage.xml +++ b/nashorn/make/code_coverage.xml @@ -132,7 +132,7 @@ - + diff --git a/nashorn/make/project.properties b/nashorn/make/project.properties index dbd9efce80c..57c99866575 100644 --- a/nashorn/make/project.properties +++ b/nashorn/make/project.properties @@ -223,7 +223,6 @@ run.test.user.language=tr run.test.user.country=TR # -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMethods -# add '-Dtest.js.outofprocess' to run each test in a new sub-process run.test.jvmargs.main=-server -Xmx${run.test.xmx} -XX:+TieredCompilation -ea -Dfile.encoding=UTF-8 -Duser.language=${run.test.user.language} -Duser.country=${run.test.user.country} #-XX:+HeapDumpOnOutOfMemoryError -XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M @@ -231,6 +230,9 @@ run.test.jvmargs.octane.main=-Xms${run.test.xms} ${run.test.jvmargs.main} run.test.jvmsecurityargs=-Xverify:all -Djava.security.properties=${basedir}/make/java.security.override -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy +# VM options for script tests with @fork option +test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} ${run.test.jvmsecurityargs} + # path of rhino.jar for benchmarks rhino.jar= diff --git a/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java b/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java index 0c8d3efde7f..d2d1cd5ac6b 100644 --- a/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java +++ b/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java @@ -303,14 +303,13 @@ abstract class AbstractJavaLinker implements GuardingDynamicLinker { private static MethodHandle unreflectSafely(AccessibleObject m) { if(m instanceof Method) { final Method reflMethod = (Method)m; - final MethodHandle handle = SafeUnreflector.unreflect(reflMethod); + final MethodHandle handle = Lookup.PUBLIC.unreflect(reflMethod); if(Modifier.isStatic(reflMethod.getModifiers())) { return StaticClassIntrospector.editStaticMethodHandle(handle); } return handle; } - return StaticClassIntrospector.editConstructorMethodHandle(SafeUnreflector.unreflectConstructor( - (Constructor)m)); + return StaticClassIntrospector.editConstructorMethodHandle(Lookup.PUBLIC.unreflectConstructor((Constructor)m)); } private static DynamicMethod mergeMethods(SingleDynamicMethod method, DynamicMethod existing, Class clazz, String name) { diff --git a/nashorn/src/jdk/internal/dynalink/beans/FacetIntrospector.java b/nashorn/src/jdk/internal/dynalink/beans/FacetIntrospector.java index 97e431ca24b..f8f1db8f96d 100644 --- a/nashorn/src/jdk/internal/dynalink/beans/FacetIntrospector.java +++ b/nashorn/src/jdk/internal/dynalink/beans/FacetIntrospector.java @@ -92,6 +92,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Map; +import jdk.internal.dynalink.support.Lookup; /** * Base for classes that expose class field and method information to an {@link AbstractJavaLinker}. There are @@ -160,11 +161,11 @@ abstract class FacetIntrospector { MethodHandle unreflectGetter(Field field) { - return editMethodHandle(SafeUnreflector.unreflectGetter(field)); + return editMethodHandle(Lookup.PUBLIC.unreflectGetter(field)); } MethodHandle unreflectSetter(Field field) { - return editMethodHandle(SafeUnreflector.unreflectSetter(field)); + return editMethodHandle(Lookup.PUBLIC.unreflectSetter(field)); } /** diff --git a/nashorn/src/jdk/internal/dynalink/beans/SafeUnreflector.java b/nashorn/src/jdk/internal/dynalink/beans/SafeUnreflector.java deleted file mode 100644 index e82870128ce..00000000000 --- a/nashorn/src/jdk/internal/dynalink/beans/SafeUnreflector.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file, and Oracle licenses the original version of this file under the BSD - * license: - */ -/* - Copyright 2009-2013 Attila Szegedi - - Licensed under both the Apache License, Version 2.0 (the "Apache License") - and the BSD License (the "BSD License"), with licensee being free to - choose either of the two at their discretion. - - You may not use this file except in compliance with either the Apache - License or the BSD License. - - If you choose to use this file in compliance with the Apache License, the - following notice applies to you: - - You may obtain a copy of the Apache License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied. See the License for the specific language governing - permissions and limitations under the License. - - If you choose to use this file in compliance with the BSD License, the - following notice applies to you: - - 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 the copyright holder nor the names of - 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 COPYRIGHT HOLDER - 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. -*/ - -package jdk.internal.dynalink.beans; - -import java.lang.invoke.MethodHandle; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedAction; -import jdk.internal.dynalink.beans.sandbox.Unreflector; - -/** - * Provides lookup of unreflected method handles through delegation to an instance of {@link SafeUnreflectorImpl}. If - * Dynalink is run as trusted code, the delegate class is loaded into an isolated zero-permissions protection domain, - * serving as a firebreak against an accidental privilege escalation downstream. - */ -final class SafeUnreflector { - private static final String UNREFLECTOR_IMPL_CLASS_NAME = "jdk.internal.dynalink.beans.SafeUnreflectorImpl"; - private static final Unreflector impl = createImpl(); - - private SafeUnreflector() { - } - - /** - * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflect(Method)}, converting any encountered - * {@link IllegalAccessException} into an {@link IllegalAccessError}. - * - * @param m the method to unreflect - * @return the unreflected method handle. - */ - static MethodHandle unreflect(Method m) { - return impl.unreflect(m); - } - - /** - * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter(Field)}, converting any encountered - * {@link IllegalAccessException} into an {@link IllegalAccessError}. - * - * @param f the field for which a getter is unreflected - * @return the unreflected field getter handle. - */ - static MethodHandle unreflectGetter(Field f) { - return impl.unreflectGetter(f); - } - - /** - * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter(Field)}, converting any encountered - * {@link IllegalAccessException} into an {@link IllegalAccessError}. - * - * @param f the field for which a setter is unreflected - * @return the unreflected field setter handle. - */ - static MethodHandle unreflectSetter(Field f) { - return impl.unreflectSetter(f); - } - - static MethodHandle unreflectConstructor(Constructor c) { - return impl.unreflectConstructor(c); - } - - private static Unreflector createImpl() { - final Class unreflectorImplClass = AccessController.doPrivileged(new PrivilegedAction>() { - @Override - public Class run() { - return SandboxClassLoader.loadClass(UNREFLECTOR_IMPL_CLASS_NAME); - } - }); - try { - return (Unreflector)unreflectorImplClass.newInstance(); - } catch(InstantiationException | IllegalAccessException e) { - throw new RuntimeException(e.getMessage(), e); - } - } -} diff --git a/nashorn/src/jdk/internal/dynalink/beans/SafeUnreflectorImpl.java b/nashorn/src/jdk/internal/dynalink/beans/SafeUnreflectorImpl.java deleted file mode 100644 index 5ae843041bd..00000000000 --- a/nashorn/src/jdk/internal/dynalink/beans/SafeUnreflectorImpl.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file, and Oracle licenses the original version of this file under the BSD - * license: - */ -/* - Copyright 2009-2013 Attila Szegedi - - Licensed under both the Apache License, Version 2.0 (the "Apache License") - and the BSD License (the "BSD License"), with licensee being free to - choose either of the two at their discretion. - - You may not use this file except in compliance with either the Apache - License or the BSD License. - - If you choose to use this file in compliance with the Apache License, the - following notice applies to you: - - You may obtain a copy of the Apache License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied. See the License for the specific language governing - permissions and limitations under the License. - - If you choose to use this file in compliance with the BSD License, the - following notice applies to you: - - 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 the copyright holder nor the names of - 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 COPYRIGHT HOLDER - 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. -*/ - -package jdk.internal.dynalink.beans; - -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import jdk.internal.dynalink.beans.sandbox.Unreflector; - -/** - * Performs lookup of unreflected method handles by delegating to {@link MethodHandles#lookup()} using itself as the - * lookup class. When Dynalink runs as trusted code, this class is loaded into an isolated zero-permissions protection - * domain to stop any accidental privilege escalation. - */ -final class SafeUnreflectorImpl implements Unreflector { - - SafeUnreflectorImpl() { - } - - @Override - public MethodHandle unreflect(Method m) { - try { - return MethodHandles.lookup().unreflect(m); - } catch(IllegalAccessException e) { - final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect method " + m); - ee.initCause(e); - throw ee; - } - } - - @Override - public MethodHandle unreflectGetter(Field f) { - try { - return MethodHandles.lookup().unreflectGetter(f); - } catch(IllegalAccessException e) { - final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect getter for field " + f); - ee.initCause(e); - throw ee; - } - } - - @Override - public MethodHandle unreflectSetter(Field f) { - try { - return MethodHandles.lookup().unreflectSetter(f); - } catch(IllegalAccessException e) { - final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect setter for field " + f); - ee.initCause(e); - throw ee; - } - } - - @Override - public MethodHandle unreflectConstructor(Constructor c) { - try { - return MethodHandles.lookup().unreflectConstructor(c); - } catch(IllegalAccessException e) { - final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect constructor " + c); - ee.initCause(e); - throw ee; - } - } -} diff --git a/nashorn/src/jdk/internal/dynalink/beans/SandboxClassLoader.java b/nashorn/src/jdk/internal/dynalink/beans/SandboxClassLoader.java deleted file mode 100644 index 00f1e7ac794..00000000000 --- a/nashorn/src/jdk/internal/dynalink/beans/SandboxClassLoader.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file, and Oracle licenses the original version of this file under the BSD - * license: - */ -/* - Copyright 2009-2013 Attila Szegedi - - Licensed under both the Apache License, Version 2.0 (the "Apache License") - and the BSD License (the "BSD License"), with licensee being free to - choose either of the two at their discretion. - - You may not use this file except in compliance with either the Apache - License or the BSD License. - - If you choose to use this file in compliance with the Apache License, the - following notice applies to you: - - You may obtain a copy of the Apache License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied. See the License for the specific language governing - permissions and limitations under the License. - - If you choose to use this file in compliance with the BSD License, the - following notice applies to you: - - 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 the copyright holder nor the names of - 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 COPYRIGHT HOLDER - 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. -*/ - -package jdk.internal.dynalink.beans; - -import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static jdk.internal.org.objectweb.asm.Opcodes.ASM4; - -import java.io.IOException; -import java.io.InputStream; -import java.security.Permissions; -import java.security.ProtectionDomain; -import java.security.SecureClassLoader; -import java.security.SecureRandom; -import jdk.internal.org.objectweb.asm.ClassReader; -import jdk.internal.org.objectweb.asm.ClassVisitor; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.MethodVisitor; - -/** - * A utility class that can load a class with specified name into an isolated zero-permissions protection domain. It can - * be used to load classes that perform security-sensitive operations with no privileges at all, therefore ensuring such - * operations will only succeed if they would require no permissions, as well as to make sure that if these operations - * bind some part of the security execution context to their results, the bound security context is completely - * unprivileged. Such measures serve as firebreaks against accidental privilege escalation. - */ -final class SandboxClassLoader { - private final String className; - private final String randomizedClassName; - - private SandboxClassLoader(String className) { - this.className = className; - final String simpleClassName = className.substring(className.lastIndexOf('.') + 1); - this.randomizedClassName = "randomPackage" + Long.toHexString(new SecureRandom().nextLong()) + "." + simpleClassName; - } - - /** - * Load the named class into a zero-permissions protection domain. Even if the class is already loaded into the - * Dynalink's class loader, an independent class is created from the same bytecode, thus the returned class will - * never be identical with the one that might already be loaded. The class to be loaded is supposed to be package - * private and have no public constructors. This is not a functional requirement, but it is enforced to ensure that - * the original class was made adequately inaccessible. The returned class will be public and its constructors will - * be changed to public. The only permission given to the returned class will be - * {@code accessClassInPackage.jdk.internal.dynalink.beans.sandbox}. That package should be used solely to define - * SPI interfaces implemented by the loaded class. - * @param className the fully qualified name of the class to load - * @return the loaded class, renamed to a random package, made public, its constructors made public, and lacking any - * permissions except access to the sandbox package. - * @throws SecurityException if the calling code lacks the {@code createClassLoader} runtime permission. This - * normally means that Dynalink itself is running as untrusted code, and whatever functionality was meant to be - * isolated into an unprivileged class is likely okay to be used directly too. - */ - static Class loadClass(String className) throws SecurityException { - return new SandboxClassLoader(className).loadClass(); - } - - private Class loadClass() throws SecurityException { - final ClassLoader loader = createClassLoader(); - try { - final Class clazz = Class.forName(randomizedClassName, true, loader); - // Sanity check to ensure we didn't accidentally pick up the class from elsewhere - if(clazz.getClassLoader() != loader) { - throw new AssertionError(randomizedClassName + " was loaded from a different class loader"); - } - return clazz; - } catch(ClassNotFoundException e) { - throw new AssertionError(e); - } - } - - private ClassLoader createClassLoader() throws SecurityException { - final String lclassName = this.randomizedClassName; - // We deliberately override loadClass instead of findClass so that we don't give a chance to finding this - // class already loaded anywhere else. We use this class' loader as the parent class loader as the loaded class - // needs to be able to access implemented interfaces from the sandbox package. - return new SecureClassLoader(getClass().getClassLoader()) { - @Override - protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - if(name.equals(lclassName)) { - final byte[] bytes = getClassBytes(); - // Define the class with a protection domain that grants (almost) no permissions. - Class clazz = defineClass(name, bytes, 0, bytes.length, createMinimalPermissionsDomain()); - if(resolve) { - resolveClass(clazz); - } - return clazz; - } - - final int i = name.lastIndexOf('.'); - if (i != -1) { - final SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPackageAccess(name.substring(0, i)); - } - } - return super.loadClass(name, resolve); - } - }; - } - - /** - * Create a no-permissions protection domain. Except, it's not really a no-permissions protection domain, since we - * need to give the protection domain the permission to access the sandbox package where the interop interfaces are - * defined. - * @return a new (almost) no-permission protection domain. - */ - private static ProtectionDomain createMinimalPermissionsDomain() { - final Permissions p = new Permissions(); - p.add(new RuntimePermission("accessClassInPackage.jdk.internal.dynalink.beans.sandbox")); - return new ProtectionDomain(null, p); - } - - private byte[] getClassBytes() { - try(final InputStream in = getClass().getResourceAsStream("/" + className.replace('.', '/') + ".class")) { - final ClassReader cr = new ClassReader(in); - final ClassWriter cw = new ClassWriter(cr, 0); - cr.accept(new ClassVisitor(ASM4, cw) { - @Override - public void visit(int version, int access, String name, String signature, String superName, - String[] interfaces) { - // Rename the class to its random name, and make it public (otherwise we won't be able to - // instantiate it). The privileged template class is package-private. - if((access & ACC_PUBLIC) != 0) { - throw new IllegalArgumentException("Class " + className + " must be package-private"); - } - super.visit(version, access | ACC_PUBLIC, randomizedClassName.replace('.', '/'), - signature, superName, interfaces); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, - String[] exceptions) { - // Make the constructor(s) public (otherwise we won't be able to instantiate the class). The - // privileged template's constructor(s) should not be public. - final boolean isCtor = "".equals(name); - if(isCtor && ((access & ACC_PUBLIC) != 0)) { - throw new IllegalArgumentException("Class " + className + " must have no public constructors"); - } - return super.visitMethod(isCtor ? (access | ACC_PUBLIC) : access, name, desc, signature, - exceptions); - } - }, 0); - return cw.toByteArray(); - } catch(IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java index 2abdbbe99e1..c473bb4cc73 100644 --- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java +++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java @@ -132,7 +132,9 @@ class StaticClassLinker implements TypeBasedGuardingDynamicLinker { return new SimpleDynamicMethod(StaticClassIntrospector.editConstructorMethodHandle( boundArrayCtor.asType(boundArrayCtor.type().changeReturnType(clazz))), clazz, ""); } - + if(CheckRestrictedPackage.isRestrictedClass(clazz)) { + return null; + } return createDynamicMethod(Arrays.asList(clazz.getConstructors()), clazz, ""); } diff --git a/nashorn/src/jdk/internal/dynalink/beans/sandbox/Unreflector.java b/nashorn/src/jdk/internal/dynalink/beans/sandbox/Unreflector.java deleted file mode 100644 index b5174cd3633..00000000000 --- a/nashorn/src/jdk/internal/dynalink/beans/sandbox/Unreflector.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file, and Oracle licenses the original version of this file under the BSD - * license: - */ -/* - Copyright 2009-2013 Attila Szegedi - - Licensed under both the Apache License, Version 2.0 (the "Apache License") - and the BSD License (the "BSD License"), with licensee being free to - choose either of the two at their discretion. - - You may not use this file except in compliance with either the Apache - License or the BSD License. - - If you choose to use this file in compliance with the Apache License, the - following notice applies to you: - - You may obtain a copy of the Apache License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied. See the License for the specific language governing - permissions and limitations under the License. - - If you choose to use this file in compliance with the BSD License, the - following notice applies to you: - - 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 the copyright holder nor the names of - 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 COPYRIGHT HOLDER - 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. -*/ - -package jdk.internal.dynalink.beans.sandbox; - -import java.lang.invoke.MethodHandle; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -/** - * Interface for creating unreflected method handles. This class is public for implementation purposes and is not part - * of any supported API. - */ -public interface Unreflector { - /** - * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflect(Method)} for some lookup object, - * also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}. - * - * @param m the method to unreflect - * @return the unreflected method handle. - */ - public MethodHandle unreflect(Method m); - - /** - * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter(Field)} for some lookup - * object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}. - * - * @param f the field for which a getter is unreflected - * @return the unreflected field getter handle. - */ - public MethodHandle unreflectGetter(Field f); - - /** - * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter(Field)} for some lookup - * object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}. - * - * @param f the field for which a setter is unreflected - * @return the unreflected field setter handle. - */ - public MethodHandle unreflectSetter(Field f); - - /** - * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectConstructor(Constructor)} for some - * lookup object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}. - * - * @param c the constructor to unreflect - * @return the unreflected constructor handle. - */ - public MethodHandle unreflectConstructor(Constructor c); - -} diff --git a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java index 682975a85d5..5b79846b011 100644 --- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java +++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java @@ -40,6 +40,9 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; import javax.script.AbstractScriptEngine; import javax.script.Bindings; import javax.script.Compilable; @@ -79,6 +82,28 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C // default options passed to Nashorn Options object private static final String[] DEFAULT_OPTIONS = new String[] { "-scripting", "-doe" }; + private static final String MESSAGES_RESOURCE = "jdk.nashorn.api.scripting.resources.Messages"; + + // Without do privileged, under security manager messages can not be loaded. + private static final ResourceBundle MESSAGES_BUNDLE; + static { + MESSAGES_BUNDLE = AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public ResourceBundle run() { + return ResourceBundle.getBundle(MESSAGES_RESOURCE, Locale.getDefault()); + } + }); + } + + private static String getMessage(final String msgId, final String... args) { + try { + return new MessageFormat(MESSAGES_BUNDLE.getString(msgId)).format(args); + } catch (final java.util.MissingResourceException e) { + throw new RuntimeException("no message resource found for message id: "+ msgId); + } + } + NashornScriptEngine(final NashornScriptEngineFactory factory, final ClassLoader appLoader) { this(factory, DEFAULT_OPTIONS, appLoader); } @@ -176,43 +201,63 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } @Override - public Object invokeMethod(final Object self, final String name, final Object... args) + public Object invokeMethod(final Object thiz, final String name, final Object... args) throws ScriptException, NoSuchMethodException { - if (self == null) { - throw new IllegalArgumentException("script object can not be null"); + if (thiz == null) { + throw new IllegalArgumentException(getMessage("thiz.cannot.be.null")); } - return invokeImpl(self, name, args); + return invokeImpl(thiz, name, args); } - private T getInterfaceInner(final Object self, final Class clazz) { + private T getInterfaceInner(final Object thiz, final Class clazz) { if (clazz == null || !clazz.isInterface()) { - throw new IllegalArgumentException("interface Class expected"); + throw new IllegalArgumentException(getMessage("interface.class.expected")); } // perform security access check as early as possible final SecurityManager sm = System.getSecurityManager(); if (sm != null) { if (! Modifier.isPublic(clazz.getModifiers())) { - throw new SecurityException("attempt to implement non-public interfce: " + clazz); + throw new SecurityException(getMessage("implementing.non.public.interface", clazz.getName())); } Context.checkPackageAccess(clazz.getName()); } - final ScriptObject realSelf; - final ScriptObject ctxtGlobal = getNashornGlobalFrom(context); - if(self == null) { - realSelf = ctxtGlobal; - } else if (!(self instanceof ScriptObject)) { - realSelf = (ScriptObject)ScriptObjectMirror.unwrap(self, ctxtGlobal); - } else { - realSelf = (ScriptObject)self; + ScriptObject realSelf = null; + ScriptObject realGlobal = null; + if(thiz == null) { + // making interface out of global functions + realSelf = realGlobal = getNashornGlobalFrom(context); + } else if (thiz instanceof ScriptObjectMirror) { + final ScriptObjectMirror mirror = (ScriptObjectMirror)thiz; + realSelf = mirror.getScriptObject(); + realGlobal = mirror.getHomeGlobal(); + if (! realGlobal.isOfContext(nashornContext)) { + throw new IllegalArgumentException(getMessage("script.object.from.another.engine")); + } + } else if (thiz instanceof ScriptObject) { + // called from script code. + realSelf = (ScriptObject)thiz; + realGlobal = Context.getGlobal(); + if (realGlobal == null) { + throw new IllegalArgumentException(getMessage("no.current.nashorn.global")); + } + + if (! realGlobal.isOfContext(nashornContext)) { + throw new IllegalArgumentException(getMessage("script.object.from.another.engine")); + } + } + + if (realSelf == null) { + throw new IllegalArgumentException(getMessage("interface.on.non.script.object")); } try { - final ScriptObject oldGlobal = getNashornGlobal(); + final ScriptObject oldGlobal = Context.getGlobal(); + final boolean globalChanged = (oldGlobal != realGlobal); try { - if(oldGlobal != ctxtGlobal) { - setNashornGlobal(ctxtGlobal); + if (globalChanged) { + Context.setGlobal(realGlobal); } if (! isInterfaceImplemented(clazz, realSelf)) { @@ -220,8 +265,8 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } return clazz.cast(JavaAdapterFactory.getConstructor(realSelf.getClass(), clazz).invoke(realSelf)); } finally { - if(oldGlobal != ctxtGlobal) { - setNashornGlobal(oldGlobal); + if (globalChanged) { + Context.setGlobal(oldGlobal); } } } catch(final RuntimeException|Error e) { @@ -237,11 +282,11 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } @Override - public T getInterface(final Object self, final Class clazz) { - if (self == null) { - throw new IllegalArgumentException("script object can not be null"); + public T getInterface(final Object thiz, final Class clazz) { + if (thiz == null) { + throw new IllegalArgumentException(getMessage("thiz.cannot.be.null")); } - return getInterfaceInner(self, clazz); + return getInterfaceInner(thiz, clazz); } // These are called from the "engine.js" script @@ -357,50 +402,48 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } private Object invokeImpl(final Object selfObject, final String name, final Object... args) throws ScriptException, NoSuchMethodException { - final ScriptObject oldGlobal = getNashornGlobal(); - final ScriptObject ctxtGlobal = getNashornGlobalFrom(context); - final boolean globalChanged = (oldGlobal != ctxtGlobal); + name.getClass(); // null check - Object self = globalChanged? ScriptObjectMirror.wrap(selfObject, oldGlobal) : selfObject; - - try { - if (globalChanged) { - setNashornGlobal(ctxtGlobal); + ScriptObjectMirror selfMirror = null; + if (selfObject instanceof ScriptObjectMirror) { + selfMirror = (ScriptObjectMirror)selfObject; + if (! selfMirror.getHomeGlobal().isOfContext(nashornContext)) { + throw new IllegalArgumentException(getMessage("script.object.from.another.engine")); + } + } else if (selfObject instanceof ScriptObject) { + // invokeMethod called from script code - in which case we may get 'naked' ScriptObject + // Wrap it with oldGlobal to make a ScriptObjectMirror for the same. + final ScriptObject oldGlobal = Context.getGlobal(); + if (oldGlobal == null) { + throw new IllegalArgumentException(getMessage("no.current.nashorn.global")); } - ScriptObject sobj; - Object value = null; - - self = ScriptObjectMirror.unwrap(self, ctxtGlobal); - - // FIXME: should convert when self is not ScriptObject - if (self instanceof ScriptObject) { - sobj = (ScriptObject)self; - value = sobj.get(name); - } else if (self == null) { - self = ctxtGlobal; - sobj = ctxtGlobal; - value = sobj.get(name); + if (! oldGlobal.isOfContext(nashornContext)) { + throw new IllegalArgumentException(getMessage("script.object.from.another.engine")); } - if (value instanceof ScriptFunction) { - final Object res; - try { - final Object[] modArgs = globalChanged? ScriptObjectMirror.wrapArray(args, oldGlobal) : args; - res = ScriptRuntime.checkAndApply((ScriptFunction)value, self, ScriptObjectMirror.unwrapArray(modArgs, ctxtGlobal)); - } catch (final Exception e) { - throwAsScriptException(e); - throw new AssertionError("should not reach here"); + selfMirror = (ScriptObjectMirror)ScriptObjectMirror.wrap(selfObject, oldGlobal); + } else if (selfObject == null) { + // selfObject is null => global function call + final ScriptObject ctxtGlobal = getNashornGlobalFrom(context); + selfMirror = (ScriptObjectMirror)ScriptObjectMirror.wrap(ctxtGlobal, ctxtGlobal); + } + + if (selfMirror != null) { + try { + return ScriptObjectMirror.translateUndefined(selfMirror.call(name, args)); + } catch (final Exception e) { + final Throwable cause = e.getCause(); + if (cause instanceof NoSuchMethodException) { + throw (NoSuchMethodException)cause; } - return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(res, ctxtGlobal)); - } - - throw new NoSuchMethodException(name); - } finally { - if (globalChanged) { - setNashornGlobal(oldGlobal); + throwAsScriptException(e); + throw new AssertionError("should not reach here"); } } + + // Non-script object passed as selfObject + throw new IllegalArgumentException(getMessage("interface.on.non.script.object")); } private Object evalImpl(final char[] buf, final ScriptContext ctxt) throws ScriptException { @@ -411,12 +454,12 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C if (script == null) { return null; } - final ScriptObject oldGlobal = getNashornGlobal(); + final ScriptObject oldGlobal = Context.getGlobal(); final ScriptObject ctxtGlobal = getNashornGlobalFrom(ctxt); final boolean globalChanged = (oldGlobal != ctxtGlobal); try { if (globalChanged) { - setNashornGlobal(ctxtGlobal); + Context.setGlobal(ctxtGlobal); } setContextVariables(ctxt); @@ -426,7 +469,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C throw new AssertionError("should not reach here"); } finally { if (globalChanged) { - setNashornGlobal(oldGlobal); + Context.setGlobal(oldGlobal); } } } @@ -469,12 +512,12 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } private ScriptFunction compileImpl(final Source source, final ScriptContext ctxt) throws ScriptException { - final ScriptObject oldGlobal = getNashornGlobal(); + final ScriptObject oldGlobal = Context.getGlobal(); final ScriptObject ctxtGlobal = getNashornGlobalFrom(ctxt); final boolean globalChanged = (oldGlobal != ctxtGlobal); try { if (globalChanged) { - setNashornGlobal(ctxtGlobal); + Context.setGlobal(ctxtGlobal); } return nashornContext.compileScript(source, ctxtGlobal); @@ -483,7 +526,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C throw new AssertionError("should not reach here"); } finally { if (globalChanged) { - setNashornGlobal(oldGlobal); + Context.setGlobal(oldGlobal); } } } @@ -502,19 +545,4 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } return true; } - - // don't make this public!! - static ScriptObject getNashornGlobal() { - return Context.getGlobal(); - } - - static void setNashornGlobal(final ScriptObject newGlobal) { - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Void run() { - Context.setGlobal(newGlobal); - return null; - } - }); - } } diff --git a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java index c7c384e7df5..7abf142c9b8 100644 --- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java +++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java @@ -79,17 +79,17 @@ public final class ScriptObjectMirror extends JSObject implements Bindings { // JSObject methods @Override public Object call(final String functionName, final Object... args) { - final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal(); + final ScriptObject oldGlobal = Context.getGlobal(); final boolean globalChanged = (oldGlobal != global); try { if (globalChanged) { - NashornScriptEngine.setNashornGlobal(global); + Context.setGlobal(global); } final Object val = functionName == null? sobj : sobj.get(functionName); if (! (val instanceof ScriptFunction)) { - throw new RuntimeException("No such function " + ((functionName != null)? functionName : "")); + throw new NoSuchMethodException("No such function " + ((functionName != null)? functionName : "")); } final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args; @@ -100,19 +100,19 @@ public final class ScriptObjectMirror extends JSObject implements Bindings { throw new RuntimeException(t); } finally { if (globalChanged) { - NashornScriptEngine.setNashornGlobal(oldGlobal); + Context.setGlobal(oldGlobal); } } } @Override public Object newObject(final String functionName, final Object... args) { - final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal(); + final ScriptObject oldGlobal = Context.getGlobal(); final boolean globalChanged = (oldGlobal != global); try { if (globalChanged) { - NashornScriptEngine.setNashornGlobal(global); + Context.setGlobal(global); } final Object val = functionName == null? sobj : sobj.get(functionName); @@ -128,7 +128,7 @@ public final class ScriptObjectMirror extends JSObject implements Bindings { throw new RuntimeException(t); } finally { if (globalChanged) { - NashornScriptEngine.setNashornGlobal(oldGlobal); + Context.setGlobal(oldGlobal); } } } @@ -272,7 +272,7 @@ public final class ScriptObjectMirror extends JSObject implements Bindings { @Override public Object put(final String key, final Object value) { - final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal(); + final ScriptObject oldGlobal = Context.getGlobal(); final boolean globalChanged = (oldGlobal != global); return inGlobal(new Callable() { @Override public Object call() { @@ -284,7 +284,7 @@ public final class ScriptObjectMirror extends JSObject implements Bindings { @Override public void putAll(final Map map) { - final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal(); + final ScriptObject oldGlobal = Context.getGlobal(); final boolean globalChanged = (oldGlobal != global); inGlobal(new Callable() { @Override public Object call() { @@ -535,7 +535,7 @@ public final class ScriptObjectMirror extends JSObject implements Bindings { * @return wrapped object */ public static Object wrap(final Object obj, final ScriptObject homeGlobal) { - return (obj instanceof ScriptObject) ? new ScriptObjectMirror((ScriptObject)obj, homeGlobal) : obj; + return (obj instanceof ScriptObject && homeGlobal != null) ? new ScriptObjectMirror((ScriptObject)obj, homeGlobal) : obj; } /** @@ -599,24 +599,32 @@ public final class ScriptObjectMirror extends JSObject implements Bindings { // package-privates below this. ScriptObjectMirror(final ScriptObject sobj, final ScriptObject global) { + assert sobj != null : "ScriptObjectMirror on null!"; + assert global != null : "null global for ScriptObjectMirror!"; + this.sobj = sobj; this.global = global; } + // accessors for script engine ScriptObject getScriptObject() { return sobj; } + ScriptObject getHomeGlobal() { + return global; + } + static Object translateUndefined(Object obj) { return (obj == ScriptRuntime.UNDEFINED)? null : obj; } // internals only below this. private V inGlobal(final Callable callable) { - final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal(); + final ScriptObject oldGlobal = Context.getGlobal(); final boolean globalChanged = (oldGlobal != global); if (globalChanged) { - NashornScriptEngine.setNashornGlobal(global); + Context.setGlobal(global); } try { return callable.call(); @@ -626,9 +634,8 @@ public final class ScriptObjectMirror extends JSObject implements Bindings { throw new AssertionError("Cannot happen", e); } finally { if (globalChanged) { - NashornScriptEngine.setNashornGlobal(oldGlobal); + Context.setGlobal(oldGlobal); } } } - } diff --git a/nashorn/src/jdk/nashorn/api/scripting/resources/Messages.properties b/nashorn/src/jdk/nashorn/api/scripting/resources/Messages.properties new file mode 100644 index 00000000000..10bd88f1b9d --- /dev/null +++ b/nashorn/src/jdk/nashorn/api/scripting/resources/Messages.properties @@ -0,0 +1,32 @@ +# +# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. 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. +# + +thiz.cannot.be.null=script object 'this' for getMethod, getInterface calls can not be null +interface.class.expected=interface Class expected in getInterface +interface.on.non.script.object=getInterface cannot be called on non-script object +no.current.nashorn.global=no current Global instance for nashorn +implementing.non.public.interface=Cannot implement non-public interface: {0} +script.object.from.another.engine=Script object belongs to another script engine + diff --git a/nashorn/src/jdk/nashorn/api/scripting/resources/engine.js b/nashorn/src/jdk/nashorn/api/scripting/resources/engine.js index 62d6735ee3f..2cf23687cf6 100644 --- a/nashorn/src/jdk/nashorn/api/scripting/resources/engine.js +++ b/nashorn/src/jdk/nashorn/api/scripting/resources/engine.js @@ -39,12 +39,20 @@ Object.defineProperty(this, "__noSuchProperty__", { } }); -function print(str) { +function print() { var writer = context.getWriter(); if (! (writer instanceof java.io.PrintWriter)) { writer = new java.io.PrintWriter(writer); } - writer.println(String(str)); + + var buf = new java.lang.StringBuilder(); + for (var i = 0; i < arguments.length; i++) { + if (i != 0) { + buf.append(' '); + } + buf.append(String(arguments[i])); + } + writer.println(buf.toString()); } /** diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java index 9503e95a4b2..0ccc8a40489 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java @@ -45,6 +45,7 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.methodDescriptor; import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup; import static jdk.nashorn.internal.codegen.CompilerConstants.staticField; import static jdk.nashorn.internal.codegen.CompilerConstants.typeDescriptor; +import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup; import static jdk.nashorn.internal.ir.Symbol.IS_INTERNAL; import static jdk.nashorn.internal.ir.Symbol.IS_TEMP; import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_FAST_SCOPE; @@ -131,6 +132,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.Source; import jdk.nashorn.internal.runtime.Undefined; +import jdk.nashorn.internal.runtime.arrays.ArrayData; import jdk.nashorn.internal.runtime.linker.LinkerCallSite; /** @@ -1143,22 +1145,23 @@ final class CodeGenerator extends NodeOperatorVisitor extends ObjectCreator { final T value = valueIter.next(); if (symbol != null && value != null) { - final int index = ArrayIndex.getArrayIndex(key); + final int index = getArrayIndex(key); - if (index < 0) { + if (!isValidArrayIndex(index)) { putField(method, key, symbol.getFieldIndex(), value); } else { - putSlot(method, index, value); + putSlot(method, ArrayIndex.toLongIndex(index), value); } } } @@ -177,9 +180,13 @@ public abstract class FieldObjectCreator extends ObjectCreator { * @param index Slot index. * @param value Value to store. */ - private void putSlot(final MethodEmitter method, final int index, final T value) { + private void putSlot(final MethodEmitter method, final long index, final T value) { method.dup(); - method.load(index); + if (JSType.isRepresentableAsInt(index)) { + method.load((int) index); + } else { + method.load(index); + } loadValue(value); method.dynamicSetIndex(callSiteFlags); } diff --git a/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java b/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java index 476ac745619..63c1fdb79e7 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java @@ -649,8 +649,8 @@ final class FinalizeTypes extends NodeOperatorVisitor { } /** - * A symbol (and {@link Property}) can be tagged as "may be primitive". This is - * used a hint for dual fields that it is even worth it to try representing this + * A symbol (and {@link jdk.nashorn.internal.runtime.Property}) can be tagged as "may be primitive". + * This is used a hint for dual fields that it is even worth it to try representing this * field as something other than java.lang.Object. * * @param node node in which to tag symbols as primitive @@ -856,7 +856,7 @@ final class FinalizeTypes extends NodeOperatorVisitor { * if the expression type changes. * * Assignments use their lhs as node symbol, and in this case we can't modify - * it. Then {@link CodeGenerator#Store} needs to do an explicit conversion. + * it. Then {@link CodeGenerator.Store} needs to do an explicit conversion. * This is happens very rarely. * * @param node diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Label.java b/nashorn/src/jdk/nashorn/internal/codegen/Label.java index be1e126faee..21939dbeea1 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/Label.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/Label.java @@ -105,6 +105,18 @@ public final class Label { Stack copy() { return new Stack(data, sp); } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder("["); + for (int i = 0; i < sp; i++) { + builder.append(data[i]); + if (i < sp - 1) { + builder.append(", "); + } + } + return builder.append("]").toString(); + } } /** Name of this label */ diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java index cc109695d38..032d27bc5bb 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java @@ -88,8 +88,6 @@ final class Lower extends NodeOperatorVisitor { /** * Constructor. - * - * @param compiler the compiler */ Lower() { super(new BlockLexicalContext() { @@ -307,8 +305,8 @@ final class Lower extends NodeOperatorVisitor { final IdentNode exception = new IdentNode(token, finish, lc.getCurrentFunction().uniqueName("catch_all")); - final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), ThrowNode.IS_SYNTHETIC_RETHROW)). - setIsTerminal(lc, true); //ends with throw, so terminal + final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), ThrowNode.IS_SYNTHETIC_RETHROW)); + assert catchBody.isTerminal(); //ends with throw, so terminal final CatchNode catchAllNode = new CatchNode(lineNumber, token, finish, new IdentNode(exception), null, catchBody, CatchNode.IS_SYNTHETIC_RETHROW); final Block catchAllBlock = new Block(token, finish, catchAllNode); @@ -330,13 +328,12 @@ final class Lower extends NodeOperatorVisitor { /** * Splice finally code into all endpoints of a trynode * @param tryNode the try node - * @param list of rethrowing throw nodes from synthetic catch blocks + * @param rethrows list of rethrowing throw nodes from synthetic catch blocks * @param finallyBody the code in the original finally block * @return new try node after splicing finally code (same if nop) */ private Node spliceFinally(final TryNode tryNode, final List rethrows, final Block finallyBody) { assert tryNode.getFinallyBody() == null; - final int finish = tryNode.getFinish(); final TryNode newTryNode = (TryNode)tryNode.accept(new NodeVisitor(new LexicalContext()) { final List insideTry = new ArrayList<>(); @@ -404,7 +401,7 @@ final class Lower extends NodeOperatorVisitor { if (!isTerminal(newStatements)) { newStatements.add(endpoint); } - return BlockStatement.createReplacement(endpoint, finish, newStatements); + return BlockStatement.createReplacement(endpoint, tryNode.getFinish(), newStatements); } return endpoint; } @@ -466,7 +463,7 @@ final class Lower extends NodeOperatorVisitor { if (tryNode.getCatchBlocks().isEmpty()) { newTryNode = tryNode.setFinallyBody(null); } else { - Block outerBody = new Block(tryNode.getToken(), tryNode.getFinish(), new ArrayList(Arrays.asList(tryNode.setFinallyBody(null)))); + Block outerBody = new Block(tryNode.getToken(), tryNode.getFinish(), tryNode.setFinallyBody(null)); newTryNode = tryNode.setBody(outerBody).setCatchBlocks(null); } diff --git a/nashorn/src/jdk/nashorn/internal/codegen/MapCreator.java b/nashorn/src/jdk/nashorn/internal/codegen/MapCreator.java index 6ad03c73691..2921ea9ecbc 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/MapCreator.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/MapCreator.java @@ -25,13 +25,15 @@ package jdk.nashorn.internal.codegen; +import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndex; +import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex; + import java.util.ArrayList; import java.util.List; import jdk.nashorn.internal.ir.Symbol; import jdk.nashorn.internal.runtime.AccessorProperty; import jdk.nashorn.internal.runtime.Property; import jdk.nashorn.internal.runtime.PropertyMap; -import jdk.nashorn.internal.runtime.arrays.ArrayIndex; /** * Class that creates PropertyMap sent to script object constructors. @@ -76,7 +78,7 @@ public class MapCreator { final String key = keys.get(i); final Symbol symbol = symbols.get(i); - if (symbol != null && !ArrayIndex.isIntArrayIndex(key)) { + if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) { properties.add(new AccessorProperty(key, getPropertyFlags(symbol, hasArguments), structure, symbol.getFieldIndex())); } } @@ -93,7 +95,7 @@ public class MapCreator { final String key = keys.get(i); final Symbol symbol = symbols.get(i); - if (symbol != null && !ArrayIndex.isIntArrayIndex(key)) { + if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) { properties.add(new AccessorProperty(key, getPropertyFlags(symbol, hasArguments), spillIndex++)); } } diff --git a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java index 4e07c4777dc..8a012ccbac1 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java @@ -1281,10 +1281,14 @@ public class MethodEmitter implements Emitter { } MethodEmitter registerReturn() { - this.hasReturn = true; + setHasReturn(); return this; } + void setHasReturn() { + this.hasReturn = true; + } + /** * Perform a non void return, popping the type from the stack * diff --git a/nashorn/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java b/nashorn/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java index 08dfedf1a9f..d30d5645fad 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java @@ -26,9 +26,13 @@ package jdk.nashorn.internal.codegen; import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup; +import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup; import static jdk.nashorn.internal.codegen.types.Type.OBJECT; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; + import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.ir.Expression; import jdk.nashorn.internal.ir.LiteralNode; @@ -36,6 +40,8 @@ import jdk.nashorn.internal.ir.Symbol; import jdk.nashorn.internal.runtime.Property; import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.ScriptObject; +import jdk.nashorn.internal.runtime.arrays.ArrayData; +import jdk.nashorn.internal.runtime.arrays.ArrayIndex; import jdk.nashorn.internal.scripts.JO; /** @@ -63,56 +69,82 @@ public class SpillObjectCreator extends ObjectCreator { protected void makeObject(final MethodEmitter method) { assert !isScope() : "spill scope objects are not currently supported"; - final int length = keys.size(); - final Object[] presetValues = new Object[propertyMap.size()]; - final Class clazz = JO.class; + final int length = keys.size(); + final Object[] presetValues = new Object[length]; + final Set postsetValues = new LinkedHashSet<>(); + final int callSiteFlags = codegen.getCallSiteFlags(); + ArrayData arrayData = ArrayData.allocate(new Object[0]); - // Compute constant values + // Compute constant property values for (int i = 0; i < length; i++) { final String key = keys.get(i); - final Property property = propertyMap.findProperty(key); + final Expression value = values.get(i); + if (value == null) { + continue; // getter or setter + } + + final Object constantValue = LiteralNode.objectAsConstant(value); + if (constantValue == LiteralNode.POSTSET_MARKER) { + postsetValues.add(i); + continue; + } + + final Property property = propertyMap.findProperty(key); if (property != null) { - presetValues[property.getSlot()] = LiteralNode.objectAsConstant(values.get(i)); + // normal property key + presetValues[property.getSlot()] = constantValue; + } else { + // array index key + final long oldLength = arrayData.length(); + final int index = ArrayIndex.getArrayIndex(key); + assert ArrayIndex.isValidArrayIndex(index); + final long longIndex = ArrayIndex.toLongIndex(index); + if (longIndex >= oldLength) { + arrayData = arrayData.ensure(longIndex); + } + arrayData = arrayData.set(index, constantValue, false); + if (longIndex > oldLength) { + arrayData = arrayData.delete(oldLength, longIndex - 1); + } } } - method._new(clazz).dup(); + // create object and invoke constructor + method._new(JO.class).dup(); codegen.loadConstant(propertyMap); - method.invoke(constructorNoLookup(JO.class, PropertyMap.class)); + // Set spill array with preset values method.dup(); codegen.loadConstant(presetValues); + method.putField(Type.getInternalName(ScriptObject.class), "spill", Type.OBJECT_ARRAY.getDescriptor()); + + // Set array data if any + if (arrayData.length() > 0) { + method.dup(); + codegen.loadConstant(arrayData); + method.invoke(virtualCallNoLookup(ScriptObject.class, "setArray",void.class, ArrayData.class)); + } // Create properties with non-constant values - for (int i = 0; i < length; i++) { + for (int i : postsetValues) { final String key = keys.get(i); final Property property = propertyMap.findProperty(key); - if (property != null && presetValues[property.getSlot()] == LiteralNode.POSTSET_MARKER) { + if (property == null) { + final int index = ArrayIndex.getArrayIndex(key); + assert ArrayIndex.isValidArrayIndex(index); method.dup(); + method.load(ArrayIndex.toLongIndex(index)); + codegen.load(values.get(i)); + method.dynamicSetIndex(callSiteFlags); + } else { + method.dup(); + method.getField(Type.getInternalName(ScriptObject.class), "spill", Type.OBJECT_ARRAY.getDescriptor()); method.load(property.getSlot()); codegen.load(values.get(i)).convert(OBJECT); method.arraystore(); - presetValues[property.getSlot()] = null; - } - } - - method.putField(Type.typeFor(ScriptObject.class).getInternalName(), "spill", Type.OBJECT_ARRAY.getDescriptor()); - final int callSiteFlags = codegen.getCallSiteFlags(); - - // Assign properties with valid array index keys - for (int i = 0; i < length; i++) { - final String key = keys.get(i); - final Property property = propertyMap.findProperty(key); - final Expression value = values.get(i); - - if (property == null && value != null) { - method.dup(); - method.load(keys.get(i)); - codegen.load(value); - method.dynamicSetIndex(callSiteFlags); } } } diff --git a/nashorn/src/jdk/nashorn/internal/codegen/SplitMethodEmitter.java b/nashorn/src/jdk/nashorn/internal/codegen/SplitMethodEmitter.java index 5fa4486a729..e689820fd6c 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/SplitMethodEmitter.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/SplitMethodEmitter.java @@ -77,15 +77,15 @@ public class SplitMethodEmitter extends MethodEmitter { } if (lc.isExternalTarget(splitNode, label)) { - externalTargets.add(label); - return externalTargets.size() - 1; - } - return -1; + externalTargets.add(label); + return externalTargets.size() - 1; + } + return -1; } @Override MethodEmitter registerReturn() { - super.registerReturn(); + setHasReturn(); loadCompilerConstant(SCOPE); checkcast(Scope.class); load(0); diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java b/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java index a35c6dfdcf1..19338499c3d 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java @@ -96,6 +96,10 @@ final class Splitter extends NodeVisitor { long weight = WeighNodes.weigh(functionNode); final boolean top = fn.isProgram(); //compiler.getFunctionNode() == outermost; + // We know that our LexicalContext is empty outside the call to functionNode.accept(this) below, + // so we can pass null to all methods expecting a LexicalContext parameter. + assert lc.isEmpty() : "LexicalContext not empty"; + if (weight >= SPLIT_THRESHOLD) { LOG.finest("Splitting '", functionNode.getName(), "' as its weight ", weight, " exceeds split threshold ", SPLIT_THRESHOLD); functionNode = (FunctionNode)functionNode.accept(this); @@ -103,11 +107,12 @@ final class Splitter extends NodeVisitor { if (functionNode.isSplit()) { // Weight has changed so weigh again, this time using block weight cache weight = WeighNodes.weigh(functionNode, weightCache); - functionNode = functionNode.setBody(lc, functionNode.getBody().setNeedsScope(lc)); + functionNode = functionNode.setBody(null, functionNode.getBody().setNeedsScope(null)); } if (weight >= SPLIT_THRESHOLD) { - functionNode = functionNode.setBody(lc, splitBlock(functionNode.getBody(), functionNode)); + functionNode = functionNode.setBody(null, splitBlock(functionNode.getBody(), functionNode)); + functionNode = functionNode.setFlag(null, FunctionNode.IS_SPLIT); weight = WeighNodes.weigh(functionNode.getBody(), weightCache); } } @@ -116,10 +121,10 @@ final class Splitter extends NodeVisitor { if (top) { assert outermostCompileUnit != null : "outermost compile unit is null"; - functionNode = functionNode.setCompileUnit(lc, outermostCompileUnit); + functionNode = functionNode.setCompileUnit(null, outermostCompileUnit); outermostCompileUnit.addWeight(weight + WeighNodes.FUNCTION_WEIGHT); } else { - functionNode = functionNode.setCompileUnit(lc, findUnit(weight)); + functionNode = functionNode.setCompileUnit(null, findUnit(weight)); } final Block body = functionNode.getBody(); @@ -138,11 +143,11 @@ final class Splitter extends NodeVisitor { return split; } }); - functionNode = functionNode.setBody(lc, newBody); + functionNode = functionNode.setBody(null, newBody); assert functionNode.getCompileUnit() != null; - return functionNode.setState(lc, CompilationState.SPLIT); + return functionNode.setState(null, CompilationState.SPLIT); } private static List directChildren(final FunctionNode functionNode) { @@ -179,7 +184,6 @@ final class Splitter extends NodeVisitor { * @return new weight for the resulting block. */ private Block splitBlock(final Block block, final FunctionNode function) { - lc.setFlag(lc.getCurrentFunction(), FunctionNode.IS_SPLIT); final List splits = new ArrayList<>(); List statements = new ArrayList<>(); @@ -255,8 +259,10 @@ final class Splitter extends NodeVisitor { // been split already, so weigh again before splitting. long weight = WeighNodes.weigh(block, weightCache); if (weight >= SPLIT_THRESHOLD) { - newBlock = splitBlock(block, lc.getFunction(block)); + final FunctionNode currentFunction = lc.getCurrentFunction(); + newBlock = splitBlock(block, currentFunction); weight = WeighNodes.weigh(newBlock, weightCache); + lc.setFlag(currentFunction, FunctionNode.IS_SPLIT); } weightCache.put(newBlock, weight); return newBlock; @@ -289,7 +295,7 @@ final class Splitter extends NodeVisitor { final Node element = value[postset]; weight = WeighNodes.weigh(element); - totalWeight += weight; + totalWeight += WeighNodes.AASTORE_WEIGHT + weight; if (totalWeight >= SPLIT_THRESHOLD) { final CompileUnit unit = compiler.findUnit(totalWeight - weight); diff --git a/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java b/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java index 57b3bafa797..9ecfccd6126 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java @@ -68,24 +68,25 @@ final class WeighNodes extends NodeOperatorVisitor { /* * Weight constants. */ - static final long FUNCTION_WEIGHT = 40; - private static final long ACCESS_WEIGHT = 4; - private static final long ADD_WEIGHT = 10; - private static final long BREAK_WEIGHT = 1; - private static final long CALL_WEIGHT = 10; - private static final long CATCH_WEIGHT = 10; - private static final long CONTINUE_WEIGHT = 1; - private static final long IF_WEIGHT = 2; - private static final long LITERAL_WEIGHT = 10; - private static final long LOOP_WEIGHT = 4; - private static final long NEW_WEIGHT = 6; - private static final long FUNC_EXPR_WEIGHT = 20; - private static final long RETURN_WEIGHT = 2; - private static final long SPLIT_WEIGHT = 40; - private static final long SWITCH_WEIGHT = 8; - private static final long THROW_WEIGHT = 2; - private static final long VAR_WEIGHT = 40; - private static final long WITH_WEIGHT = 8; + static final long FUNCTION_WEIGHT = 40; + static final long AASTORE_WEIGHT = 2; + static final long ACCESS_WEIGHT = 4; + static final long ADD_WEIGHT = 10; + static final long BREAK_WEIGHT = 1; + static final long CALL_WEIGHT = 10; + static final long CATCH_WEIGHT = 10; + static final long CONTINUE_WEIGHT = 1; + static final long IF_WEIGHT = 2; + static final long LITERAL_WEIGHT = 10; + static final long LOOP_WEIGHT = 4; + static final long NEW_WEIGHT = 6; + static final long FUNC_EXPR_WEIGHT = 20; + static final long RETURN_WEIGHT = 2; + static final long SPLIT_WEIGHT = 40; + static final long SWITCH_WEIGHT = 8; + static final long THROW_WEIGHT = 2; + static final long VAR_WEIGHT = 40; + static final long WITH_WEIGHT = 8; /** Accumulated weight. */ private long weight; @@ -210,6 +211,7 @@ final class WeighNodes extends NodeOperatorVisitor { if (units == null) { for (final int postset : postsets) { + weight += AASTORE_WEIGHT; final Node element = value[postset]; if (element != null) { diff --git a/nashorn/src/jdk/nashorn/internal/ir/Block.java b/nashorn/src/jdk/nashorn/internal/ir/Block.java index c411401e710..f262d8d1a26 100644 --- a/nashorn/src/jdk/nashorn/internal/ir/Block.java +++ b/nashorn/src/jdk/nashorn/internal/ir/Block.java @@ -33,10 +33,14 @@ import java.util.Comparator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; + import jdk.nashorn.internal.codegen.Label; +import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.ir.annotations.Immutable; import jdk.nashorn.internal.ir.visitor.NodeVisitor; +import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN; + /** * IR representation for a list of statements. */ @@ -89,13 +93,13 @@ public class Block extends Node implements BreakableNode, Flags { this.symbols = new LinkedHashMap<>(); this.entryLabel = new Label("block_entry"); this.breakLabel = new Label("block_break"); - this.flags = 0; + final int len = statements.length; + this.flags = (len > 0 && statements[len - 1].hasTerminalFlags()) ? IS_TERMINAL : 0; } /** * Constructor * - * @param lineNumber line number * @param token token * @param finish finish * @param statements statements @@ -213,6 +217,19 @@ public class Block extends Node implements BreakableNode, Flags { return isTerminal ? setFlag(lc, IS_TERMINAL) : clearFlag(lc, IS_TERMINAL); } + /** + * Set the type of the return symbol in this block if present. + * @param returnType the new type + * @return this block + */ + public Block setReturnType(final Type returnType) { + final Symbol symbol = getExistingSymbol(RETURN.symbolName()); + if (symbol != null) { + symbol.setTypeOverride(returnType); + } + return this; + } + @Override public boolean isTerminal() { return getFlag(IS_TERMINAL); diff --git a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java index 311a7f917b7..b0998ae1911 100644 --- a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java +++ b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java @@ -540,12 +540,13 @@ public final class FunctionNode extends LexicalContextExpression implements Flag /** * Check if this function's generated Java method needs a {@code callee} parameter. Functions that need access to * their parent scope, functions that reference themselves, and non-strict functions that need an Arguments object - * (since it exposes {@code arguments.callee} property) will need to have a callee parameter. + * (since it exposes {@code arguments.callee} property) will need to have a callee parameter. We also return true + * for split functions to make sure symbols slots are the same in the main and split methods. * * @return true if the function's generated Java method needs a {@code callee} parameter. */ public boolean needsCallee() { - return needsParentScope() || needsSelfSymbol() || (needsArguments() && !isStrict()); + return needsParentScope() || needsSelfSymbol() || isSplit() || (needsArguments() && !isStrict()); } /** @@ -816,6 +817,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (this.returnType == returnType) { return this; } + final Type type = Type.widest(this.returnType, returnType.isObject() ? Type.OBJECT : returnType); return Node.replaceInLexicalContext( lc, this, @@ -824,12 +826,10 @@ public final class FunctionNode extends LexicalContextExpression implements Flag lastToken, flags, name, - Type.widest(this.returnType, returnType.isObject() ? - Type.OBJECT : - returnType), + type, compileUnit, compilationState, - body, + body.setReturnType(type), parameters, snapshot, hints)); diff --git a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java index 14d1304dfaa..95bd7462acb 100644 --- a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java +++ b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java @@ -153,14 +153,27 @@ public final class IdentNode extends Expression implements PropertyKey, TypeOver } /** - * We can only override type if the symbol lives in the scope, otherwise - * it is strongly determined by the local variable already allocated + * We can only override type if the symbol lives in the scope, as otherwise + * it is strongly determined by the local variable already allocated. + * + *

                              We also return true if the symbol represents the return value of a function with a + * non-generic return type as in this case we need to propagate the type instead of + * converting to object, for example if the symbol is used as the left hand side of an + * assignment such as in the code below.

                              + * + *
                              {@code
                              +     *   try {
                              +     *     return 2;
                              +     *   } finally {
                              +     *     return 3;
                              +     *   }
                              +     * }
                              * * @return true if can have callsite type */ @Override public boolean canHaveCallSiteType() { - return getSymbol() != null && getSymbol().isScope(); + return getSymbol() != null && (getSymbol().isScope() || getSymbol().isNonGenericReturn()); } /** diff --git a/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java b/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java index ed0ca62f9b9..666be7e3fc1 100644 --- a/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java +++ b/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java @@ -350,10 +350,12 @@ public class LexicalContext { * @return the innermost function in the context. */ public FunctionNode getCurrentFunction() { - if (isEmpty()) { - return null; + for (int i = sp - 1; i >= 0; i--) { + if (stack[i] instanceof FunctionNode) { + return (FunctionNode) stack[i]; + } } - return new NodeIterator<>(FunctionNode.class).next(); + return null; } /** diff --git a/nashorn/src/jdk/nashorn/internal/ir/Symbol.java b/nashorn/src/jdk/nashorn/internal/ir/Symbol.java index 5061ab9049a..69e98ac6b3d 100644 --- a/nashorn/src/jdk/nashorn/internal/ir/Symbol.java +++ b/nashorn/src/jdk/nashorn/internal/ir/Symbol.java @@ -35,6 +35,8 @@ import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.Debug; import jdk.nashorn.internal.runtime.options.Options; +import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN; + /** * Maps a name to specific data. */ @@ -441,6 +443,14 @@ public final class Symbol implements Comparable { this.range = range; } + /** + * Check if this symbol represents a return value with a known non-generic type. + * @return true if specialized return value + */ + public boolean isNonGenericReturn() { + return getName().equals(RETURN.symbolName()) && type != Type.OBJECT; + } + /** * Check if this symbol is a function parameter of known * narrowest type diff --git a/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java b/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java index 2f75e09b8b1..19e4d04f7ca 100644 --- a/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java +++ b/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java @@ -102,7 +102,7 @@ public final class ASTWriter { preorder.add(node); } - final boolean isReference = field != null && field.getAnnotation(Reference.class) != null; + final boolean isReference = field != null && field.isAnnotationPresent(Reference.class); Class clazz = node.getClass(); String type = clazz.getName(); @@ -183,7 +183,7 @@ public final class ASTWriter { append('\n'); for (final Field child : children) { - if (child.getAnnotation(Ignore.class) != null) { + if (child.isAnnotationPresent(Ignore.class)) { continue; } diff --git a/nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java b/nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java index 40b1a95cd72..ecf8bec8b68 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java +++ b/nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java @@ -115,6 +115,11 @@ abstract class ArrayBufferView extends ScriptObject { this.elementLength = elementLength; } + @Override + public ArrayData copy() { + throw new UnsupportedOperationException(); // Not used for ArrayBuffers + } + @Override public Object[] asObjectArray() { final Object[] array = new Object[elementLength]; diff --git a/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java b/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java index a8f311eb19f..d0e5b987f65 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java +++ b/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java @@ -35,7 +35,7 @@ import jdk.nashorn.internal.runtime.ScriptRuntime; * must track their {@code [[TargetFunction]]} property for purposes of correctly implementing {@code [[HasInstance]]}; * see {@link ScriptFunction#isInstance(ScriptObject)}. */ -class BoundScriptFunctionImpl extends ScriptFunctionImpl { +final class BoundScriptFunctionImpl extends ScriptFunctionImpl { private final ScriptFunction targetFunction; BoundScriptFunctionImpl(ScriptFunctionData data, ScriptFunction targetFunction) { diff --git a/nashorn/src/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk/nashorn/internal/objects/Global.java index e54fbb45e6d..62288414f6f 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/Global.java +++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java @@ -63,6 +63,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.ScriptingFunctions; import jdk.nashorn.internal.runtime.Source; +import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; import jdk.nashorn.internal.scripts.JO; @@ -411,18 +412,33 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { // initialized by nasgen private static PropertyMap $nasgenmap$; + // performs initialization checks for Global constructor and returns the + // PropertyMap, if everything is fine. + private static PropertyMap checkAndGetMap(final Context context) { + // security check first + final SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new RuntimePermission("nashorn.newGlobal")); + } + + // null check on context + context.getClass(); + + /* + * Duplicate global's map and use it. This way the initial Map filled + * by nasgen (referenced from static field in this class) is retained + * 'as is' (as that one is process wide singleton. + */ + return $nasgenmap$.duplicate(); + } + /** * Constructor * * @param context the context */ public Global(final Context context) { - /* - * Duplicate global's map and use it. This way the initial Map filled - * by nasgen (referenced from static field in this class) is retained - * 'as is' (as that one is process wide singleton. - */ - super($nasgenmap$.duplicate()); + super(checkAndGetMap(context)); this.setContext(context); this.setIsScope(); @@ -533,7 +549,8 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { if (hint == String.class) { final Object toString = TO_STRING.getGetter().invokeExact(sobj); - if (toString instanceof ScriptFunction) { + + if (Bootstrap.isCallable(toString)) { final Object value = TO_STRING.getInvoker().invokeExact(toString, sobj); if (JSType.isPrimitive(value)) { return value; @@ -541,7 +558,7 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { } final Object valueOf = VALUE_OF.getGetter().invokeExact(sobj); - if (valueOf instanceof ScriptFunction) { + if (Bootstrap.isCallable(valueOf)) { final Object value = VALUE_OF.getInvoker().invokeExact(valueOf, sobj); if (JSType.isPrimitive(value)) { return value; @@ -552,7 +569,7 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { if (hint == Number.class) { final Object valueOf = VALUE_OF.getGetter().invokeExact(sobj); - if (valueOf instanceof ScriptFunction) { + if (Bootstrap.isCallable(valueOf)) { final Object value = VALUE_OF.getInvoker().invokeExact(valueOf, sobj); if (JSType.isPrimitive(value)) { return value; @@ -560,7 +577,7 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { } final Object toString = TO_STRING.getGetter().invokeExact(sobj); - if (toString instanceof ScriptFunction) { + if (Bootstrap.isCallable(toString)) { final Object value = TO_STRING.getInvoker().invokeExact(toString, sobj); if (JSType.isPrimitive(value)) { return value; diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java index c1b64c781f3..5572cb14522 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java @@ -360,7 +360,7 @@ public final class NativeArray extends ScriptObject { final ScriptObject sobj = (ScriptObject)obj; try { final Object join = JOIN.getGetter().invokeExact(sobj); - if (join instanceof ScriptFunction) { + if (Bootstrap.isCallable(join)) { return JOIN.getInvoker().invokeExact(join, sobj); } } catch (final RuntimeException | Error e) { @@ -396,7 +396,7 @@ public final class NativeArray extends ScriptObject { final ScriptObject sobj = (ScriptObject)val; final Object toLocaleString = TO_LOCALE_STRING.getGetter().invokeExact(sobj); - if (toLocaleString instanceof ScriptFunction) { + if (Bootstrap.isCallable(toLocaleString)) { sb.append((String)TO_LOCALE_STRING.getInvoker().invokeExact(toLocaleString, sobj)); } else { throw typeError("not.a.function", "toLocaleString"); diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java index 11ab886e467..e12b022ec34 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java @@ -44,9 +44,9 @@ import jdk.nashorn.internal.runtime.ConsString; import jdk.nashorn.internal.runtime.JSType; import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.ScriptEnvironment; -import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; +import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; /** @@ -862,7 +862,7 @@ public final class NativeDate extends ScriptObject { try { final Object func = TO_ISO_STRING.getGetter().invokeExact(sobj); - if (func instanceof ScriptFunction) { + if (Bootstrap.isCallable(func)) { return TO_ISO_STRING.getInvoker().invokeExact(func, sobj, key); } throw typeError("not.a.function", ScriptRuntime.safeToString(func)); diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java b/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java index 863d531bda9..c7e9f1c0fcc 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java @@ -189,7 +189,7 @@ public final class NativeJSON extends ScriptObject { if (value instanceof ScriptObject) { final ScriptObject svalue = (ScriptObject)value; final Object toJSON = TO_JSON.getGetter().invokeExact(svalue); - if (toJSON instanceof ScriptFunction) { + if (Bootstrap.isCallable(toJSON)) { value = TO_JSON.getInvoker().invokeExact(toJSON, svalue, key); } } diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java index b392c662e70..659040534d4 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java @@ -55,7 +55,6 @@ import jdk.nashorn.internal.runtime.ECMAException; import jdk.nashorn.internal.runtime.JSType; import jdk.nashorn.internal.runtime.Property; import jdk.nashorn.internal.runtime.PropertyMap; -import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.linker.Bootstrap; @@ -407,7 +406,7 @@ public final class NativeObject { try { final Object toString = TO_STRING.getGetter().invokeExact(sobj); - if (toString instanceof ScriptFunction) { + if (Bootstrap.isCallable(toString)) { return TO_STRING.getInvoker().invokeExact(toString, sobj); } } catch (final RuntimeException | Error e) { diff --git a/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java b/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java index 837fee8b789..4610afc2473 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java +++ b/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java @@ -75,7 +75,7 @@ public class PrototypeObject extends ScriptObject { * * @param map property map */ - public PrototypeObject(final PropertyMap map) { + PrototypeObject(final PropertyMap map) { this(Global.instance(), map); } @@ -89,7 +89,7 @@ public class PrototypeObject extends ScriptObject { * @param self self reference * @return constructor, probably, but not necessarily, a {@link ScriptFunction} */ - public static Object getConstructor(final Object self) { + static Object getConstructor(final Object self) { return (self instanceof PrototypeObject) ? ((PrototypeObject)self).getConstructor() : UNDEFINED; @@ -100,7 +100,7 @@ public class PrototypeObject extends ScriptObject { * @param self self reference * @param constructor constructor, probably, but not necessarily, a {@link ScriptFunction} */ - public static void setConstructor(final Object self, final Object constructor) { + static void setConstructor(final Object self, final Object constructor) { if (self instanceof PrototypeObject) { ((PrototypeObject)self).setConstructor(constructor); } diff --git a/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java b/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java index 25b500cef07..80f7ce0745d 100644 --- a/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java +++ b/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java @@ -25,6 +25,7 @@ package jdk.nashorn.internal.parser; +import static jdk.nashorn.internal.parser.TokenType.COMMENT; import static jdk.nashorn.internal.parser.TokenType.EOF; import static jdk.nashorn.internal.parser.TokenType.EOL; import static jdk.nashorn.internal.parser.TokenType.IDENT; @@ -135,14 +136,27 @@ public abstract class AbstractParser { } /** - * Seek next token that is not an EOL. + * Seek next token that is not an EOL or comment. * * @return tokenType of next token. */ protected final TokenType next() { do { nextOrEOL(); - } while (type == EOL); + } while (type == EOL || type == COMMENT); + + return type; + } + + /** + * Seek next token or EOL (skipping comments.) + * + * @return tokenType of next token. + */ + protected final TokenType nextOrEOL() { + do { + nextToken(); + } while (type == COMMENT); return type; } @@ -152,7 +166,7 @@ public abstract class AbstractParser { * * @return tokenType of next token. */ - protected final TokenType nextOrEOL() { + private final TokenType nextToken() { // Capture last token tokenType. last = type; if (type != EOF) { diff --git a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java index adb1445c9a4..09269c6ccd7 100644 --- a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java +++ b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java @@ -26,6 +26,7 @@ package jdk.nashorn.internal.parser; import static jdk.nashorn.internal.parser.TokenType.ADD; +import static jdk.nashorn.internal.parser.TokenType.COMMENT; import static jdk.nashorn.internal.parser.TokenType.DECIMAL; import static jdk.nashorn.internal.parser.TokenType.EOF; import static jdk.nashorn.internal.parser.TokenType.EOL; @@ -83,12 +84,70 @@ public class Lexer extends Scanner { /** Type of last token added. */ private TokenType last; - private static final String JAVASCRIPT_WHITESPACE; - private static final String JAVASCRIPT_WHITESPACE_EOL; - private static final String JAVASCRIPT_WHITESPACE_IN_REGEXP; + private static final String SPACETAB = " \t"; // ASCII space and tab + private static final String LFCR = "\n\r"; // line feed and carriage return (ctrl-m) - private static final String JSON_WHITESPACE; - private static final String JSON_WHITESPACE_EOL; + private static final String JSON_WHITESPACE_EOL = LFCR; + private static final String JSON_WHITESPACE = SPACETAB + LFCR; + + private static final String JAVASCRIPT_WHITESPACE_EOL = + LFCR + + "\u2028" + // line separator + "\u2029" // paragraph separator + ; + private static final String JAVASCRIPT_WHITESPACE = + SPACETAB + + JAVASCRIPT_WHITESPACE_EOL + + "\u000b" + // tabulation line + "\u000c" + // ff (ctrl-l) + "\u00a0" + // Latin-1 space + "\u1680" + // Ogham space mark + "\u180e" + // separator, Mongolian vowel + "\u2000" + // en quad + "\u2001" + // em quad + "\u2002" + // en space + "\u2003" + // em space + "\u2004" + // three-per-em space + "\u2005" + // four-per-em space + "\u2006" + // six-per-em space + "\u2007" + // figure space + "\u2008" + // punctuation space + "\u2009" + // thin space + "\u200a" + // hair space + "\u202f" + // narrow no-break space + "\u205f" + // medium mathematical space + "\u3000" + // ideographic space + "\ufeff" // byte order mark + ; + + private static final String JAVASCRIPT_WHITESPACE_IN_REGEXP = + "\\u000a" + // line feed + "\\u000d" + // carriage return (ctrl-m) + "\\u2028" + // line separator + "\\u2029" + // paragraph separator + "\\u0009" + // tab + "\\u0020" + // ASCII space + "\\u000b" + // tabulation line + "\\u000c" + // ff (ctrl-l) + "\\u00a0" + // Latin-1 space + "\\u1680" + // Ogham space mark + "\\u180e" + // separator, Mongolian vowel + "\\u2000" + // en quad + "\\u2001" + // em quad + "\\u2002" + // en space + "\\u2003" + // em space + "\\u2004" + // three-per-em space + "\\u2005" + // four-per-em space + "\\u2006" + // six-per-em space + "\\u2007" + // figure space + "\\u2008" + // punctuation space + "\\u2009" + // thin space + "\\u200a" + // hair space + "\\u202f" + // narrow no-break space + "\\u205f" + // medium mathematical space + "\\u3000" + // ideographic space + "\\ufeff" // byte order mark + ; static String unicodeEscape(final char ch) { final StringBuilder sb = new StringBuilder(); @@ -104,65 +163,6 @@ public class Lexer extends Scanner { return sb.toString(); } - static { - final StringBuilder ws = new StringBuilder(); - final StringBuilder wsEOL = new StringBuilder(); - final StringBuilder wsRegExp = new StringBuilder(); - final StringBuilder jsonWs = new StringBuilder(); - - jsonWs.append((char)0x000a); - jsonWs.append((char)0x000d); - JSON_WHITESPACE_EOL = jsonWs.toString(); - - jsonWs.append((char)0x0009); - jsonWs.append((char)0x0020); - JSON_WHITESPACE = jsonWs.toString(); - - for (int i = 0; i <= 0xffff; i++) { - switch (i) { - case 0x000a: // line feed - case 0x000d: // carriage return (ctrl-m) - case 0x2028: // line separator - case 0x2029: // paragraph separator - wsEOL.append((char)i); - case 0x0009: // tab - case 0x0020: // ASCII space - case 0x000b: // tabulation line - case 0x000c: // ff (ctrl-l) - case 0x00a0: // Latin-1 space - case 0x1680: // Ogham space mark - case 0x180e: // separator, Mongolian vowel - case 0x2000: // en quad - case 0x2001: // em quad - case 0x2002: // en space - case 0x2003: // em space - case 0x2004: // three-per-em space - case 0x2005: // four-per-em space - case 0x2006: // six-per-em space - case 0x2007: // figure space - case 0x2008: // punctuation space - case 0x2009: // thin space - case 0x200a: // hair space - case 0x202f: // narrow no-break space - case 0x205f: // medium mathematical space - case 0x3000: // ideographic space - case 0xfeff: // byte order mark - ws.append((char)i); - - wsRegExp.append(Lexer.unicodeEscape((char)i)); - break; - - default: - break; - } - } - - JAVASCRIPT_WHITESPACE = ws.toString(); - JAVASCRIPT_WHITESPACE_EOL = wsEOL.toString(); - JAVASCRIPT_WHITESPACE_IN_REGEXP = wsRegExp.toString(); - - } - /** * Constructor * @@ -427,6 +427,9 @@ public class Lexer extends Scanner { * @return True if a comment. */ protected boolean skipComments() { + // Save the current position. + final int start = position; + if (ch0 == '/') { // Is it a // comment. if (ch1 == '/') { @@ -437,10 +440,9 @@ public class Lexer extends Scanner { skip(1); } // Did detect a comment. + add(COMMENT, start); return true; } else if (ch1 == '*') { - // Record beginning of comment. - final int start = position; // Skip over /*. skip(2); // Scan for */. @@ -462,11 +464,11 @@ public class Lexer extends Scanner { } // Did detect a comment. + add(COMMENT, start); return true; } - } - - if (scripting && ch0 == '#') { + } else if (ch0 == '#') { + assert scripting; // shell style comment // Skip over #. skip(1); @@ -475,6 +477,7 @@ public class Lexer extends Scanner { skip(1); } // Did detect a comment. + add(COMMENT, start); return true; } @@ -563,7 +566,7 @@ public class Lexer extends Scanner { * * @param token the token. * @param startTokenType the token type. - * @parasm lir LineInfoReceiver that receives line info for multi-line string literals. + * @param lir LineInfoReceiver that receives line info for multi-line string literals. * @return True if a literal beginning with startToken was found and scanned. */ protected boolean scanLiteral(final long token, final TokenType startTokenType, final LineInfoReceiver lir) { @@ -1461,11 +1464,10 @@ public class Lexer extends Scanner { final State restState = saveState(); // keep line number updated int lastLine = line; - int lastLinePosition = linePosition; skipLine(false); lastLine++; - lastLinePosition = position; + int lastLinePosition = position; restState.setLimit(position); // Record beginning of string. diff --git a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java index c92b9e98284..6a0f564486b 100644 --- a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java +++ b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java @@ -44,6 +44,7 @@ public enum TokenType { ERROR (SPECIAL, null), EOF (SPECIAL, null), EOL (SPECIAL, null), + COMMENT (SPECIAL, null), NOT (UNARY, "!", 14, false), NE (BINARY, "!=", 9, true), diff --git a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java index c9d2a04229f..702ca76ba1f 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java @@ -51,7 +51,7 @@ import jdk.nashorn.internal.lookup.MethodHandleFactory; * An AccessorProperty is the most generic property type. An AccessorProperty is * represented as fields in a ScriptObject class. */ -public class AccessorProperty extends Property { +public final class AccessorProperty extends Property { private static final MethodHandles.Lookup lookup = MethodHandles.lookup(); private static final MethodHandle REPLACE_MAP = findOwnMH("replaceMap", Object.class, Object.class, PropertyMap.class, String.class, Class.class, Class.class); @@ -149,7 +149,7 @@ public class AccessorProperty extends Property { * @param property accessor property to rebind * @param delegate delegate object to rebind receiver to */ - public AccessorProperty(final AccessorProperty property, final Object delegate) { + AccessorProperty(final AccessorProperty property, final Object delegate) { super(property); this.primitiveGetter = bindTo(property.primitiveGetter, delegate); @@ -185,7 +185,7 @@ public class AccessorProperty extends Property { * @param getter the property getter * @param setter the property setter or null if non writable, non configurable */ - public AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) { + AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) { super(key, flags, slot); // we don't need to prep the setters these will never be invalidated as this is a nasgen diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk/nashorn/internal/runtime/Context.java index 6638ae60e83..b0e2f15fb66 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java @@ -36,13 +36,17 @@ import java.io.IOException; import java.io.PrintWriter; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; +import java.lang.reflect.Modifier; import java.util.concurrent.atomic.AtomicLong; import java.net.MalformedURLException; import java.net.URL; +import java.security.AccessControlContext; import java.security.AccessController; import java.security.CodeSigner; import java.security.CodeSource; +import java.security.Permissions; import java.security.PrivilegedAction; +import java.security.ProtectionDomain; import java.util.Map; import jdk.internal.org.objectweb.asm.ClassReader; import jdk.internal.org.objectweb.asm.util.CheckClassAdapter; @@ -121,11 +125,6 @@ public final class Context { * @param global the global scope */ public static void setGlobal(final ScriptObject global) { - final SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new RuntimePermission("nashorn.setGlobal")); - } - if (global != null && !(global instanceof Global)) { throw new IllegalArgumentException("global is not an instance of Global!"); } @@ -205,6 +204,7 @@ public final class Context { private static final ClassLoader myLoader = Context.class.getClassLoader(); private static final StructureLoader sharedLoader; + private static final AccessControlContext NO_PERMISSIONS_CONTEXT; static { sharedLoader = AccessController.doPrivileged(new PrivilegedAction() { @@ -213,6 +213,7 @@ public final class Context { return new StructureLoader(myLoader, null); } }); + NO_PERMISSIONS_CONTEXT = new AccessControlContext(new ProtectionDomain[] { new ProtectionDomain(null, new Permissions()) }); } /** @@ -483,7 +484,7 @@ public final class Context { source = new Source(name, script); } } else if (src instanceof Map) { - final Map map = (Map)src; + final Map map = (Map)src; if (map.containsKey("script") && map.containsKey("name")) { final String script = JSType.toString(map.get("script")); final String name = JSType.toString(map.get("name")); @@ -553,24 +554,59 @@ public final class Context { * @throws ClassNotFoundException if structure class cannot be resolved */ public static Class forStructureClass(final String fullName) throws ClassNotFoundException { + if (System.getSecurityManager() != null && !NashornLoader.isStructureClass(fullName)) { + throw new ClassNotFoundException(fullName); + } return Class.forName(fullName, true, sharedLoader); } /** - * Checks that the given package can be accessed from current call stack. + * Checks that the given package can be accessed from no permissions context. * * @param fullName fully qualified package name + * @throw SecurityException if not accessible */ public static void checkPackageAccess(final String fullName) { final int index = fullName.lastIndexOf('.'); if (index != -1) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPackageAccess(fullName.substring(0, index)); + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { + sm.checkPackageAccess(fullName.substring(0, index)); + return null; + } + }, NO_PERMISSIONS_CONTEXT); } } } + /** + * Checks that the given package can be accessed from no permissions context. + * + * @param fullName fully qualified package name + * @return true if package is accessible, false otherwise + */ + public static boolean isAccessiblePackage(final String fullName) { + try { + checkPackageAccess(fullName); + return true; + } catch (final SecurityException se) { + return false; + } + } + + /** + * Checks that the given Class is public and it can be accessed from no permissions context. + * + * @param clazz Class object to check + * @return true if Class is accessible, false otherwise + */ + public static boolean isAccessibleClass(final Class clazz) { + return Modifier.isPublic(clazz.getModifiers()) && Context.isAccessiblePackage(clazz.getName()); + } + /** * Lookup a Java class. This is used for JSR-223 stuff linking in from * {@code jdk.nashorn.internal.objects.NativeJava} and {@code jdk.nashorn.internal.runtime.NativeJavaPackage} @@ -626,7 +662,7 @@ public final class Context { // No verification when security manager is around as verifier // may load further classes - which should be avoided. if (System.getSecurityManager() == null) { - CheckClassAdapter.verify(new ClassReader(bytecode), scriptLoader, false, new PrintWriter(System.err, true)); + CheckClassAdapter.verify(new ClassReader(bytecode), sharedLoader, false, new PrintWriter(System.err, true)); } } } @@ -645,12 +681,7 @@ public final class Context { * @return the global script object */ public ScriptObject newGlobal() { - final SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new RuntimePermission("nashorn.newGlobal")); - } - - return newGlobalTrusted(); + return new Global(this); } /** @@ -828,10 +859,6 @@ public final class Context { }); } - private ScriptObject newGlobalTrusted() { - return new Global(this); - } - private long getUniqueScriptId() { return uniqueScriptId.getAndIncrement(); } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java b/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java index 469245f113a..f28ed6ae298 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java @@ -33,7 +33,7 @@ import java.lang.invoke.MethodHandle; * This is a subclass that represents a script function that may not be regenerated. * This is used for example for bound functions and builtins. */ -public final class FinalScriptFunctionData extends ScriptFunctionData { +final class FinalScriptFunctionData extends ScriptFunctionData { /** * Constructor - used for bind diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java b/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java index 194bd132000..1d5603f6818 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java @@ -31,6 +31,7 @@ import java.util.Iterator; import java.util.ListIterator; import java.util.NoSuchElementException; import java.util.RandomAccess; +import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; /** @@ -46,7 +47,7 @@ import jdk.nashorn.internal.runtime.linker.InvokeByName; * operations respectively, while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and * {@code pop}. */ -public class ListAdapter extends AbstractList implements RandomAccess, Deque { +public final class ListAdapter extends AbstractList implements RandomAccess, Deque { // These add to the back and front of the list private static final InvokeByName PUSH = new InvokeByName("push", ScriptObject.class, void.class, Object.class); private static final InvokeByName UNSHIFT = new InvokeByName("unshift", ScriptObject.class, void.class, Object.class); @@ -157,7 +158,7 @@ public class ListAdapter extends AbstractList implements RandomAccess, D } } private static void checkFunction(Object fn, InvokeByName invoke) { - if(!(fn instanceof ScriptFunction)) { + if(!(Bootstrap.isCallable(fn))) { throw new UnsupportedOperationException("The script object doesn't have a function named " + invoke.getName()); } } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java b/nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java index 5ce31008088..4e349730451 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java @@ -44,26 +44,29 @@ import jdk.nashorn.tools.Shell; * */ abstract class NashornLoader extends SecureClassLoader { - private static final String OBJECTS_PKG = "jdk.nashorn.internal.objects"; - private static final String RUNTIME_PKG = "jdk.nashorn.internal.runtime"; + private static final String OBJECTS_PKG = "jdk.nashorn.internal.objects"; + private static final String RUNTIME_PKG = "jdk.nashorn.internal.runtime"; + private static final String RUNTIME_ARRAYS_PKG = "jdk.nashorn.internal.runtime.arrays"; private static final String RUNTIME_LINKER_PKG = "jdk.nashorn.internal.runtime.linker"; - private static final String SCRIPTS_PKG = "jdk.nashorn.internal.scripts"; + private static final String SCRIPTS_PKG = "jdk.nashorn.internal.scripts"; private static final Permission[] SCRIPT_PERMISSIONS; - static { - SCRIPT_PERMISSIONS = new Permission[4]; + static { /* * Generated classes get access to runtime, runtime.linker, objects, scripts packages. * Note that the actual scripts can not access these because Java.type, Packages * prevent these restricted packages. And Java reflection and JSR292 access is prevented * for scripts. In other words, nashorn generated portions of script classes can access - * clases in these implementation packages. + * classes in these implementation packages. */ - SCRIPT_PERMISSIONS[0] = new RuntimePermission("accessClassInPackage." + RUNTIME_PKG); - SCRIPT_PERMISSIONS[1] = new RuntimePermission("accessClassInPackage." + RUNTIME_LINKER_PKG); - SCRIPT_PERMISSIONS[2] = new RuntimePermission("accessClassInPackage." + OBJECTS_PKG); - SCRIPT_PERMISSIONS[3] = new RuntimePermission("accessClassInPackage." + SCRIPTS_PKG); + SCRIPT_PERMISSIONS = new Permission[] { + new RuntimePermission("accessClassInPackage." + RUNTIME_PKG), + new RuntimePermission("accessClassInPackage." + RUNTIME_LINKER_PKG), + new RuntimePermission("accessClassInPackage." + OBJECTS_PKG), + new RuntimePermission("accessClassInPackage." + SCRIPTS_PKG), + new RuntimePermission("accessClassInPackage." + RUNTIME_ARRAYS_PKG) + }; } private final Context context; @@ -97,6 +100,7 @@ abstract class NashornLoader extends SecureClassLoader { final String pkgName = name.substring(0, i); switch (pkgName) { case RUNTIME_PKG: + case RUNTIME_ARRAYS_PKG: case RUNTIME_LINKER_PKG: case OBJECTS_PKG: case SCRIPTS_PKG: @@ -118,6 +122,10 @@ abstract class NashornLoader extends SecureClassLoader { return permCollection; } + static boolean isStructureClass(final String fullName) { + return fullName.startsWith(SCRIPTS_PKG); + } + /** * Create a secure URL class loader for the given classpath * @param classPath classpath for the loader to search from diff --git a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java index 145afac6a26..9e725e339df 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java @@ -84,8 +84,8 @@ public final class NativeJavaPackage extends ScriptObject { * @param proto proto */ public NativeJavaPackage(final String name, final ScriptObject proto) { + super(proto, null); this.name = name; - this.setProto(proto); } @Override diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Property.java b/nashorn/src/jdk/nashorn/internal/runtime/Property.java index e2cc6cdec21..e735ed11ea5 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/Property.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/Property.java @@ -100,7 +100,7 @@ public abstract class Property { * @param flags property flags * @param slot property field number or spill slot */ - public Property(final String key, final int flags, final int slot) { + Property(final String key, final int flags, final int slot) { assert key != null; this.key = key; this.flags = flags; @@ -112,7 +112,7 @@ public abstract class Property { * * @param property source property */ - protected Property(final Property property) { + Property(final Property property) { this.key = property.key; this.flags = property.flags; this.slot = property.slot; @@ -123,7 +123,7 @@ public abstract class Property { * * @return cloned property */ - protected abstract Property copy(); + abstract Property copy(); /** * Property flag utility method for {@link PropertyDescriptor}s. Given two property descriptors, diff --git a/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java b/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java index 1ce18b63d8f..dc1426d827c 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java @@ -32,6 +32,7 @@ import java.util.WeakHashMap; * Helper class to manage property listeners and notification. */ public class PropertyListenerManager implements PropertyListener { + PropertyListenerManager() {} /** property listeners for this object. */ private Map listeners; diff --git a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java index 511ff666cd5..64f4b449079 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java @@ -352,11 +352,15 @@ public final class PropertyMap implements Iterable, PropertyListener { return newMap; } - /* + /** * Make a new UserAccessorProperty property. getter and setter functions are stored in * this ScriptObject and slot values are used in property object. Note that slots * are assigned speculatively and should be added to map before adding other * properties. + * + * @param key the property name + * @param propertyFlags attribute flags of the property + * @return the newly created UserAccessorProperty */ public UserAccessorProperty newUserAccessors(final String key, final int propertyFlags) { int oldSpillLength = spillLength; diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java index 673c0152ecf..c1c1de6edd5 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java @@ -67,7 +67,7 @@ public abstract class ScriptFunctionData { * @param isBuiltin is the function built in * @param isConstructor is the function a constructor */ - protected ScriptFunctionData(final String name, final int arity, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) { + ScriptFunctionData(final String name, final int arity, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) { this.name = name; this.arity = arity; this.code = new CompiledFunctions(); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java index 7ac47c84541..099aad5511c 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java @@ -1045,6 +1045,15 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr return getContext()._strict; } + /** + * Checks if this object belongs to the given context + * @param ctx context to check against + * @return true if this object belongs to the given context + */ + public final boolean isOfContext(final Context ctx) { + return context == ctx; + } + /** * Return the current context from the object's map. * @return Current context. @@ -3192,9 +3201,15 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr return true; } - /* + /** * Make a new UserAccessorProperty property. getter and setter functions are stored in * this ScriptObject and slot values are used in property object. + * + * @param key the property name + * @param propertyFlags attribute flags of the property + * @param getter getter function for the property + * @param setter setter function for the property + * @return the newly created UserAccessorProperty */ protected final UserAccessorProperty newUserAccessors(final String key, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) { final UserAccessorProperty property = getMap().newUserAccessors(key, propertyFlags); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java index f0b68c52ddf..dbeee76ad8c 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java @@ -335,9 +335,7 @@ public final class ScriptRuntime { */ public static Object checkAndApply(final ScriptFunction target, final Object self, final Object... args) { final ScriptObject global = Context.getGlobalTrusted(); - if (! (global instanceof GlobalObject)) { - throw new IllegalStateException("No current global set"); - } + assert (global instanceof GlobalObject): "No current global set"; if (target.getContext() != global.getContext()) { throw new IllegalArgumentException("'target' function is not from current Context"); @@ -383,9 +381,7 @@ public final class ScriptRuntime { */ public static Object checkAndConstruct(final ScriptFunction target, final Object... args) { final ScriptObject global = Context.getGlobalTrusted(); - if (! (global instanceof GlobalObject)) { - throw new IllegalStateException("No current global set"); - } + assert (global instanceof GlobalObject): "No current global set"; if (target.getContext() != global.getContext()) { throw new IllegalArgumentException("'target' function is not from current Context"); @@ -395,7 +391,7 @@ public final class ScriptRuntime { return construct(target, args); } - /* + /** * Call a script function as a constructor with given args. * * @param target ScriptFunction object. diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Source.java b/nashorn/src/jdk/nashorn/internal/runtime/Source.java index b5033e95534..7e3c8684e91 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/Source.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/Source.java @@ -384,11 +384,7 @@ public final class Source { } final byte[] buf = Files.readAllBytes(file.toPath()); - if (cs != null) { - return new String(buf, cs).toCharArray(); - } else { - return byteToCharArray(buf); - } + return (cs != null)? new String(buf, cs).toCharArray() : byteToCharArray(buf); } /** @@ -465,11 +461,7 @@ public final class Source { } private static char[] readFully(final InputStream is, final Charset cs) throws IOException { - if (cs != null) { - return new String(readBytes(is), cs).toCharArray(); - } else { - return readFully(is); - } + return (cs != null)? new String(readBytes(is), cs).toCharArray() : readFully(is); } private static char[] readFully(final InputStream is) throws IOException { diff --git a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java index 1dc64311545..7f4659c00ce 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java @@ -83,7 +83,7 @@ public final class UserAccessorProperty extends Property { * @param getterSlot getter slot, starting at first embed * @param setterSlot setter slot, starting at first embed */ - public UserAccessorProperty(final String key, final int flags, final int getterSlot, final int setterSlot) { + UserAccessorProperty(final String key, final int flags, final int getterSlot, final int setterSlot) { super(key, flags, -1); this.getterSlot = getterSlot; this.setterSlot = setterSlot; diff --git a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java index ca3fcac973e..7c08e8545ab 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java @@ -57,11 +57,9 @@ public final class WithObject extends ScriptObject implements Scope { * @param scope scope object * @param expression with expression */ - public WithObject(final ScriptObject scope, final Object expression) { - super(); - + WithObject(final ScriptObject scope, final Object expression) { + super(scope, null); setIsScope(); - setProto(scope); this.expression = expression; } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java index 9e3efeed5b9..1278d49ff95 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java @@ -56,7 +56,7 @@ public abstract class ArrayData { * Constructor * @param length Virtual length of the array. */ - public ArrayData(final long length) { + protected ArrayData(final long length) { this.length = length; } @@ -182,6 +182,14 @@ public abstract class ArrayData { return length; } + /** + * Return a copy of the array that can be modified without affecting this instance. + * It is safe to return themselves for immutable subclasses. + * + * @return a new array + */ + public abstract ArrayData copy(); + /** * Return a copy of the array data as an Object array. * diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java index f59229c40ec..58d1a49db22 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java @@ -177,15 +177,5 @@ public final class ArrayIndex { return index & JSType.MAX_UINT; } - /** - * Check whether a key string represents a valid array index in JavaScript and is small enough - * to fit into a positive int. - * - * @param key the key - * @return true if key works as a valid int array index - */ - public static boolean isIntArrayIndex(final String key) { - return getArrayIndex(key) >= 0; - } } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java index 71d4d15205e..8d2de2ced89 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java @@ -30,7 +30,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; /** * Iterator over a NativeArray */ -public class ArrayIterator extends ArrayLikeIterator { +class ArrayIterator extends ArrayLikeIterator { /** Array {@link ScriptObject} to iterate over */ protected final ScriptObject array; diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java index b5f1f16d024..20c415e7514 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java @@ -43,6 +43,13 @@ final class DeletedArrayFilter extends ArrayFilter { this.deleted = new BitVector(underlying.length()); } + @Override + public ArrayData copy() { + DeletedArrayFilter copy = new DeletedArrayFilter(underlying.copy()); + copy.getDeleted().copy(deleted); + return copy; + } + @Override public Object[] asObjectArray() { final Object[] value = super.asObjectArray(); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java index 29c443bae10..403689669ac 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java @@ -49,6 +49,11 @@ final class DeletedRangeArrayFilter extends ArrayFilter { return lo <= index && index <= hi; } + @Override + public ArrayData copy() { + return new DeletedRangeArrayFilter(underlying.copy(), lo, hi); + } + @Override public Object[] asObjectArray() { final Object[] value = super.asObjectArray(); @@ -191,11 +196,7 @@ final class DeletedRangeArrayFilter extends ArrayFilter { private ArrayData getDeletedArrayFilter() { final ArrayData deleteFilter = new DeletedArrayFilter(getUnderlying()); - - for (long i = lo; i <= hi; i++) { - deleteFilter.delete((int) i); - } - + deleteFilter.delete(lo, hi); return deleteFilter; } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java index 07a53fd7cee..a1f772b8bae 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java @@ -38,6 +38,11 @@ final class FrozenArrayFilter extends SealedArrayFilter { super(underlying); } + @Override + public ArrayData copy() { + return this; + } + @Override public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), false, true, false); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java index 54d98d9badd..add399127b8 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java @@ -33,7 +33,7 @@ import jdk.nashorn.internal.runtime.ScriptRuntime; * Implementation of {@link ArrayData} as soon as an int has been * written to the array. This is the default data for new arrays */ -public final class IntArrayData extends ArrayData { +final class IntArrayData extends ArrayData { /** * The wrapped array */ @@ -55,10 +55,13 @@ public final class IntArrayData extends ArrayData { */ IntArrayData(final int array[], final int length) { super(length); + assert array.length >= length; this.array = array; - if (array.length > length) { - Arrays.fill(array, length, array.length, 0); - } + } + + @Override + public ArrayData copy() { + return new IntArrayData(array.clone(), (int) length()); } @Override diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java index 91b20e5d222..9b6cbb447fe 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java @@ -31,6 +31,7 @@ import jdk.nashorn.api.scripting.ScriptObjectMirror; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptRuntime; +import jdk.nashorn.internal.runtime.linker.Bootstrap; /** * Helper class for the various map/apply functions in {@link jdk.nashorn.internal.objects.NativeArray}. @@ -103,6 +104,8 @@ public abstract class IteratorAction { } else if (callbackfn instanceof ScriptObjectMirror && ((ScriptObjectMirror)callbackfn).isFunction()) { strict = ((ScriptObjectMirror)callbackfn).isStrictFunction(); + } else if (Bootstrap.isDynamicMethod(callbackfn) || Bootstrap.isFunctionalInterfaceObject(callbackfn)) { + strict = false; } else { throw typeError("not.a.function", ScriptRuntime.safeToString(callbackfn)); } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java index f33c86384a6..a72ef4a029a 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java @@ -46,9 +46,15 @@ final class LongArrayData extends ArrayData { */ LongArrayData(final long array[], final int length) { super(length); + assert array.length >= length; this.array = array; } + @Override + public ArrayData copy() { + return new LongArrayData(array.clone(), (int) length()); + } + @Override public Object[] asObjectArray() { return toObjectArray(array, (int) length()); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/NoTypeArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/NoTypeArrayData.java index 8fb53607b84..1f2298c0d99 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/NoTypeArrayData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/NoTypeArrayData.java @@ -46,6 +46,11 @@ final class NoTypeArrayData extends ArrayData { return new Object[0]; } + @Override + public ArrayData copy() { + return new NoTypeArrayData(); + } + @Override public Object asArrayOfType(final Class componentType) { return Array.newInstance(componentType, 0); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java index e555ec45d93..2ecf9d74c7f 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java @@ -46,10 +46,13 @@ final class NumberArrayData extends ArrayData { */ NumberArrayData(final double array[], final int length) { super(length); + assert array.length >= length; this.array = array; - if (array.length > length) { - Arrays.fill(array, length, array.length, 0.0); - } + } + + @Override + public ArrayData copy() { + return new NumberArrayData(array.clone(), (int) length()); } @Override diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java index 41c4d5ced30..136e6437477 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java @@ -47,10 +47,13 @@ final class ObjectArrayData extends ArrayData { */ ObjectArrayData(final Object array[], final int length) { super(length); + assert array.length >= length; this.array = array; - if (array.length > length) { - Arrays.fill(array, length, array.length, ScriptRuntime.UNDEFINED); - } + } + + @Override + public ArrayData copy() { + return new ObjectArrayData(array.clone(), (int) length()); } @Override @@ -109,9 +112,6 @@ final class ObjectArrayData extends ArrayData { @Override public ArrayData set(final int index, final Object value, final boolean strict) { - if (value == ScriptRuntime.UNDEFINED) { - return new UndefinedArrayFilter(this).set(index, value, strict); - } array[index] = value; setLength(Math.max(index + 1, length())); return this; diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java index f9ba0ff0057..4746de860b7 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java @@ -30,7 +30,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; /** * Reverse iterator over a NativeArray */ -public final class ReverseArrayIterator extends ArrayIterator { +final class ReverseArrayIterator extends ArrayIterator { /** * Constructor diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java index 7cf7321bf72..6f77ddc02e6 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java @@ -38,6 +38,11 @@ class SealedArrayFilter extends ArrayFilter { super(underlying); } + @Override + public ArrayData copy() { + return new SealedArrayFilter(underlying.copy()); + } + @Override public ArrayData slice(final long from, final long to) { return getUnderlying().slice(from, to); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java index 0ccbb23c535..0fc466d4652 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java @@ -41,22 +41,26 @@ class SparseArrayData extends ArrayData { private ArrayData underlying; /** Maximum length to be stored in the array. */ - private final long maxDenseLength; /** Sparse elements. */ - private TreeMap sparseMap = new TreeMap<>(); + private TreeMap sparseMap; - SparseArrayData(final ArrayData underlying) { - super(underlying.length()); - this.underlying = underlying; - this.maxDenseLength = Math.max(MAX_DENSE_LENGTH, underlying.length()); + SparseArrayData(final ArrayData underlying, final long length) { + this(underlying, length, new TreeMap()); } - SparseArrayData(final ArrayData array, final long length) { - this(array); - assert array.length() <= length; - super.setLength(length); + SparseArrayData(final ArrayData underlying, final long length, final TreeMap sparseMap) { + super(length); + assert underlying.length() <= length; + this.underlying = underlying; + this.maxDenseLength = Math.max(MAX_DENSE_LENGTH, underlying.length()); + this.sparseMap = sparseMap; + } + + @Override + public ArrayData copy() { + return new SparseArrayData(underlying.copy(), length(), new TreeMap(sparseMap)); } @Override diff --git a/nashorn/src/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java b/nashorn/src/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java index f71a9954287..57046f8ca1e 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java @@ -43,6 +43,13 @@ final class UndefinedArrayFilter extends ArrayFilter { this.undefined = new BitVector(underlying.length()); } + @Override + public ArrayData copy() { + UndefinedArrayFilter copy = new UndefinedArrayFilter(underlying.copy()); + copy.getUndefined().copy(undefined); + return copy; + } + @Override public Object[] asObjectArray() { final Object[] value = super.asObjectArray(); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationException.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationException.java index 33429dd1017..3bf3eec6549 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationException.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationException.java @@ -26,7 +26,7 @@ package jdk.nashorn.internal.runtime.linker; @SuppressWarnings("serial") -class AdaptationException extends Exception { +final class AdaptationException extends Exception { private final AdaptationResult adaptationResult; AdaptationException(final AdaptationResult.Outcome outcome, final String classList) { diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java index 5185a955a2d..de1cfccc2a9 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java @@ -32,7 +32,7 @@ import jdk.nashorn.internal.runtime.ECMAException; * A result of generating an adapter for a class. A tuple of an outcome and - in case of an error outcome - a list of * classes that caused the error. */ -class AdaptationResult { +final class AdaptationResult { /** * Contains various outcomes for attempting to generate an adapter class. These are stored in AdapterInfo instances. * We have a successful outcome (adapter class was generated) and four possible error outcomes: superclass is final, diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java index 4007393bef9..421e5f62490 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java @@ -38,8 +38,12 @@ import jdk.internal.dynalink.DynamicLinkerFactory; import jdk.internal.dynalink.beans.BeansLinker; import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.LinkerServices; +import jdk.nashorn.api.scripting.ScriptObjectMirror; import jdk.nashorn.internal.codegen.CompilerConstants.Call; import jdk.nashorn.internal.codegen.RuntimeCallSite; +import jdk.nashorn.internal.runtime.JSType; +import jdk.nashorn.internal.runtime.ScriptFunction; +import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.options.Options; /** @@ -67,6 +71,41 @@ public final class Bootstrap { dynamicLinker = factory.createLinker(); } + /** + * Returns if the given object is a "callable" + * @param obj object to be checked for callability + * @return true if the obj is callable + */ + public static boolean isCallable(final Object obj) { + if (obj == ScriptRuntime.UNDEFINED || obj == null) { + return false; + } + + return obj instanceof ScriptFunction || + ((obj instanceof ScriptObjectMirror) && ((ScriptObjectMirror)obj).isFunction()) || + isDynamicMethod(obj) || + isFunctionalInterfaceObject(obj); + } + + /** + * Returns if the given object is a dynalink Dynamic method + * @param obj object to be checked + * @return true if the obj is a dynamic method + */ + public static boolean isDynamicMethod(final Object obj) { + return obj instanceof BoundDynamicMethod || BeansLinker.isDynamicMethod(obj); + } + + /** + * Returns if the given object is an instance of an interface annotated with + * java.lang.FunctionalInterface + * @param obj object to be checked + * @return true if the obj is an instance of @FunctionalInterface interface + */ + public static boolean isFunctionalInterfaceObject(final Object obj) { + return !JSType.isPrimitive(obj) && (NashornBottomLinker.getFunctionalInterfaceMethod(obj.getClass()) != null); + } + /** * Create a call site and link it for Nashorn. This version of the method conforms to the invokedynamic bootstrap * method expected signature and is referenced from Nashorn generated bytecode as the bootstrap method for all diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java index efec5b44738..e6d13c20c9a 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java @@ -58,7 +58,7 @@ import java.lang.invoke.MethodHandle; * you dynamically invoke a function with the same name from multiple places in your code, it is advisable to create a * separate instance of this class for every place. */ -public class InvokeByName { +public final class InvokeByName { private final String name; private final MethodHandle getter; private final MethodHandle invoker; diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java index 1fe76954391..2264cae50fd 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java @@ -45,18 +45,17 @@ import static jdk.nashorn.internal.runtime.linker.AdaptationResult.Outcome.ERROR import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; +import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedAction; -import java.security.SecureRandom; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Random; import java.util.Set; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.Label; @@ -66,6 +65,7 @@ import jdk.internal.org.objectweb.asm.commons.InstructionAdapter; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; +import sun.reflect.CallerSensitive; /** * Generates bytecode for a Java adapter class. Used by the {@link JavaAdapterFactory}. @@ -121,7 +121,23 @@ import jdk.nashorn.internal.runtime.ScriptObject; * constructor's trailing position and thus provide further instance-specific overrides. The order of invocation is * always instance-specified method, then a class-specified method, and finally the superclass method. */ -final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { +final class JavaAdapterBytecodeGenerator { + static final Type CONTEXT_TYPE = Type.getType(Context.class); + static final Type OBJECT_TYPE = Type.getType(Object.class); + static final Type SCRIPT_OBJECT_TYPE = Type.getType(ScriptObject.class); + + static final String CONTEXT_TYPE_NAME = CONTEXT_TYPE.getInternalName(); + static final String OBJECT_TYPE_NAME = OBJECT_TYPE.getInternalName(); + + static final String INIT = ""; + + static final String GLOBAL_FIELD_NAME = "global"; + + static final String SCRIPT_OBJECT_TYPE_DESCRIPTOR = SCRIPT_OBJECT_TYPE.getDescriptor(); + + static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, SCRIPT_OBJECT_TYPE); + static final String VOID_NOARG_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE); + private static final Type SCRIPT_FUNCTION_TYPE = Type.getType(ScriptFunction.class); private static final Type STRING_TYPE = Type.getType(String.class); private static final Type METHOD_TYPE_TYPE = Type.getType(MethodType.class); @@ -147,11 +163,11 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { // Package used when the adapter can't be defined in the adaptee's package (either because it's sealed, or because // it's a java.* package. - private static final String ADAPTER_PACKAGE_PREFIX = "jdk/nashorn/internal/javaadapters/"; + private static final String ADAPTER_PACKAGE_PREFIX = "jdk/nashorn/javaadapters/"; // Class name suffix used to append to the adaptee class name, when it can be defined in the adaptee's package. private static final String ADAPTER_CLASS_NAME_SUFFIX = "$$NashornJavaAdapter"; private static final String JAVA_PACKAGE_PREFIX = "java/"; - private static final int MAX_GENERATED_TYPE_NAME_LENGTH = 238; //255 - 17; 17 is the maximum possible length for the global setter inner class suffix + private static final int MAX_GENERATED_TYPE_NAME_LENGTH = 255; private static final String CLASS_INIT = ""; private static final String STATIC_GLOBAL_FIELD_NAME = "staticGlobal"; @@ -161,8 +177,6 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { */ private static final Collection EXCLUDED = getExcludedMethods(); - private static final Random random = new SecureRandom(); - // This is the superclass for our generated adapter. private final Class superClass; // Class loader used as the parent for the class loader we'll create to load the generated class. It will be a class @@ -175,8 +189,6 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { private final String superClassName; // Binary name of the generated class. private final String generatedClassName; - // Binary name of the PrivilegedAction inner class that is used to - private final String globalSetterClassName; private final Set usedFieldNames = new HashSet<>(); private final Set abstractMethodNames = new HashSet<>(); private final String samName; @@ -214,15 +226,6 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { superClassName = Type.getInternalName(superClass); generatedClassName = getGeneratedClassName(superClass, interfaces); - // Randomize the name of the privileged global setter, to make it non-feasible to find. - final long l; - synchronized(random) { - l = random.nextLong(); - } - - // NOTE: they way this class name is calculated affects the value of MAX_GENERATED_TYPE_NAME_LENGTH constant. If - // you change the calculation of globalSetterClassName, adjust the constant too. - globalSetterClassName = generatedClassName.concat("$" + Long.toHexString(l & Long.MAX_VALUE)); cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, generatedClassName, null, superClassName, getInternalTypeNames(interfaces)); generateGlobalFields(); @@ -250,7 +253,7 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { } JavaAdapterClassLoader createAdapterClassLoader() { - return new JavaAdapterClassLoader(generatedClassName, cw.toByteArray(), globalSetterClassName); + return new JavaAdapterClassLoader(generatedClassName, cw.toByteArray()); } boolean isAutoConvertibleFromFunction() { @@ -367,7 +370,7 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { boolean gotCtor = false; for (final Constructor ctor: superClass.getDeclaredConstructors()) { final int modifier = ctor.getModifiers(); - if((modifier & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) { + if((modifier & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0 && !isCallerSensitive(ctor)) { generateConstructors(ctor); gotCtor = true; } @@ -511,8 +514,8 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR); } - private void invokeSetGlobal(final InstructionAdapter mv) { - mv.invokestatic(globalSetterClassName, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR); + private static void invokeSetGlobal(final InstructionAdapter mv) { + mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR); } /** @@ -794,7 +797,7 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { * entry. * @param globalsDifferVar index of the boolean local variable that is true if the global needs to be restored. */ - private void emitFinally(final InstructionAdapter mv, final int currentGlobalVar, final int globalsDifferVar) { + private static void emitFinally(final InstructionAdapter mv, final int currentGlobalVar, final int globalsDifferVar) { // Emit code to restore the previous Nashorn global if needed mv.visitVarInsn(ILOAD, globalsDifferVar); final Label skip = new Label(); @@ -832,7 +835,7 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { } if (Modifier.isPublic(m) || Modifier.isProtected(m)) { final MethodInfo mi = new MethodInfo(typeMethod); - if (Modifier.isFinal(m)) { + if (Modifier.isFinal(m) || isCallerSensitive(typeMethod)) { finalMethods.add(mi); } else if (!finalMethods.contains(mi) && methodInfos.add(mi)) { if (Modifier.isAbstract(m)) { @@ -909,4 +912,8 @@ final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase { final Class superClass = c1.getSuperclass(); return superClass.isAssignableFrom(c2) ? superClass : assignableSuperClass(superClass, c2); } + + private static boolean isCallerSensitive(final AccessibleObject e) { + return e.isAnnotationPresent(CallerSensitive.class); + } } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java index a3f4718b25b..73c0563631d 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java @@ -25,16 +25,6 @@ package jdk.nashorn.internal.runtime.linker; -import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL; -import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PRIVATE; -import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC; -import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER; -import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL; -import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD; -import static jdk.internal.org.objectweb.asm.Opcodes.ARETURN; -import static jdk.internal.org.objectweb.asm.Opcodes.RETURN; - import java.security.AccessController; import java.security.AllPermission; import java.security.CodeSigner; @@ -45,12 +35,6 @@ import java.security.ProtectionDomain; import java.security.SecureClassLoader; import jdk.internal.dynalink.beans.StaticClass; -import jdk.internal.org.objectweb.asm.ClassWriter; -import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.internal.org.objectweb.asm.Type; -import jdk.internal.org.objectweb.asm.commons.InstructionAdapter; -import jdk.nashorn.internal.runtime.Context; -import jdk.nashorn.internal.runtime.ScriptObject; /** * This class encapsulates the bytecode of the adapter class and can be used to load it into the JVM as an actual Class. @@ -60,22 +44,15 @@ import jdk.nashorn.internal.runtime.ScriptObject; * class are normally created by {@link JavaAdapterBytecodeGenerator}. */ @SuppressWarnings("javadoc") -class JavaAdapterClassLoader extends JavaAdapterGeneratorBase { - private static final Type PRIVILEGED_ACTION_TYPE = Type.getType(PrivilegedAction.class); - - private static final String PRIVILEGED_ACTION_TYPE_NAME = PRIVILEGED_ACTION_TYPE.getInternalName(); - private static final String PRIVILEGED_RUN_METHOD_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE); - +final class JavaAdapterClassLoader { private static final ProtectionDomain GENERATED_PROTECTION_DOMAIN = createGeneratedProtectionDomain(); private final String className; private final byte[] classBytes; - private final String globalSetterClassName; - JavaAdapterClassLoader(String className, byte[] classBytes, String globalSetterClassName) { + JavaAdapterClassLoader(String className, byte[] classBytes) { this.className = className.replace('/', '.'); this.classBytes = classBytes; - this.globalSetterClassName = globalSetterClassName.replace('/', '.'); } /** @@ -96,16 +73,6 @@ class JavaAdapterClassLoader extends JavaAdapterGeneratorBase { }); } - private static class AdapterLoader extends SecureClassLoader { - AdapterLoader(ClassLoader parent) { - super(parent); - } - } - - static boolean isAdapterClass(Class clazz) { - return clazz.getClassLoader() instanceof AdapterLoader; - } - // Note that the adapter class is created in the protection domain of the class/interface being // extended/implemented, and only the privileged global setter action class is generated in the protection domain // of Nashorn itself. Also note that the creation and loading of the global setter is deferred until it is @@ -114,9 +81,8 @@ class JavaAdapterClassLoader extends JavaAdapterGeneratorBase { // with ability to introspect on the class and use setAccessible(true) on it could invoke the method. It's a // security tradeoff... private ClassLoader createClassLoader(final ClassLoader parentLoader) { - return new AdapterLoader(parentLoader) { + return new SecureClassLoader(parentLoader) { private final ClassLoader myLoader = getClass().getClassLoader(); - private final ProtectionDomain myProtectionDomain = getClass().getProtectionDomain(); @Override public Class loadClass(final String name, final boolean resolve) throws ClassNotFoundException { @@ -138,9 +104,6 @@ class JavaAdapterClassLoader extends JavaAdapterGeneratorBase { protected Class findClass(final String name) throws ClassNotFoundException { if(name.equals(className)) { return defineClass(name, classBytes, 0, classBytes.length, GENERATED_PROTECTION_DOMAIN); - } else if(name.equals(globalSetterClassName)) { - final byte[] bytes = generatePrivilegedActionClassBytes(globalSetterClassName.replace('.', '/')); - return defineClass(name, bytes, 0, bytes.length, myProtectionDomain); } else { throw new ClassNotFoundException(name); } @@ -158,70 +121,4 @@ class JavaAdapterClassLoader extends JavaAdapterGeneratorBase { permissions.add(new AllPermission()); return new ProtectionDomain(new CodeSource(null, (CodeSigner[])null), permissions); } - - /** - * Generates a PrivilegedAction implementation class for invoking {@link Context#setGlobal(ScriptObject)} from the - * adapter class. - */ - private static byte[] generatePrivilegedActionClassBytes(final String className) { - final ClassWriter w = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - // class GlobalSetter implements PrivilegedAction { - w.visit(Opcodes.V1_7, ACC_SUPER | ACC_FINAL, className, null, OBJECT_TYPE_NAME, new String[] { - PRIVILEGED_ACTION_TYPE_NAME - }); - - // private final ScriptObject global; - w.visitField(ACC_PRIVATE | ACC_FINAL, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR, null, null).visitEnd(); - - // private GlobalSetter(ScriptObject global) { - InstructionAdapter mv = new InstructionAdapter(w.visitMethod(ACC_PRIVATE, INIT, - SET_GLOBAL_METHOD_DESCRIPTOR, null, new String[0])); - mv.visitCode(); - // super(); - mv.visitVarInsn(ALOAD, 0); - mv.invokespecial(OBJECT_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR); - // this.global = global; - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.putfield(className, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR); - - mv.visitInsn(RETURN); - mv.visitEnd(); - mv.visitMaxs(0, 0); - - // public Object run() { - mv = new InstructionAdapter(w.visitMethod(ACC_PUBLIC, "run", PRIVILEGED_RUN_METHOD_DESCRIPTOR, null, - new String[0])); - mv.visitCode(); - // Context.setGlobal(this.global); - mv.visitVarInsn(ALOAD, 0); - mv.getfield(className, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR); - mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR); - // return null; - mv.visitInsn(ACONST_NULL); - mv.visitInsn(ARETURN); - - mv.visitEnd(); - mv.visitMaxs(0, 0); - - // static void setGlobal(ScriptObject global) { - mv = new InstructionAdapter(w.visitMethod(ACC_STATIC, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR, null, - new String[0])); - mv.visitCode(); - // new GlobalSetter(ScriptObject global) - mv.anew(Type.getType("L" + className + ";")); - mv.dup(); - mv.visitVarInsn(ALOAD, 0); - mv.invokespecial(className, INIT, SET_GLOBAL_METHOD_DESCRIPTOR); - // AccessController.doPrivileged(...) - mv.invokestatic(Type.getInternalName(AccessController.class), "doPrivileged", Type.getMethodDescriptor( - OBJECT_TYPE, PRIVILEGED_ACTION_TYPE)); - mv.pop(); - mv.visitInsn(RETURN); - - mv.visitEnd(); - mv.visitMaxs(0, 0); - - return w.toByteArray(); - } } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java index 472b8dcd727..93c2dd391a0 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java @@ -137,15 +137,6 @@ public final class JavaAdapterFactory { }); } - /** - * Tells if the given Class is an adapter or support class - * @param clazz Class object - * @return true if the Class given is adapter or support class - */ - public static boolean isAdapterClass(Class clazz) { - return JavaAdapterClassLoader.isAdapterClass(clazz); - } - /** * Returns whether an instance of the specified class/interface can be generated from a ScriptFunction. Returns true * iff: the adapter for the class/interface can be created, it is abstract (this includes interfaces), it has at diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterGeneratorBase.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterGeneratorBase.java deleted file mode 100644 index ff33ba6ef72..00000000000 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterGeneratorBase.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.nashorn.internal.runtime.linker; - -import jdk.internal.org.objectweb.asm.Type; -import jdk.nashorn.internal.runtime.Context; -import jdk.nashorn.internal.runtime.ScriptObject; - -/** - * Base class for both {@link JavaAdapterBytecodeGenerator} and {@link JavaAdapterClassLoader}, containing those - * bytecode types, type names and method descriptor that are used by both. - */ -@SuppressWarnings("javadoc") -abstract class JavaAdapterGeneratorBase { - static final Type CONTEXT_TYPE = Type.getType(Context.class); - static final Type OBJECT_TYPE = Type.getType(Object.class); - static final Type SCRIPT_OBJECT_TYPE = Type.getType(ScriptObject.class); - - static final String CONTEXT_TYPE_NAME = CONTEXT_TYPE.getInternalName(); - static final String OBJECT_TYPE_NAME = OBJECT_TYPE.getInternalName(); - - static final String INIT = ""; - - static final String GLOBAL_FIELD_NAME = "global"; - - static final String SCRIPT_OBJECT_TYPE_DESCRIPTOR = SCRIPT_OBJECT_TYPE.getDescriptor(); - - static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, SCRIPT_OBJECT_TYPE); - static final String VOID_NOARG_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE); - - protected JavaAdapterGeneratorBase() { - } -} diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java index eb890b9bc32..6614304f112 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java @@ -37,7 +37,7 @@ import jdk.nashorn.internal.runtime.Undefined; /** * Provides static utility services to generated Java adapter classes. */ -public class JavaAdapterServices { +public final class JavaAdapterServices { private static final ThreadLocal classOverrides = new ThreadLocal<>(); private JavaAdapterServices() { diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java index 834898afbf7..f035071b73f 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java @@ -42,7 +42,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; * Utility class shared by {@code NashornLinker} and {@code NashornPrimitiveLinker} for converting JS values to Java * types. */ -public class JavaArgumentConverters { +final class JavaArgumentConverters { private static final MethodHandle TO_BOOLEAN = findOwnMH("toBoolean", Boolean.class, Object.class); private static final MethodHandle TO_STRING = findOwnMH("toString", String.class, Object.class); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java index 271bee5fbe4..882c65dda10 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java @@ -477,6 +477,7 @@ public class LinkerCallSite extends ChainedCallSite { /** * Tracer function that logs a callsite miss * + * @param desc callsite descriptor string * @param args arguments to function * * @throws Throwable if invocation failes or throws exception/error diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java index 3e73ff11cea..6dbcbdd3ea9 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java @@ -30,6 +30,9 @@ import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; import static jdk.nashorn.internal.lookup.Lookup.MH; import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodType; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.beans.BeansLinker; import jdk.internal.dynalink.linker.GuardedInvocation; @@ -37,6 +40,7 @@ import jdk.internal.dynalink.linker.GuardingDynamicLinker; import jdk.internal.dynalink.linker.LinkRequest; import jdk.internal.dynalink.linker.LinkerServices; import jdk.internal.dynalink.support.Guards; +import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.ScriptRuntime; /** @@ -73,7 +77,7 @@ final class NashornBottomLinker implements GuardingDynamicLinker { private static final MethodHandle EMPTY_ELEM_SETTER = MH.dropArguments(EMPTY_PROP_SETTER, 0, Object.class); - private static GuardedInvocation linkBean(final LinkRequest linkRequest, final LinkerServices linkerServices) { + private static GuardedInvocation linkBean(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception { final NashornCallSiteDescriptor desc = (NashornCallSiteDescriptor)linkRequest.getCallSiteDescriptor(); final Object self = linkRequest.getReceiver(); final String operator = desc.getFirstOperator(); @@ -84,6 +88,22 @@ final class NashornBottomLinker implements GuardingDynamicLinker { } throw typeError("not.a.function", ScriptRuntime.safeToString(self)); case "call": + // Support dyn:call on any object that supports some @FunctionalInterface + // annotated interface. This way Java method, constructor references or + // implementations of java.util.function.* interfaces can be called as though + // those are script functions. + final Method m = getFunctionalInterfaceMethod(self.getClass()); + if (m != null) { + final MethodType callType = desc.getMethodType(); + // 'callee' and 'thiz' passed from script + actual arguments + if (callType.parameterCount() != m.getParameterCount() + 2) { + throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self)); + } + return new GuardedInvocation( + // drop 'thiz' passed from the script. + MH.dropArguments(desc.getLookup().unreflect(m), 1, callType.parameterType(1)), + Guards.getInstanceOfGuard(m.getDeclaringClass())).asType(callType); + } if(BeansLinker.isDynamicMethod(self)) { throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self)); } @@ -148,4 +168,44 @@ final class NashornBottomLinker implements GuardingDynamicLinker { } return ScriptRuntime.safeToString(linkRequest.getArguments()[1]); } + + // cache of @FunctionalInterface method of implementor classes + private static final ClassValue FUNCTIONAL_IFACE_METHOD = new ClassValue() { + @Override + protected Method computeValue(final Class type) { + return findFunctionalInterfaceMethod(type); + } + + private Method findFunctionalInterfaceMethod(final Class clazz) { + if (clazz == null) { + return null; + } + + for (Class iface : clazz.getInterfaces()) { + // check accessiblity up-front + if (! Context.isAccessibleClass(iface)) { + continue; + } + + // check for @FunctionalInterface + if (iface.isAnnotationPresent(FunctionalInterface.class)) { + // return the first abstract method + for (final Method m : iface.getMethods()) { + if (Modifier.isAbstract(m.getModifiers())) { + return m; + } + } + } + } + + // did not find here, try super class + return findFunctionalInterfaceMethod(clazz.getSuperclass()); + } + }; + + // Returns @FunctionalInterface annotated interface's single abstract + // method. If not found, returns null. + static Method getFunctionalInterfaceMethod(final Class clazz) { + return FUNCTIONAL_IFACE_METHOD.get(clazz); + } } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java index fe720c18537..0c2c4d5bbd9 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java @@ -39,7 +39,7 @@ import jdk.internal.dynalink.support.CallSiteDescriptorFactory; * we can have a more compact representation, as we know that we're always only using {@code "dyn:*"} operations; also * we're storing flags in an additional primitive field. */ -public class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor { +public final class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor { /** Flags that the call site references a scope variable (it's an identifier reference or a var declaration, not a * property access expression. */ public static final int CALLSITE_SCOPE = 0x01; diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java index 083dfef36db..3a23b1410c5 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java @@ -46,7 +46,7 @@ import jdk.nashorn.internal.runtime.Undefined; * This is the main dynamic linker for Nashorn. It is used for linking all {@link ScriptObject} and its subclasses (this * includes {@link ScriptFunction} and its subclasses) as well as {@link Undefined}. */ -public final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory, ConversionComparator { +final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory, ConversionComparator { /** * Returns true if {@code ScriptObject} is assignable from {@code type}, or it is {@code Undefined}. */ diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java index 67c1d8db5f8..9c9f528350c 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java @@ -34,6 +34,7 @@ import jdk.internal.dynalink.linker.LinkRequest; import jdk.internal.dynalink.linker.LinkerServices; import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; import jdk.internal.dynalink.support.Guards; +import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.ECMAErrors; /** @@ -63,10 +64,14 @@ final class NashornStaticClassLinker implements TypeBasedGuardingDynamicLinker { if (self.getClass() != StaticClass.class) { return null; } + final Class receiverClass = ((StaticClass) self).getRepresentedClass(); + Bootstrap.checkReflectionAccess(receiverClass); final CallSiteDescriptor desc = request.getCallSiteDescriptor(); // We intercept "new" on StaticClass instances to provide additional capabilities if ("new".equals(desc.getNameToken(CallSiteDescriptor.OPERATOR))) { - final Class receiverClass = ((StaticClass) self).getRepresentedClass(); + // make sure new is on accessible Class + Context.checkPackageAccess(receiverClass.getName()); + // Is the class abstract? (This includes interfaces.) if (NashornLinker.isAbstractClass(receiverClass)) { // Change this link request into a link request on the adapter class. diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java index eaba64f4629..c9b5eaa3fa9 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java @@ -25,7 +25,6 @@ package jdk.nashorn.internal.runtime.linker; -import jdk.nashorn.internal.lookup.Lookup; import static jdk.nashorn.internal.lookup.Lookup.MH; import java.lang.invoke.MethodHandle; @@ -35,6 +34,7 @@ import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.LinkRequest; import jdk.internal.dynalink.support.CallSiteDescriptorFactory; import jdk.internal.dynalink.support.Guards; +import jdk.nashorn.internal.lookup.Lookup; import jdk.nashorn.internal.runtime.ScriptObject; /** @@ -42,7 +42,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; * numbers). This class is only public so it can be accessed by classes in the {@code jdk.nashorn.internal.objects} * package. */ -public class PrimitiveLookup { +public final class PrimitiveLookup { private PrimitiveLookup() { } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java index 79d1195f80a..1e540231f24 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java @@ -76,9 +76,10 @@ final class ReflectionCheckLinker implements TypeBasedGuardingDynamicLinker{ final CallSiteDescriptor desc = requestWithoutContext.getCallSiteDescriptor(); if(CallSiteDescriptorFactory.tokenizeOperators(desc).contains("getProp")) { if ("static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) { - Context.checkPackageAccess(((Class)self).getName()); - // If "getProp:static" passes package access, allow access. - return; + if (Context.isAccessibleClass((Class)self) && !isReflectionClass((Class)self)) { + // If "getProp:static" passes access checks, allow access. + return; + } } } } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/options/KeyValueOption.java b/nashorn/src/jdk/nashorn/internal/runtime/options/KeyValueOption.java index aee6caf0be8..bbf1620ae8d 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/options/KeyValueOption.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/options/KeyValueOption.java @@ -36,7 +36,7 @@ import java.util.StringTokenizer; * * {@code --log=module1:level1,module2:level2... } */ -public class KeyValueOption extends Option { +public final class KeyValueOption extends Option { /** * Map of keys given */ diff --git a/nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java b/nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java index 4c1c44fccbc..b6790aa24f5 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java @@ -34,7 +34,7 @@ import jdk.nashorn.internal.runtime.QuotedStringTokenizer; * bundle file. Metainfo such as parameters and description is here as well * for context sensitive help generation. */ -public class OptionTemplate implements Comparable { +public final class OptionTemplate implements Comparable { /** Resource, e.g. "nashorn" for this option */ private final String resource; diff --git a/nashorn/test/script/basic/JDK-8010946-2.js b/nashorn/test/script/basic/JDK-8010946-2.js index c3dc2889a6c..bf808d0e05a 100644 --- a/nashorn/test/script/basic/JDK-8010946-2.js +++ b/nashorn/test/script/basic/JDK-8010946-2.js @@ -30,9 +30,8 @@ * @run */ -// Ensure these are CallerSensitiveDynamicMethods +// Ensure this is CallerSensitiveDynamicMethod print(java.security.AccessController["doPrivileged(PrivilegedAction)"]) -print(java.lang.Class["forName(String)"]) // Ensure this is not print(java.lang.String["valueOf(char)"]) diff --git a/nashorn/test/script/basic/JDK-8010946-2.js.EXPECTED b/nashorn/test/script/basic/JDK-8010946-2.js.EXPECTED index d573510c9de..cced7632420 100644 --- a/nashorn/test/script/basic/JDK-8010946-2.js.EXPECTED +++ b/nashorn/test/script/basic/JDK-8010946-2.js.EXPECTED @@ -1,3 +1,2 @@ [jdk.internal.dynalink.beans.CallerSensitiveDynamicMethod Object java.security.AccessController.doPrivileged(PrivilegedAction)] -[jdk.internal.dynalink.beans.CallerSensitiveDynamicMethod Class java.lang.Class.forName(String)] [jdk.internal.dynalink.beans.SimpleDynamicMethod String java.lang.String.valueOf(char)] diff --git a/nashorn/test/script/basic/JDK-8020132.js b/nashorn/test/script/basic/JDK-8020132.js new file mode 100644 index 00000000000..49fc1b16742 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8020132.js @@ -0,0 +1,23992 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8020132: Big object literal with numerical keys exceeds method size + * + * @test + * @run + */ + +var last = 58565; + +function getObject() { + return { + 33209: 20246, + 33210: 20252, + 33211: 20253, + 33212: 20257, + 33213: 20259, + 33214: 20264, + 33215: 20265, + 33216: 20268, + 33217: 20269, + 33218: 20270, + 33219: 20273, + 33220: 20275, + 33221: 20277, + 33222: 20279, + 33223: 20281, + 33224: 20283, + 33225: 20286, + 33226: 20287, + 33227: 20288, + 33228: 20289, + 33229: 20290, + 33230: 20292, + 33231: 20293, + 33232: 20295, + 33233: 20296, + 33234: 20297, + 33235: 20298, + 33236: 20299, + 33237: 20300, + 33238: 20306, + 33239: 20308, + 33240: 20310, + 33241: 20321, + 33242: 20322, + 33243: 20326, + 33244: 20328, + 33245: 20330, + 33246: 20331, + 33247: 20333, + 33248: 20334, + 33249: 20337, + 33250: 20338, + 33251: 20341, + 33252: 20343, + 33253: 20344, + 33254: 20345, + 33255: 20346, + 33256: 20349, + 33257: 20352, + 33258: 20353, + 33259: 20354, + 33260: 20357, + 33261: 20358, + 33262: 20359, + 33263: 20362, + 33264: 20364, + 33265: 20366, + 33266: 20368, + 33267: 20370, + 33268: 20371, + 33269: 20373, + 33270: 20374, + 33271: 20376, + 33272: 20377, + 33273: 20378, + 33274: 20380, + 33275: 20382, + 33276: 20383, + 33277: 20385, + 33278: 20386, + 33344: 20388, + 33345: 20395, + 33346: 20397, + 33347: 20400, + 33348: 20401, + 33349: 20402, + 33350: 20403, + 33351: 20404, + 33352: 20406, + 33353: 20407, + 33354: 20408, + 33355: 20409, + 33356: 20410, + 33357: 20411, + 33358: 20412, + 33359: 20413, + 33360: 20414, + 33361: 20416, + 33362: 20417, + 33363: 20418, + 33364: 20422, + 33365: 20423, + 33366: 20424, + 33367: 20425, + 33368: 20427, + 33369: 20428, + 33370: 20429, + 33371: 20434, + 33372: 20435, + 33373: 20436, + 33374: 20437, + 33375: 20438, + 33376: 20441, + 33377: 20443, + 33378: 20448, + 33379: 20450, + 33380: 20452, + 33381: 20453, + 33382: 20455, + 33383: 20459, + 33384: 20460, + 33385: 20464, + 33386: 20466, + 33387: 20468, + 33388: 20469, + 33389: 20470, + 33390: 20471, + 33391: 20473, + 33392: 20475, + 33393: 20476, + 33394: 20477, + 33395: 20479, + 33396: 20480, + 33397: 20481, + 33398: 20482, + 33399: 20483, + 33400: 20484, + 33401: 20485, + 33402: 20486, + 33403: 20487, + 33404: 20488, + 33405: 20489, + 33406: 20490, + 33408: 20491, + 33409: 20494, + 33410: 20496, + 33411: 20497, + 33412: 20499, + 33413: 20501, + 33414: 20502, + 33415: 20503, + 33416: 20507, + 33417: 20509, + 33418: 20510, + 33419: 20512, + 33420: 20514, + 33421: 20515, + 33422: 20516, + 33423: 20519, + 33424: 20523, + 33425: 20527, + 33426: 20528, + 33427: 20529, + 33428: 20530, + 33429: 20531, + 33430: 20532, + 33431: 20533, + 33432: 20534, + 33433: 20535, + 33434: 20536, + 33435: 20537, + 33436: 20539, + 33437: 20541, + 33438: 20543, + 33439: 20544, + 33440: 20545, + 33441: 20546, + 33442: 20548, + 33443: 20549, + 33444: 20550, + 33445: 20553, + 33446: 20554, + 33447: 20555, + 33448: 20557, + 33449: 20560, + 33450: 20561, + 33451: 20562, + 33452: 20563, + 33453: 20564, + 33454: 20566, + 33455: 20567, + 33456: 20568, + 33457: 20569, + 33458: 20571, + 33459: 20573, + 33460: 20574, + 33461: 20575, + 33462: 20576, + 33463: 20577, + 33464: 20578, + 33465: 20579, + 33466: 20580, + 33467: 20582, + 33468: 20583, + 33469: 20584, + 33470: 20585, + 33471: 20586, + 33472: 20587, + 33473: 20589, + 33474: 20590, + 33475: 20591, + 33476: 20592, + 33477: 20593, + 33478: 20594, + 33479: 20595, + 33480: 20596, + 33481: 20597, + 33482: 20600, + 33483: 20601, + 33484: 20602, + 33485: 20604, + 33486: 20605, + 33487: 20609, + 33488: 20610, + 33489: 20611, + 33490: 20612, + 33491: 20614, + 33492: 20615, + 33493: 20617, + 33494: 20618, + 33495: 20619, + 33496: 20620, + 33497: 20622, + 33498: 20623, + 33499: 20624, + 33500: 20625, + 33501: 20626, + 33502: 20627, + 33503: 20628, + 33504: 20629, + 33505: 20630, + 33506: 20631, + 33507: 20632, + 33508: 20633, + 33509: 20634, + 33510: 20635, + 33511: 20636, + 33512: 20637, + 33513: 20638, + 33514: 20639, + 33515: 20640, + 33516: 20641, + 33517: 20642, + 33518: 20644, + 33519: 20646, + 33520: 20650, + 33521: 20651, + 33522: 20653, + 33523: 20654, + 33524: 20655, + 33525: 20656, + 33526: 20657, + 33527: 20659, + 33528: 20660, + 33529: 20661, + 33530: 20662, + 33531: 20663, + 33532: 20664, + 33533: 20665, + 33534: 20668, + 33600: 20669, + 33601: 20670, + 33602: 20671, + 33603: 20672, + 33604: 20673, + 33605: 20674, + 33606: 20675, + 33607: 20676, + 33608: 20677, + 33609: 20678, + 33610: 20679, + 33611: 20680, + 33612: 20681, + 33613: 20682, + 33614: 20683, + 33615: 20684, + 33616: 20685, + 33617: 20686, + 33618: 20688, + 33619: 20689, + 33620: 20690, + 33621: 20691, + 33622: 20692, + 33623: 20693, + 33624: 20695, + 33625: 20696, + 33626: 20697, + 33627: 20699, + 33628: 20700, + 33629: 20701, + 33630: 20702, + 33631: 20703, + 33632: 20704, + 33633: 20705, + 33634: 20706, + 33635: 20707, + 33636: 20708, + 33637: 20709, + 33638: 20712, + 33639: 20713, + 33640: 20714, + 33641: 20715, + 33642: 20719, + 33643: 20720, + 33644: 20721, + 33645: 20722, + 33646: 20724, + 33647: 20726, + 33648: 20727, + 33649: 20728, + 33650: 20729, + 33651: 20730, + 33652: 20732, + 33653: 20733, + 33654: 20734, + 33655: 20735, + 33656: 20736, + 33657: 20737, + 33658: 20738, + 33659: 20739, + 33660: 20740, + 33661: 20741, + 33662: 20744, + 33664: 20745, + 33665: 20746, + 33666: 20748, + 33667: 20749, + 33668: 20750, + 33669: 20751, + 33670: 20752, + 33671: 20753, + 33672: 20755, + 33673: 20756, + 33674: 20757, + 33675: 20758, + 33676: 20759, + 33677: 20760, + 33678: 20761, + 33679: 20762, + 33680: 20763, + 33681: 20764, + 33682: 20765, + 33683: 20766, + 33684: 20767, + 33685: 20768, + 33686: 20770, + 33687: 20771, + 33688: 20772, + 33689: 20773, + 33690: 20774, + 33691: 20775, + 33692: 20776, + 33693: 20777, + 33694: 20778, + 33695: 20779, + 33696: 20780, + 33697: 20781, + 33698: 20782, + 33699: 20783, + 33700: 20784, + 33701: 20785, + 33702: 20786, + 33703: 20787, + 33704: 20788, + 33705: 20789, + 33706: 20790, + 33707: 20791, + 33708: 20792, + 33709: 20793, + 33710: 20794, + 33711: 20795, + 33712: 20796, + 33713: 20797, + 33714: 20798, + 33715: 20802, + 33716: 20807, + 33717: 20810, + 33718: 20812, + 33719: 20814, + 33720: 20815, + 33721: 20816, + 33722: 20818, + 33723: 20819, + 33724: 20823, + 33725: 20824, + 33726: 20825, + 33727: 20827, + 33728: 20829, + 33729: 20830, + 33730: 20831, + 33731: 20832, + 33732: 20833, + 33733: 20835, + 33734: 20836, + 33735: 20838, + 33736: 20839, + 33737: 20841, + 33738: 20842, + 33739: 20847, + 33740: 20850, + 33741: 20858, + 33742: 20862, + 33743: 20863, + 33744: 20867, + 33745: 20868, + 33746: 20870, + 33747: 20871, + 33748: 20874, + 33749: 20875, + 33750: 20878, + 33751: 20879, + 33752: 20880, + 33753: 20881, + 33754: 20883, + 33755: 20884, + 33756: 20888, + 33757: 20890, + 33758: 20893, + 33759: 20894, + 33760: 20895, + 33761: 20897, + 33762: 20899, + 33763: 20902, + 33764: 20903, + 33765: 20904, + 33766: 20905, + 33767: 20906, + 33768: 20909, + 33769: 20910, + 33770: 20916, + 33771: 20920, + 33772: 20921, + 33773: 20922, + 33774: 20926, + 33775: 20927, + 33776: 20929, + 33777: 20930, + 33778: 20931, + 33779: 20933, + 33780: 20936, + 33781: 20938, + 33782: 20941, + 33783: 20942, + 33784: 20944, + 33785: 20946, + 33786: 20947, + 33787: 20948, + 33788: 20949, + 33789: 20950, + 33790: 20951, + 33856: 20952, + 33857: 20953, + 33858: 20954, + 33859: 20956, + 33860: 20958, + 33861: 20959, + 33862: 20962, + 33863: 20963, + 33864: 20965, + 33865: 20966, + 33866: 20967, + 33867: 20968, + 33868: 20969, + 33869: 20970, + 33870: 20972, + 33871: 20974, + 33872: 20977, + 33873: 20978, + 33874: 20980, + 33875: 20983, + 33876: 20990, + 33877: 20996, + 33878: 20997, + 33879: 21001, + 33880: 21003, + 33881: 21004, + 33882: 21007, + 33883: 21008, + 33884: 21011, + 33885: 21012, + 33886: 21013, + 33887: 21020, + 33888: 21022, + 33889: 21023, + 33890: 21025, + 33891: 21026, + 33892: 21027, + 33893: 21029, + 33894: 21030, + 33895: 21031, + 33896: 21034, + 33897: 21036, + 33898: 21039, + 33899: 21041, + 33900: 21042, + 33901: 21044, + 33902: 21045, + 33903: 21052, + 33904: 21054, + 33905: 21060, + 33906: 21061, + 33907: 21062, + 33908: 21063, + 33909: 21064, + 33910: 21065, + 33911: 21067, + 33912: 21070, + 33913: 21071, + 33914: 21074, + 33915: 21075, + 33916: 21077, + 33917: 21079, + 33918: 21080, + 33920: 21081, + 33921: 21082, + 33922: 21083, + 33923: 21085, + 33924: 21087, + 33925: 21088, + 33926: 21090, + 33927: 21091, + 33928: 21092, + 33929: 21094, + 33930: 21096, + 33931: 21099, + 33932: 21100, + 33933: 21101, + 33934: 21102, + 33935: 21104, + 33936: 21105, + 33937: 21107, + 33938: 21108, + 33939: 21109, + 33940: 21110, + 33941: 21111, + 33942: 21112, + 33943: 21113, + 33944: 21114, + 33945: 21115, + 33946: 21116, + 33947: 21118, + 33948: 21120, + 33949: 21123, + 33950: 21124, + 33951: 21125, + 33952: 21126, + 33953: 21127, + 33954: 21129, + 33955: 21130, + 33956: 21131, + 33957: 21132, + 33958: 21133, + 33959: 21134, + 33960: 21135, + 33961: 21137, + 33962: 21138, + 33963: 21140, + 33964: 21141, + 33965: 21142, + 33966: 21143, + 33967: 21144, + 33968: 21145, + 33969: 21146, + 33970: 21148, + 33971: 21156, + 33972: 21157, + 33973: 21158, + 33974: 21159, + 33975: 21166, + 33976: 21167, + 33977: 21168, + 33978: 21172, + 33979: 21173, + 33980: 21174, + 33981: 21175, + 33982: 21176, + 33983: 21177, + 33984: 21178, + 33985: 21179, + 33986: 21180, + 33987: 21181, + 33988: 21184, + 33989: 21185, + 33990: 21186, + 33991: 21188, + 33992: 21189, + 33993: 21190, + 33994: 21192, + 33995: 21194, + 33996: 21196, + 33997: 21197, + 33998: 21198, + 33999: 21199, + 34000: 21201, + 34001: 21203, + 34002: 21204, + 34003: 21205, + 34004: 21207, + 34005: 21209, + 34006: 21210, + 34007: 21211, + 34008: 21212, + 34009: 21213, + 34010: 21214, + 34011: 21216, + 34012: 21217, + 34013: 21218, + 34014: 21219, + 34015: 21221, + 34016: 21222, + 34017: 21223, + 34018: 21224, + 34019: 21225, + 34020: 21226, + 34021: 21227, + 34022: 21228, + 34023: 21229, + 34024: 21230, + 34025: 21231, + 34026: 21233, + 34027: 21234, + 34028: 21235, + 34029: 21236, + 34030: 21237, + 34031: 21238, + 34032: 21239, + 34033: 21240, + 34034: 21243, + 34035: 21244, + 34036: 21245, + 34037: 21249, + 34038: 21250, + 34039: 21251, + 34040: 21252, + 34041: 21255, + 34042: 21257, + 34043: 21258, + 34044: 21259, + 34045: 21260, + 34046: 21262, + 34112: 21265, + 34113: 21266, + 34114: 21267, + 34115: 21268, + 34116: 21272, + 34117: 21275, + 34118: 21276, + 34119: 21278, + 34120: 21279, + 34121: 21282, + 34122: 21284, + 34123: 21285, + 34124: 21287, + 34125: 21288, + 34126: 21289, + 34127: 21291, + 34128: 21292, + 34129: 21293, + 34130: 21295, + 34131: 21296, + 34132: 21297, + 34133: 21298, + 34134: 21299, + 34135: 21300, + 34136: 21301, + 34137: 21302, + 34138: 21303, + 34139: 21304, + 34140: 21308, + 34141: 21309, + 34142: 21312, + 34143: 21314, + 34144: 21316, + 34145: 21318, + 34146: 21323, + 34147: 21324, + 34148: 21325, + 34149: 21328, + 34150: 21332, + 34151: 21336, + 34152: 21337, + 34153: 21339, + 34154: 21341, + 34155: 21349, + 34156: 21352, + 34157: 21354, + 34158: 21356, + 34159: 21357, + 34160: 21362, + 34161: 21366, + 34162: 21369, + 34163: 21371, + 34164: 21372, + 34165: 21373, + 34166: 21374, + 34167: 21376, + 34168: 21377, + 34169: 21379, + 34170: 21383, + 34171: 21384, + 34172: 21386, + 34173: 21390, + 34174: 21391, + 34176: 21392, + 34177: 21393, + 34178: 21394, + 34179: 21395, + 34180: 21396, + 34181: 21398, + 34182: 21399, + 34183: 21401, + 34184: 21403, + 34185: 21404, + 34186: 21406, + 34187: 21408, + 34188: 21409, + 34189: 21412, + 34190: 21415, + 34191: 21418, + 34192: 21419, + 34193: 21420, + 34194: 21421, + 34195: 21423, + 34196: 21424, + 34197: 21425, + 34198: 21426, + 34199: 21427, + 34200: 21428, + 34201: 21429, + 34202: 21431, + 34203: 21432, + 34204: 21433, + 34205: 21434, + 34206: 21436, + 34207: 21437, + 34208: 21438, + 34209: 21440, + 34210: 21443, + 34211: 21444, + 34212: 21445, + 34213: 21446, + 34214: 21447, + 34215: 21454, + 34216: 21455, + 34217: 21456, + 34218: 21458, + 34219: 21459, + 34220: 21461, + 34221: 21466, + 34222: 21468, + 34223: 21469, + 34224: 21470, + 34225: 21473, + 34226: 21474, + 34227: 21479, + 34228: 21492, + 34229: 21498, + 34230: 21502, + 34231: 21503, + 34232: 21504, + 34233: 21506, + 34234: 21509, + 34235: 21511, + 34236: 21515, + 34237: 21524, + 34238: 21528, + 34239: 21529, + 33088: 19970, + 33089: 19972, + 33090: 19973, + 33091: 19974, + 33092: 19983, + 33093: 19986, + 33094: 19991, + 33095: 19999, + 33096: 20000, + 33097: 20001, + 33098: 20003, + 33099: 20006, + 33100: 20009, + 33101: 20014, + 33102: 20015, + 33103: 20017, + 33104: 20019, + 33105: 20021, + 33106: 20023, + 33107: 20028, + 33108: 20032, + 33109: 20033, + 33110: 20034, + 33111: 20036, + 33112: 20038, + 33113: 20042, + 33114: 20049, + 33115: 20053, + 33116: 20055, + 33117: 20058, + 33118: 20059, + 33119: 20066, + 33120: 20067, + 33121: 20068, + 33122: 20069, + 33123: 20071, + 33124: 20072, + 33125: 20074, + 33126: 20075, + 33127: 20076, + 33128: 20077, + 33129: 20078, + 33130: 20079, + 33131: 20082, + 33132: 20084, + 33133: 20085, + 33134: 20086, + 33135: 20087, + 33136: 20088, + 33137: 20089, + 33138: 20090, + 33139: 20091, + 33140: 20092, + 33141: 20093, + 33142: 20095, + 33143: 20096, + 33144: 20097, + 33145: 20098, + 33146: 20099, + 33147: 20100, + 33148: 20101, + 33149: 20103, + 33150: 20106, + 33152: 20112, + 33153: 20118, + 33154: 20119, + 33155: 20121, + 33156: 20124, + 33157: 20125, + 33158: 20126, + 33159: 20131, + 33160: 20138, + 33161: 20143, + 33162: 20144, + 33163: 20145, + 33164: 20148, + 33165: 20150, + 33166: 20151, + 33167: 20152, + 33168: 20153, + 33169: 20156, + 33170: 20157, + 33171: 20158, + 33172: 20168, + 33173: 20172, + 33174: 20175, + 33175: 20176, + 33176: 20178, + 33177: 20186, + 33178: 20187, + 33179: 20188, + 33180: 20192, + 33181: 20194, + 33182: 20198, + 33183: 20199, + 33184: 20201, + 33185: 20205, + 33186: 20206, + 33187: 20207, + 33188: 20209, + 33189: 20212, + 33190: 20216, + 33191: 20217, + 33192: 20218, + 33193: 20220, + 33194: 20222, + 33195: 20224, + 33196: 20226, + 33197: 20227, + 33198: 20228, + 33199: 20229, + 33200: 20230, + 33201: 20231, + 33202: 20232, + 33203: 20235, + 33204: 20236, + 33205: 20242, + 33206: 20243, + 33207: 20244, + 33208: 20245, + 34240: 21530, + 34241: 21532, + 34242: 21538, + 34243: 21540, + 34244: 21541, + 34245: 21546, + 34246: 21552, + 34247: 21555, + 34248: 21558, + 34249: 21559, + 34250: 21562, + 34251: 21565, + 34252: 21567, + 34253: 21569, + 34254: 21570, + 34255: 21572, + 34256: 21573, + 34257: 21575, + 34258: 21577, + 34259: 21580, + 34260: 21581, + 34261: 21582, + 34262: 21583, + 34263: 21585, + 34264: 21594, + 34265: 21597, + 34266: 21598, + 34267: 21599, + 34268: 21600, + 34269: 21601, + 34270: 21603, + 34271: 21605, + 34272: 21607, + 34273: 21609, + 34274: 21610, + 34275: 21611, + 34276: 21612, + 34277: 21613, + 34278: 21614, + 34279: 21615, + 34280: 21616, + 34281: 21620, + 34282: 21625, + 34283: 21626, + 34284: 21630, + 34285: 21631, + 34286: 21633, + 34287: 21635, + 34288: 21637, + 34289: 21639, + 34290: 21640, + 34291: 21641, + 34292: 21642, + 34293: 21645, + 34294: 21649, + 34295: 21651, + 34296: 21655, + 34297: 21656, + 34298: 21660, + 34299: 21662, + 34300: 21663, + 34301: 21664, + 34302: 21665, + 34368: 21666, + 34369: 21669, + 34370: 21678, + 34371: 21680, + 34372: 21682, + 34373: 21685, + 34374: 21686, + 34375: 21687, + 34376: 21689, + 34377: 21690, + 34378: 21692, + 34379: 21694, + 34380: 21699, + 34381: 21701, + 34382: 21706, + 34383: 21707, + 34384: 21718, + 34385: 21720, + 34386: 21723, + 34387: 21728, + 34388: 21729, + 34389: 21730, + 34390: 21731, + 34391: 21732, + 34392: 21739, + 34393: 21740, + 34394: 21743, + 34395: 21744, + 34396: 21745, + 34397: 21748, + 34398: 21749, + 34399: 21750, + 34400: 21751, + 34401: 21752, + 34402: 21753, + 34403: 21755, + 34404: 21758, + 34405: 21760, + 34406: 21762, + 34407: 21763, + 34408: 21764, + 34409: 21765, + 34410: 21768, + 34411: 21770, + 34412: 21771, + 34413: 21772, + 34414: 21773, + 34415: 21774, + 34416: 21778, + 34417: 21779, + 34418: 21781, + 34419: 21782, + 34420: 21783, + 34421: 21784, + 34422: 21785, + 34423: 21786, + 34424: 21788, + 34425: 21789, + 34426: 21790, + 34427: 21791, + 34428: 21793, + 34429: 21797, + 34430: 21798, + 34432: 21800, + 34433: 21801, + 34434: 21803, + 34435: 21805, + 34436: 21810, + 34437: 21812, + 34438: 21813, + 34439: 21814, + 34440: 21816, + 34441: 21817, + 34442: 21818, + 34443: 21819, + 34444: 21821, + 34445: 21824, + 34446: 21826, + 34447: 21829, + 34448: 21831, + 34449: 21832, + 34450: 21835, + 34451: 21836, + 34452: 21837, + 34453: 21838, + 34454: 21839, + 34455: 21841, + 34456: 21842, + 34457: 21843, + 34458: 21844, + 34459: 21847, + 34460: 21848, + 34461: 21849, + 34462: 21850, + 34463: 21851, + 34464: 21853, + 34465: 21854, + 34466: 21855, + 34467: 21856, + 34468: 21858, + 34469: 21859, + 34470: 21864, + 34471: 21865, + 34472: 21867, + 34473: 21871, + 34474: 21872, + 34475: 21873, + 34476: 21874, + 34477: 21875, + 34478: 21876, + 34479: 21881, + 34480: 21882, + 34481: 21885, + 34482: 21887, + 34483: 21893, + 34484: 21894, + 34485: 21900, + 34486: 21901, + 34487: 21902, + 34488: 21904, + 34489: 21906, + 34490: 21907, + 34491: 21909, + 34492: 21910, + 34493: 21911, + 34494: 21914, + 34495: 21915, + 34496: 21918, + 34497: 21920, + 34498: 21921, + 34499: 21922, + 34500: 21923, + 34501: 21924, + 34502: 21925, + 34503: 21926, + 34504: 21928, + 34505: 21929, + 34506: 21930, + 34507: 21931, + 34508: 21932, + 34509: 21933, + 34510: 21934, + 34511: 21935, + 34512: 21936, + 34513: 21938, + 34514: 21940, + 34515: 21942, + 34516: 21944, + 34517: 21946, + 34518: 21948, + 34519: 21951, + 34520: 21952, + 34521: 21953, + 34522: 21954, + 34523: 21955, + 34524: 21958, + 34525: 21959, + 34526: 21960, + 34527: 21962, + 34528: 21963, + 34529: 21966, + 34530: 21967, + 34531: 21968, + 34532: 21973, + 34533: 21975, + 34534: 21976, + 34535: 21977, + 34536: 21978, + 34537: 21979, + 34538: 21982, + 34539: 21984, + 34540: 21986, + 34541: 21991, + 34542: 21993, + 34543: 21997, + 34544: 21998, + 34545: 22000, + 34546: 22001, + 34547: 22004, + 34548: 22006, + 34549: 22008, + 34550: 22009, + 34551: 22010, + 34552: 22011, + 34553: 22012, + 34554: 22015, + 34555: 22018, + 34556: 22019, + 34557: 22020, + 34558: 22021, + 34624: 22022, + 34625: 22023, + 34626: 22026, + 34627: 22027, + 34628: 22029, + 34629: 22032, + 34630: 22033, + 34631: 22034, + 34632: 22035, + 34633: 22036, + 34634: 22037, + 34635: 22038, + 34636: 22039, + 34637: 22041, + 34638: 22042, + 34639: 22044, + 34640: 22045, + 34641: 22048, + 34642: 22049, + 34643: 22050, + 34644: 22053, + 34645: 22054, + 34646: 22056, + 34647: 22057, + 34648: 22058, + 34649: 22059, + 34650: 22062, + 34651: 22063, + 34652: 22064, + 34653: 22067, + 34654: 22069, + 34655: 22071, + 34656: 22072, + 34657: 22074, + 34658: 22076, + 34659: 22077, + 34660: 22078, + 34661: 22080, + 34662: 22081, + 34663: 22082, + 34664: 22083, + 34665: 22084, + 34666: 22085, + 34667: 22086, + 34668: 22087, + 34669: 22088, + 34670: 22089, + 34671: 22090, + 34672: 22091, + 34673: 22095, + 34674: 22096, + 34675: 22097, + 34676: 22098, + 34677: 22099, + 34678: 22101, + 34679: 22102, + 34680: 22106, + 34681: 22107, + 34682: 22109, + 34683: 22110, + 34684: 22111, + 34685: 22112, + 34686: 22113, + 34688: 22115, + 34689: 22117, + 34690: 22118, + 34691: 22119, + 34692: 22125, + 34693: 22126, + 34694: 22127, + 34695: 22128, + 34696: 22130, + 34697: 22131, + 34698: 22132, + 34699: 22133, + 34700: 22135, + 34701: 22136, + 34702: 22137, + 34703: 22138, + 34704: 22141, + 34705: 22142, + 34706: 22143, + 34707: 22144, + 34708: 22145, + 34709: 22146, + 34710: 22147, + 34711: 22148, + 34712: 22151, + 34713: 22152, + 34714: 22153, + 34715: 22154, + 34716: 22155, + 34717: 22156, + 34718: 22157, + 34719: 22160, + 34720: 22161, + 34721: 22162, + 34722: 22164, + 34723: 22165, + 34724: 22166, + 34725: 22167, + 34726: 22168, + 34727: 22169, + 34728: 22170, + 34729: 22171, + 34730: 22172, + 34731: 22173, + 34732: 22174, + 34733: 22175, + 34734: 22176, + 34735: 22177, + 34736: 22178, + 34737: 22180, + 34738: 22181, + 34739: 22182, + 34740: 22183, + 34741: 22184, + 34742: 22185, + 34743: 22186, + 34744: 22187, + 34745: 22188, + 34746: 22189, + 34747: 22190, + 34748: 22192, + 34749: 22193, + 34750: 22194, + 34751: 22195, + 34752: 22196, + 34753: 22197, + 34754: 22198, + 34755: 22200, + 34756: 22201, + 34757: 22202, + 34758: 22203, + 34759: 22205, + 34760: 22206, + 34761: 22207, + 34762: 22208, + 34763: 22209, + 34764: 22210, + 34765: 22211, + 34766: 22212, + 34767: 22213, + 34768: 22214, + 34769: 22215, + 34770: 22216, + 34771: 22217, + 34772: 22219, + 34773: 22220, + 34774: 22221, + 34775: 22222, + 34776: 22223, + 34777: 22224, + 34778: 22225, + 34779: 22226, + 34780: 22227, + 34781: 22229, + 34782: 22230, + 34783: 22232, + 34784: 22233, + 34785: 22236, + 34786: 22243, + 34787: 22245, + 34788: 22246, + 34789: 22247, + 34790: 22248, + 34791: 22249, + 34792: 22250, + 34793: 22252, + 34794: 22254, + 34795: 22255, + 34796: 22258, + 34797: 22259, + 34798: 22262, + 34799: 22263, + 34800: 22264, + 34801: 22267, + 34802: 22268, + 34803: 22272, + 34804: 22273, + 34805: 22274, + 34806: 22277, + 34807: 22279, + 34808: 22283, + 34809: 22284, + 34810: 22285, + 34811: 22286, + 34812: 22287, + 34813: 22288, + 34814: 22289, + 34880: 22290, + 34881: 22291, + 34882: 22292, + 34883: 22293, + 34884: 22294, + 34885: 22295, + 34886: 22296, + 34887: 22297, + 34888: 22298, + 34889: 22299, + 34890: 22301, + 34891: 22302, + 34892: 22304, + 34893: 22305, + 34894: 22306, + 34895: 22308, + 34896: 22309, + 34897: 22310, + 34898: 22311, + 34899: 22315, + 34900: 22321, + 34901: 22322, + 34902: 22324, + 34903: 22325, + 34904: 22326, + 34905: 22327, + 34906: 22328, + 34907: 22332, + 34908: 22333, + 34909: 22335, + 34910: 22337, + 34911: 22339, + 34912: 22340, + 34913: 22341, + 34914: 22342, + 34915: 22344, + 34916: 22345, + 34917: 22347, + 34918: 22354, + 34919: 22355, + 34920: 22356, + 34921: 22357, + 34922: 22358, + 34923: 22360, + 34924: 22361, + 34925: 22370, + 34926: 22371, + 34927: 22373, + 34928: 22375, + 34929: 22380, + 34930: 22382, + 34931: 22384, + 34932: 22385, + 34933: 22386, + 34934: 22388, + 34935: 22389, + 34936: 22392, + 34937: 22393, + 34938: 22394, + 34939: 22397, + 34940: 22398, + 34941: 22399, + 34942: 22400, + 34944: 22401, + 34945: 22407, + 34946: 22408, + 34947: 22409, + 34948: 22410, + 34949: 22413, + 34950: 22414, + 34951: 22415, + 34952: 22416, + 34953: 22417, + 34954: 22420, + 34955: 22421, + 34956: 22422, + 34957: 22423, + 34958: 22424, + 34959: 22425, + 34960: 22426, + 34961: 22428, + 34962: 22429, + 34963: 22430, + 34964: 22431, + 34965: 22437, + 34966: 22440, + 34967: 22442, + 34968: 22444, + 34969: 22447, + 34970: 22448, + 34971: 22449, + 34972: 22451, + 34973: 22453, + 34974: 22454, + 34975: 22455, + 34976: 22457, + 34977: 22458, + 34978: 22459, + 34979: 22460, + 34980: 22461, + 34981: 22462, + 34982: 22463, + 34983: 22464, + 34984: 22465, + 34985: 22468, + 34986: 22469, + 34987: 22470, + 34988: 22471, + 34989: 22472, + 34990: 22473, + 34991: 22474, + 34992: 22476, + 34993: 22477, + 34994: 22480, + 34995: 22481, + 34996: 22483, + 34997: 22486, + 34998: 22487, + 34999: 22491, + 35000: 22492, + 35001: 22494, + 35002: 22497, + 35003: 22498, + 35004: 22499, + 35005: 22501, + 35006: 22502, + 35007: 22503, + 35008: 22504, + 35009: 22505, + 35010: 22506, + 35011: 22507, + 35012: 22508, + 35013: 22510, + 35014: 22512, + 35015: 22513, + 35016: 22514, + 35017: 22515, + 35018: 22517, + 35019: 22518, + 35020: 22519, + 35021: 22523, + 35022: 22524, + 35023: 22526, + 35024: 22527, + 35025: 22529, + 35026: 22531, + 35027: 22532, + 35028: 22533, + 35029: 22536, + 35030: 22537, + 35031: 22538, + 35032: 22540, + 35033: 22542, + 35034: 22543, + 35035: 22544, + 35036: 22546, + 35037: 22547, + 35038: 22548, + 35039: 22550, + 35040: 22551, + 35041: 22552, + 35042: 22554, + 35043: 22555, + 35044: 22556, + 35045: 22557, + 35046: 22559, + 35047: 22562, + 35048: 22563, + 35049: 22565, + 35050: 22566, + 35051: 22567, + 35052: 22568, + 35053: 22569, + 35054: 22571, + 35055: 22572, + 35056: 22573, + 35057: 22574, + 35058: 22575, + 35059: 22577, + 35060: 22578, + 35061: 22579, + 35062: 22580, + 35063: 22582, + 35064: 22583, + 35065: 22584, + 35066: 22585, + 35067: 22586, + 35068: 22587, + 35069: 22588, + 35070: 22589, + 35136: 22590, + 35137: 22591, + 35138: 22592, + 35139: 22593, + 35140: 22594, + 35141: 22595, + 35142: 22597, + 35143: 22598, + 35144: 22599, + 35145: 22600, + 35146: 22601, + 35147: 22602, + 35148: 22603, + 35149: 22606, + 35150: 22607, + 35151: 22608, + 35152: 22610, + 35153: 22611, + 35154: 22613, + 35155: 22614, + 35156: 22615, + 35157: 22617, + 35158: 22618, + 35159: 22619, + 35160: 22620, + 35161: 22621, + 35162: 22623, + 35163: 22624, + 35164: 22625, + 35165: 22626, + 35166: 22627, + 35167: 22628, + 35168: 22630, + 35169: 22631, + 35170: 22632, + 35171: 22633, + 35172: 22634, + 35173: 22637, + 35174: 22638, + 35175: 22639, + 35176: 22640, + 35177: 22641, + 35178: 22642, + 35179: 22643, + 35180: 22644, + 35181: 22645, + 35182: 22646, + 35183: 22647, + 35184: 22648, + 35185: 22649, + 35186: 22650, + 35187: 22651, + 35188: 22652, + 35189: 22653, + 35190: 22655, + 35191: 22658, + 35192: 22660, + 35193: 22662, + 35194: 22663, + 35195: 22664, + 35196: 22666, + 35197: 22667, + 35198: 22668, + 35200: 22669, + 35201: 22670, + 35202: 22671, + 35203: 22672, + 35204: 22673, + 35205: 22676, + 35206: 22677, + 35207: 22678, + 35208: 22679, + 35209: 22680, + 35210: 22683, + 35211: 22684, + 35212: 22685, + 35213: 22688, + 35214: 22689, + 35215: 22690, + 35216: 22691, + 35217: 22692, + 35218: 22693, + 35219: 22694, + 35220: 22695, + 35221: 22698, + 35222: 22699, + 35223: 22700, + 35224: 22701, + 35225: 22702, + 35226: 22703, + 35227: 22704, + 35228: 22705, + 35229: 22706, + 35230: 22707, + 35231: 22708, + 35232: 22709, + 35233: 22710, + 35234: 22711, + 35235: 22712, + 35236: 22713, + 35237: 22714, + 35238: 22715, + 35239: 22717, + 35240: 22718, + 35241: 22719, + 35242: 22720, + 35243: 22722, + 35244: 22723, + 35245: 22724, + 35246: 22726, + 35247: 22727, + 35248: 22728, + 35249: 22729, + 35250: 22730, + 35251: 22731, + 35252: 22732, + 35253: 22733, + 35254: 22734, + 35255: 22735, + 35256: 22736, + 35257: 22738, + 35258: 22739, + 35259: 22740, + 35260: 22742, + 35261: 22743, + 35262: 22744, + 35263: 22745, + 35264: 22746, + 35265: 22747, + 35266: 22748, + 35267: 22749, + 35268: 22750, + 35269: 22751, + 35270: 22752, + 35271: 22753, + 35272: 22754, + 35273: 22755, + 35274: 22757, + 35275: 22758, + 35276: 22759, + 35277: 22760, + 35278: 22761, + 35279: 22762, + 35280: 22765, + 35281: 22767, + 35282: 22769, + 35283: 22770, + 35284: 22772, + 35285: 22773, + 35286: 22775, + 35287: 22776, + 35288: 22778, + 35289: 22779, + 35290: 22780, + 35291: 22781, + 35292: 22782, + 35293: 22783, + 35294: 22784, + 35295: 22785, + 35296: 22787, + 35297: 22789, + 35298: 22790, + 35299: 22792, + 35300: 22793, + 35301: 22794, + 35302: 22795, + 35303: 22796, + 35304: 22798, + 35305: 22800, + 35306: 22801, + 35307: 22802, + 35308: 22803, + 35309: 22807, + 35310: 22808, + 35311: 22811, + 35312: 22813, + 35313: 22814, + 35314: 22816, + 35315: 22817, + 35316: 22818, + 35317: 22819, + 35318: 22822, + 35319: 22824, + 35320: 22828, + 35321: 22832, + 35322: 22834, + 35323: 22835, + 35324: 22837, + 35325: 22838, + 35326: 22843, + 35392: 22845, + 35393: 22846, + 35394: 22847, + 35395: 22848, + 35396: 22851, + 35397: 22853, + 35398: 22854, + 35399: 22858, + 35400: 22860, + 35401: 22861, + 35402: 22864, + 35403: 22866, + 35404: 22867, + 35405: 22873, + 35406: 22875, + 35407: 22876, + 35408: 22877, + 35409: 22878, + 35410: 22879, + 35411: 22881, + 35412: 22883, + 35413: 22884, + 35414: 22886, + 35415: 22887, + 35416: 22888, + 35417: 22889, + 35418: 22890, + 35419: 22891, + 35420: 22892, + 35421: 22893, + 35422: 22894, + 35423: 22895, + 35424: 22896, + 35425: 22897, + 35426: 22898, + 35427: 22901, + 35428: 22903, + 35429: 22906, + 35430: 22907, + 35431: 22908, + 35432: 22910, + 35433: 22911, + 35434: 22912, + 35435: 22917, + 35436: 22921, + 35437: 22923, + 35438: 22924, + 35439: 22926, + 35440: 22927, + 35441: 22928, + 35442: 22929, + 35443: 22932, + 35444: 22933, + 35445: 22936, + 35446: 22938, + 35447: 22939, + 35448: 22940, + 35449: 22941, + 35450: 22943, + 35451: 22944, + 35452: 22945, + 35453: 22946, + 35454: 22950, + 35456: 22951, + 35457: 22956, + 35458: 22957, + 35459: 22960, + 35460: 22961, + 35461: 22963, + 35462: 22964, + 35463: 22965, + 35464: 22966, + 35465: 22967, + 35466: 22968, + 35467: 22970, + 35468: 22972, + 35469: 22973, + 35470: 22975, + 35471: 22976, + 35472: 22977, + 35473: 22978, + 35474: 22979, + 35475: 22980, + 35476: 22981, + 35477: 22983, + 35478: 22984, + 35479: 22985, + 35480: 22988, + 35481: 22989, + 35482: 22990, + 35483: 22991, + 35484: 22997, + 35485: 22998, + 35486: 23001, + 35487: 23003, + 35488: 23006, + 35489: 23007, + 35490: 23008, + 35491: 23009, + 35492: 23010, + 35493: 23012, + 35494: 23014, + 35495: 23015, + 35496: 23017, + 35497: 23018, + 35498: 23019, + 35499: 23021, + 35500: 23022, + 35501: 23023, + 35502: 23024, + 35503: 23025, + 35504: 23026, + 35505: 23027, + 35506: 23028, + 35507: 23029, + 35508: 23030, + 35509: 23031, + 35510: 23032, + 35511: 23034, + 35512: 23036, + 35513: 23037, + 35514: 23038, + 35515: 23040, + 35516: 23042, + 35517: 23050, + 35518: 23051, + 35519: 23053, + 35520: 23054, + 35521: 23055, + 35522: 23056, + 35523: 23058, + 35524: 23060, + 35525: 23061, + 35526: 23062, + 35527: 23063, + 35528: 23065, + 35529: 23066, + 35530: 23067, + 35531: 23069, + 35532: 23070, + 35533: 23073, + 35534: 23074, + 35535: 23076, + 35536: 23078, + 35537: 23079, + 35538: 23080, + 35539: 23082, + 35540: 23083, + 35541: 23084, + 35542: 23085, + 35543: 23086, + 35544: 23087, + 35545: 23088, + 35546: 23091, + 35547: 23093, + 35548: 23095, + 35549: 23096, + 35550: 23097, + 35551: 23098, + 35552: 23099, + 35553: 23101, + 35554: 23102, + 35555: 23103, + 35556: 23105, + 35557: 23106, + 35558: 23107, + 35559: 23108, + 35560: 23109, + 35561: 23111, + 35562: 23112, + 35563: 23115, + 35564: 23116, + 35565: 23117, + 35566: 23118, + 35567: 23119, + 35568: 23120, + 35569: 23121, + 35570: 23122, + 35571: 23123, + 35572: 23124, + 35573: 23126, + 35574: 23127, + 35575: 23128, + 35576: 23129, + 35577: 23131, + 35578: 23132, + 35579: 23133, + 35580: 23134, + 35581: 23135, + 35582: 23136, + 35648: 23137, + 35649: 23139, + 35650: 23140, + 35651: 23141, + 35652: 23142, + 35653: 23144, + 35654: 23145, + 35655: 23147, + 35656: 23148, + 35657: 23149, + 35658: 23150, + 35659: 23151, + 35660: 23152, + 35661: 23153, + 35662: 23154, + 35663: 23155, + 35664: 23160, + 35665: 23161, + 35666: 23163, + 35667: 23164, + 35668: 23165, + 35669: 23166, + 35670: 23168, + 35671: 23169, + 35672: 23170, + 35673: 23171, + 35674: 23172, + 35675: 23173, + 35676: 23174, + 35677: 23175, + 35678: 23176, + 35679: 23177, + 35680: 23178, + 35681: 23179, + 35682: 23180, + 35683: 23181, + 35684: 23182, + 35685: 23183, + 35686: 23184, + 35687: 23185, + 35688: 23187, + 35689: 23188, + 35690: 23189, + 35691: 23190, + 35692: 23191, + 35693: 23192, + 35694: 23193, + 35695: 23196, + 35696: 23197, + 35697: 23198, + 35698: 23199, + 35699: 23200, + 35700: 23201, + 35701: 23202, + 35702: 23203, + 35703: 23204, + 35704: 23205, + 35705: 23206, + 35706: 23207, + 35707: 23208, + 35708: 23209, + 35709: 23211, + 35710: 23212, + 35712: 23213, + 35713: 23214, + 35714: 23215, + 35715: 23216, + 35716: 23217, + 35717: 23220, + 35718: 23222, + 35719: 23223, + 35720: 23225, + 35721: 23226, + 35722: 23227, + 35723: 23228, + 35724: 23229, + 35725: 23231, + 35726: 23232, + 35727: 23235, + 35728: 23236, + 35729: 23237, + 35730: 23238, + 35731: 23239, + 35732: 23240, + 35733: 23242, + 35734: 23243, + 35735: 23245, + 35736: 23246, + 35737: 23247, + 35738: 23248, + 35739: 23249, + 35740: 23251, + 35741: 23253, + 35742: 23255, + 35743: 23257, + 35744: 23258, + 35745: 23259, + 35746: 23261, + 35747: 23262, + 35748: 23263, + 35749: 23266, + 35750: 23268, + 35751: 23269, + 35752: 23271, + 35753: 23272, + 35754: 23274, + 35755: 23276, + 35756: 23277, + 35757: 23278, + 35758: 23279, + 35759: 23280, + 35760: 23282, + 35761: 23283, + 35762: 23284, + 35763: 23285, + 35764: 23286, + 35765: 23287, + 35766: 23288, + 35767: 23289, + 35768: 23290, + 35769: 23291, + 35770: 23292, + 35771: 23293, + 35772: 23294, + 35773: 23295, + 35774: 23296, + 35775: 23297, + 35776: 23298, + 35777: 23299, + 35778: 23300, + 35779: 23301, + 35780: 23302, + 35781: 23303, + 35782: 23304, + 35783: 23306, + 35784: 23307, + 35785: 23308, + 35786: 23309, + 35787: 23310, + 35788: 23311, + 35789: 23312, + 35790: 23313, + 35791: 23314, + 35792: 23315, + 35793: 23316, + 35794: 23317, + 35795: 23320, + 35796: 23321, + 35797: 23322, + 35798: 23323, + 35799: 23324, + 35800: 23325, + 35801: 23326, + 35802: 23327, + 35803: 23328, + 35804: 23329, + 35805: 23330, + 35806: 23331, + 35807: 23332, + 35808: 23333, + 35809: 23334, + 35810: 23335, + 35811: 23336, + 35812: 23337, + 35813: 23338, + 35814: 23339, + 35815: 23340, + 35816: 23341, + 35817: 23342, + 35818: 23343, + 35819: 23344, + 35820: 23345, + 35821: 23347, + 35822: 23349, + 35823: 23350, + 35824: 23352, + 35825: 23353, + 35826: 23354, + 35827: 23355, + 35828: 23356, + 35829: 23357, + 35830: 23358, + 35831: 23359, + 35832: 23361, + 35833: 23362, + 35834: 23363, + 35835: 23364, + 35836: 23365, + 35837: 23366, + 35838: 23367, + 35904: 23368, + 35905: 23369, + 35906: 23370, + 35907: 23371, + 35908: 23372, + 35909: 23373, + 35910: 23374, + 35911: 23375, + 35912: 23378, + 35913: 23382, + 35914: 23390, + 35915: 23392, + 35916: 23393, + 35917: 23399, + 35918: 23400, + 35919: 23403, + 35920: 23405, + 35921: 23406, + 35922: 23407, + 35923: 23410, + 35924: 23412, + 35925: 23414, + 35926: 23415, + 35927: 23416, + 35928: 23417, + 35929: 23419, + 35930: 23420, + 35931: 23422, + 35932: 23423, + 35933: 23426, + 35934: 23430, + 35935: 23434, + 35936: 23437, + 35937: 23438, + 35938: 23440, + 35939: 23441, + 35940: 23442, + 35941: 23444, + 35942: 23446, + 35943: 23455, + 35944: 23463, + 35945: 23464, + 35946: 23465, + 35947: 23468, + 35948: 23469, + 35949: 23470, + 35950: 23471, + 35951: 23473, + 35952: 23474, + 35953: 23479, + 35954: 23482, + 35955: 23483, + 35956: 23484, + 35957: 23488, + 35958: 23489, + 35959: 23491, + 35960: 23496, + 35961: 23497, + 35962: 23498, + 35963: 23499, + 35964: 23501, + 35965: 23502, + 35966: 23503, + 35968: 23505, + 35969: 23508, + 35970: 23509, + 35971: 23510, + 35972: 23511, + 35973: 23512, + 35974: 23513, + 35975: 23514, + 35976: 23515, + 35977: 23516, + 35978: 23520, + 35979: 23522, + 35980: 23523, + 35981: 23526, + 35982: 23527, + 35983: 23529, + 35984: 23530, + 35985: 23531, + 35986: 23532, + 35987: 23533, + 35988: 23535, + 35989: 23537, + 35990: 23538, + 35991: 23539, + 35992: 23540, + 35993: 23541, + 35994: 23542, + 35995: 23543, + 35996: 23549, + 35997: 23550, + 35998: 23552, + 35999: 23554, + 36000: 23555, + 36001: 23557, + 36002: 23559, + 36003: 23560, + 36004: 23563, + 36005: 23564, + 36006: 23565, + 36007: 23566, + 36008: 23568, + 36009: 23570, + 36010: 23571, + 36011: 23575, + 36012: 23577, + 36013: 23579, + 36014: 23582, + 36015: 23583, + 36016: 23584, + 36017: 23585, + 36018: 23587, + 36019: 23590, + 36020: 23592, + 36021: 23593, + 36022: 23594, + 36023: 23595, + 36024: 23597, + 36025: 23598, + 36026: 23599, + 36027: 23600, + 36028: 23602, + 36029: 23603, + 36030: 23605, + 36031: 23606, + 36032: 23607, + 36033: 23619, + 36034: 23620, + 36035: 23622, + 36036: 23623, + 36037: 23628, + 36038: 23629, + 36039: 23634, + 36040: 23635, + 36041: 23636, + 36042: 23638, + 36043: 23639, + 36044: 23640, + 36045: 23642, + 36046: 23643, + 36047: 23644, + 36048: 23645, + 36049: 23647, + 36050: 23650, + 36051: 23652, + 36052: 23655, + 36053: 23656, + 36054: 23657, + 36055: 23658, + 36056: 23659, + 36057: 23660, + 36058: 23661, + 36059: 23664, + 36060: 23666, + 36061: 23667, + 36062: 23668, + 36063: 23669, + 36064: 23670, + 36065: 23671, + 36066: 23672, + 36067: 23675, + 36068: 23676, + 36069: 23677, + 36070: 23678, + 36071: 23680, + 36072: 23683, + 36073: 23684, + 36074: 23685, + 36075: 23686, + 36076: 23687, + 36077: 23689, + 36078: 23690, + 36079: 23691, + 36080: 23694, + 36081: 23695, + 36082: 23698, + 36083: 23699, + 36084: 23701, + 36085: 23709, + 36086: 23710, + 36087: 23711, + 36088: 23712, + 36089: 23713, + 36090: 23716, + 36091: 23717, + 36092: 23718, + 36093: 23719, + 36094: 23720, + 36160: 23722, + 36161: 23726, + 36162: 23727, + 36163: 23728, + 36164: 23730, + 36165: 23732, + 36166: 23734, + 36167: 23737, + 36168: 23738, + 36169: 23739, + 36170: 23740, + 36171: 23742, + 36172: 23744, + 36173: 23746, + 36174: 23747, + 36175: 23749, + 36176: 23750, + 36177: 23751, + 36178: 23752, + 36179: 23753, + 36180: 23754, + 36181: 23756, + 36182: 23757, + 36183: 23758, + 36184: 23759, + 36185: 23760, + 36186: 23761, + 36187: 23763, + 36188: 23764, + 36189: 23765, + 36190: 23766, + 36191: 23767, + 36192: 23768, + 36193: 23770, + 36194: 23771, + 36195: 23772, + 36196: 23773, + 36197: 23774, + 36198: 23775, + 36199: 23776, + 36200: 23778, + 36201: 23779, + 36202: 23783, + 36203: 23785, + 36204: 23787, + 36205: 23788, + 36206: 23790, + 36207: 23791, + 36208: 23793, + 36209: 23794, + 36210: 23795, + 36211: 23796, + 36212: 23797, + 36213: 23798, + 36214: 23799, + 36215: 23800, + 36216: 23801, + 36217: 23802, + 36218: 23804, + 36219: 23805, + 36220: 23806, + 36221: 23807, + 36222: 23808, + 36224: 23809, + 36225: 23812, + 36226: 23813, + 36227: 23816, + 36228: 23817, + 36229: 23818, + 36230: 23819, + 36231: 23820, + 36232: 23821, + 36233: 23823, + 36234: 23824, + 36235: 23825, + 36236: 23826, + 36237: 23827, + 36238: 23829, + 36239: 23831, + 36240: 23832, + 36241: 23833, + 36242: 23834, + 36243: 23836, + 36244: 23837, + 36245: 23839, + 36246: 23840, + 36247: 23841, + 36248: 23842, + 36249: 23843, + 36250: 23845, + 36251: 23848, + 36252: 23850, + 36253: 23851, + 36254: 23852, + 36255: 23855, + 36256: 23856, + 36257: 23857, + 36258: 23858, + 36259: 23859, + 36260: 23861, + 36261: 23862, + 36262: 23863, + 36263: 23864, + 36264: 23865, + 36265: 23866, + 36266: 23867, + 36267: 23868, + 36268: 23871, + 36269: 23872, + 36270: 23873, + 36271: 23874, + 36272: 23875, + 36273: 23876, + 36274: 23877, + 36275: 23878, + 36276: 23880, + 36277: 23881, + 36278: 23885, + 36279: 23886, + 36280: 23887, + 36281: 23888, + 36282: 23889, + 36283: 23890, + 36284: 23891, + 36285: 23892, + 36286: 23893, + 36287: 23894, + 36288: 23895, + 36289: 23897, + 36290: 23898, + 36291: 23900, + 36292: 23902, + 36293: 23903, + 36294: 23904, + 36295: 23905, + 36296: 23906, + 36297: 23907, + 36298: 23908, + 36299: 23909, + 36300: 23910, + 36301: 23911, + 36302: 23912, + 36303: 23914, + 36304: 23917, + 36305: 23918, + 36306: 23920, + 36307: 23921, + 36308: 23922, + 36309: 23923, + 36310: 23925, + 36311: 23926, + 36312: 23927, + 36313: 23928, + 36314: 23929, + 36315: 23930, + 36316: 23931, + 36317: 23932, + 36318: 23933, + 36319: 23934, + 36320: 23935, + 36321: 23936, + 36322: 23937, + 36323: 23939, + 36324: 23940, + 36325: 23941, + 36326: 23942, + 36327: 23943, + 36328: 23944, + 36329: 23945, + 36330: 23946, + 36331: 23947, + 36332: 23948, + 36333: 23949, + 36334: 23950, + 36335: 23951, + 36336: 23952, + 36337: 23953, + 36338: 23954, + 36339: 23955, + 36340: 23956, + 36341: 23957, + 36342: 23958, + 36343: 23959, + 36344: 23960, + 36345: 23962, + 36346: 23963, + 36347: 23964, + 36348: 23966, + 36349: 23967, + 36350: 23968, + 36416: 23969, + 36417: 23970, + 36418: 23971, + 36419: 23972, + 36420: 23973, + 36421: 23974, + 36422: 23975, + 36423: 23976, + 36424: 23977, + 36425: 23978, + 36426: 23979, + 36427: 23980, + 36428: 23981, + 36429: 23982, + 36430: 23983, + 36431: 23984, + 36432: 23985, + 36433: 23986, + 36434: 23987, + 36435: 23988, + 36436: 23989, + 36437: 23990, + 36438: 23992, + 36439: 23993, + 36440: 23994, + 36441: 23995, + 36442: 23996, + 36443: 23997, + 36444: 23998, + 36445: 23999, + 36446: 24000, + 36447: 24001, + 36448: 24002, + 36449: 24003, + 36450: 24004, + 36451: 24006, + 36452: 24007, + 36453: 24008, + 36454: 24009, + 36455: 24010, + 36456: 24011, + 36457: 24012, + 36458: 24014, + 36459: 24015, + 36460: 24016, + 36461: 24017, + 36462: 24018, + 36463: 24019, + 36464: 24020, + 36465: 24021, + 36466: 24022, + 36467: 24023, + 36468: 24024, + 36469: 24025, + 36470: 24026, + 36471: 24028, + 36472: 24031, + 36473: 24032, + 36474: 24035, + 36475: 24036, + 36476: 24042, + 36477: 24044, + 36478: 24045, + 36480: 24048, + 36481: 24053, + 36482: 24054, + 36483: 24056, + 36484: 24057, + 36485: 24058, + 36486: 24059, + 36487: 24060, + 36488: 24063, + 36489: 24064, + 36490: 24068, + 36491: 24071, + 36492: 24073, + 36493: 24074, + 36494: 24075, + 36495: 24077, + 36496: 24078, + 36497: 24082, + 36498: 24083, + 36499: 24087, + 36500: 24094, + 36501: 24095, + 36502: 24096, + 36503: 24097, + 36504: 24098, + 36505: 24099, + 36506: 24100, + 36507: 24101, + 36508: 24104, + 36509: 24105, + 36510: 24106, + 36511: 24107, + 36512: 24108, + 36513: 24111, + 36514: 24112, + 36515: 24114, + 36516: 24115, + 36517: 24116, + 36518: 24117, + 36519: 24118, + 36520: 24121, + 36521: 24122, + 36522: 24126, + 36523: 24127, + 36524: 24128, + 36525: 24129, + 36526: 24131, + 36527: 24134, + 36528: 24135, + 36529: 24136, + 36530: 24137, + 36531: 24138, + 36532: 24139, + 36533: 24141, + 36534: 24142, + 36535: 24143, + 36536: 24144, + 36537: 24145, + 36538: 24146, + 36539: 24147, + 36540: 24150, + 36541: 24151, + 36542: 24152, + 36543: 24153, + 36544: 24154, + 36545: 24156, + 36546: 24157, + 36547: 24159, + 36548: 24160, + 36549: 24163, + 36550: 24164, + 36551: 24165, + 36552: 24166, + 36553: 24167, + 36554: 24168, + 36555: 24169, + 36556: 24170, + 36557: 24171, + 36558: 24172, + 36559: 24173, + 36560: 24174, + 36561: 24175, + 36562: 24176, + 36563: 24177, + 36564: 24181, + 36565: 24183, + 36566: 24185, + 36567: 24190, + 36568: 24193, + 36569: 24194, + 36570: 24195, + 36571: 24197, + 36572: 24200, + 36573: 24201, + 36574: 24204, + 36575: 24205, + 36576: 24206, + 36577: 24210, + 36578: 24216, + 36579: 24219, + 36580: 24221, + 36581: 24225, + 36582: 24226, + 36583: 24227, + 36584: 24228, + 36585: 24232, + 36586: 24233, + 36587: 24234, + 36588: 24235, + 36589: 24236, + 36590: 24238, + 36591: 24239, + 36592: 24240, + 36593: 24241, + 36594: 24242, + 36595: 24244, + 36596: 24250, + 36597: 24251, + 36598: 24252, + 36599: 24253, + 36600: 24255, + 36601: 24256, + 36602: 24257, + 36603: 24258, + 36604: 24259, + 36605: 24260, + 36606: 24261, + 36672: 24262, + 36673: 24263, + 36674: 24264, + 36675: 24267, + 36676: 24268, + 36677: 24269, + 36678: 24270, + 36679: 24271, + 36680: 24272, + 36681: 24276, + 36682: 24277, + 36683: 24279, + 36684: 24280, + 36685: 24281, + 36686: 24282, + 36687: 24284, + 36688: 24285, + 36689: 24286, + 36690: 24287, + 36691: 24288, + 36692: 24289, + 36693: 24290, + 36694: 24291, + 36695: 24292, + 36696: 24293, + 36697: 24294, + 36698: 24295, + 36699: 24297, + 36700: 24299, + 36701: 24300, + 36702: 24301, + 36703: 24302, + 36704: 24303, + 36705: 24304, + 36706: 24305, + 36707: 24306, + 36708: 24307, + 36709: 24309, + 36710: 24312, + 36711: 24313, + 36712: 24315, + 36713: 24316, + 36714: 24317, + 36715: 24325, + 36716: 24326, + 36717: 24327, + 36718: 24329, + 36719: 24332, + 36720: 24333, + 36721: 24334, + 36722: 24336, + 36723: 24338, + 36724: 24340, + 36725: 24342, + 36726: 24345, + 36727: 24346, + 36728: 24348, + 36729: 24349, + 36730: 24350, + 36731: 24353, + 36732: 24354, + 36733: 24355, + 36734: 24356, + 36736: 24360, + 36737: 24363, + 36738: 24364, + 36739: 24366, + 36740: 24368, + 36741: 24370, + 36742: 24371, + 36743: 24372, + 36744: 24373, + 36745: 24374, + 36746: 24375, + 36747: 24376, + 36748: 24379, + 36749: 24381, + 36750: 24382, + 36751: 24383, + 36752: 24385, + 36753: 24386, + 36754: 24387, + 36755: 24388, + 36756: 24389, + 36757: 24390, + 36758: 24391, + 36759: 24392, + 36760: 24393, + 36761: 24394, + 36762: 24395, + 36763: 24396, + 36764: 24397, + 36765: 24398, + 36766: 24399, + 36767: 24401, + 36768: 24404, + 36769: 24409, + 36770: 24410, + 36771: 24411, + 36772: 24412, + 36773: 24414, + 36774: 24415, + 36775: 24416, + 36776: 24419, + 36777: 24421, + 36778: 24423, + 36779: 24424, + 36780: 24427, + 36781: 24430, + 36782: 24431, + 36783: 24434, + 36784: 24436, + 36785: 24437, + 36786: 24438, + 36787: 24440, + 36788: 24442, + 36789: 24445, + 36790: 24446, + 36791: 24447, + 36792: 24451, + 36793: 24454, + 36794: 24461, + 36795: 24462, + 36796: 24463, + 36797: 24465, + 36798: 24467, + 36799: 24468, + 36800: 24470, + 36801: 24474, + 36802: 24475, + 36803: 24477, + 36804: 24478, + 36805: 24479, + 36806: 24480, + 36807: 24482, + 36808: 24483, + 36809: 24484, + 36810: 24485, + 36811: 24486, + 36812: 24487, + 36813: 24489, + 36814: 24491, + 36815: 24492, + 36816: 24495, + 36817: 24496, + 36818: 24497, + 36819: 24498, + 36820: 24499, + 36821: 24500, + 36822: 24502, + 36823: 24504, + 36824: 24505, + 36825: 24506, + 36826: 24507, + 36827: 24510, + 36828: 24511, + 36829: 24512, + 36830: 24513, + 36831: 24514, + 36832: 24519, + 36833: 24520, + 36834: 24522, + 36835: 24523, + 36836: 24526, + 36837: 24531, + 36838: 24532, + 36839: 24533, + 36840: 24538, + 36841: 24539, + 36842: 24540, + 36843: 24542, + 36844: 24543, + 36845: 24546, + 36846: 24547, + 36847: 24549, + 36848: 24550, + 36849: 24552, + 36850: 24553, + 36851: 24556, + 36852: 24559, + 36853: 24560, + 36854: 24562, + 36855: 24563, + 36856: 24564, + 36857: 24566, + 36858: 24567, + 36859: 24569, + 36860: 24570, + 36861: 24572, + 36862: 24583, + 36928: 24584, + 36929: 24585, + 36930: 24587, + 36931: 24588, + 36932: 24592, + 36933: 24593, + 36934: 24595, + 36935: 24599, + 36936: 24600, + 36937: 24602, + 36938: 24606, + 36939: 24607, + 36940: 24610, + 36941: 24611, + 36942: 24612, + 36943: 24620, + 36944: 24621, + 36945: 24622, + 36946: 24624, + 36947: 24625, + 36948: 24626, + 36949: 24627, + 36950: 24628, + 36951: 24630, + 36952: 24631, + 36953: 24632, + 36954: 24633, + 36955: 24634, + 36956: 24637, + 36957: 24638, + 36958: 24640, + 36959: 24644, + 36960: 24645, + 36961: 24646, + 36962: 24647, + 36963: 24648, + 36964: 24649, + 36965: 24650, + 36966: 24652, + 36967: 24654, + 36968: 24655, + 36969: 24657, + 36970: 24659, + 36971: 24660, + 36972: 24662, + 36973: 24663, + 36974: 24664, + 36975: 24667, + 36976: 24668, + 36977: 24670, + 36978: 24671, + 36979: 24672, + 36980: 24673, + 36981: 24677, + 36982: 24678, + 36983: 24686, + 36984: 24689, + 36985: 24690, + 36986: 24692, + 36987: 24693, + 36988: 24695, + 36989: 24702, + 36990: 24704, + 36992: 24705, + 36993: 24706, + 36994: 24709, + 36995: 24710, + 36996: 24711, + 36997: 24712, + 36998: 24714, + 36999: 24715, + 37000: 24718, + 37001: 24719, + 37002: 24720, + 37003: 24721, + 37004: 24723, + 37005: 24725, + 37006: 24727, + 37007: 24728, + 37008: 24729, + 37009: 24732, + 37010: 24734, + 37011: 24737, + 37012: 24738, + 37013: 24740, + 37014: 24741, + 37015: 24743, + 37016: 24745, + 37017: 24746, + 37018: 24750, + 37019: 24752, + 37020: 24755, + 37021: 24757, + 37022: 24758, + 37023: 24759, + 37024: 24761, + 37025: 24762, + 37026: 24765, + 37027: 24766, + 37028: 24767, + 37029: 24768, + 37030: 24769, + 37031: 24770, + 37032: 24771, + 37033: 24772, + 37034: 24775, + 37035: 24776, + 37036: 24777, + 37037: 24780, + 37038: 24781, + 37039: 24782, + 37040: 24783, + 37041: 24784, + 37042: 24786, + 37043: 24787, + 37044: 24788, + 37045: 24790, + 37046: 24791, + 37047: 24793, + 37048: 24795, + 37049: 24798, + 37050: 24801, + 37051: 24802, + 37052: 24803, + 37053: 24804, + 37054: 24805, + 37055: 24810, + 37056: 24817, + 37057: 24818, + 37058: 24821, + 37059: 24823, + 37060: 24824, + 37061: 24827, + 37062: 24828, + 37063: 24829, + 37064: 24830, + 37065: 24831, + 37066: 24834, + 37067: 24835, + 37068: 24836, + 37069: 24837, + 37070: 24839, + 37071: 24842, + 37072: 24843, + 37073: 24844, + 37074: 24848, + 37075: 24849, + 37076: 24850, + 37077: 24851, + 37078: 24852, + 37079: 24854, + 37080: 24855, + 37081: 24856, + 37082: 24857, + 37083: 24859, + 37084: 24860, + 37085: 24861, + 37086: 24862, + 37087: 24865, + 37088: 24866, + 37089: 24869, + 37090: 24872, + 37091: 24873, + 37092: 24874, + 37093: 24876, + 37094: 24877, + 37095: 24878, + 37096: 24879, + 37097: 24880, + 37098: 24881, + 37099: 24882, + 37100: 24883, + 37101: 24884, + 37102: 24885, + 37103: 24886, + 37104: 24887, + 37105: 24888, + 37106: 24889, + 37107: 24890, + 37108: 24891, + 37109: 24892, + 37110: 24893, + 37111: 24894, + 37112: 24896, + 37113: 24897, + 37114: 24898, + 37115: 24899, + 37116: 24900, + 37117: 24901, + 37118: 24902, + 37184: 24903, + 37185: 24905, + 37186: 24907, + 37187: 24909, + 37188: 24911, + 37189: 24912, + 37190: 24914, + 37191: 24915, + 37192: 24916, + 37193: 24918, + 37194: 24919, + 37195: 24920, + 37196: 24921, + 37197: 24922, + 37198: 24923, + 37199: 24924, + 37200: 24926, + 37201: 24927, + 37202: 24928, + 37203: 24929, + 37204: 24931, + 37205: 24932, + 37206: 24933, + 37207: 24934, + 37208: 24937, + 37209: 24938, + 37210: 24939, + 37211: 24940, + 37212: 24941, + 37213: 24942, + 37214: 24943, + 37215: 24945, + 37216: 24946, + 37217: 24947, + 37218: 24948, + 37219: 24950, + 37220: 24952, + 37221: 24953, + 37222: 24954, + 37223: 24955, + 37224: 24956, + 37225: 24957, + 37226: 24958, + 37227: 24959, + 37228: 24960, + 37229: 24961, + 37230: 24962, + 37231: 24963, + 37232: 24964, + 37233: 24965, + 37234: 24966, + 37235: 24967, + 37236: 24968, + 37237: 24969, + 37238: 24970, + 37239: 24972, + 37240: 24973, + 37241: 24975, + 37242: 24976, + 37243: 24977, + 37244: 24978, + 37245: 24979, + 37246: 24981, + 37248: 24982, + 37249: 24983, + 37250: 24984, + 37251: 24985, + 37252: 24986, + 37253: 24987, + 37254: 24988, + 37255: 24990, + 37256: 24991, + 37257: 24992, + 37258: 24993, + 37259: 24994, + 37260: 24995, + 37261: 24996, + 37262: 24997, + 37263: 24998, + 37264: 25002, + 37265: 25003, + 37266: 25005, + 37267: 25006, + 37268: 25007, + 37269: 25008, + 37270: 25009, + 37271: 25010, + 37272: 25011, + 37273: 25012, + 37274: 25013, + 37275: 25014, + 37276: 25016, + 37277: 25017, + 37278: 25018, + 37279: 25019, + 37280: 25020, + 37281: 25021, + 37282: 25023, + 37283: 25024, + 37284: 25025, + 37285: 25027, + 37286: 25028, + 37287: 25029, + 37288: 25030, + 37289: 25031, + 37290: 25033, + 37291: 25036, + 37292: 25037, + 37293: 25038, + 37294: 25039, + 37295: 25040, + 37296: 25043, + 37297: 25045, + 37298: 25046, + 37299: 25047, + 37300: 25048, + 37301: 25049, + 37302: 25050, + 37303: 25051, + 37304: 25052, + 37305: 25053, + 37306: 25054, + 37307: 25055, + 37308: 25056, + 37309: 25057, + 37310: 25058, + 37311: 25059, + 37312: 25060, + 37313: 25061, + 37314: 25063, + 37315: 25064, + 37316: 25065, + 37317: 25066, + 37318: 25067, + 37319: 25068, + 37320: 25069, + 37321: 25070, + 37322: 25071, + 37323: 25072, + 37324: 25073, + 37325: 25074, + 37326: 25075, + 37327: 25076, + 37328: 25078, + 37329: 25079, + 37330: 25080, + 37331: 25081, + 37332: 25082, + 37333: 25083, + 37334: 25084, + 37335: 25085, + 37336: 25086, + 37337: 25088, + 37338: 25089, + 37339: 25090, + 37340: 25091, + 37341: 25092, + 37342: 25093, + 37343: 25095, + 37344: 25097, + 37345: 25107, + 37346: 25108, + 37347: 25113, + 37348: 25116, + 37349: 25117, + 37350: 25118, + 37351: 25120, + 37352: 25123, + 37353: 25126, + 37354: 25127, + 37355: 25128, + 37356: 25129, + 37357: 25131, + 37358: 25133, + 37359: 25135, + 37360: 25136, + 37361: 25137, + 37362: 25138, + 37363: 25141, + 37364: 25142, + 37365: 25144, + 37366: 25145, + 37367: 25146, + 37368: 25147, + 37369: 25148, + 37370: 25154, + 37371: 25156, + 37372: 25157, + 37373: 25158, + 37374: 25162, + 37440: 25167, + 37441: 25168, + 37442: 25173, + 37443: 25174, + 37444: 25175, + 37445: 25177, + 37446: 25178, + 37447: 25180, + 37448: 25181, + 37449: 25182, + 37450: 25183, + 37451: 25184, + 37452: 25185, + 37453: 25186, + 37454: 25188, + 37455: 25189, + 37456: 25192, + 37457: 25201, + 37458: 25202, + 37459: 25204, + 37460: 25205, + 37461: 25207, + 37462: 25208, + 37463: 25210, + 37464: 25211, + 37465: 25213, + 37466: 25217, + 37467: 25218, + 37468: 25219, + 37469: 25221, + 37470: 25222, + 37471: 25223, + 37472: 25224, + 37473: 25227, + 37474: 25228, + 37475: 25229, + 37476: 25230, + 37477: 25231, + 37478: 25232, + 37479: 25236, + 37480: 25241, + 37481: 25244, + 37482: 25245, + 37483: 25246, + 37484: 25251, + 37485: 25254, + 37486: 25255, + 37487: 25257, + 37488: 25258, + 37489: 25261, + 37490: 25262, + 37491: 25263, + 37492: 25264, + 37493: 25266, + 37494: 25267, + 37495: 25268, + 37496: 25270, + 37497: 25271, + 37498: 25272, + 37499: 25274, + 37500: 25278, + 37501: 25280, + 37502: 25281, + 37504: 25283, + 37505: 25291, + 37506: 25295, + 37507: 25297, + 37508: 25301, + 37509: 25309, + 37510: 25310, + 37511: 25312, + 37512: 25313, + 37513: 25316, + 37514: 25322, + 37515: 25323, + 37516: 25328, + 37517: 25330, + 37518: 25333, + 37519: 25336, + 37520: 25337, + 37521: 25338, + 37522: 25339, + 37523: 25344, + 37524: 25347, + 37525: 25348, + 37526: 25349, + 37527: 25350, + 37528: 25354, + 37529: 25355, + 37530: 25356, + 37531: 25357, + 37532: 25359, + 37533: 25360, + 37534: 25362, + 37535: 25363, + 37536: 25364, + 37537: 25365, + 37538: 25367, + 37539: 25368, + 37540: 25369, + 37541: 25372, + 37542: 25382, + 37543: 25383, + 37544: 25385, + 37545: 25388, + 37546: 25389, + 37547: 25390, + 37548: 25392, + 37549: 25393, + 37550: 25395, + 37551: 25396, + 37552: 25397, + 37553: 25398, + 37554: 25399, + 37555: 25400, + 37556: 25403, + 37557: 25404, + 37558: 25406, + 37559: 25407, + 37560: 25408, + 37561: 25409, + 37562: 25412, + 37563: 25415, + 37564: 25416, + 37565: 25418, + 37566: 25425, + 37567: 25426, + 37568: 25427, + 37569: 25428, + 37570: 25430, + 37571: 25431, + 37572: 25432, + 37573: 25433, + 37574: 25434, + 37575: 25435, + 37576: 25436, + 37577: 25437, + 37578: 25440, + 37579: 25444, + 37580: 25445, + 37581: 25446, + 37582: 25448, + 37583: 25450, + 37584: 25451, + 37585: 25452, + 37586: 25455, + 37587: 25456, + 37588: 25458, + 37589: 25459, + 37590: 25460, + 37591: 25461, + 37592: 25464, + 37593: 25465, + 37594: 25468, + 37595: 25469, + 37596: 25470, + 37597: 25471, + 37598: 25473, + 37599: 25475, + 37600: 25476, + 37601: 25477, + 37602: 25478, + 37603: 25483, + 37604: 25485, + 37605: 25489, + 37606: 25491, + 37607: 25492, + 37608: 25493, + 37609: 25495, + 37610: 25497, + 37611: 25498, + 37612: 25499, + 37613: 25500, + 37614: 25501, + 37615: 25502, + 37616: 25503, + 37617: 25505, + 37618: 25508, + 37619: 25510, + 37620: 25515, + 37621: 25519, + 37622: 25521, + 37623: 25522, + 37624: 25525, + 37625: 25526, + 37626: 25529, + 37627: 25531, + 37628: 25533, + 37629: 25535, + 37630: 25536, + 37696: 25537, + 37697: 25538, + 37698: 25539, + 37699: 25541, + 37700: 25543, + 37701: 25544, + 37702: 25546, + 37703: 25547, + 37704: 25548, + 37705: 25553, + 37706: 25555, + 37707: 25556, + 37708: 25557, + 37709: 25559, + 37710: 25560, + 37711: 25561, + 37712: 25562, + 37713: 25563, + 37714: 25564, + 37715: 25565, + 37716: 25567, + 37717: 25570, + 37718: 25572, + 37719: 25573, + 37720: 25574, + 37721: 25575, + 37722: 25576, + 37723: 25579, + 37724: 25580, + 37725: 25582, + 37726: 25583, + 37727: 25584, + 37728: 25585, + 37729: 25587, + 37730: 25589, + 37731: 25591, + 37732: 25593, + 37733: 25594, + 37734: 25595, + 37735: 25596, + 37736: 25598, + 37737: 25603, + 37738: 25604, + 37739: 25606, + 37740: 25607, + 37741: 25608, + 37742: 25609, + 37743: 25610, + 37744: 25613, + 37745: 25614, + 37746: 25617, + 37747: 25618, + 37748: 25621, + 37749: 25622, + 37750: 25623, + 37751: 25624, + 37752: 25625, + 37753: 25626, + 37754: 25629, + 37755: 25631, + 37756: 25634, + 37757: 25635, + 37758: 25636, + 37760: 25637, + 37761: 25639, + 37762: 25640, + 37763: 25641, + 37764: 25643, + 37765: 25646, + 37766: 25647, + 37767: 25648, + 37768: 25649, + 37769: 25650, + 37770: 25651, + 37771: 25653, + 37772: 25654, + 37773: 25655, + 37774: 25656, + 37775: 25657, + 37776: 25659, + 37777: 25660, + 37778: 25662, + 37779: 25664, + 37780: 25666, + 37781: 25667, + 37782: 25673, + 37783: 25675, + 37784: 25676, + 37785: 25677, + 37786: 25678, + 37787: 25679, + 37788: 25680, + 37789: 25681, + 37790: 25683, + 37791: 25685, + 37792: 25686, + 37793: 25687, + 37794: 25689, + 37795: 25690, + 37796: 25691, + 37797: 25692, + 37798: 25693, + 37799: 25695, + 37800: 25696, + 37801: 25697, + 37802: 25698, + 37803: 25699, + 37804: 25700, + 37805: 25701, + 37806: 25702, + 37807: 25704, + 37808: 25706, + 37809: 25707, + 37810: 25708, + 37811: 25710, + 37812: 25711, + 37813: 25712, + 37814: 25713, + 37815: 25714, + 37816: 25715, + 37817: 25716, + 37818: 25717, + 37819: 25718, + 37820: 25719, + 37821: 25723, + 37822: 25724, + 37823: 25725, + 37824: 25726, + 37825: 25727, + 37826: 25728, + 37827: 25729, + 37828: 25731, + 37829: 25734, + 37830: 25736, + 37831: 25737, + 37832: 25738, + 37833: 25739, + 37834: 25740, + 37835: 25741, + 37836: 25742, + 37837: 25743, + 37838: 25744, + 37839: 25747, + 37840: 25748, + 37841: 25751, + 37842: 25752, + 37843: 25754, + 37844: 25755, + 37845: 25756, + 37846: 25757, + 37847: 25759, + 37848: 25760, + 37849: 25761, + 37850: 25762, + 37851: 25763, + 37852: 25765, + 37853: 25766, + 37854: 25767, + 37855: 25768, + 37856: 25770, + 37857: 25771, + 37858: 25775, + 37859: 25777, + 37860: 25778, + 37861: 25779, + 37862: 25780, + 37863: 25782, + 37864: 25785, + 37865: 25787, + 37866: 25789, + 37867: 25790, + 37868: 25791, + 37869: 25793, + 37870: 25795, + 37871: 25796, + 37872: 25798, + 37873: 25799, + 37874: 25800, + 37875: 25801, + 37876: 25802, + 37877: 25803, + 37878: 25804, + 37879: 25807, + 37880: 25809, + 37881: 25811, + 37882: 25812, + 37883: 25813, + 37884: 25814, + 37885: 25817, + 37886: 25818, + 37952: 25819, + 37953: 25820, + 37954: 25821, + 37955: 25823, + 37956: 25824, + 37957: 25825, + 37958: 25827, + 37959: 25829, + 37960: 25831, + 37961: 25832, + 37962: 25833, + 37963: 25834, + 37964: 25835, + 37965: 25836, + 37966: 25837, + 37967: 25838, + 37968: 25839, + 37969: 25840, + 37970: 25841, + 37971: 25842, + 37972: 25843, + 37973: 25844, + 37974: 25845, + 37975: 25846, + 37976: 25847, + 37977: 25848, + 37978: 25849, + 37979: 25850, + 37980: 25851, + 37981: 25852, + 37982: 25853, + 37983: 25854, + 37984: 25855, + 37985: 25857, + 37986: 25858, + 37987: 25859, + 37988: 25860, + 37989: 25861, + 37990: 25862, + 37991: 25863, + 37992: 25864, + 37993: 25866, + 37994: 25867, + 37995: 25868, + 37996: 25869, + 37997: 25870, + 37998: 25871, + 37999: 25872, + 38000: 25873, + 38001: 25875, + 38002: 25876, + 38003: 25877, + 38004: 25878, + 38005: 25879, + 38006: 25881, + 38007: 25882, + 38008: 25883, + 38009: 25884, + 38010: 25885, + 38011: 25886, + 38012: 25887, + 38013: 25888, + 38014: 25889, + 38016: 25890, + 38017: 25891, + 38018: 25892, + 38019: 25894, + 38020: 25895, + 38021: 25896, + 38022: 25897, + 38023: 25898, + 38024: 25900, + 38025: 25901, + 38026: 25904, + 38027: 25905, + 38028: 25906, + 38029: 25907, + 38030: 25911, + 38031: 25914, + 38032: 25916, + 38033: 25917, + 38034: 25920, + 38035: 25921, + 38036: 25922, + 38037: 25923, + 38038: 25924, + 38039: 25926, + 38040: 25927, + 38041: 25930, + 38042: 25931, + 38043: 25933, + 38044: 25934, + 38045: 25936, + 38046: 25938, + 38047: 25939, + 38048: 25940, + 38049: 25943, + 38050: 25944, + 38051: 25946, + 38052: 25948, + 38053: 25951, + 38054: 25952, + 38055: 25953, + 38056: 25956, + 38057: 25957, + 38058: 25959, + 38059: 25960, + 38060: 25961, + 38061: 25962, + 38062: 25965, + 38063: 25966, + 38064: 25967, + 38065: 25969, + 38066: 25971, + 38067: 25973, + 38068: 25974, + 38069: 25976, + 38070: 25977, + 38071: 25978, + 38072: 25979, + 38073: 25980, + 38074: 25981, + 38075: 25982, + 38076: 25983, + 38077: 25984, + 38078: 25985, + 38079: 25986, + 38080: 25987, + 38081: 25988, + 38082: 25989, + 38083: 25990, + 38084: 25992, + 38085: 25993, + 38086: 25994, + 38087: 25997, + 38088: 25998, + 38089: 25999, + 38090: 26002, + 38091: 26004, + 38092: 26005, + 38093: 26006, + 38094: 26008, + 38095: 26010, + 38096: 26013, + 38097: 26014, + 38098: 26016, + 38099: 26018, + 38100: 26019, + 38101: 26022, + 38102: 26024, + 38103: 26026, + 38104: 26028, + 38105: 26030, + 38106: 26033, + 38107: 26034, + 38108: 26035, + 38109: 26036, + 38110: 26037, + 38111: 26038, + 38112: 26039, + 38113: 26040, + 38114: 26042, + 38115: 26043, + 38116: 26046, + 38117: 26047, + 38118: 26048, + 38119: 26050, + 38120: 26055, + 38121: 26056, + 38122: 26057, + 38123: 26058, + 38124: 26061, + 38125: 26064, + 38126: 26065, + 38127: 26067, + 38128: 26068, + 38129: 26069, + 38130: 26072, + 38131: 26073, + 38132: 26074, + 38133: 26075, + 38134: 26076, + 38135: 26077, + 38136: 26078, + 38137: 26079, + 38138: 26081, + 38139: 26083, + 38140: 26084, + 38141: 26090, + 38142: 26091, + 38208: 26098, + 38209: 26099, + 38210: 26100, + 38211: 26101, + 38212: 26104, + 38213: 26105, + 38214: 26107, + 38215: 26108, + 38216: 26109, + 38217: 26110, + 38218: 26111, + 38219: 26113, + 38220: 26116, + 38221: 26117, + 38222: 26119, + 38223: 26120, + 38224: 26121, + 38225: 26123, + 38226: 26125, + 38227: 26128, + 38228: 26129, + 38229: 26130, + 38230: 26134, + 38231: 26135, + 38232: 26136, + 38233: 26138, + 38234: 26139, + 38235: 26140, + 38236: 26142, + 38237: 26145, + 38238: 26146, + 38239: 26147, + 38240: 26148, + 38241: 26150, + 38242: 26153, + 38243: 26154, + 38244: 26155, + 38245: 26156, + 38246: 26158, + 38247: 26160, + 38248: 26162, + 38249: 26163, + 38250: 26167, + 38251: 26168, + 38252: 26169, + 38253: 26170, + 38254: 26171, + 38255: 26173, + 38256: 26175, + 38257: 26176, + 38258: 26178, + 38259: 26180, + 38260: 26181, + 38261: 26182, + 38262: 26183, + 38263: 26184, + 38264: 26185, + 38265: 26186, + 38266: 26189, + 38267: 26190, + 38268: 26192, + 38269: 26193, + 38270: 26200, + 38272: 26201, + 38273: 26203, + 38274: 26204, + 38275: 26205, + 38276: 26206, + 38277: 26208, + 38278: 26210, + 38279: 26211, + 38280: 26213, + 38281: 26215, + 38282: 26217, + 38283: 26218, + 38284: 26219, + 38285: 26220, + 38286: 26221, + 38287: 26225, + 38288: 26226, + 38289: 26227, + 38290: 26229, + 38291: 26232, + 38292: 26233, + 38293: 26235, + 38294: 26236, + 38295: 26237, + 38296: 26239, + 38297: 26240, + 38298: 26241, + 38299: 26243, + 38300: 26245, + 38301: 26246, + 38302: 26248, + 38303: 26249, + 38304: 26250, + 38305: 26251, + 38306: 26253, + 38307: 26254, + 38308: 26255, + 38309: 26256, + 38310: 26258, + 38311: 26259, + 38312: 26260, + 38313: 26261, + 38314: 26264, + 38315: 26265, + 38316: 26266, + 38317: 26267, + 38318: 26268, + 38319: 26270, + 38320: 26271, + 38321: 26272, + 38322: 26273, + 38323: 26274, + 38324: 26275, + 38325: 26276, + 38326: 26277, + 38327: 26278, + 38328: 26281, + 38329: 26282, + 38330: 26283, + 38331: 26284, + 38332: 26285, + 38333: 26287, + 38334: 26288, + 38335: 26289, + 38336: 26290, + 38337: 26291, + 38338: 26293, + 38339: 26294, + 38340: 26295, + 38341: 26296, + 38342: 26298, + 38343: 26299, + 38344: 26300, + 38345: 26301, + 38346: 26303, + 38347: 26304, + 38348: 26305, + 38349: 26306, + 38350: 26307, + 38351: 26308, + 38352: 26309, + 38353: 26310, + 38354: 26311, + 38355: 26312, + 38356: 26313, + 38357: 26314, + 38358: 26315, + 38359: 26316, + 38360: 26317, + 38361: 26318, + 38362: 26319, + 38363: 26320, + 38364: 26321, + 38365: 26322, + 38366: 26323, + 38367: 26324, + 38368: 26325, + 38369: 26326, + 38370: 26327, + 38371: 26328, + 38372: 26330, + 38373: 26334, + 38374: 26335, + 38375: 26336, + 38376: 26337, + 38377: 26338, + 38378: 26339, + 38379: 26340, + 38380: 26341, + 38381: 26343, + 38382: 26344, + 38383: 26346, + 38384: 26347, + 38385: 26348, + 38386: 26349, + 38387: 26350, + 38388: 26351, + 38389: 26353, + 38390: 26357, + 38391: 26358, + 38392: 26360, + 38393: 26362, + 38394: 26363, + 38395: 26365, + 38396: 26369, + 38397: 26370, + 38398: 26371, + 38464: 26372, + 38465: 26373, + 38466: 26374, + 38467: 26375, + 38468: 26380, + 38469: 26382, + 38470: 26383, + 38471: 26385, + 38472: 26386, + 38473: 26387, + 38474: 26390, + 38475: 26392, + 38476: 26393, + 38477: 26394, + 38478: 26396, + 38479: 26398, + 38480: 26400, + 38481: 26401, + 38482: 26402, + 38483: 26403, + 38484: 26404, + 38485: 26405, + 38486: 26407, + 38487: 26409, + 38488: 26414, + 38489: 26416, + 38490: 26418, + 38491: 26419, + 38492: 26422, + 38493: 26423, + 38494: 26424, + 38495: 26425, + 38496: 26427, + 38497: 26428, + 38498: 26430, + 38499: 26431, + 38500: 26433, + 38501: 26436, + 38502: 26437, + 38503: 26439, + 38504: 26442, + 38505: 26443, + 38506: 26445, + 38507: 26450, + 38508: 26452, + 38509: 26453, + 38510: 26455, + 38511: 26456, + 38512: 26457, + 38513: 26458, + 38514: 26459, + 38515: 26461, + 38516: 26466, + 38517: 26467, + 38518: 26468, + 38519: 26470, + 38520: 26471, + 38521: 26475, + 38522: 26476, + 38523: 26478, + 38524: 26481, + 38525: 26484, + 38526: 26486, + 38528: 26488, + 38529: 26489, + 38530: 26490, + 38531: 26491, + 38532: 26493, + 38533: 26496, + 38534: 26498, + 38535: 26499, + 38536: 26501, + 38537: 26502, + 38538: 26504, + 38539: 26506, + 38540: 26508, + 38541: 26509, + 38542: 26510, + 38543: 26511, + 38544: 26513, + 38545: 26514, + 38546: 26515, + 38547: 26516, + 38548: 26518, + 38549: 26521, + 38550: 26523, + 38551: 26527, + 38552: 26528, + 38553: 26529, + 38554: 26532, + 38555: 26534, + 38556: 26537, + 38557: 26540, + 38558: 26542, + 38559: 26545, + 38560: 26546, + 38561: 26548, + 38562: 26553, + 38563: 26554, + 38564: 26555, + 38565: 26556, + 38566: 26557, + 38567: 26558, + 38568: 26559, + 38569: 26560, + 38570: 26562, + 38571: 26565, + 38572: 26566, + 38573: 26567, + 38574: 26568, + 38575: 26569, + 38576: 26570, + 38577: 26571, + 38578: 26572, + 38579: 26573, + 38580: 26574, + 38581: 26581, + 38582: 26582, + 38583: 26583, + 38584: 26587, + 38585: 26591, + 38586: 26593, + 38587: 26595, + 38588: 26596, + 38589: 26598, + 38590: 26599, + 38591: 26600, + 38592: 26602, + 38593: 26603, + 38594: 26605, + 38595: 26606, + 38596: 26610, + 38597: 26613, + 38598: 26614, + 38599: 26615, + 38600: 26616, + 38601: 26617, + 38602: 26618, + 38603: 26619, + 38604: 26620, + 38605: 26622, + 38606: 26625, + 38607: 26626, + 38608: 26627, + 38609: 26628, + 38610: 26630, + 38611: 26637, + 38612: 26640, + 38613: 26642, + 38614: 26644, + 38615: 26645, + 38616: 26648, + 38617: 26649, + 38618: 26650, + 38619: 26651, + 38620: 26652, + 38621: 26654, + 38622: 26655, + 38623: 26656, + 38624: 26658, + 38625: 26659, + 38626: 26660, + 38627: 26661, + 38628: 26662, + 38629: 26663, + 38630: 26664, + 38631: 26667, + 38632: 26668, + 38633: 26669, + 38634: 26670, + 38635: 26671, + 38636: 26672, + 38637: 26673, + 38638: 26676, + 38639: 26677, + 38640: 26678, + 38641: 26682, + 38642: 26683, + 38643: 26687, + 38644: 26695, + 38645: 26699, + 38646: 26701, + 38647: 26703, + 38648: 26706, + 38649: 26710, + 38650: 26711, + 38651: 26712, + 38652: 26713, + 38653: 26714, + 38654: 26715, + 38720: 26716, + 38721: 26717, + 38722: 26718, + 38723: 26719, + 38724: 26730, + 38725: 26732, + 38726: 26733, + 38727: 26734, + 38728: 26735, + 38729: 26736, + 38730: 26737, + 38731: 26738, + 38732: 26739, + 38733: 26741, + 38734: 26744, + 38735: 26745, + 38736: 26746, + 38737: 26747, + 38738: 26748, + 38739: 26749, + 38740: 26750, + 38741: 26751, + 38742: 26752, + 38743: 26754, + 38744: 26756, + 38745: 26759, + 38746: 26760, + 38747: 26761, + 38748: 26762, + 38749: 26763, + 38750: 26764, + 38751: 26765, + 38752: 26766, + 38753: 26768, + 38754: 26769, + 38755: 26770, + 38756: 26772, + 38757: 26773, + 38758: 26774, + 38759: 26776, + 38760: 26777, + 38761: 26778, + 38762: 26779, + 38763: 26780, + 38764: 26781, + 38765: 26782, + 38766: 26783, + 38767: 26784, + 38768: 26785, + 38769: 26787, + 38770: 26788, + 38771: 26789, + 38772: 26793, + 38773: 26794, + 38774: 26795, + 38775: 26796, + 38776: 26798, + 38777: 26801, + 38778: 26802, + 38779: 26804, + 38780: 26806, + 38781: 26807, + 38782: 26808, + 38784: 26809, + 38785: 26810, + 38786: 26811, + 38787: 26812, + 38788: 26813, + 38789: 26814, + 38790: 26815, + 38791: 26817, + 38792: 26819, + 38793: 26820, + 38794: 26821, + 38795: 26822, + 38796: 26823, + 38797: 26824, + 38798: 26826, + 38799: 26828, + 38800: 26830, + 38801: 26831, + 38802: 26832, + 38803: 26833, + 38804: 26835, + 38805: 26836, + 38806: 26838, + 38807: 26839, + 38808: 26841, + 38809: 26843, + 38810: 26844, + 38811: 26845, + 38812: 26846, + 38813: 26847, + 38814: 26849, + 38815: 26850, + 38816: 26852, + 38817: 26853, + 38818: 26854, + 38819: 26855, + 38820: 26856, + 38821: 26857, + 38822: 26858, + 38823: 26859, + 38824: 26860, + 38825: 26861, + 38826: 26863, + 38827: 26866, + 38828: 26867, + 38829: 26868, + 38830: 26870, + 38831: 26871, + 38832: 26872, + 38833: 26875, + 38834: 26877, + 38835: 26878, + 38836: 26879, + 38837: 26880, + 38838: 26882, + 38839: 26883, + 38840: 26884, + 38841: 26886, + 38842: 26887, + 38843: 26888, + 38844: 26889, + 38845: 26890, + 38846: 26892, + 38847: 26895, + 38848: 26897, + 38849: 26899, + 38850: 26900, + 38851: 26901, + 38852: 26902, + 38853: 26903, + 38854: 26904, + 38855: 26905, + 38856: 26906, + 38857: 26907, + 38858: 26908, + 38859: 26909, + 38860: 26910, + 38861: 26913, + 38862: 26914, + 38863: 26915, + 38864: 26917, + 38865: 26918, + 38866: 26919, + 38867: 26920, + 38868: 26921, + 38869: 26922, + 38870: 26923, + 38871: 26924, + 38872: 26926, + 38873: 26927, + 38874: 26929, + 38875: 26930, + 38876: 26931, + 38877: 26933, + 38878: 26934, + 38879: 26935, + 38880: 26936, + 38881: 26938, + 38882: 26939, + 38883: 26940, + 38884: 26942, + 38885: 26944, + 38886: 26945, + 38887: 26947, + 38888: 26948, + 38889: 26949, + 38890: 26950, + 38891: 26951, + 38892: 26952, + 38893: 26953, + 38894: 26954, + 38895: 26955, + 38896: 26956, + 38897: 26957, + 38898: 26958, + 38899: 26959, + 38900: 26960, + 38901: 26961, + 38902: 26962, + 38903: 26963, + 38904: 26965, + 38905: 26966, + 38906: 26968, + 38907: 26969, + 38908: 26971, + 38909: 26972, + 38910: 26975, + 38976: 26977, + 38977: 26978, + 38978: 26980, + 38979: 26981, + 38980: 26983, + 38981: 26984, + 38982: 26985, + 38983: 26986, + 38984: 26988, + 38985: 26989, + 38986: 26991, + 38987: 26992, + 38988: 26994, + 38989: 26995, + 38990: 26996, + 38991: 26997, + 38992: 26998, + 38993: 27002, + 38994: 27003, + 38995: 27005, + 38996: 27006, + 38997: 27007, + 38998: 27009, + 38999: 27011, + 39000: 27013, + 39001: 27018, + 39002: 27019, + 39003: 27020, + 39004: 27022, + 39005: 27023, + 39006: 27024, + 39007: 27025, + 39008: 27026, + 39009: 27027, + 39010: 27030, + 39011: 27031, + 39012: 27033, + 39013: 27034, + 39014: 27037, + 39015: 27038, + 39016: 27039, + 39017: 27040, + 39018: 27041, + 39019: 27042, + 39020: 27043, + 39021: 27044, + 39022: 27045, + 39023: 27046, + 39024: 27049, + 39025: 27050, + 39026: 27052, + 39027: 27054, + 39028: 27055, + 39029: 27056, + 39030: 27058, + 39031: 27059, + 39032: 27061, + 39033: 27062, + 39034: 27064, + 39035: 27065, + 39036: 27066, + 39037: 27068, + 39038: 27069, + 39040: 27070, + 39041: 27071, + 39042: 27072, + 39043: 27074, + 39044: 27075, + 39045: 27076, + 39046: 27077, + 39047: 27078, + 39048: 27079, + 39049: 27080, + 39050: 27081, + 39051: 27083, + 39052: 27085, + 39053: 27087, + 39054: 27089, + 39055: 27090, + 39056: 27091, + 39057: 27093, + 39058: 27094, + 39059: 27095, + 39060: 27096, + 39061: 27097, + 39062: 27098, + 39063: 27100, + 39064: 27101, + 39065: 27102, + 39066: 27105, + 39067: 27106, + 39068: 27107, + 39069: 27108, + 39070: 27109, + 39071: 27110, + 39072: 27111, + 39073: 27112, + 39074: 27113, + 39075: 27114, + 39076: 27115, + 39077: 27116, + 39078: 27118, + 39079: 27119, + 39080: 27120, + 39081: 27121, + 39082: 27123, + 39083: 27124, + 39084: 27125, + 39085: 27126, + 39086: 27127, + 39087: 27128, + 39088: 27129, + 39089: 27130, + 39090: 27131, + 39091: 27132, + 39092: 27134, + 39093: 27136, + 39094: 27137, + 39095: 27138, + 39096: 27139, + 39097: 27140, + 39098: 27141, + 39099: 27142, + 39100: 27143, + 39101: 27144, + 39102: 27145, + 39103: 27147, + 39104: 27148, + 39105: 27149, + 39106: 27150, + 39107: 27151, + 39108: 27152, + 39109: 27153, + 39110: 27154, + 39111: 27155, + 39112: 27156, + 39113: 27157, + 39114: 27158, + 39115: 27161, + 39116: 27162, + 39117: 27163, + 39118: 27164, + 39119: 27165, + 39120: 27166, + 39121: 27168, + 39122: 27170, + 39123: 27171, + 39124: 27172, + 39125: 27173, + 39126: 27174, + 39127: 27175, + 39128: 27177, + 39129: 27179, + 39130: 27180, + 39131: 27181, + 39132: 27182, + 39133: 27184, + 39134: 27186, + 39135: 27187, + 39136: 27188, + 39137: 27190, + 39138: 27191, + 39139: 27192, + 39140: 27193, + 39141: 27194, + 39142: 27195, + 39143: 27196, + 39144: 27199, + 39145: 27200, + 39146: 27201, + 39147: 27202, + 39148: 27203, + 39149: 27205, + 39150: 27206, + 39151: 27208, + 39152: 27209, + 39153: 27210, + 39154: 27211, + 39155: 27212, + 39156: 27213, + 39157: 27214, + 39158: 27215, + 39159: 27217, + 39160: 27218, + 39161: 27219, + 39162: 27220, + 39163: 27221, + 39164: 27222, + 39165: 27223, + 39166: 27226, + 39232: 27228, + 39233: 27229, + 39234: 27230, + 39235: 27231, + 39236: 27232, + 39237: 27234, + 39238: 27235, + 39239: 27236, + 39240: 27238, + 39241: 27239, + 39242: 27240, + 39243: 27241, + 39244: 27242, + 39245: 27243, + 39246: 27244, + 39247: 27245, + 39248: 27246, + 39249: 27247, + 39250: 27248, + 39251: 27250, + 39252: 27251, + 39253: 27252, + 39254: 27253, + 39255: 27254, + 39256: 27255, + 39257: 27256, + 39258: 27258, + 39259: 27259, + 39260: 27261, + 39261: 27262, + 39262: 27263, + 39263: 27265, + 39264: 27266, + 39265: 27267, + 39266: 27269, + 39267: 27270, + 39268: 27271, + 39269: 27272, + 39270: 27273, + 39271: 27274, + 39272: 27275, + 39273: 27276, + 39274: 27277, + 39275: 27279, + 39276: 27282, + 39277: 27283, + 39278: 27284, + 39279: 27285, + 39280: 27286, + 39281: 27288, + 39282: 27289, + 39283: 27290, + 39284: 27291, + 39285: 27292, + 39286: 27293, + 39287: 27294, + 39288: 27295, + 39289: 27297, + 39290: 27298, + 39291: 27299, + 39292: 27300, + 39293: 27301, + 39294: 27302, + 39296: 27303, + 39297: 27304, + 39298: 27306, + 39299: 27309, + 39300: 27310, + 39301: 27311, + 39302: 27312, + 39303: 27313, + 39304: 27314, + 39305: 27315, + 39306: 27316, + 39307: 27317, + 39308: 27318, + 39309: 27319, + 39310: 27320, + 39311: 27321, + 39312: 27322, + 39313: 27323, + 39314: 27324, + 39315: 27325, + 39316: 27326, + 39317: 27327, + 39318: 27328, + 39319: 27329, + 39320: 27330, + 39321: 27331, + 39322: 27332, + 39323: 27333, + 39324: 27334, + 39325: 27335, + 39326: 27336, + 39327: 27337, + 39328: 27338, + 39329: 27339, + 39330: 27340, + 39331: 27341, + 39332: 27342, + 39333: 27343, + 39334: 27344, + 39335: 27345, + 39336: 27346, + 39337: 27347, + 39338: 27348, + 39339: 27349, + 39340: 27350, + 39341: 27351, + 39342: 27352, + 39343: 27353, + 39344: 27354, + 39345: 27355, + 39346: 27356, + 39347: 27357, + 39348: 27358, + 39349: 27359, + 39350: 27360, + 39351: 27361, + 39352: 27362, + 39353: 27363, + 39354: 27364, + 39355: 27365, + 39356: 27366, + 39357: 27367, + 39358: 27368, + 39359: 27369, + 39360: 27370, + 39361: 27371, + 39362: 27372, + 39363: 27373, + 39364: 27374, + 39365: 27375, + 39366: 27376, + 39367: 27377, + 39368: 27378, + 39369: 27379, + 39370: 27380, + 39371: 27381, + 39372: 27382, + 39373: 27383, + 39374: 27384, + 39375: 27385, + 39376: 27386, + 39377: 27387, + 39378: 27388, + 39379: 27389, + 39380: 27390, + 39381: 27391, + 39382: 27392, + 39383: 27393, + 39384: 27394, + 39385: 27395, + 39386: 27396, + 39387: 27397, + 39388: 27398, + 39389: 27399, + 39390: 27400, + 39391: 27401, + 39392: 27402, + 39393: 27403, + 39394: 27404, + 39395: 27405, + 39396: 27406, + 39397: 27407, + 39398: 27408, + 39399: 27409, + 39400: 27410, + 39401: 27411, + 39402: 27412, + 39403: 27413, + 39404: 27414, + 39405: 27415, + 39406: 27416, + 39407: 27417, + 39408: 27418, + 39409: 27419, + 39410: 27420, + 39411: 27421, + 39412: 27422, + 39413: 27423, + 39414: 27429, + 39415: 27430, + 39416: 27432, + 39417: 27433, + 39418: 27434, + 39419: 27435, + 39420: 27436, + 39421: 27437, + 39422: 27438, + 39488: 27439, + 39489: 27440, + 39490: 27441, + 39491: 27443, + 39492: 27444, + 39493: 27445, + 39494: 27446, + 39495: 27448, + 39496: 27451, + 39497: 27452, + 39498: 27453, + 39499: 27455, + 39500: 27456, + 39501: 27457, + 39502: 27458, + 39503: 27460, + 39504: 27461, + 39505: 27464, + 39506: 27466, + 39507: 27467, + 39508: 27469, + 39509: 27470, + 39510: 27471, + 39511: 27472, + 39512: 27473, + 39513: 27474, + 39514: 27475, + 39515: 27476, + 39516: 27477, + 39517: 27478, + 39518: 27479, + 39519: 27480, + 39520: 27482, + 39521: 27483, + 39522: 27484, + 39523: 27485, + 39524: 27486, + 39525: 27487, + 39526: 27488, + 39527: 27489, + 39528: 27496, + 39529: 27497, + 39530: 27499, + 39531: 27500, + 39532: 27501, + 39533: 27502, + 39534: 27503, + 39535: 27504, + 39536: 27505, + 39537: 27506, + 39538: 27507, + 39539: 27508, + 39540: 27509, + 39541: 27510, + 39542: 27511, + 39543: 27512, + 39544: 27514, + 39545: 27517, + 39546: 27518, + 39547: 27519, + 39548: 27520, + 39549: 27525, + 39550: 27528, + 39552: 27532, + 39553: 27534, + 39554: 27535, + 39555: 27536, + 39556: 27537, + 39557: 27540, + 39558: 27541, + 39559: 27543, + 39560: 27544, + 39561: 27545, + 39562: 27548, + 39563: 27549, + 39564: 27550, + 39565: 27551, + 39566: 27552, + 39567: 27554, + 39568: 27555, + 39569: 27556, + 39570: 27557, + 39571: 27558, + 39572: 27559, + 39573: 27560, + 39574: 27561, + 39575: 27563, + 39576: 27564, + 39577: 27565, + 39578: 27566, + 39579: 27567, + 39580: 27568, + 39581: 27569, + 39582: 27570, + 39583: 27574, + 39584: 27576, + 39585: 27577, + 39586: 27578, + 39587: 27579, + 39588: 27580, + 39589: 27581, + 39590: 27582, + 39591: 27584, + 39592: 27587, + 39593: 27588, + 39594: 27590, + 39595: 27591, + 39596: 27592, + 39597: 27593, + 39598: 27594, + 39599: 27596, + 39600: 27598, + 39601: 27600, + 39602: 27601, + 39603: 27608, + 39604: 27610, + 39605: 27612, + 39606: 27613, + 39607: 27614, + 39608: 27615, + 39609: 27616, + 39610: 27618, + 39611: 27619, + 39612: 27620, + 39613: 27621, + 39614: 27622, + 39615: 27623, + 39616: 27624, + 39617: 27625, + 39618: 27628, + 39619: 27629, + 39620: 27630, + 39621: 27632, + 39622: 27633, + 39623: 27634, + 39624: 27636, + 39625: 27638, + 39626: 27639, + 39627: 27640, + 39628: 27642, + 39629: 27643, + 39630: 27644, + 39631: 27646, + 39632: 27647, + 39633: 27648, + 39634: 27649, + 39635: 27650, + 39636: 27651, + 39637: 27652, + 39638: 27656, + 39639: 27657, + 39640: 27658, + 39641: 27659, + 39642: 27660, + 39643: 27662, + 39644: 27666, + 39645: 27671, + 39646: 27676, + 39647: 27677, + 39648: 27678, + 39649: 27680, + 39650: 27683, + 39651: 27685, + 39652: 27691, + 39653: 27692, + 39654: 27693, + 39655: 27697, + 39656: 27699, + 39657: 27702, + 39658: 27703, + 39659: 27705, + 39660: 27706, + 39661: 27707, + 39662: 27708, + 39663: 27710, + 39664: 27711, + 39665: 27715, + 39666: 27716, + 39667: 27717, + 39668: 27720, + 39669: 27723, + 39670: 27724, + 39671: 27725, + 39672: 27726, + 39673: 27727, + 39674: 27729, + 39675: 27730, + 39676: 27731, + 39677: 27734, + 39678: 27736, + 39744: 27737, + 39745: 27738, + 39746: 27746, + 39747: 27747, + 39748: 27749, + 39749: 27750, + 39750: 27751, + 39751: 27755, + 39752: 27756, + 39753: 27757, + 39754: 27758, + 39755: 27759, + 39756: 27761, + 39757: 27763, + 39758: 27765, + 39759: 27767, + 39760: 27768, + 39761: 27770, + 39762: 27771, + 39763: 27772, + 39764: 27775, + 39765: 27776, + 39766: 27780, + 39767: 27783, + 39768: 27786, + 39769: 27787, + 39770: 27789, + 39771: 27790, + 39772: 27793, + 39773: 27794, + 39774: 27797, + 39775: 27798, + 39776: 27799, + 39777: 27800, + 39778: 27802, + 39779: 27804, + 39780: 27805, + 39781: 27806, + 39782: 27808, + 39783: 27810, + 39784: 27816, + 39785: 27820, + 39786: 27823, + 39787: 27824, + 39788: 27828, + 39789: 27829, + 39790: 27830, + 39791: 27831, + 39792: 27834, + 39793: 27840, + 39794: 27841, + 39795: 27842, + 39796: 27843, + 39797: 27846, + 39798: 27847, + 39799: 27848, + 39800: 27851, + 39801: 27853, + 39802: 27854, + 39803: 27855, + 39804: 27857, + 39805: 27858, + 39806: 27864, + 39808: 27865, + 39809: 27866, + 39810: 27868, + 39811: 27869, + 39812: 27871, + 39813: 27876, + 39814: 27878, + 39815: 27879, + 39816: 27881, + 39817: 27884, + 39818: 27885, + 39819: 27890, + 39820: 27892, + 39821: 27897, + 39822: 27903, + 39823: 27904, + 39824: 27906, + 39825: 27907, + 39826: 27909, + 39827: 27910, + 39828: 27912, + 39829: 27913, + 39830: 27914, + 39831: 27917, + 39832: 27919, + 39833: 27920, + 39834: 27921, + 39835: 27923, + 39836: 27924, + 39837: 27925, + 39838: 27926, + 39839: 27928, + 39840: 27932, + 39841: 27933, + 39842: 27935, + 39843: 27936, + 39844: 27937, + 39845: 27938, + 39846: 27939, + 39847: 27940, + 39848: 27942, + 39849: 27944, + 39850: 27945, + 39851: 27948, + 39852: 27949, + 39853: 27951, + 39854: 27952, + 39855: 27956, + 39856: 27958, + 39857: 27959, + 39858: 27960, + 39859: 27962, + 39860: 27967, + 39861: 27968, + 39862: 27970, + 39863: 27972, + 39864: 27977, + 39865: 27980, + 39866: 27984, + 39867: 27989, + 39868: 27990, + 39869: 27991, + 39870: 27992, + 39871: 27995, + 39872: 27997, + 39873: 27999, + 39874: 28001, + 39875: 28002, + 39876: 28004, + 39877: 28005, + 39878: 28007, + 39879: 28008, + 39880: 28011, + 39881: 28012, + 39882: 28013, + 39883: 28016, + 39884: 28017, + 39885: 28018, + 39886: 28019, + 39887: 28021, + 39888: 28022, + 39889: 28025, + 39890: 28026, + 39891: 28027, + 39892: 28029, + 39893: 28030, + 39894: 28031, + 39895: 28032, + 39896: 28033, + 39897: 28035, + 39898: 28036, + 39899: 28038, + 39900: 28039, + 39901: 28042, + 39902: 28043, + 39903: 28045, + 39904: 28047, + 39905: 28048, + 39906: 28050, + 39907: 28054, + 39908: 28055, + 39909: 28056, + 39910: 28057, + 39911: 28058, + 39912: 28060, + 39913: 28066, + 39914: 28069, + 39915: 28076, + 39916: 28077, + 39917: 28080, + 39918: 28081, + 39919: 28083, + 39920: 28084, + 39921: 28086, + 39922: 28087, + 39923: 28089, + 39924: 28090, + 39925: 28091, + 39926: 28092, + 39927: 28093, + 39928: 28094, + 39929: 28097, + 39930: 28098, + 39931: 28099, + 39932: 28104, + 39933: 28105, + 39934: 28106, + 40000: 28109, + 40001: 28110, + 40002: 28111, + 40003: 28112, + 40004: 28114, + 40005: 28115, + 40006: 28116, + 40007: 28117, + 40008: 28119, + 40009: 28122, + 40010: 28123, + 40011: 28124, + 40012: 28127, + 40013: 28130, + 40014: 28131, + 40015: 28133, + 40016: 28135, + 40017: 28136, + 40018: 28137, + 40019: 28138, + 40020: 28141, + 40021: 28143, + 40022: 28144, + 40023: 28146, + 40024: 28148, + 40025: 28149, + 40026: 28150, + 40027: 28152, + 40028: 28154, + 40029: 28157, + 40030: 28158, + 40031: 28159, + 40032: 28160, + 40033: 28161, + 40034: 28162, + 40035: 28163, + 40036: 28164, + 40037: 28166, + 40038: 28167, + 40039: 28168, + 40040: 28169, + 40041: 28171, + 40042: 28175, + 40043: 28178, + 40044: 28179, + 40045: 28181, + 40046: 28184, + 40047: 28185, + 40048: 28187, + 40049: 28188, + 40050: 28190, + 40051: 28191, + 40052: 28194, + 40053: 28198, + 40054: 28199, + 40055: 28200, + 40056: 28202, + 40057: 28204, + 40058: 28206, + 40059: 28208, + 40060: 28209, + 40061: 28211, + 40062: 28213, + 40064: 28214, + 40065: 28215, + 40066: 28217, + 40067: 28219, + 40068: 28220, + 40069: 28221, + 40070: 28222, + 40071: 28223, + 40072: 28224, + 40073: 28225, + 40074: 28226, + 40075: 28229, + 40076: 28230, + 40077: 28231, + 40078: 28232, + 40079: 28233, + 40080: 28234, + 40081: 28235, + 40082: 28236, + 40083: 28239, + 40084: 28240, + 40085: 28241, + 40086: 28242, + 40087: 28245, + 40088: 28247, + 40089: 28249, + 40090: 28250, + 40091: 28252, + 40092: 28253, + 40093: 28254, + 40094: 28256, + 40095: 28257, + 40096: 28258, + 40097: 28259, + 40098: 28260, + 40099: 28261, + 40100: 28262, + 40101: 28263, + 40102: 28264, + 40103: 28265, + 40104: 28266, + 40105: 28268, + 40106: 28269, + 40107: 28271, + 40108: 28272, + 40109: 28273, + 40110: 28274, + 40111: 28275, + 40112: 28276, + 40113: 28277, + 40114: 28278, + 40115: 28279, + 40116: 28280, + 40117: 28281, + 40118: 28282, + 40119: 28283, + 40120: 28284, + 40121: 28285, + 40122: 28288, + 40123: 28289, + 40124: 28290, + 40125: 28292, + 40126: 28295, + 40127: 28296, + 40128: 28298, + 40129: 28299, + 40130: 28300, + 40131: 28301, + 40132: 28302, + 40133: 28305, + 40134: 28306, + 40135: 28307, + 40136: 28308, + 40137: 28309, + 40138: 28310, + 40139: 28311, + 40140: 28313, + 40141: 28314, + 40142: 28315, + 40143: 28317, + 40144: 28318, + 40145: 28320, + 40146: 28321, + 40147: 28323, + 40148: 28324, + 40149: 28326, + 40150: 28328, + 40151: 28329, + 40152: 28331, + 40153: 28332, + 40154: 28333, + 40155: 28334, + 40156: 28336, + 40157: 28339, + 40158: 28341, + 40159: 28344, + 40160: 28345, + 40161: 28348, + 40162: 28350, + 40163: 28351, + 40164: 28352, + 40165: 28355, + 40166: 28356, + 40167: 28357, + 40168: 28358, + 40169: 28360, + 40170: 28361, + 40171: 28362, + 40172: 28364, + 40173: 28365, + 40174: 28366, + 40175: 28368, + 40176: 28370, + 40177: 28374, + 40178: 28376, + 40179: 28377, + 40180: 28379, + 40181: 28380, + 40182: 28381, + 40183: 28387, + 40184: 28391, + 40185: 28394, + 40186: 28395, + 40187: 28396, + 40188: 28397, + 40189: 28398, + 40190: 28399, + 40256: 28400, + 40257: 28401, + 40258: 28402, + 40259: 28403, + 40260: 28405, + 40261: 28406, + 40262: 28407, + 40263: 28408, + 40264: 28410, + 40265: 28411, + 40266: 28412, + 40267: 28413, + 40268: 28414, + 40269: 28415, + 40270: 28416, + 40271: 28417, + 40272: 28419, + 40273: 28420, + 40274: 28421, + 40275: 28423, + 40276: 28424, + 40277: 28426, + 40278: 28427, + 40279: 28428, + 40280: 28429, + 40281: 28430, + 40282: 28432, + 40283: 28433, + 40284: 28434, + 40285: 28438, + 40286: 28439, + 40287: 28440, + 40288: 28441, + 40289: 28442, + 40290: 28443, + 40291: 28444, + 40292: 28445, + 40293: 28446, + 40294: 28447, + 40295: 28449, + 40296: 28450, + 40297: 28451, + 40298: 28453, + 40299: 28454, + 40300: 28455, + 40301: 28456, + 40302: 28460, + 40303: 28462, + 40304: 28464, + 40305: 28466, + 40306: 28468, + 40307: 28469, + 40308: 28471, + 40309: 28472, + 40310: 28473, + 40311: 28474, + 40312: 28475, + 40313: 28476, + 40314: 28477, + 40315: 28479, + 40316: 28480, + 40317: 28481, + 40318: 28482, + 40320: 28483, + 40321: 28484, + 40322: 28485, + 40323: 28488, + 40324: 28489, + 40325: 28490, + 40326: 28492, + 40327: 28494, + 40328: 28495, + 40329: 28496, + 40330: 28497, + 40331: 28498, + 40332: 28499, + 40333: 28500, + 40334: 28501, + 40335: 28502, + 40336: 28503, + 40337: 28505, + 40338: 28506, + 40339: 28507, + 40340: 28509, + 40341: 28511, + 40342: 28512, + 40343: 28513, + 40344: 28515, + 40345: 28516, + 40346: 28517, + 40347: 28519, + 40348: 28520, + 40349: 28521, + 40350: 28522, + 40351: 28523, + 40352: 28524, + 40353: 28527, + 40354: 28528, + 40355: 28529, + 40356: 28531, + 40357: 28533, + 40358: 28534, + 40359: 28535, + 40360: 28537, + 40361: 28539, + 40362: 28541, + 40363: 28542, + 40364: 28543, + 40365: 28544, + 40366: 28545, + 40367: 28546, + 40368: 28547, + 40369: 28549, + 40370: 28550, + 40371: 28551, + 40372: 28554, + 40373: 28555, + 40374: 28559, + 40375: 28560, + 40376: 28561, + 40377: 28562, + 40378: 28563, + 40379: 28564, + 40380: 28565, + 40381: 28566, + 40382: 28567, + 40383: 28568, + 40384: 28569, + 40385: 28570, + 40386: 28571, + 40387: 28573, + 40388: 28574, + 40389: 28575, + 40390: 28576, + 40391: 28578, + 40392: 28579, + 40393: 28580, + 40394: 28581, + 40395: 28582, + 40396: 28584, + 40397: 28585, + 40398: 28586, + 40399: 28587, + 40400: 28588, + 40401: 28589, + 40402: 28590, + 40403: 28591, + 40404: 28592, + 40405: 28593, + 40406: 28594, + 40407: 28596, + 40408: 28597, + 40409: 28599, + 40410: 28600, + 40411: 28602, + 40412: 28603, + 40413: 28604, + 40414: 28605, + 40415: 28606, + 40416: 28607, + 40417: 28609, + 40418: 28611, + 40419: 28612, + 40420: 28613, + 40421: 28614, + 40422: 28615, + 40423: 28616, + 40424: 28618, + 40425: 28619, + 40426: 28620, + 40427: 28621, + 40428: 28622, + 40429: 28623, + 40430: 28624, + 40431: 28627, + 40432: 28628, + 40433: 28629, + 40434: 28630, + 40435: 28631, + 40436: 28632, + 40437: 28633, + 40438: 28634, + 40439: 28635, + 40440: 28636, + 40441: 28637, + 40442: 28639, + 40443: 28642, + 40444: 28643, + 40445: 28644, + 40446: 28645, + 40512: 28646, + 40513: 28647, + 40514: 28648, + 40515: 28649, + 40516: 28650, + 40517: 28651, + 40518: 28652, + 40519: 28653, + 40520: 28656, + 40521: 28657, + 40522: 28658, + 40523: 28659, + 40524: 28660, + 40525: 28661, + 40526: 28662, + 40527: 28663, + 40528: 28664, + 40529: 28665, + 40530: 28666, + 40531: 28667, + 40532: 28668, + 40533: 28669, + 40534: 28670, + 40535: 28671, + 40536: 28672, + 40537: 28673, + 40538: 28674, + 40539: 28675, + 40540: 28676, + 40541: 28677, + 40542: 28678, + 40543: 28679, + 40544: 28680, + 40545: 28681, + 40546: 28682, + 40547: 28683, + 40548: 28684, + 40549: 28685, + 40550: 28686, + 40551: 28687, + 40552: 28688, + 40553: 28690, + 40554: 28691, + 40555: 28692, + 40556: 28693, + 40557: 28694, + 40558: 28695, + 40559: 28696, + 40560: 28697, + 40561: 28700, + 40562: 28701, + 40563: 28702, + 40564: 28703, + 40565: 28704, + 40566: 28705, + 40567: 28706, + 40568: 28708, + 40569: 28709, + 40570: 28710, + 40571: 28711, + 40572: 28712, + 40573: 28713, + 40574: 28714, + 40576: 28715, + 40577: 28716, + 40578: 28717, + 40579: 28718, + 40580: 28719, + 40581: 28720, + 40582: 28721, + 40583: 28722, + 40584: 28723, + 40585: 28724, + 40586: 28726, + 40587: 28727, + 40588: 28728, + 40589: 28730, + 40590: 28731, + 40591: 28732, + 40592: 28733, + 40593: 28734, + 40594: 28735, + 40595: 28736, + 40596: 28737, + 40597: 28738, + 40598: 28739, + 40599: 28740, + 40600: 28741, + 40601: 28742, + 40602: 28743, + 40603: 28744, + 40604: 28745, + 40605: 28746, + 40606: 28747, + 40607: 28749, + 40608: 28750, + 40609: 28752, + 40610: 28753, + 40611: 28754, + 40612: 28755, + 40613: 28756, + 40614: 28757, + 40615: 28758, + 40616: 28759, + 40617: 28760, + 40618: 28761, + 40619: 28762, + 40620: 28763, + 40621: 28764, + 40622: 28765, + 40623: 28767, + 40624: 28768, + 40625: 28769, + 40626: 28770, + 40627: 28771, + 40628: 28772, + 40629: 28773, + 40630: 28774, + 40631: 28775, + 40632: 28776, + 40633: 28777, + 40634: 28778, + 40635: 28782, + 40636: 28785, + 40637: 28786, + 40638: 28787, + 40639: 28788, + 40640: 28791, + 40641: 28793, + 40642: 28794, + 40643: 28795, + 40644: 28797, + 40645: 28801, + 40646: 28802, + 40647: 28803, + 40648: 28804, + 40649: 28806, + 40650: 28807, + 40651: 28808, + 40652: 28811, + 40653: 28812, + 40654: 28813, + 40655: 28815, + 40656: 28816, + 40657: 28817, + 40658: 28819, + 40659: 28823, + 40660: 28824, + 40661: 28826, + 40662: 28827, + 40663: 28830, + 40664: 28831, + 40665: 28832, + 40666: 28833, + 40667: 28834, + 40668: 28835, + 40669: 28836, + 40670: 28837, + 40671: 28838, + 40672: 28839, + 40673: 28840, + 40674: 28841, + 40675: 28842, + 40676: 28848, + 40677: 28850, + 40678: 28852, + 40679: 28853, + 40680: 28854, + 40681: 28858, + 40682: 28862, + 40683: 28863, + 40684: 28868, + 40685: 28869, + 40686: 28870, + 40687: 28871, + 40688: 28873, + 40689: 28875, + 40690: 28876, + 40691: 28877, + 40692: 28878, + 40693: 28879, + 40694: 28880, + 40695: 28881, + 40696: 28882, + 40697: 28883, + 40698: 28884, + 40699: 28885, + 40700: 28886, + 40701: 28887, + 40702: 28890, + 40768: 28892, + 40769: 28893, + 40770: 28894, + 40771: 28896, + 40772: 28897, + 40773: 28898, + 40774: 28899, + 40775: 28901, + 40776: 28906, + 40777: 28910, + 40778: 28912, + 40779: 28913, + 40780: 28914, + 40781: 28915, + 40782: 28916, + 40783: 28917, + 40784: 28918, + 40785: 28920, + 40786: 28922, + 40787: 28923, + 40788: 28924, + 40789: 28926, + 40790: 28927, + 40791: 28928, + 40792: 28929, + 40793: 28930, + 40794: 28931, + 40795: 28932, + 40796: 28933, + 40797: 28934, + 40798: 28935, + 40799: 28936, + 40800: 28939, + 40801: 28940, + 40802: 28941, + 40803: 28942, + 40804: 28943, + 40805: 28945, + 40806: 28946, + 40807: 28948, + 40808: 28951, + 40809: 28955, + 40810: 28956, + 40811: 28957, + 40812: 28958, + 40813: 28959, + 40814: 28960, + 40815: 28961, + 40816: 28962, + 40817: 28963, + 40818: 28964, + 40819: 28965, + 40820: 28967, + 40821: 28968, + 40822: 28969, + 40823: 28970, + 40824: 28971, + 40825: 28972, + 40826: 28973, + 40827: 28974, + 40828: 28978, + 40829: 28979, + 40830: 28980, + 40832: 28981, + 40833: 28983, + 40834: 28984, + 40835: 28985, + 40836: 28986, + 40837: 28987, + 40838: 28988, + 40839: 28989, + 40840: 28990, + 40841: 28991, + 40842: 28992, + 40843: 28993, + 40844: 28994, + 40845: 28995, + 40846: 28996, + 40847: 28998, + 40848: 28999, + 40849: 29000, + 40850: 29001, + 40851: 29003, + 40852: 29005, + 40853: 29007, + 40854: 29008, + 40855: 29009, + 40856: 29010, + 40857: 29011, + 40858: 29012, + 40859: 29013, + 40860: 29014, + 40861: 29015, + 40862: 29016, + 40863: 29017, + 40864: 29018, + 40865: 29019, + 40866: 29021, + 40867: 29023, + 40868: 29024, + 40869: 29025, + 40870: 29026, + 40871: 29027, + 40872: 29029, + 40873: 29033, + 40874: 29034, + 40875: 29035, + 40876: 29036, + 40877: 29037, + 40878: 29039, + 40879: 29040, + 40880: 29041, + 40881: 29044, + 40882: 29045, + 40883: 29046, + 40884: 29047, + 40885: 29049, + 40886: 29051, + 40887: 29052, + 40888: 29054, + 40889: 29055, + 40890: 29056, + 40891: 29057, + 40892: 29058, + 40893: 29059, + 40894: 29061, + 40895: 29062, + 40896: 29063, + 40897: 29064, + 40898: 29065, + 40899: 29067, + 40900: 29068, + 40901: 29069, + 40902: 29070, + 40903: 29072, + 40904: 29073, + 40905: 29074, + 40906: 29075, + 40907: 29077, + 40908: 29078, + 40909: 29079, + 40910: 29082, + 40911: 29083, + 40912: 29084, + 40913: 29085, + 40914: 29086, + 40915: 29089, + 40916: 29090, + 40917: 29091, + 40918: 29092, + 40919: 29093, + 40920: 29094, + 40921: 29095, + 40922: 29097, + 40923: 29098, + 40924: 29099, + 40925: 29101, + 40926: 29102, + 40927: 29103, + 40928: 29104, + 40929: 29105, + 40930: 29106, + 40931: 29108, + 40932: 29110, + 40933: 29111, + 40934: 29112, + 40935: 29114, + 40936: 29115, + 40937: 29116, + 40938: 29117, + 40939: 29118, + 40940: 29119, + 40941: 29120, + 40942: 29121, + 40943: 29122, + 40944: 29124, + 40945: 29125, + 40946: 29126, + 40947: 29127, + 40948: 29128, + 40949: 29129, + 40950: 29130, + 40951: 29131, + 40952: 29132, + 40953: 29133, + 40954: 29135, + 40955: 29136, + 40956: 29137, + 40957: 29138, + 40958: 29139, + 41024: 29142, + 41025: 29143, + 41026: 29144, + 41027: 29145, + 41028: 29146, + 41029: 29147, + 41030: 29148, + 41031: 29149, + 41032: 29150, + 41033: 29151, + 41034: 29153, + 41035: 29154, + 41036: 29155, + 41037: 29156, + 41038: 29158, + 41039: 29160, + 41040: 29161, + 41041: 29162, + 41042: 29163, + 41043: 29164, + 41044: 29165, + 41045: 29167, + 41046: 29168, + 41047: 29169, + 41048: 29170, + 41049: 29171, + 41050: 29172, + 41051: 29173, + 41052: 29174, + 41053: 29175, + 41054: 29176, + 41055: 29178, + 41056: 29179, + 41057: 29180, + 41058: 29181, + 41059: 29182, + 41060: 29183, + 41061: 29184, + 41062: 29185, + 41063: 29186, + 41064: 29187, + 41065: 29188, + 41066: 29189, + 41067: 29191, + 41068: 29192, + 41069: 29193, + 41070: 29194, + 41071: 29195, + 41072: 29196, + 41073: 29197, + 41074: 29198, + 41075: 29199, + 41076: 29200, + 41077: 29201, + 41078: 29202, + 41079: 29203, + 41080: 29204, + 41081: 29205, + 41082: 29206, + 41083: 29207, + 41084: 29208, + 41085: 29209, + 41086: 29210, + 41088: 29211, + 41089: 29212, + 41090: 29214, + 41091: 29215, + 41092: 29216, + 41093: 29217, + 41094: 29218, + 41095: 29219, + 41096: 29220, + 41097: 29221, + 41098: 29222, + 41099: 29223, + 41100: 29225, + 41101: 29227, + 41102: 29229, + 41103: 29230, + 41104: 29231, + 41105: 29234, + 41106: 29235, + 41107: 29236, + 41108: 29242, + 41109: 29244, + 41110: 29246, + 41111: 29248, + 41112: 29249, + 41113: 29250, + 41114: 29251, + 41115: 29252, + 41116: 29253, + 41117: 29254, + 41118: 29257, + 41119: 29258, + 41120: 29259, + 41121: 29262, + 41122: 29263, + 41123: 29264, + 41124: 29265, + 41125: 29267, + 41126: 29268, + 41127: 29269, + 41128: 29271, + 41129: 29272, + 41130: 29274, + 41131: 29276, + 41132: 29278, + 41133: 29280, + 41134: 29283, + 41135: 29284, + 41136: 29285, + 41137: 29288, + 41138: 29290, + 41139: 29291, + 41140: 29292, + 41141: 29293, + 41142: 29296, + 41143: 29297, + 41144: 29299, + 41145: 29300, + 41146: 29302, + 41147: 29303, + 41148: 29304, + 41149: 29307, + 41150: 29308, + 41151: 29309, + 41152: 29314, + 41153: 29315, + 41154: 29317, + 41155: 29318, + 41156: 29319, + 41157: 29320, + 41158: 29321, + 41159: 29324, + 41160: 29326, + 41161: 29328, + 41162: 29329, + 41163: 29331, + 41164: 29332, + 41165: 29333, + 41166: 29334, + 41167: 29335, + 41168: 29336, + 41169: 29337, + 41170: 29338, + 41171: 29339, + 41172: 29340, + 41173: 29341, + 41174: 29342, + 41175: 29344, + 41176: 29345, + 41177: 29346, + 41178: 29347, + 41179: 29348, + 41180: 29349, + 41181: 29350, + 41182: 29351, + 41183: 29352, + 41184: 29353, + 41185: 29354, + 41186: 29355, + 41187: 29358, + 41188: 29361, + 41189: 29362, + 41190: 29363, + 41191: 29365, + 41192: 29370, + 41193: 29371, + 41194: 29372, + 41195: 29373, + 41196: 29374, + 41197: 29375, + 41198: 29376, + 41199: 29381, + 41200: 29382, + 41201: 29383, + 41202: 29385, + 41203: 29386, + 41204: 29387, + 41205: 29388, + 41206: 29391, + 41207: 29393, + 41208: 29395, + 41209: 29396, + 41210: 29397, + 41211: 29398, + 41212: 29400, + 41213: 29402, + 41214: 29403, + 41280: 58566, + 41281: 58567, + 41282: 58568, + 41283: 58569, + 41284: 58570, + 41285: 58571, + 41286: 58572, + 41287: 58573, + 41288: 58574, + 41289: 58575, + 41290: 58576, + 41291: 58577, + 41292: 58578, + 41293: 58579, + 41294: 58580, + 41295: 58581, + 41296: 58582, + 41297: 58583, + 41298: 58584, + 41299: 58585, + 41300: 58586, + 41301: 58587, + 41302: 58588, + 41303: 58589, + 41304: 58590, + 41305: 58591, + 41306: 58592, + 41307: 58593, + 41308: 58594, + 41309: 58595, + 41310: 58596, + 41311: 58597, + 41312: 58598, + 41313: 58599, + 41314: 58600, + 41315: 58601, + 41316: 58602, + 41317: 58603, + 41318: 58604, + 41319: 58605, + 41320: 58606, + 41321: 58607, + 41322: 58608, + 41323: 58609, + 41324: 58610, + 41325: 58611, + 41326: 58612, + 41327: 58613, + 41328: 58614, + 41329: 58615, + 41330: 58616, + 41331: 58617, + 41332: 58618, + 41333: 58619, + 41334: 58620, + 41335: 58621, + 41336: 58622, + 41337: 58623, + 41338: 58624, + 41339: 58625, + 41340: 58626, + 41341: 58627, + 41342: 58628, + 41344: 58629, + 41345: 58630, + 41346: 58631, + 41347: 58632, + 41348: 58633, + 41349: 58634, + 41350: 58635, + 41351: 58636, + 41352: 58637, + 41353: 58638, + 41354: 58639, + 41355: 58640, + 41356: 58641, + 41357: 58642, + 41358: 58643, + 41359: 58644, + 41360: 58645, + 41361: 58646, + 41362: 58647, + 41363: 58648, + 41364: 58649, + 41365: 58650, + 41366: 58651, + 41367: 58652, + 41368: 58653, + 41369: 58654, + 41370: 58655, + 41371: 58656, + 41372: 58657, + 41373: 58658, + 41374: 58659, + 41375: 58660, + 41376: 58661, + 41377: 12288, + 41378: 12289, + 41379: 12290, + 41380: 183, + 41381: 713, + 41382: 711, + 41383: 168, + 41384: 12291, + 41385: 12293, + 41386: 8212, + 41387: 65374, + 41388: 8214, + 41389: 8230, + 41390: 8216, + 41391: 8217, + 41392: 8220, + 41393: 8221, + 41394: 12308, + 41395: 12309, + 41396: 12296, + 41397: 12297, + 41398: 12298, + 41399: 12299, + 41400: 12300, + 41401: 12301, + 41402: 12302, + 41403: 12303, + 41404: 12310, + 41405: 12311, + 41406: 12304, + 41407: 12305, + 41408: 177, + 41409: 215, + 41410: 247, + 41411: 8758, + 41412: 8743, + 41413: 8744, + 41414: 8721, + 41415: 8719, + 41416: 8746, + 41417: 8745, + 41418: 8712, + 41419: 8759, + 41420: 8730, + 41421: 8869, + 41422: 8741, + 41423: 8736, + 41424: 8978, + 41425: 8857, + 41426: 8747, + 41427: 8750, + 41428: 8801, + 41429: 8780, + 41430: 8776, + 41431: 8765, + 41432: 8733, + 41433: 8800, + 41434: 8814, + 41435: 8815, + 41436: 8804, + 41437: 8805, + 41438: 8734, + 41439: 8757, + 41440: 8756, + 41441: 9794, + 41442: 9792, + 41443: 176, + 41444: 8242, + 41445: 8243, + 41446: 8451, + 41447: 65284, + 41448: 164, + 41449: 65504, + 41450: 65505, + 41451: 8240, + 41452: 167, + 41453: 8470, + 41454: 9734, + 41455: 9733, + 41456: 9675, + 41457: 9679, + 41458: 9678, + 41459: 9671, + 41460: 9670, + 41461: 9633, + 41462: 9632, + 41463: 9651, + 41464: 9650, + 41465: 8251, + 41466: 8594, + 41467: 8592, + 41468: 8593, + 41469: 8595, + 41470: 12307, + 41536: 58662, + 41537: 58663, + 41538: 58664, + 41539: 58665, + 41540: 58666, + 41541: 58667, + 41542: 58668, + 41543: 58669, + 41544: 58670, + 41545: 58671, + 41546: 58672, + 41547: 58673, + 41548: 58674, + 41549: 58675, + 41550: 58676, + 41551: 58677, + 41552: 58678, + 41553: 58679, + 41554: 58680, + 41555: 58681, + 41556: 58682, + 41557: 58683, + 41558: 58684, + 41559: 58685, + 41560: 58686, + 41561: 58687, + 41562: 58688, + 41563: 58689, + 41564: 58690, + 41565: 58691, + 41566: 58692, + 41567: 58693, + 41568: 58694, + 41569: 58695, + 41570: 58696, + 41571: 58697, + 41572: 58698, + 41573: 58699, + 41574: 58700, + 41575: 58701, + 41576: 58702, + 41577: 58703, + 41578: 58704, + 41579: 58705, + 41580: 58706, + 41581: 58707, + 41582: 58708, + 41583: 58709, + 41584: 58710, + 41585: 58711, + 41586: 58712, + 41587: 58713, + 41588: 58714, + 41589: 58715, + 41590: 58716, + 41591: 58717, + 41592: 58718, + 41593: 58719, + 41594: 58720, + 41595: 58721, + 41596: 58722, + 41597: 58723, + 41598: 58724, + 41600: 58725, + 41601: 58726, + 41602: 58727, + 41603: 58728, + 41604: 58729, + 41605: 58730, + 41606: 58731, + 41607: 58732, + 41608: 58733, + 41609: 58734, + 41610: 58735, + 41611: 58736, + 41612: 58737, + 41613: 58738, + 41614: 58739, + 41615: 58740, + 41616: 58741, + 41617: 58742, + 41618: 58743, + 41619: 58744, + 41620: 58745, + 41621: 58746, + 41622: 58747, + 41623: 58748, + 41624: 58749, + 41625: 58750, + 41626: 58751, + 41627: 58752, + 41628: 58753, + 41629: 58754, + 41630: 58755, + 41631: 58756, + 41632: 58757, + 41633: 8560, + 41634: 8561, + 41635: 8562, + 41636: 8563, + 41637: 8564, + 41638: 8565, + 41639: 8566, + 41640: 8567, + 41641: 8568, + 41642: 8569, + 41643: 59238, + 41644: 59239, + 41645: 59240, + 41646: 59241, + 41647: 59242, + 41648: 59243, + 41649: 9352, + 41650: 9353, + 41651: 9354, + 41652: 9355, + 41653: 9356, + 41654: 9357, + 41655: 9358, + 41656: 9359, + 41657: 9360, + 41658: 9361, + 41659: 9362, + 41660: 9363, + 41661: 9364, + 41662: 9365, + 41663: 9366, + 41664: 9367, + 41665: 9368, + 41666: 9369, + 41667: 9370, + 41668: 9371, + 41669: 9332, + 41670: 9333, + 41671: 9334, + 41672: 9335, + 41673: 9336, + 41674: 9337, + 41675: 9338, + 41676: 9339, + 41677: 9340, + 41678: 9341, + 41679: 9342, + 41680: 9343, + 41681: 9344, + 41682: 9345, + 41683: 9346, + 41684: 9347, + 41685: 9348, + 41686: 9349, + 41687: 9350, + 41688: 9351, + 41689: 9312, + 41690: 9313, + 41691: 9314, + 41692: 9315, + 41693: 9316, + 41694: 9317, + 41695: 9318, + 41696: 9319, + 41697: 9320, + 41698: 9321, + 41699: 8364, + 41700: 59245, + 41701: 12832, + 41702: 12833, + 41703: 12834, + 41704: 12835, + 41705: 12836, + 41706: 12837, + 41707: 12838, + 41708: 12839, + 41709: 12840, + 41710: 12841, + 41711: 59246, + 41712: 59247, + 41713: 8544, + 41714: 8545, + 41715: 8546, + 41716: 8547, + 41717: 8548, + 41718: 8549, + 41719: 8550, + 41720: 8551, + 41721: 8552, + 41722: 8553, + 41723: 8554, + 41724: 8555, + 41725: 59248, + 41726: 59249, + 41792: 58758, + 41793: 58759, + 41794: 58760, + 41795: 58761, + 41796: 58762, + 41797: 58763, + 41798: 58764, + 41799: 58765, + 41800: 58766, + 41801: 58767, + 41802: 58768, + 41803: 58769, + 41804: 58770, + 41805: 58771, + 41806: 58772, + 41807: 58773, + 41808: 58774, + 41809: 58775, + 41810: 58776, + 41811: 58777, + 41812: 58778, + 41813: 58779, + 41814: 58780, + 41815: 58781, + 41816: 58782, + 41817: 58783, + 41818: 58784, + 41819: 58785, + 41820: 58786, + 41821: 58787, + 41822: 58788, + 41823: 58789, + 41824: 58790, + 41825: 58791, + 41826: 58792, + 41827: 58793, + 41828: 58794, + 41829: 58795, + 41830: 58796, + 41831: 58797, + 41832: 58798, + 41833: 58799, + 41834: 58800, + 41835: 58801, + 41836: 58802, + 41837: 58803, + 41838: 58804, + 41839: 58805, + 41840: 58806, + 41841: 58807, + 41842: 58808, + 41843: 58809, + 41844: 58810, + 41845: 58811, + 41846: 58812, + 41847: 58813, + 41848: 58814, + 41849: 58815, + 41850: 58816, + 41851: 58817, + 41852: 58818, + 41853: 58819, + 41854: 58820, + 41856: 58821, + 41857: 58822, + 41858: 58823, + 41859: 58824, + 41860: 58825, + 41861: 58826, + 41862: 58827, + 41863: 58828, + 41864: 58829, + 41865: 58830, + 41866: 58831, + 41867: 58832, + 41868: 58833, + 41869: 58834, + 41870: 58835, + 41871: 58836, + 41872: 58837, + 41873: 58838, + 41874: 58839, + 41875: 58840, + 41876: 58841, + 41877: 58842, + 41878: 58843, + 41879: 58844, + 41880: 58845, + 41881: 58846, + 41882: 58847, + 41883: 58848, + 41884: 58849, + 41885: 58850, + 41886: 58851, + 41887: 58852, + 41888: 58853, + 41889: 65281, + 41890: 65282, + 41891: 65283, + 41892: 65509, + 41893: 65285, + 41894: 65286, + 41895: 65287, + 41896: 65288, + 41897: 65289, + 41898: 65290, + 41899: 65291, + 41900: 65292, + 41901: 65293, + 41902: 65294, + 41903: 65295, + 41904: 65296, + 41905: 65297, + 41906: 65298, + 41907: 65299, + 41908: 65300, + 41909: 65301, + 41910: 65302, + 41911: 65303, + 41912: 65304, + 41913: 65305, + 41914: 65306, + 41915: 65307, + 41916: 65308, + 41917: 65309, + 41918: 65310, + 41919: 65311, + 41920: 65312, + 41921: 65313, + 41922: 65314, + 41923: 65315, + 41924: 65316, + 41925: 65317, + 41926: 65318, + 41927: 65319, + 41928: 65320, + 41929: 65321, + 41930: 65322, + 41931: 65323, + 41932: 65324, + 41933: 65325, + 41934: 65326, + 41935: 65327, + 41936: 65328, + 41937: 65329, + 41938: 65330, + 41939: 65331, + 41940: 65332, + 41941: 65333, + 41942: 65334, + 41943: 65335, + 41944: 65336, + 41945: 65337, + 41946: 65338, + 41947: 65339, + 41948: 65340, + 41949: 65341, + 41950: 65342, + 41951: 65343, + 41952: 65344, + 41953: 65345, + 41954: 65346, + 41955: 65347, + 41956: 65348, + 41957: 65349, + 41958: 65350, + 41959: 65351, + 41960: 65352, + 41961: 65353, + 41962: 65354, + 41963: 65355, + 41964: 65356, + 41965: 65357, + 41966: 65358, + 41967: 65359, + 41968: 65360, + 41969: 65361, + 41970: 65362, + 41971: 65363, + 41972: 65364, + 41973: 65365, + 41974: 65366, + 41975: 65367, + 41976: 65368, + 41977: 65369, + 41978: 65370, + 41979: 65371, + 41980: 65372, + 41981: 65373, + 41982: 65507, + 42048: 58854, + 42049: 58855, + 42050: 58856, + 42051: 58857, + 42052: 58858, + 42053: 58859, + 42054: 58860, + 42055: 58861, + 42056: 58862, + 42057: 58863, + 42058: 58864, + 42059: 58865, + 42060: 58866, + 42061: 58867, + 42062: 58868, + 42063: 58869, + 42064: 58870, + 42065: 58871, + 42066: 58872, + 42067: 58873, + 42068: 58874, + 42069: 58875, + 42070: 58876, + 42071: 58877, + 42072: 58878, + 42073: 58879, + 42074: 58880, + 42075: 58881, + 42076: 58882, + 42077: 58883, + 42078: 58884, + 42079: 58885, + 42080: 58886, + 42081: 58887, + 42082: 58888, + 42083: 58889, + 42084: 58890, + 42085: 58891, + 42086: 58892, + 42087: 58893, + 42088: 58894, + 42089: 58895, + 42090: 58896, + 42091: 58897, + 42092: 58898, + 42093: 58899, + 42094: 58900, + 42095: 58901, + 42096: 58902, + 42097: 58903, + 42098: 58904, + 42099: 58905, + 42100: 58906, + 42101: 58907, + 42102: 58908, + 42103: 58909, + 42104: 58910, + 42105: 58911, + 42106: 58912, + 42107: 58913, + 42108: 58914, + 42109: 58915, + 42110: 58916, + 42112: 58917, + 42113: 58918, + 42114: 58919, + 42115: 58920, + 42116: 58921, + 42117: 58922, + 42118: 58923, + 42119: 58924, + 42120: 58925, + 42121: 58926, + 42122: 58927, + 42123: 58928, + 42124: 58929, + 42125: 58930, + 42126: 58931, + 42127: 58932, + 42128: 58933, + 42129: 58934, + 42130: 58935, + 42131: 58936, + 42132: 58937, + 42133: 58938, + 42134: 58939, + 42135: 58940, + 42136: 58941, + 42137: 58942, + 42138: 58943, + 42139: 58944, + 42140: 58945, + 42141: 58946, + 42142: 58947, + 42143: 58948, + 42144: 58949, + 42145: 12353, + 42146: 12354, + 42147: 12355, + 42148: 12356, + 42149: 12357, + 42150: 12358, + 42151: 12359, + 42152: 12360, + 42153: 12361, + 42154: 12362, + 42155: 12363, + 42156: 12364, + 42157: 12365, + 42158: 12366, + 42159: 12367, + 42160: 12368, + 42161: 12369, + 42162: 12370, + 42163: 12371, + 42164: 12372, + 42165: 12373, + 42166: 12374, + 42167: 12375, + 42168: 12376, + 42169: 12377, + 42170: 12378, + 42171: 12379, + 42172: 12380, + 42173: 12381, + 42174: 12382, + 42175: 12383, + 42176: 12384, + 42177: 12385, + 42178: 12386, + 42179: 12387, + 42180: 12388, + 42181: 12389, + 42182: 12390, + 42183: 12391, + 42184: 12392, + 42185: 12393, + 42186: 12394, + 42187: 12395, + 42188: 12396, + 42189: 12397, + 42190: 12398, + 42191: 12399, + 42192: 12400, + 42193: 12401, + 42194: 12402, + 42195: 12403, + 42196: 12404, + 42197: 12405, + 42198: 12406, + 42199: 12407, + 42200: 12408, + 42201: 12409, + 42202: 12410, + 42203: 12411, + 42204: 12412, + 42205: 12413, + 42206: 12414, + 42207: 12415, + 42208: 12416, + 42209: 12417, + 42210: 12418, + 42211: 12419, + 42212: 12420, + 42213: 12421, + 42214: 12422, + 42215: 12423, + 42216: 12424, + 42217: 12425, + 42218: 12426, + 42219: 12427, + 42220: 12428, + 42221: 12429, + 42222: 12430, + 42223: 12431, + 42224: 12432, + 42225: 12433, + 42226: 12434, + 42227: 12435, + 42228: 59250, + 42229: 59251, + 42230: 59252, + 42231: 59253, + 42232: 59254, + 42233: 59255, + 42234: 59256, + 42235: 59257, + 42236: 59258, + 42237: 59259, + 42238: 59260, + 42304: 58950, + 42305: 58951, + 42306: 58952, + 42307: 58953, + 42308: 58954, + 42309: 58955, + 42310: 58956, + 42311: 58957, + 42312: 58958, + 42313: 58959, + 42314: 58960, + 42315: 58961, + 42316: 58962, + 42317: 58963, + 42318: 58964, + 42319: 58965, + 42320: 58966, + 42321: 58967, + 42322: 58968, + 42323: 58969, + 42324: 58970, + 42325: 58971, + 42326: 58972, + 42327: 58973, + 42328: 58974, + 42329: 58975, + 42330: 58976, + 42331: 58977, + 42332: 58978, + 42333: 58979, + 42334: 58980, + 42335: 58981, + 42336: 58982, + 42337: 58983, + 42338: 58984, + 42339: 58985, + 42340: 58986, + 42341: 58987, + 42342: 58988, + 42343: 58989, + 42344: 58990, + 42345: 58991, + 42346: 58992, + 42347: 58993, + 42348: 58994, + 42349: 58995, + 42350: 58996, + 42351: 58997, + 42352: 58998, + 42353: 58999, + 42354: 59000, + 42355: 59001, + 42356: 59002, + 42357: 59003, + 42358: 59004, + 42359: 59005, + 42360: 59006, + 42361: 59007, + 42362: 59008, + 42363: 59009, + 42364: 59010, + 42365: 59011, + 42366: 59012, + 42368: 59013, + 42369: 59014, + 42370: 59015, + 42371: 59016, + 42372: 59017, + 42373: 59018, + 42374: 59019, + 42375: 59020, + 42376: 59021, + 42377: 59022, + 42378: 59023, + 42379: 59024, + 42380: 59025, + 42381: 59026, + 42382: 59027, + 42383: 59028, + 42384: 59029, + 42385: 59030, + 42386: 59031, + 42387: 59032, + 42388: 59033, + 42389: 59034, + 42390: 59035, + 42391: 59036, + 42392: 59037, + 42393: 59038, + 42394: 59039, + 42395: 59040, + 42396: 59041, + 42397: 59042, + 42398: 59043, + 42399: 59044, + 42400: 59045, + 42401: 12449, + 42402: 12450, + 42403: 12451, + 42404: 12452, + 42405: 12453, + 42406: 12454, + 42407: 12455, + 42408: 12456, + 42409: 12457, + 42410: 12458, + 42411: 12459, + 42412: 12460, + 42413: 12461, + 42414: 12462, + 42415: 12463, + 42416: 12464, + 42417: 12465, + 42418: 12466, + 42419: 12467, + 42420: 12468, + 42421: 12469, + 42422: 12470, + 42423: 12471, + 42424: 12472, + 42425: 12473, + 42426: 12474, + 42427: 12475, + 42428: 12476, + 42429: 12477, + 42430: 12478, + 42431: 12479, + 42432: 12480, + 42433: 12481, + 42434: 12482, + 42435: 12483, + 42436: 12484, + 42437: 12485, + 42438: 12486, + 42439: 12487, + 42440: 12488, + 42441: 12489, + 42442: 12490, + 42443: 12491, + 42444: 12492, + 42445: 12493, + 42446: 12494, + 42447: 12495, + 42448: 12496, + 42449: 12497, + 42450: 12498, + 42451: 12499, + 42452: 12500, + 42453: 12501, + 42454: 12502, + 42455: 12503, + 42456: 12504, + 42457: 12505, + 42458: 12506, + 42459: 12507, + 42460: 12508, + 42461: 12509, + 42462: 12510, + 42463: 12511, + 42464: 12512, + 42465: 12513, + 42466: 12514, + 42467: 12515, + 42468: 12516, + 42469: 12517, + 42470: 12518, + 42471: 12519, + 42472: 12520, + 42473: 12521, + 42474: 12522, + 42475: 12523, + 42476: 12524, + 42477: 12525, + 42478: 12526, + 42479: 12527, + 42480: 12528, + 42481: 12529, + 42482: 12530, + 42483: 12531, + 42484: 12532, + 42485: 12533, + 42486: 12534, + 42487: 59261, + 42488: 59262, + 42489: 59263, + 42490: 59264, + 42491: 59265, + 42492: 59266, + 42493: 59267, + 42494: 59268, + 42560: 59046, + 42561: 59047, + 42562: 59048, + 42563: 59049, + 42564: 59050, + 42565: 59051, + 42566: 59052, + 42567: 59053, + 42568: 59054, + 42569: 59055, + 42570: 59056, + 42571: 59057, + 42572: 59058, + 42573: 59059, + 42574: 59060, + 42575: 59061, + 42576: 59062, + 42577: 59063, + 42578: 59064, + 42579: 59065, + 42580: 59066, + 42581: 59067, + 42582: 59068, + 42583: 59069, + 42584: 59070, + 42585: 59071, + 42586: 59072, + 42587: 59073, + 42588: 59074, + 42589: 59075, + 42590: 59076, + 42591: 59077, + 42592: 59078, + 42593: 59079, + 42594: 59080, + 42595: 59081, + 42596: 59082, + 42597: 59083, + 42598: 59084, + 42599: 59085, + 42600: 59086, + 42601: 59087, + 42602: 59088, + 42603: 59089, + 42604: 59090, + 42605: 59091, + 42606: 59092, + 42607: 59093, + 42608: 59094, + 42609: 59095, + 42610: 59096, + 42611: 59097, + 42612: 59098, + 42613: 59099, + 42614: 59100, + 42615: 59101, + 42616: 59102, + 42617: 59103, + 42618: 59104, + 42619: 59105, + 42620: 59106, + 42621: 59107, + 42622: 59108, + 42624: 59109, + 42625: 59110, + 42626: 59111, + 42627: 59112, + 42628: 59113, + 42629: 59114, + 42630: 59115, + 42631: 59116, + 42632: 59117, + 42633: 59118, + 42634: 59119, + 42635: 59120, + 42636: 59121, + 42637: 59122, + 42638: 59123, + 42639: 59124, + 42640: 59125, + 42641: 59126, + 42642: 59127, + 42643: 59128, + 42644: 59129, + 42645: 59130, + 42646: 59131, + 42647: 59132, + 42648: 59133, + 42649: 59134, + 42650: 59135, + 42651: 59136, + 42652: 59137, + 42653: 59138, + 42654: 59139, + 42655: 59140, + 42656: 59141, + 42657: 913, + 42658: 914, + 42659: 915, + 42660: 916, + 42661: 917, + 42662: 918, + 42663: 919, + 42664: 920, + 42665: 921, + 42666: 922, + 42667: 923, + 42668: 924, + 42669: 925, + 42670: 926, + 42671: 927, + 42672: 928, + 42673: 929, + 42674: 931, + 42675: 932, + 42676: 933, + 42677: 934, + 42678: 935, + 42679: 936, + 42680: 937, + 42681: 59269, + 42682: 59270, + 42683: 59271, + 42684: 59272, + 42685: 59273, + 42686: 59274, + 42687: 59275, + 42688: 59276, + 42689: 945, + 42690: 946, + 42691: 947, + 42692: 948, + 42693: 949, + 42694: 950, + 42695: 951, + 42696: 952, + 42697: 953, + 42698: 954, + 42699: 955, + 42700: 956, + 42701: 957, + 42702: 958, + 42703: 959, + 42704: 960, + 42705: 961, + 42706: 963, + 42707: 964, + 42708: 965, + 42709: 966, + 42710: 967, + 42711: 968, + 42712: 969, + 42713: 59277, + 42714: 59278, + 42715: 59279, + 42716: 59280, + 42717: 59281, + 42718: 59282, + 42719: 59283, + 42720: 65077, + 42721: 65078, + 42722: 65081, + 42723: 65082, + 42724: 65087, + 42725: 65088, + 42726: 65085, + 42727: 65086, + 42728: 65089, + 42729: 65090, + 42730: 65091, + 42731: 65092, + 42732: 59284, + 42733: 59285, + 42734: 65083, + 42735: 65084, + 42736: 65079, + 42737: 65080, + 42738: 65073, + 42739: 59286, + 42740: 65075, + 42741: 65076, + 42742: 59287, + 42743: 59288, + 42744: 59289, + 42745: 59290, + 42746: 59291, + 42747: 59292, + 42748: 59293, + 42749: 59294, + 42750: 59295, + 42816: 59142, + 42817: 59143, + 42818: 59144, + 42819: 59145, + 42820: 59146, + 42821: 59147, + 42822: 59148, + 42823: 59149, + 42824: 59150, + 42825: 59151, + 42826: 59152, + 42827: 59153, + 42828: 59154, + 42829: 59155, + 42830: 59156, + 42831: 59157, + 42832: 59158, + 42833: 59159, + 42834: 59160, + 42835: 59161, + 42836: 59162, + 42837: 59163, + 42838: 59164, + 42839: 59165, + 42840: 59166, + 42841: 59167, + 42842: 59168, + 42843: 59169, + 42844: 59170, + 42845: 59171, + 42846: 59172, + 42847: 59173, + 42848: 59174, + 42849: 59175, + 42850: 59176, + 42851: 59177, + 42852: 59178, + 42853: 59179, + 42854: 59180, + 42855: 59181, + 42856: 59182, + 42857: 59183, + 42858: 59184, + 42859: 59185, + 42860: 59186, + 42861: 59187, + 42862: 59188, + 42863: 59189, + 42864: 59190, + 42865: 59191, + 42866: 59192, + 42867: 59193, + 42868: 59194, + 42869: 59195, + 42870: 59196, + 42871: 59197, + 42872: 59198, + 42873: 59199, + 42874: 59200, + 42875: 59201, + 42876: 59202, + 42877: 59203, + 42878: 59204, + 42880: 59205, + 42881: 59206, + 42882: 59207, + 42883: 59208, + 42884: 59209, + 42885: 59210, + 42886: 59211, + 42887: 59212, + 42888: 59213, + 42889: 59214, + 42890: 59215, + 42891: 59216, + 42892: 59217, + 42893: 59218, + 42894: 59219, + 42895: 59220, + 42896: 59221, + 42897: 59222, + 42898: 59223, + 42899: 59224, + 42900: 59225, + 42901: 59226, + 42902: 59227, + 42903: 59228, + 42904: 59229, + 42905: 59230, + 42906: 59231, + 42907: 59232, + 42908: 59233, + 42909: 59234, + 42910: 59235, + 42911: 59236, + 42912: 59237, + 42913: 1040, + 42914: 1041, + 42915: 1042, + 42916: 1043, + 42917: 1044, + 42918: 1045, + 42919: 1025, + 42920: 1046, + 42921: 1047, + 42922: 1048, + 42923: 1049, + 42924: 1050, + 42925: 1051, + 42926: 1052, + 42927: 1053, + 42928: 1054, + 42929: 1055, + 42930: 1056, + 42931: 1057, + 42932: 1058, + 42933: 1059, + 42934: 1060, + 42935: 1061, + 42936: 1062, + 42937: 1063, + 42938: 1064, + 42939: 1065, + 42940: 1066, + 42941: 1067, + 42942: 1068, + 42943: 1069, + 42944: 1070, + 42945: 1071, + 42946: 59296, + 42947: 59297, + 42948: 59298, + 42949: 59299, + 42950: 59300, + 42951: 59301, + 42952: 59302, + 42953: 59303, + 42954: 59304, + 42955: 59305, + 42956: 59306, + 42957: 59307, + 42958: 59308, + 42959: 59309, + 42960: 59310, + 42961: 1072, + 42962: 1073, + 42963: 1074, + 42964: 1075, + 42965: 1076, + 42966: 1077, + 42967: 1105, + 42968: 1078, + 42969: 1079, + 42970: 1080, + 42971: 1081, + 42972: 1082, + 42973: 1083, + 42974: 1084, + 42975: 1085, + 42976: 1086, + 42977: 1087, + 42978: 1088, + 42979: 1089, + 42980: 1090, + 42981: 1091, + 42982: 1092, + 42983: 1093, + 42984: 1094, + 42985: 1095, + 42986: 1096, + 42987: 1097, + 42988: 1098, + 42989: 1099, + 42990: 1100, + 42991: 1101, + 42992: 1102, + 42993: 1103, + 42994: 59311, + 42995: 59312, + 42996: 59313, + 42997: 59314, + 42998: 59315, + 42999: 59316, + 43000: 59317, + 43001: 59318, + 43002: 59319, + 43003: 59320, + 43004: 59321, + 43005: 59322, + 43006: 59323, + 43072: 714, + 43073: 715, + 43074: 729, + 43075: 8211, + 43076: 8213, + 43077: 8229, + 43078: 8245, + 43079: 8453, + 43080: 8457, + 43081: 8598, + 43082: 8599, + 43083: 8600, + 43084: 8601, + 43085: 8725, + 43086: 8735, + 43087: 8739, + 43088: 8786, + 43089: 8806, + 43090: 8807, + 43091: 8895, + 43092: 9552, + 43093: 9553, + 43094: 9554, + 43095: 9555, + 43096: 9556, + 43097: 9557, + 43098: 9558, + 43099: 9559, + 43100: 9560, + 43101: 9561, + 43102: 9562, + 43103: 9563, + 43104: 9564, + 43105: 9565, + 43106: 9566, + 43107: 9567, + 43108: 9568, + 43109: 9569, + 43110: 9570, + 43111: 9571, + 43112: 9572, + 43113: 9573, + 43114: 9574, + 43115: 9575, + 43116: 9576, + 43117: 9577, + 43118: 9578, + 43119: 9579, + 43120: 9580, + 43121: 9581, + 43122: 9582, + 43123: 9583, + 43124: 9584, + 43125: 9585, + 43126: 9586, + 43127: 9587, + 43128: 9601, + 43129: 9602, + 43130: 9603, + 43131: 9604, + 43132: 9605, + 43133: 9606, + 43134: 9607, + 43136: 9608, + 43137: 9609, + 43138: 9610, + 43139: 9611, + 43140: 9612, + 43141: 9613, + 43142: 9614, + 43143: 9615, + 43144: 9619, + 43145: 9620, + 43146: 9621, + 43147: 9660, + 43148: 9661, + 43149: 9698, + 43150: 9699, + 43151: 9700, + 43152: 9701, + 43153: 9737, + 43154: 8853, + 43155: 12306, + 43156: 12317, + 43157: 12318, + 43158: 59324, + 43159: 59325, + 43160: 59326, + 43161: 59327, + 43162: 59328, + 43163: 59329, + 43164: 59330, + 43165: 59331, + 43166: 59332, + 43167: 59333, + 43168: 59334, + 43169: 257, + 43170: 225, + 43171: 462, + 43172: 224, + 43173: 275, + 43174: 233, + 43175: 283, + 43176: 232, + 43177: 299, + 43178: 237, + 43179: 464, + 43180: 236, + 43181: 333, + 43182: 243, + 43183: 466, + 43184: 242, + 43185: 363, + 43186: 250, + 43187: 468, + 43188: 249, + 43189: 470, + 43190: 472, + 43191: 474, + 43192: 476, + 43193: 252, + 43194: 234, + 43195: 593, + 43196: 59335, + 43197: 324, + 43198: 328, + 43199: 505, + 43200: 609, + 43201: 59337, + 43202: 59338, + 43203: 59339, + 43204: 59340, + 43205: 12549, + 43206: 12550, + 43207: 12551, + 43208: 12552, + 43209: 12553, + 43210: 12554, + 43211: 12555, + 43212: 12556, + 43213: 12557, + 43214: 12558, + 43215: 12559, + 43216: 12560, + 43217: 12561, + 43218: 12562, + 43219: 12563, + 43220: 12564, + 43221: 12565, + 43222: 12566, + 43223: 12567, + 43224: 12568, + 43225: 12569, + 43226: 12570, + 43227: 12571, + 43228: 12572, + 43229: 12573, + 43230: 12574, + 43231: 12575, + 43232: 12576, + 43233: 12577, + 43234: 12578, + 43235: 12579, + 43236: 12580, + 43237: 12581, + 43238: 12582, + 43239: 12583, + 43240: 12584, + 43241: 12585, + 43242: 59341, + 43243: 59342, + 43244: 59343, + 43245: 59344, + 43246: 59345, + 43247: 59346, + 43248: 59347, + 43249: 59348, + 43250: 59349, + 43251: 59350, + 43252: 59351, + 43253: 59352, + 43254: 59353, + 43255: 59354, + 43256: 59355, + 43257: 59356, + 43258: 59357, + 43259: 59358, + 43260: 59359, + 43261: 59360, + 43262: 59361, + 43328: 12321, + 43329: 12322, + 43330: 12323, + 43331: 12324, + 43332: 12325, + 43333: 12326, + 43334: 12327, + 43335: 12328, + 43336: 12329, + 43337: 12963, + 43338: 13198, + 43339: 13199, + 43340: 13212, + 43341: 13213, + 43342: 13214, + 43343: 13217, + 43344: 13252, + 43345: 13262, + 43346: 13265, + 43347: 13266, + 43348: 13269, + 43349: 65072, + 43350: 65506, + 43351: 65508, + 43352: 59362, + 43353: 8481, + 43354: 12849, + 43355: 59363, + 43356: 8208, + 43357: 59364, + 43358: 59365, + 43359: 59366, + 43360: 12540, + 43361: 12443, + 43362: 12444, + 43363: 12541, + 43364: 12542, + 43365: 12294, + 43366: 12445, + 43367: 12446, + 43368: 65097, + 43369: 65098, + 43370: 65099, + 43371: 65100, + 43372: 65101, + 43373: 65102, + 43374: 65103, + 43375: 65104, + 43376: 65105, + 43377: 65106, + 43378: 65108, + 43379: 65109, + 43380: 65110, + 43381: 65111, + 43382: 65113, + 43383: 65114, + 43384: 65115, + 43385: 65116, + 43386: 65117, + 43387: 65118, + 43388: 65119, + 43389: 65120, + 43390: 65121, + 43392: 65122, + 43393: 65123, + 43394: 65124, + 43395: 65125, + 43396: 65126, + 43397: 65128, + 43398: 65129, + 43399: 65130, + 43400: 65131, + 43401: 12350, + 43402: 12272, + 43403: 12273, + 43404: 12274, + 43405: 12275, + 43406: 12276, + 43407: 12277, + 43408: 12278, + 43409: 12279, + 43410: 12280, + 43411: 12281, + 43412: 12282, + 43413: 12283, + 43414: 12295, + 43415: 59380, + 43416: 59381, + 43417: 59382, + 43418: 59383, + 43419: 59384, + 43420: 59385, + 43421: 59386, + 43422: 59387, + 43423: 59388, + 43424: 59389, + 43425: 59390, + 43426: 59391, + 43427: 59392, + 43428: 9472, + 43429: 9473, + 43430: 9474, + 43431: 9475, + 43432: 9476, + 43433: 9477, + 43434: 9478, + 43435: 9479, + 43436: 9480, + 43437: 9481, + 43438: 9482, + 43439: 9483, + 43440: 9484, + 43441: 9485, + 43442: 9486, + 43443: 9487, + 43444: 9488, + 43445: 9489, + 43446: 9490, + 43447: 9491, + 43448: 9492, + 43449: 9493, + 43450: 9494, + 43451: 9495, + 43452: 9496, + 43453: 9497, + 43454: 9498, + 43455: 9499, + 43456: 9500, + 43457: 9501, + 43458: 9502, + 43459: 9503, + 43460: 9504, + 43461: 9505, + 43462: 9506, + 43463: 9507, + 43464: 9508, + 43465: 9509, + 43466: 9510, + 43467: 9511, + 43468: 9512, + 43469: 9513, + 43470: 9514, + 43471: 9515, + 43472: 9516, + 43473: 9517, + 43474: 9518, + 43475: 9519, + 43476: 9520, + 43477: 9521, + 43478: 9522, + 43479: 9523, + 43480: 9524, + 43481: 9525, + 43482: 9526, + 43483: 9527, + 43484: 9528, + 43485: 9529, + 43486: 9530, + 43487: 9531, + 43488: 9532, + 43489: 9533, + 43490: 9534, + 43491: 9535, + 43492: 9536, + 43493: 9537, + 43494: 9538, + 43495: 9539, + 43496: 9540, + 43497: 9541, + 43498: 9542, + 43499: 9543, + 43500: 9544, + 43501: 9545, + 43502: 9546, + 43503: 9547, + 43504: 59393, + 43505: 59394, + 43506: 59395, + 43507: 59396, + 43508: 59397, + 43509: 59398, + 43510: 59399, + 43511: 59400, + 43512: 59401, + 43513: 59402, + 43514: 59403, + 43515: 59404, + 43516: 59405, + 43517: 59406, + 43518: 59407, + 43584: 29404, + 43585: 29405, + 43586: 29407, + 43587: 29410, + 43588: 29411, + 43589: 29412, + 43590: 29413, + 43591: 29414, + 43592: 29415, + 43593: 29418, + 43594: 29419, + 43595: 29429, + 43596: 29430, + 43597: 29433, + 43598: 29437, + 43599: 29438, + 43600: 29439, + 43601: 29440, + 43602: 29442, + 43603: 29444, + 43604: 29445, + 43605: 29446, + 43606: 29447, + 43607: 29448, + 43608: 29449, + 43609: 29451, + 43610: 29452, + 43611: 29453, + 43612: 29455, + 43613: 29456, + 43614: 29457, + 43615: 29458, + 43616: 29460, + 43617: 29464, + 43618: 29465, + 43619: 29466, + 43620: 29471, + 43621: 29472, + 43622: 29475, + 43623: 29476, + 43624: 29478, + 43625: 29479, + 43626: 29480, + 43627: 29485, + 43628: 29487, + 43629: 29488, + 43630: 29490, + 43631: 29491, + 43632: 29493, + 43633: 29494, + 43634: 29498, + 43635: 29499, + 43636: 29500, + 43637: 29501, + 43638: 29504, + 43639: 29505, + 43640: 29506, + 43641: 29507, + 43642: 29508, + 43643: 29509, + 43644: 29510, + 43645: 29511, + 43646: 29512, + 43648: 29513, + 43649: 29514, + 43650: 29515, + 43651: 29516, + 43652: 29518, + 43653: 29519, + 43654: 29521, + 43655: 29523, + 43656: 29524, + 43657: 29525, + 43658: 29526, + 43659: 29528, + 43660: 29529, + 43661: 29530, + 43662: 29531, + 43663: 29532, + 43664: 29533, + 43665: 29534, + 43666: 29535, + 43667: 29537, + 43668: 29538, + 43669: 29539, + 43670: 29540, + 43671: 29541, + 43672: 29542, + 43673: 29543, + 43674: 29544, + 43675: 29545, + 43676: 29546, + 43677: 29547, + 43678: 29550, + 43679: 29552, + 43680: 29553, + 43681: 57344, + 43682: 57345, + 43683: 57346, + 43684: 57347, + 43685: 57348, + 43686: 57349, + 43687: 57350, + 43688: 57351, + 43689: 57352, + 43690: 57353, + 43691: 57354, + 43692: 57355, + 43693: 57356, + 43694: 57357, + 43695: 57358, + 43696: 57359, + 43697: 57360, + 43698: 57361, + 43699: 57362, + 43700: 57363, + 43701: 57364, + 43702: 57365, + 43703: 57366, + 43704: 57367, + 43705: 57368, + 43706: 57369, + 43707: 57370, + 43708: 57371, + 43709: 57372, + 43710: 57373, + 43711: 57374, + 43712: 57375, + 43713: 57376, + 43714: 57377, + 43715: 57378, + 43716: 57379, + 43717: 57380, + 43718: 57381, + 43719: 57382, + 43720: 57383, + 43721: 57384, + 43722: 57385, + 43723: 57386, + 43724: 57387, + 43725: 57388, + 43726: 57389, + 43727: 57390, + 43728: 57391, + 43729: 57392, + 43730: 57393, + 43731: 57394, + 43732: 57395, + 43733: 57396, + 43734: 57397, + 43735: 57398, + 43736: 57399, + 43737: 57400, + 43738: 57401, + 43739: 57402, + 43740: 57403, + 43741: 57404, + 43742: 57405, + 43743: 57406, + 43744: 57407, + 43745: 57408, + 43746: 57409, + 43747: 57410, + 43748: 57411, + 43749: 57412, + 43750: 57413, + 43751: 57414, + 43752: 57415, + 43753: 57416, + 43754: 57417, + 43755: 57418, + 43756: 57419, + 43757: 57420, + 43758: 57421, + 43759: 57422, + 43760: 57423, + 43761: 57424, + 43762: 57425, + 43763: 57426, + 43764: 57427, + 43765: 57428, + 43766: 57429, + 43767: 57430, + 43768: 57431, + 43769: 57432, + 43770: 57433, + 43771: 57434, + 43772: 57435, + 43773: 57436, + 43774: 57437, + 43840: 29554, + 43841: 29555, + 43842: 29556, + 43843: 29557, + 43844: 29558, + 43845: 29559, + 43846: 29560, + 43847: 29561, + 43848: 29562, + 43849: 29563, + 43850: 29564, + 43851: 29565, + 43852: 29567, + 43853: 29568, + 43854: 29569, + 43855: 29570, + 43856: 29571, + 43857: 29573, + 43858: 29574, + 43859: 29576, + 43860: 29578, + 43861: 29580, + 43862: 29581, + 43863: 29583, + 43864: 29584, + 43865: 29586, + 43866: 29587, + 43867: 29588, + 43868: 29589, + 43869: 29591, + 43870: 29592, + 43871: 29593, + 43872: 29594, + 43873: 29596, + 43874: 29597, + 43875: 29598, + 43876: 29600, + 43877: 29601, + 43878: 29603, + 43879: 29604, + 43880: 29605, + 43881: 29606, + 43882: 29607, + 43883: 29608, + 43884: 29610, + 43885: 29612, + 43886: 29613, + 43887: 29617, + 43888: 29620, + 43889: 29621, + 43890: 29622, + 43891: 29624, + 43892: 29625, + 43893: 29628, + 43894: 29629, + 43895: 29630, + 43896: 29631, + 43897: 29633, + 43898: 29635, + 43899: 29636, + 43900: 29637, + 43901: 29638, + 43902: 29639, + 43904: 29643, + 43905: 29644, + 43906: 29646, + 43907: 29650, + 43908: 29651, + 43909: 29652, + 43910: 29653, + 43911: 29654, + 43912: 29655, + 43913: 29656, + 43914: 29658, + 43915: 29659, + 43916: 29660, + 43917: 29661, + 43918: 29663, + 43919: 29665, + 43920: 29666, + 43921: 29667, + 43922: 29668, + 43923: 29670, + 43924: 29672, + 43925: 29674, + 43926: 29675, + 43927: 29676, + 43928: 29678, + 43929: 29679, + 43930: 29680, + 43931: 29681, + 43932: 29683, + 43933: 29684, + 43934: 29685, + 43935: 29686, + 43936: 29687, + 43937: 57438, + 43938: 57439, + 43939: 57440, + 43940: 57441, + 43941: 57442, + 43942: 57443, + 43943: 57444, + 43944: 57445, + 43945: 57446, + 43946: 57447, + 43947: 57448, + 43948: 57449, + 43949: 57450, + 43950: 57451, + 43951: 57452, + 43952: 57453, + 43953: 57454, + 43954: 57455, + 43955: 57456, + 43956: 57457, + 43957: 57458, + 43958: 57459, + 43959: 57460, + 43960: 57461, + 43961: 57462, + 43962: 57463, + 43963: 57464, + 43964: 57465, + 43965: 57466, + 43966: 57467, + 43967: 57468, + 43968: 57469, + 43969: 57470, + 43970: 57471, + 43971: 57472, + 43972: 57473, + 43973: 57474, + 43974: 57475, + 43975: 57476, + 43976: 57477, + 43977: 57478, + 43978: 57479, + 43979: 57480, + 43980: 57481, + 43981: 57482, + 43982: 57483, + 43983: 57484, + 43984: 57485, + 43985: 57486, + 43986: 57487, + 43987: 57488, + 43988: 57489, + 43989: 57490, + 43990: 57491, + 43991: 57492, + 43992: 57493, + 43993: 57494, + 43994: 57495, + 43995: 57496, + 43996: 57497, + 43997: 57498, + 43998: 57499, + 43999: 57500, + 44000: 57501, + 44001: 57502, + 44002: 57503, + 44003: 57504, + 44004: 57505, + 44005: 57506, + 44006: 57507, + 44007: 57508, + 44008: 57509, + 44009: 57510, + 44010: 57511, + 44011: 57512, + 44012: 57513, + 44013: 57514, + 44014: 57515, + 44015: 57516, + 44016: 57517, + 44017: 57518, + 44018: 57519, + 44019: 57520, + 44020: 57521, + 44021: 57522, + 44022: 57523, + 44023: 57524, + 44024: 57525, + 44025: 57526, + 44026: 57527, + 44027: 57528, + 44028: 57529, + 44029: 57530, + 44030: 57531, + 44096: 29688, + 44097: 29689, + 44098: 29690, + 44099: 29691, + 44100: 29692, + 44101: 29693, + 44102: 29694, + 44103: 29695, + 44104: 29696, + 44105: 29697, + 44106: 29698, + 44107: 29700, + 44108: 29703, + 44109: 29704, + 44110: 29707, + 44111: 29708, + 44112: 29709, + 44113: 29710, + 44114: 29713, + 44115: 29714, + 44116: 29715, + 44117: 29716, + 44118: 29717, + 44119: 29718, + 44120: 29719, + 44121: 29720, + 44122: 29721, + 44123: 29724, + 44124: 29725, + 44125: 29726, + 44126: 29727, + 44127: 29728, + 44128: 29729, + 44129: 29731, + 44130: 29732, + 44131: 29735, + 44132: 29737, + 44133: 29739, + 44134: 29741, + 44135: 29743, + 44136: 29745, + 44137: 29746, + 44138: 29751, + 44139: 29752, + 44140: 29753, + 44141: 29754, + 44142: 29755, + 44143: 29757, + 44144: 29758, + 44145: 29759, + 44146: 29760, + 44147: 29762, + 44148: 29763, + 44149: 29764, + 44150: 29765, + 44151: 29766, + 44152: 29767, + 44153: 29768, + 44154: 29769, + 44155: 29770, + 44156: 29771, + 44157: 29772, + 44158: 29773, + 44160: 29774, + 44161: 29775, + 44162: 29776, + 44163: 29777, + 44164: 29778, + 44165: 29779, + 44166: 29780, + 44167: 29782, + 44168: 29784, + 44169: 29789, + 44170: 29792, + 44171: 29793, + 44172: 29794, + 44173: 29795, + 44174: 29796, + 44175: 29797, + 44176: 29798, + 44177: 29799, + 44178: 29800, + 44179: 29801, + 44180: 29802, + 44181: 29803, + 44182: 29804, + 44183: 29806, + 44184: 29807, + 44185: 29809, + 44186: 29810, + 44187: 29811, + 44188: 29812, + 44189: 29813, + 44190: 29816, + 44191: 29817, + 44192: 29818, + 44193: 57532, + 44194: 57533, + 44195: 57534, + 44196: 57535, + 44197: 57536, + 44198: 57537, + 44199: 57538, + 44200: 57539, + 44201: 57540, + 44202: 57541, + 44203: 57542, + 44204: 57543, + 44205: 57544, + 44206: 57545, + 44207: 57546, + 44208: 57547, + 44209: 57548, + 44210: 57549, + 44211: 57550, + 44212: 57551, + 44213: 57552, + 44214: 57553, + 44215: 57554, + 44216: 57555, + 44217: 57556, + 44218: 57557, + 44219: 57558, + 44220: 57559, + 44221: 57560, + 44222: 57561, + 44223: 57562, + 44224: 57563, + 44225: 57564, + 44226: 57565, + 44227: 57566, + 44228: 57567, + 44229: 57568, + 44230: 57569, + 44231: 57570, + 44232: 57571, + 44233: 57572, + 44234: 57573, + 44235: 57574, + 44236: 57575, + 44237: 57576, + 44238: 57577, + 44239: 57578, + 44240: 57579, + 44241: 57580, + 44242: 57581, + 44243: 57582, + 44244: 57583, + 44245: 57584, + 44246: 57585, + 44247: 57586, + 44248: 57587, + 44249: 57588, + 44250: 57589, + 44251: 57590, + 44252: 57591, + 44253: 57592, + 44254: 57593, + 44255: 57594, + 44256: 57595, + 44257: 57596, + 44258: 57597, + 44259: 57598, + 44260: 57599, + 44261: 57600, + 44262: 57601, + 44263: 57602, + 44264: 57603, + 44265: 57604, + 44266: 57605, + 44267: 57606, + 44268: 57607, + 44269: 57608, + 44270: 57609, + 44271: 57610, + 44272: 57611, + 44273: 57612, + 44274: 57613, + 44275: 57614, + 44276: 57615, + 44277: 57616, + 44278: 57617, + 44279: 57618, + 44280: 57619, + 44281: 57620, + 44282: 57621, + 44283: 57622, + 44284: 57623, + 44285: 57624, + 44286: 57625, + 44352: 29819, + 44353: 29820, + 44354: 29821, + 44355: 29823, + 44356: 29826, + 44357: 29828, + 44358: 29829, + 44359: 29830, + 44360: 29832, + 44361: 29833, + 44362: 29834, + 44363: 29836, + 44364: 29837, + 44365: 29839, + 44366: 29841, + 44367: 29842, + 44368: 29843, + 44369: 29844, + 44370: 29845, + 44371: 29846, + 44372: 29847, + 44373: 29848, + 44374: 29849, + 44375: 29850, + 44376: 29851, + 44377: 29853, + 44378: 29855, + 44379: 29856, + 44380: 29857, + 44381: 29858, + 44382: 29859, + 44383: 29860, + 44384: 29861, + 44385: 29862, + 44386: 29866, + 44387: 29867, + 44388: 29868, + 44389: 29869, + 44390: 29870, + 44391: 29871, + 44392: 29872, + 44393: 29873, + 44394: 29874, + 44395: 29875, + 44396: 29876, + 44397: 29877, + 44398: 29878, + 44399: 29879, + 44400: 29880, + 44401: 29881, + 44402: 29883, + 44403: 29884, + 44404: 29885, + 44405: 29886, + 44406: 29887, + 44407: 29888, + 44408: 29889, + 44409: 29890, + 44410: 29891, + 44411: 29892, + 44412: 29893, + 44413: 29894, + 44414: 29895, + 44416: 29896, + 44417: 29897, + 44418: 29898, + 44419: 29899, + 44420: 29900, + 44421: 29901, + 44422: 29902, + 44423: 29903, + 44424: 29904, + 44425: 29905, + 44426: 29907, + 44427: 29908, + 44428: 29909, + 44429: 29910, + 44430: 29911, + 44431: 29912, + 44432: 29913, + 44433: 29914, + 44434: 29915, + 44435: 29917, + 44436: 29919, + 44437: 29921, + 44438: 29925, + 44439: 29927, + 44440: 29928, + 44441: 29929, + 44442: 29930, + 44443: 29931, + 44444: 29932, + 44445: 29933, + 44446: 29936, + 44447: 29937, + 44448: 29938, + 44449: 57626, + 44450: 57627, + 44451: 57628, + 44452: 57629, + 44453: 57630, + 44454: 57631, + 44455: 57632, + 44456: 57633, + 44457: 57634, + 44458: 57635, + 44459: 57636, + 44460: 57637, + 44461: 57638, + 44462: 57639, + 44463: 57640, + 44464: 57641, + 44465: 57642, + 44466: 57643, + 44467: 57644, + 44468: 57645, + 44469: 57646, + 44470: 57647, + 44471: 57648, + 44472: 57649, + 44473: 57650, + 44474: 57651, + 44475: 57652, + 44476: 57653, + 44477: 57654, + 44478: 57655, + 44479: 57656, + 44480: 57657, + 44481: 57658, + 44482: 57659, + 44483: 57660, + 44484: 57661, + 44485: 57662, + 44486: 57663, + 44487: 57664, + 44488: 57665, + 44489: 57666, + 44490: 57667, + 44491: 57668, + 44492: 57669, + 44493: 57670, + 44494: 57671, + 44495: 57672, + 44496: 57673, + 44497: 57674, + 44498: 57675, + 44499: 57676, + 44500: 57677, + 44501: 57678, + 44502: 57679, + 44503: 57680, + 44504: 57681, + 44505: 57682, + 44506: 57683, + 44507: 57684, + 44508: 57685, + 44509: 57686, + 44510: 57687, + 44511: 57688, + 44512: 57689, + 44513: 57690, + 44514: 57691, + 44515: 57692, + 44516: 57693, + 44517: 57694, + 44518: 57695, + 44519: 57696, + 44520: 57697, + 44521: 57698, + 44522: 57699, + 44523: 57700, + 44524: 57701, + 44525: 57702, + 44526: 57703, + 44527: 57704, + 44528: 57705, + 44529: 57706, + 44530: 57707, + 44531: 57708, + 44532: 57709, + 44533: 57710, + 44534: 57711, + 44535: 57712, + 44536: 57713, + 44537: 57714, + 44538: 57715, + 44539: 57716, + 44540: 57717, + 44541: 57718, + 44542: 57719, + 44608: 29939, + 44609: 29941, + 44610: 29944, + 44611: 29945, + 44612: 29946, + 44613: 29947, + 44614: 29948, + 44615: 29949, + 44616: 29950, + 44617: 29952, + 44618: 29953, + 44619: 29954, + 44620: 29955, + 44621: 29957, + 44622: 29958, + 44623: 29959, + 44624: 29960, + 44625: 29961, + 44626: 29962, + 44627: 29963, + 44628: 29964, + 44629: 29966, + 44630: 29968, + 44631: 29970, + 44632: 29972, + 44633: 29973, + 44634: 29974, + 44635: 29975, + 44636: 29979, + 44637: 29981, + 44638: 29982, + 44639: 29984, + 44640: 29985, + 44641: 29986, + 44642: 29987, + 44643: 29988, + 44644: 29990, + 44645: 29991, + 44646: 29994, + 44647: 29998, + 44648: 30004, + 44649: 30006, + 44650: 30009, + 44651: 30012, + 44652: 30013, + 44653: 30015, + 44654: 30017, + 44655: 30018, + 44656: 30019, + 44657: 30020, + 44658: 30022, + 44659: 30023, + 44660: 30025, + 44661: 30026, + 44662: 30029, + 44663: 30032, + 44664: 30033, + 44665: 30034, + 44666: 30035, + 44667: 30037, + 44668: 30038, + 44669: 30039, + 44670: 30040, + 44672: 30045, + 44673: 30046, + 44674: 30047, + 44675: 30048, + 44676: 30049, + 44677: 30050, + 44678: 30051, + 44679: 30052, + 44680: 30055, + 44681: 30056, + 44682: 30057, + 44683: 30059, + 44684: 30060, + 44685: 30061, + 44686: 30062, + 44687: 30063, + 44688: 30064, + 44689: 30065, + 44690: 30067, + 44691: 30069, + 44692: 30070, + 44693: 30071, + 44694: 30074, + 44695: 30075, + 44696: 30076, + 44697: 30077, + 44698: 30078, + 44699: 30080, + 44700: 30081, + 44701: 30082, + 44702: 30084, + 44703: 30085, + 44704: 30087, + 44705: 57720, + 44706: 57721, + 44707: 57722, + 44708: 57723, + 44709: 57724, + 44710: 57725, + 44711: 57726, + 44712: 57727, + 44713: 57728, + 44714: 57729, + 44715: 57730, + 44716: 57731, + 44717: 57732, + 44718: 57733, + 44719: 57734, + 44720: 57735, + 44721: 57736, + 44722: 57737, + 44723: 57738, + 44724: 57739, + 44725: 57740, + 44726: 57741, + 44727: 57742, + 44728: 57743, + 44729: 57744, + 44730: 57745, + 44731: 57746, + 44732: 57747, + 44733: 57748, + 44734: 57749, + 44735: 57750, + 44736: 57751, + 44737: 57752, + 44738: 57753, + 44739: 57754, + 44740: 57755, + 44741: 57756, + 44742: 57757, + 44743: 57758, + 44744: 57759, + 44745: 57760, + 44746: 57761, + 44747: 57762, + 44748: 57763, + 44749: 57764, + 44750: 57765, + 44751: 57766, + 44752: 57767, + 44753: 57768, + 44754: 57769, + 44755: 57770, + 44756: 57771, + 44757: 57772, + 44758: 57773, + 44759: 57774, + 44760: 57775, + 44761: 57776, + 44762: 57777, + 44763: 57778, + 44764: 57779, + 44765: 57780, + 44766: 57781, + 44767: 57782, + 44768: 57783, + 44769: 57784, + 44770: 57785, + 44771: 57786, + 44772: 57787, + 44773: 57788, + 44774: 57789, + 44775: 57790, + 44776: 57791, + 44777: 57792, + 44778: 57793, + 44779: 57794, + 44780: 57795, + 44781: 57796, + 44782: 57797, + 44783: 57798, + 44784: 57799, + 44785: 57800, + 44786: 57801, + 44787: 57802, + 44788: 57803, + 44789: 57804, + 44790: 57805, + 44791: 57806, + 44792: 57807, + 44793: 57808, + 44794: 57809, + 44795: 57810, + 44796: 57811, + 44797: 57812, + 44798: 57813, + 44864: 30088, + 44865: 30089, + 44866: 30090, + 44867: 30092, + 44868: 30093, + 44869: 30094, + 44870: 30096, + 44871: 30099, + 44872: 30101, + 44873: 30104, + 44874: 30107, + 44875: 30108, + 44876: 30110, + 44877: 30114, + 44878: 30118, + 44879: 30119, + 44880: 30120, + 44881: 30121, + 44882: 30122, + 44883: 30125, + 44884: 30134, + 44885: 30135, + 44886: 30138, + 44887: 30139, + 44888: 30143, + 44889: 30144, + 44890: 30145, + 44891: 30150, + 44892: 30155, + 44893: 30156, + 44894: 30158, + 44895: 30159, + 44896: 30160, + 44897: 30161, + 44898: 30163, + 44899: 30167, + 44900: 30169, + 44901: 30170, + 44902: 30172, + 44903: 30173, + 44904: 30175, + 44905: 30176, + 44906: 30177, + 44907: 30181, + 44908: 30185, + 44909: 30188, + 44910: 30189, + 44911: 30190, + 44912: 30191, + 44913: 30194, + 44914: 30195, + 44915: 30197, + 44916: 30198, + 44917: 30199, + 44918: 30200, + 44919: 30202, + 44920: 30203, + 44921: 30205, + 44922: 30206, + 44923: 30210, + 44924: 30212, + 44925: 30214, + 44926: 30215, + 44928: 30216, + 44929: 30217, + 44930: 30219, + 44931: 30221, + 44932: 30222, + 44933: 30223, + 44934: 30225, + 44935: 30226, + 44936: 30227, + 44937: 30228, + 44938: 30230, + 44939: 30234, + 44940: 30236, + 44941: 30237, + 44942: 30238, + 44943: 30241, + 44944: 30243, + 44945: 30247, + 44946: 30248, + 44947: 30252, + 44948: 30254, + 44949: 30255, + 44950: 30257, + 44951: 30258, + 44952: 30262, + 44953: 30263, + 44954: 30265, + 44955: 30266, + 44956: 30267, + 44957: 30269, + 44958: 30273, + 44959: 30274, + 44960: 30276, + 44961: 57814, + 44962: 57815, + 44963: 57816, + 44964: 57817, + 44965: 57818, + 44966: 57819, + 44967: 57820, + 44968: 57821, + 44969: 57822, + 44970: 57823, + 44971: 57824, + 44972: 57825, + 44973: 57826, + 44974: 57827, + 44975: 57828, + 44976: 57829, + 44977: 57830, + 44978: 57831, + 44979: 57832, + 44980: 57833, + 44981: 57834, + 44982: 57835, + 44983: 57836, + 44984: 57837, + 44985: 57838, + 44986: 57839, + 44987: 57840, + 44988: 57841, + 44989: 57842, + 44990: 57843, + 44991: 57844, + 44992: 57845, + 44993: 57846, + 44994: 57847, + 44995: 57848, + 44996: 57849, + 44997: 57850, + 44998: 57851, + 44999: 57852, + 45000: 57853, + 45001: 57854, + 45002: 57855, + 45003: 57856, + 45004: 57857, + 45005: 57858, + 45006: 57859, + 45007: 57860, + 45008: 57861, + 45009: 57862, + 45010: 57863, + 45011: 57864, + 45012: 57865, + 45013: 57866, + 45014: 57867, + 45015: 57868, + 45016: 57869, + 45017: 57870, + 45018: 57871, + 45019: 57872, + 45020: 57873, + 45021: 57874, + 45022: 57875, + 45023: 57876, + 45024: 57877, + 45025: 57878, + 45026: 57879, + 45027: 57880, + 45028: 57881, + 45029: 57882, + 45030: 57883, + 45031: 57884, + 45032: 57885, + 45033: 57886, + 45034: 57887, + 45035: 57888, + 45036: 57889, + 45037: 57890, + 45038: 57891, + 45039: 57892, + 45040: 57893, + 45041: 57894, + 45042: 57895, + 45043: 57896, + 45044: 57897, + 45045: 57898, + 45046: 57899, + 45047: 57900, + 45048: 57901, + 45049: 57902, + 45050: 57903, + 45051: 57904, + 45052: 57905, + 45053: 57906, + 45054: 57907, + 45120: 30277, + 45121: 30278, + 45122: 30279, + 45123: 30280, + 45124: 30281, + 45125: 30282, + 45126: 30283, + 45127: 30286, + 45128: 30287, + 45129: 30288, + 45130: 30289, + 45131: 30290, + 45132: 30291, + 45133: 30293, + 45134: 30295, + 45135: 30296, + 45136: 30297, + 45137: 30298, + 45138: 30299, + 45139: 30301, + 45140: 30303, + 45141: 30304, + 45142: 30305, + 45143: 30306, + 45144: 30308, + 45145: 30309, + 45146: 30310, + 45147: 30311, + 45148: 30312, + 45149: 30313, + 45150: 30314, + 45151: 30316, + 45152: 30317, + 45153: 30318, + 45154: 30320, + 45155: 30321, + 45156: 30322, + 45157: 30323, + 45158: 30324, + 45159: 30325, + 45160: 30326, + 45161: 30327, + 45162: 30329, + 45163: 30330, + 45164: 30332, + 45165: 30335, + 45166: 30336, + 45167: 30337, + 45168: 30339, + 45169: 30341, + 45170: 30345, + 45171: 30346, + 45172: 30348, + 45173: 30349, + 45174: 30351, + 45175: 30352, + 45176: 30354, + 45177: 30356, + 45178: 30357, + 45179: 30359, + 45180: 30360, + 45181: 30362, + 45182: 30363, + 45184: 30364, + 45185: 30365, + 45186: 30366, + 45187: 30367, + 45188: 30368, + 45189: 30369, + 45190: 30370, + 45191: 30371, + 45192: 30373, + 45193: 30374, + 45194: 30375, + 45195: 30376, + 45196: 30377, + 45197: 30378, + 45198: 30379, + 45199: 30380, + 45200: 30381, + 45201: 30383, + 45202: 30384, + 45203: 30387, + 45204: 30389, + 45205: 30390, + 45206: 30391, + 45207: 30392, + 45208: 30393, + 45209: 30394, + 45210: 30395, + 45211: 30396, + 45212: 30397, + 45213: 30398, + 45214: 30400, + 45215: 30401, + 45216: 30403, + 45217: 21834, + 45218: 38463, + 45219: 22467, + 45220: 25384, + 45221: 21710, + 45222: 21769, + 45223: 21696, + 45224: 30353, + 45225: 30284, + 45226: 34108, + 45227: 30702, + 45228: 33406, + 45229: 30861, + 45230: 29233, + 45231: 38552, + 45232: 38797, + 45233: 27688, + 45234: 23433, + 45235: 20474, + 45236: 25353, + 45237: 26263, + 45238: 23736, + 45239: 33018, + 45240: 26696, + 45241: 32942, + 45242: 26114, + 45243: 30414, + 45244: 20985, + 45245: 25942, + 45246: 29100, + 45247: 32753, + 45248: 34948, + 45249: 20658, + 45250: 22885, + 45251: 25034, + 45252: 28595, + 45253: 33453, + 45254: 25420, + 45255: 25170, + 45256: 21485, + 45257: 21543, + 45258: 31494, + 45259: 20843, + 45260: 30116, + 45261: 24052, + 45262: 25300, + 45263: 36299, + 45264: 38774, + 45265: 25226, + 45266: 32793, + 45267: 22365, + 45268: 38712, + 45269: 32610, + 45270: 29240, + 45271: 30333, + 45272: 26575, + 45273: 30334, + 45274: 25670, + 45275: 20336, + 45276: 36133, + 45277: 25308, + 45278: 31255, + 45279: 26001, + 45280: 29677, + 45281: 25644, + 45282: 25203, + 45283: 33324, + 45284: 39041, + 45285: 26495, + 45286: 29256, + 45287: 25198, + 45288: 25292, + 45289: 20276, + 45290: 29923, + 45291: 21322, + 45292: 21150, + 45293: 32458, + 45294: 37030, + 45295: 24110, + 45296: 26758, + 45297: 27036, + 45298: 33152, + 45299: 32465, + 45300: 26834, + 45301: 30917, + 45302: 34444, + 45303: 38225, + 45304: 20621, + 45305: 35876, + 45306: 33502, + 45307: 32990, + 45308: 21253, + 45309: 35090, + 45310: 21093, + 45376: 30404, + 45377: 30407, + 45378: 30409, + 45379: 30411, + 45380: 30412, + 45381: 30419, + 45382: 30421, + 45383: 30425, + 45384: 30426, + 45385: 30428, + 45386: 30429, + 45387: 30430, + 45388: 30432, + 45389: 30433, + 45390: 30434, + 45391: 30435, + 45392: 30436, + 45393: 30438, + 45394: 30439, + 45395: 30440, + 45396: 30441, + 45397: 30442, + 45398: 30443, + 45399: 30444, + 45400: 30445, + 45401: 30448, + 45402: 30451, + 45403: 30453, + 45404: 30454, + 45405: 30455, + 45406: 30458, + 45407: 30459, + 45408: 30461, + 45409: 30463, + 45410: 30464, + 45411: 30466, + 45412: 30467, + 45413: 30469, + 45414: 30470, + 45415: 30474, + 45416: 30476, + 45417: 30478, + 45418: 30479, + 45419: 30480, + 45420: 30481, + 45421: 30482, + 45422: 30483, + 45423: 30484, + 45424: 30485, + 45425: 30486, + 45426: 30487, + 45427: 30488, + 45428: 30491, + 45429: 30492, + 45430: 30493, + 45431: 30494, + 45432: 30497, + 45433: 30499, + 45434: 30500, + 45435: 30501, + 45436: 30503, + 45437: 30506, + 45438: 30507, + 45440: 30508, + 45441: 30510, + 45442: 30512, + 45443: 30513, + 45444: 30514, + 45445: 30515, + 45446: 30516, + 45447: 30521, + 45448: 30523, + 45449: 30525, + 45450: 30526, + 45451: 30527, + 45452: 30530, + 45453: 30532, + 45454: 30533, + 45455: 30534, + 45456: 30536, + 45457: 30537, + 45458: 30538, + 45459: 30539, + 45460: 30540, + 45461: 30541, + 45462: 30542, + 45463: 30543, + 45464: 30546, + 45465: 30547, + 45466: 30548, + 45467: 30549, + 45468: 30550, + 45469: 30551, + 45470: 30552, + 45471: 30553, + 45472: 30556, + 45473: 34180, + 45474: 38649, + 45475: 20445, + 45476: 22561, + 45477: 39281, + 45478: 23453, + 45479: 25265, + 45480: 25253, + 45481: 26292, + 45482: 35961, + 45483: 40077, + 45484: 29190, + 45485: 26479, + 45486: 30865, + 45487: 24754, + 45488: 21329, + 45489: 21271, + 45490: 36744, + 45491: 32972, + 45492: 36125, + 45493: 38049, + 45494: 20493, + 45495: 29384, + 45496: 22791, + 45497: 24811, + 45498: 28953, + 45499: 34987, + 45500: 22868, + 45501: 33519, + 45502: 26412, + 45503: 31528, + 45504: 23849, + 45505: 32503, + 45506: 29997, + 45507: 27893, + 45508: 36454, + 45509: 36856, + 45510: 36924, + 45511: 40763, + 45512: 27604, + 45513: 37145, + 45514: 31508, + 45515: 24444, + 45516: 30887, + 45517: 34006, + 45518: 34109, + 45519: 27605, + 45520: 27609, + 45521: 27606, + 45522: 24065, + 45523: 24199, + 45524: 30201, + 45525: 38381, + 45526: 25949, + 45527: 24330, + 45528: 24517, + 45529: 36767, + 45530: 22721, + 45531: 33218, + 45532: 36991, + 45533: 38491, + 45534: 38829, + 45535: 36793, + 45536: 32534, + 45537: 36140, + 45538: 25153, + 45539: 20415, + 45540: 21464, + 45541: 21342, + 45542: 36776, + 45543: 36777, + 45544: 36779, + 45545: 36941, + 45546: 26631, + 45547: 24426, + 45548: 33176, + 45549: 34920, + 45550: 40150, + 45551: 24971, + 45552: 21035, + 45553: 30250, + 45554: 24428, + 45555: 25996, + 45556: 28626, + 45557: 28392, + 45558: 23486, + 45559: 25672, + 45560: 20853, + 45561: 20912, + 45562: 26564, + 45563: 19993, + 45564: 31177, + 45565: 39292, + 45566: 28851, + 45632: 30557, + 45633: 30558, + 45634: 30559, + 45635: 30560, + 45636: 30564, + 45637: 30567, + 45638: 30569, + 45639: 30570, + 45640: 30573, + 45641: 30574, + 45642: 30575, + 45643: 30576, + 45644: 30577, + 45645: 30578, + 45646: 30579, + 45647: 30580, + 45648: 30581, + 45649: 30582, + 45650: 30583, + 45651: 30584, + 45652: 30586, + 45653: 30587, + 45654: 30588, + 45655: 30593, + 45656: 30594, + 45657: 30595, + 45658: 30598, + 45659: 30599, + 45660: 30600, + 45661: 30601, + 45662: 30602, + 45663: 30603, + 45664: 30607, + 45665: 30608, + 45666: 30611, + 45667: 30612, + 45668: 30613, + 45669: 30614, + 45670: 30615, + 45671: 30616, + 45672: 30617, + 45673: 30618, + 45674: 30619, + 45675: 30620, + 45676: 30621, + 45677: 30622, + 45678: 30625, + 45679: 30627, + 45680: 30628, + 45681: 30630, + 45682: 30632, + 45683: 30635, + 45684: 30637, + 45685: 30638, + 45686: 30639, + 45687: 30641, + 45688: 30642, + 45689: 30644, + 45690: 30646, + 45691: 30647, + 45692: 30648, + 45693: 30649, + 45694: 30650, + 45696: 30652, + 45697: 30654, + 45698: 30656, + 45699: 30657, + 45700: 30658, + 45701: 30659, + 45702: 30660, + 45703: 30661, + 45704: 30662, + 45705: 30663, + 45706: 30664, + 45707: 30665, + 45708: 30666, + 45709: 30667, + 45710: 30668, + 45711: 30670, + 45712: 30671, + 45713: 30672, + 45714: 30673, + 45715: 30674, + 45716: 30675, + 45717: 30676, + 45718: 30677, + 45719: 30678, + 45720: 30680, + 45721: 30681, + 45722: 30682, + 45723: 30685, + 45724: 30686, + 45725: 30687, + 45726: 30688, + 45727: 30689, + 45728: 30692, + 45729: 30149, + 45730: 24182, + 45731: 29627, + 45732: 33760, + 45733: 25773, + 45734: 25320, + 45735: 38069, + 45736: 27874, + 45737: 21338, + 45738: 21187, + 45739: 25615, + 45740: 38082, + 45741: 31636, + 45742: 20271, + 45743: 24091, + 45744: 33334, + 45745: 33046, + 45746: 33162, + 45747: 28196, + 45748: 27850, + 45749: 39539, + 45750: 25429, + 45751: 21340, + 45752: 21754, + 45753: 34917, + 45754: 22496, + 45755: 19981, + 45756: 24067, + 45757: 27493, + 45758: 31807, + 45759: 37096, + 45760: 24598, + 45761: 25830, + 45762: 29468, + 45763: 35009, + 45764: 26448, + 45765: 25165, + 45766: 36130, + 45767: 30572, + 45768: 36393, + 45769: 37319, + 45770: 24425, + 45771: 33756, + 45772: 34081, + 45773: 39184, + 45774: 21442, + 45775: 34453, + 45776: 27531, + 45777: 24813, + 45778: 24808, + 45779: 28799, + 45780: 33485, + 45781: 33329, + 45782: 20179, + 45783: 27815, + 45784: 34255, + 45785: 25805, + 45786: 31961, + 45787: 27133, + 45788: 26361, + 45789: 33609, + 45790: 21397, + 45791: 31574, + 45792: 20391, + 45793: 20876, + 45794: 27979, + 45795: 23618, + 45796: 36461, + 45797: 25554, + 45798: 21449, + 45799: 33580, + 45800: 33590, + 45801: 26597, + 45802: 30900, + 45803: 25661, + 45804: 23519, + 45805: 23700, + 45806: 24046, + 45807: 35815, + 45808: 25286, + 45809: 26612, + 45810: 35962, + 45811: 25600, + 45812: 25530, + 45813: 34633, + 45814: 39307, + 45815: 35863, + 45816: 32544, + 45817: 38130, + 45818: 20135, + 45819: 38416, + 45820: 39076, + 45821: 26124, + 45822: 29462, + 45888: 30694, + 45889: 30696, + 45890: 30698, + 45891: 30703, + 45892: 30704, + 45893: 30705, + 45894: 30706, + 45895: 30708, + 45896: 30709, + 45897: 30711, + 45898: 30713, + 45899: 30714, + 45900: 30715, + 45901: 30716, + 45902: 30723, + 45903: 30724, + 45904: 30725, + 45905: 30726, + 45906: 30727, + 45907: 30728, + 45908: 30730, + 45909: 30731, + 45910: 30734, + 45911: 30735, + 45912: 30736, + 45913: 30739, + 45914: 30741, + 45915: 30745, + 45916: 30747, + 45917: 30750, + 45918: 30752, + 45919: 30753, + 45920: 30754, + 45921: 30756, + 45922: 30760, + 45923: 30762, + 45924: 30763, + 45925: 30766, + 45926: 30767, + 45927: 30769, + 45928: 30770, + 45929: 30771, + 45930: 30773, + 45931: 30774, + 45932: 30781, + 45933: 30783, + 45934: 30785, + 45935: 30786, + 45936: 30787, + 45937: 30788, + 45938: 30790, + 45939: 30792, + 45940: 30793, + 45941: 30794, + 45942: 30795, + 45943: 30797, + 45944: 30799, + 45945: 30801, + 45946: 30803, + 45947: 30804, + 45948: 30808, + 45949: 30809, + 45950: 30810, + 45952: 30811, + 45953: 30812, + 45954: 30814, + 45955: 30815, + 45956: 30816, + 45957: 30817, + 45958: 30818, + 45959: 30819, + 45960: 30820, + 45961: 30821, + 45962: 30822, + 45963: 30823, + 45964: 30824, + 45965: 30825, + 45966: 30831, + 45967: 30832, + 45968: 30833, + 45969: 30834, + 45970: 30835, + 45971: 30836, + 45972: 30837, + 45973: 30838, + 45974: 30840, + 45975: 30841, + 45976: 30842, + 45977: 30843, + 45978: 30845, + 45979: 30846, + 45980: 30847, + 45981: 30848, + 45982: 30849, + 45983: 30850, + 45984: 30851, + 45985: 22330, + 45986: 23581, + 45987: 24120, + 45988: 38271, + 45989: 20607, + 45990: 32928, + 45991: 21378, + 45992: 25950, + 45993: 30021, + 45994: 21809, + 45995: 20513, + 45996: 36229, + 45997: 25220, + 45998: 38046, + 45999: 26397, + 46000: 22066, + 46001: 28526, + 46002: 24034, + 46003: 21557, + 46004: 28818, + 46005: 36710, + 46006: 25199, + 46007: 25764, + 46008: 25507, + 46009: 24443, + 46010: 28552, + 46011: 37108, + 46012: 33251, + 46013: 36784, + 46014: 23576, + 46015: 26216, + 46016: 24561, + 46017: 27785, + 46018: 38472, + 46019: 36225, + 46020: 34924, + 46021: 25745, + 46022: 31216, + 46023: 22478, + 46024: 27225, + 46025: 25104, + 46026: 21576, + 46027: 20056, + 46028: 31243, + 46029: 24809, + 46030: 28548, + 46031: 35802, + 46032: 25215, + 46033: 36894, + 46034: 39563, + 46035: 31204, + 46036: 21507, + 46037: 30196, + 46038: 25345, + 46039: 21273, + 46040: 27744, + 46041: 36831, + 46042: 24347, + 46043: 39536, + 46044: 32827, + 46045: 40831, + 46046: 20360, + 46047: 23610, + 46048: 36196, + 46049: 32709, + 46050: 26021, + 46051: 28861, + 46052: 20805, + 46053: 20914, + 46054: 34411, + 46055: 23815, + 46056: 23456, + 46057: 25277, + 46058: 37228, + 46059: 30068, + 46060: 36364, + 46061: 31264, + 46062: 24833, + 46063: 31609, + 46064: 20167, + 46065: 32504, + 46066: 30597, + 46067: 19985, + 46068: 33261, + 46069: 21021, + 46070: 20986, + 46071: 27249, + 46072: 21416, + 46073: 36487, + 46074: 38148, + 46075: 38607, + 46076: 28353, + 46077: 38500, + 46078: 26970, + 46144: 30852, + 46145: 30853, + 46146: 30854, + 46147: 30856, + 46148: 30858, + 46149: 30859, + 46150: 30863, + 46151: 30864, + 46152: 30866, + 46153: 30868, + 46154: 30869, + 46155: 30870, + 46156: 30873, + 46157: 30877, + 46158: 30878, + 46159: 30880, + 46160: 30882, + 46161: 30884, + 46162: 30886, + 46163: 30888, + 46164: 30889, + 46165: 30890, + 46166: 30891, + 46167: 30892, + 46168: 30893, + 46169: 30894, + 46170: 30895, + 46171: 30901, + 46172: 30902, + 46173: 30903, + 46174: 30904, + 46175: 30906, + 46176: 30907, + 46177: 30908, + 46178: 30909, + 46179: 30911, + 46180: 30912, + 46181: 30914, + 46182: 30915, + 46183: 30916, + 46184: 30918, + 46185: 30919, + 46186: 30920, + 46187: 30924, + 46188: 30925, + 46189: 30926, + 46190: 30927, + 46191: 30929, + 46192: 30930, + 46193: 30931, + 46194: 30934, + 46195: 30935, + 46196: 30936, + 46197: 30938, + 46198: 30939, + 46199: 30940, + 46200: 30941, + 46201: 30942, + 46202: 30943, + 46203: 30944, + 46204: 30945, + 46205: 30946, + 46206: 30947, + 46208: 30948, + 46209: 30949, + 46210: 30950, + 46211: 30951, + 46212: 30953, + 46213: 30954, + 46214: 30955, + 46215: 30957, + 46216: 30958, + 46217: 30959, + 46218: 30960, + 46219: 30961, + 46220: 30963, + 46221: 30965, + 46222: 30966, + 46223: 30968, + 46224: 30969, + 46225: 30971, + 46226: 30972, + 46227: 30973, + 46228: 30974, + 46229: 30975, + 46230: 30976, + 46231: 30978, + 46232: 30979, + 46233: 30980, + 46234: 30982, + 46235: 30983, + 46236: 30984, + 46237: 30985, + 46238: 30986, + 46239: 30987, + 46240: 30988, + 46241: 30784, + 46242: 20648, + 46243: 30679, + 46244: 25616, + 46245: 35302, + 46246: 22788, + 46247: 25571, + 46248: 24029, + 46249: 31359, + 46250: 26941, + 46251: 20256, + 46252: 33337, + 46253: 21912, + 46254: 20018, + 46255: 30126, + 46256: 31383, + 46257: 24162, + 46258: 24202, + 46259: 38383, + 46260: 21019, + 46261: 21561, + 46262: 28810, + 46263: 25462, + 46264: 38180, + 46265: 22402, + 46266: 26149, + 46267: 26943, + 46268: 37255, + 46269: 21767, + 46270: 28147, + 46271: 32431, + 46272: 34850, + 46273: 25139, + 46274: 32496, + 46275: 30133, + 46276: 33576, + 46277: 30913, + 46278: 38604, + 46279: 36766, + 46280: 24904, + 46281: 29943, + 46282: 35789, + 46283: 27492, + 46284: 21050, + 46285: 36176, + 46286: 27425, + 46287: 32874, + 46288: 33905, + 46289: 22257, + 46290: 21254, + 46291: 20174, + 46292: 19995, + 46293: 20945, + 46294: 31895, + 46295: 37259, + 46296: 31751, + 46297: 20419, + 46298: 36479, + 46299: 31713, + 46300: 31388, + 46301: 25703, + 46302: 23828, + 46303: 20652, + 46304: 33030, + 46305: 30209, + 46306: 31929, + 46307: 28140, + 46308: 32736, + 46309: 26449, + 46310: 23384, + 46311: 23544, + 46312: 30923, + 46313: 25774, + 46314: 25619, + 46315: 25514, + 46316: 25387, + 46317: 38169, + 46318: 25645, + 46319: 36798, + 46320: 31572, + 46321: 30249, + 46322: 25171, + 46323: 22823, + 46324: 21574, + 46325: 27513, + 46326: 20643, + 46327: 25140, + 46328: 24102, + 46329: 27526, + 46330: 20195, + 46331: 36151, + 46332: 34955, + 46333: 24453, + 46334: 36910, + 46400: 30989, + 46401: 30990, + 46402: 30991, + 46403: 30992, + 46404: 30993, + 46405: 30994, + 46406: 30996, + 46407: 30997, + 46408: 30998, + 46409: 30999, + 46410: 31000, + 46411: 31001, + 46412: 31002, + 46413: 31003, + 46414: 31004, + 46415: 31005, + 46416: 31007, + 46417: 31008, + 46418: 31009, + 46419: 31010, + 46420: 31011, + 46421: 31013, + 46422: 31014, + 46423: 31015, + 46424: 31016, + 46425: 31017, + 46426: 31018, + 46427: 31019, + 46428: 31020, + 46429: 31021, + 46430: 31022, + 46431: 31023, + 46432: 31024, + 46433: 31025, + 46434: 31026, + 46435: 31027, + 46436: 31029, + 46437: 31030, + 46438: 31031, + 46439: 31032, + 46440: 31033, + 46441: 31037, + 46442: 31039, + 46443: 31042, + 46444: 31043, + 46445: 31044, + 46446: 31045, + 46447: 31047, + 46448: 31050, + 46449: 31051, + 46450: 31052, + 46451: 31053, + 46452: 31054, + 46453: 31055, + 46454: 31056, + 46455: 31057, + 46456: 31058, + 46457: 31060, + 46458: 31061, + 46459: 31064, + 46460: 31065, + 46461: 31073, + 46462: 31075, + 46464: 31076, + 46465: 31078, + 46466: 31081, + 46467: 31082, + 46468: 31083, + 46469: 31084, + 46470: 31086, + 46471: 31088, + 46472: 31089, + 46473: 31090, + 46474: 31091, + 46475: 31092, + 46476: 31093, + 46477: 31094, + 46478: 31097, + 46479: 31099, + 46480: 31100, + 46481: 31101, + 46482: 31102, + 46483: 31103, + 46484: 31106, + 46485: 31107, + 46486: 31110, + 46487: 31111, + 46488: 31112, + 46489: 31113, + 46490: 31115, + 46491: 31116, + 46492: 31117, + 46493: 31118, + 46494: 31120, + 46495: 31121, + 46496: 31122, + 46497: 24608, + 46498: 32829, + 46499: 25285, + 46500: 20025, + 46501: 21333, + 46502: 37112, + 46503: 25528, + 46504: 32966, + 46505: 26086, + 46506: 27694, + 46507: 20294, + 46508: 24814, + 46509: 28129, + 46510: 35806, + 46511: 24377, + 46512: 34507, + 46513: 24403, + 46514: 25377, + 46515: 20826, + 46516: 33633, + 46517: 26723, + 46518: 20992, + 46519: 25443, + 46520: 36424, + 46521: 20498, + 46522: 23707, + 46523: 31095, + 46524: 23548, + 46525: 21040, + 46526: 31291, + 46527: 24764, + 46528: 36947, + 46529: 30423, + 46530: 24503, + 46531: 24471, + 46532: 30340, + 46533: 36460, + 46534: 28783, + 46535: 30331, + 46536: 31561, + 46537: 30634, + 46538: 20979, + 46539: 37011, + 46540: 22564, + 46541: 20302, + 46542: 28404, + 46543: 36842, + 46544: 25932, + 46545: 31515, + 46546: 29380, + 46547: 28068, + 46548: 32735, + 46549: 23265, + 46550: 25269, + 46551: 24213, + 46552: 22320, + 46553: 33922, + 46554: 31532, + 46555: 24093, + 46556: 24351, + 46557: 36882, + 46558: 32532, + 46559: 39072, + 46560: 25474, + 46561: 28359, + 46562: 30872, + 46563: 28857, + 46564: 20856, + 46565: 38747, + 46566: 22443, + 46567: 30005, + 46568: 20291, + 46569: 30008, + 46570: 24215, + 46571: 24806, + 46572: 22880, + 46573: 28096, + 46574: 27583, + 46575: 30857, + 46576: 21500, + 46577: 38613, + 46578: 20939, + 46579: 20993, + 46580: 25481, + 46581: 21514, + 46582: 38035, + 46583: 35843, + 46584: 36300, + 46585: 29241, + 46586: 30879, + 46587: 34678, + 46588: 36845, + 46589: 35853, + 46590: 21472, + 46656: 31123, + 46657: 31124, + 46658: 31125, + 46659: 31126, + 46660: 31127, + 46661: 31128, + 46662: 31129, + 46663: 31131, + 46664: 31132, + 46665: 31133, + 46666: 31134, + 46667: 31135, + 46668: 31136, + 46669: 31137, + 46670: 31138, + 46671: 31139, + 46672: 31140, + 46673: 31141, + 46674: 31142, + 46675: 31144, + 46676: 31145, + 46677: 31146, + 46678: 31147, + 46679: 31148, + 46680: 31149, + 46681: 31150, + 46682: 31151, + 46683: 31152, + 46684: 31153, + 46685: 31154, + 46686: 31156, + 46687: 31157, + 46688: 31158, + 46689: 31159, + 46690: 31160, + 46691: 31164, + 46692: 31167, + 46693: 31170, + 46694: 31172, + 46695: 31173, + 46696: 31175, + 46697: 31176, + 46698: 31178, + 46699: 31180, + 46700: 31182, + 46701: 31183, + 46702: 31184, + 46703: 31187, + 46704: 31188, + 46705: 31190, + 46706: 31191, + 46707: 31193, + 46708: 31194, + 46709: 31195, + 46710: 31196, + 46711: 31197, + 46712: 31198, + 46713: 31200, + 46714: 31201, + 46715: 31202, + 46716: 31205, + 46717: 31208, + 46718: 31210, + 46720: 31212, + 46721: 31214, + 46722: 31217, + 46723: 31218, + 46724: 31219, + 46725: 31220, + 46726: 31221, + 46727: 31222, + 46728: 31223, + 46729: 31225, + 46730: 31226, + 46731: 31228, + 46732: 31230, + 46733: 31231, + 46734: 31233, + 46735: 31236, + 46736: 31237, + 46737: 31239, + 46738: 31240, + 46739: 31241, + 46740: 31242, + 46741: 31244, + 46742: 31247, + 46743: 31248, + 46744: 31249, + 46745: 31250, + 46746: 31251, + 46747: 31253, + 46748: 31254, + 46749: 31256, + 46750: 31257, + 46751: 31259, + 46752: 31260, + 46753: 19969, + 46754: 30447, + 46755: 21486, + 46756: 38025, + 46757: 39030, + 46758: 40718, + 46759: 38189, + 46760: 23450, + 46761: 35746, + 46762: 20002, + 46763: 19996, + 46764: 20908, + 46765: 33891, + 46766: 25026, + 46767: 21160, + 46768: 26635, + 46769: 20375, + 46770: 24683, + 46771: 20923, + 46772: 27934, + 46773: 20828, + 46774: 25238, + 46775: 26007, + 46776: 38497, + 46777: 35910, + 46778: 36887, + 46779: 30168, + 46780: 37117, + 46781: 30563, + 46782: 27602, + 46783: 29322, + 46784: 29420, + 46785: 35835, + 46786: 22581, + 46787: 30585, + 46788: 36172, + 46789: 26460, + 46790: 38208, + 46791: 32922, + 46792: 24230, + 46793: 28193, + 46794: 22930, + 46795: 31471, + 46796: 30701, + 46797: 38203, + 46798: 27573, + 46799: 26029, + 46800: 32526, + 46801: 22534, + 46802: 20817, + 46803: 38431, + 46804: 23545, + 46805: 22697, + 46806: 21544, + 46807: 36466, + 46808: 25958, + 46809: 39039, + 46810: 22244, + 46811: 38045, + 46812: 30462, + 46813: 36929, + 46814: 25479, + 46815: 21702, + 46816: 22810, + 46817: 22842, + 46818: 22427, + 46819: 36530, + 46820: 26421, + 46821: 36346, + 46822: 33333, + 46823: 21057, + 46824: 24816, + 46825: 22549, + 46826: 34558, + 46827: 23784, + 46828: 40517, + 46829: 20420, + 46830: 39069, + 46831: 35769, + 46832: 23077, + 46833: 24694, + 46834: 21380, + 46835: 25212, + 46836: 36943, + 46837: 37122, + 46838: 39295, + 46839: 24681, + 46840: 32780, + 46841: 20799, + 46842: 32819, + 46843: 23572, + 46844: 39285, + 46845: 27953, + 46846: 20108, + 46912: 31261, + 46913: 31263, + 46914: 31265, + 46915: 31266, + 46916: 31268, + 46917: 31269, + 46918: 31270, + 46919: 31271, + 46920: 31272, + 46921: 31273, + 46922: 31274, + 46923: 31275, + 46924: 31276, + 46925: 31277, + 46926: 31278, + 46927: 31279, + 46928: 31280, + 46929: 31281, + 46930: 31282, + 46931: 31284, + 46932: 31285, + 46933: 31286, + 46934: 31288, + 46935: 31290, + 46936: 31294, + 46937: 31296, + 46938: 31297, + 46939: 31298, + 46940: 31299, + 46941: 31300, + 46942: 31301, + 46943: 31303, + 46944: 31304, + 46945: 31305, + 46946: 31306, + 46947: 31307, + 46948: 31308, + 46949: 31309, + 46950: 31310, + 46951: 31311, + 46952: 31312, + 46953: 31314, + 46954: 31315, + 46955: 31316, + 46956: 31317, + 46957: 31318, + 46958: 31320, + 46959: 31321, + 46960: 31322, + 46961: 31323, + 46962: 31324, + 46963: 31325, + 46964: 31326, + 46965: 31327, + 46966: 31328, + 46967: 31329, + 46968: 31330, + 46969: 31331, + 46970: 31332, + 46971: 31333, + 46972: 31334, + 46973: 31335, + 46974: 31336, + 46976: 31337, + 46977: 31338, + 46978: 31339, + 46979: 31340, + 46980: 31341, + 46981: 31342, + 46982: 31343, + 46983: 31345, + 46984: 31346, + 46985: 31347, + 46986: 31349, + 46987: 31355, + 46988: 31356, + 46989: 31357, + 46990: 31358, + 46991: 31362, + 46992: 31365, + 46993: 31367, + 46994: 31369, + 46995: 31370, + 46996: 31371, + 46997: 31372, + 46998: 31374, + 46999: 31375, + 47000: 31376, + 47001: 31379, + 47002: 31380, + 47003: 31385, + 47004: 31386, + 47005: 31387, + 47006: 31390, + 47007: 31393, + 47008: 31394, + 47009: 36144, + 47010: 21457, + 47011: 32602, + 47012: 31567, + 47013: 20240, + 47014: 20047, + 47015: 38400, + 47016: 27861, + 47017: 29648, + 47018: 34281, + 47019: 24070, + 47020: 30058, + 47021: 32763, + 47022: 27146, + 47023: 30718, + 47024: 38034, + 47025: 32321, + 47026: 20961, + 47027: 28902, + 47028: 21453, + 47029: 36820, + 47030: 33539, + 47031: 36137, + 47032: 29359, + 47033: 39277, + 47034: 27867, + 47035: 22346, + 47036: 33459, + 47037: 26041, + 47038: 32938, + 47039: 25151, + 47040: 38450, + 47041: 22952, + 47042: 20223, + 47043: 35775, + 47044: 32442, + 47045: 25918, + 47046: 33778, + 47047: 38750, + 47048: 21857, + 47049: 39134, + 47050: 32933, + 47051: 21290, + 47052: 35837, + 47053: 21536, + 47054: 32954, + 47055: 24223, + 47056: 27832, + 47057: 36153, + 47058: 33452, + 47059: 37210, + 47060: 21545, + 47061: 27675, + 47062: 20998, + 47063: 32439, + 47064: 22367, + 47065: 28954, + 47066: 27774, + 47067: 31881, + 47068: 22859, + 47069: 20221, + 47070: 24575, + 47071: 24868, + 47072: 31914, + 47073: 20016, + 47074: 23553, + 47075: 26539, + 47076: 34562, + 47077: 23792, + 47078: 38155, + 47079: 39118, + 47080: 30127, + 47081: 28925, + 47082: 36898, + 47083: 20911, + 47084: 32541, + 47085: 35773, + 47086: 22857, + 47087: 20964, + 47088: 20315, + 47089: 21542, + 47090: 22827, + 47091: 25975, + 47092: 32932, + 47093: 23413, + 47094: 25206, + 47095: 25282, + 47096: 36752, + 47097: 24133, + 47098: 27679, + 47099: 31526, + 47100: 20239, + 47101: 20440, + 47102: 26381, + 47168: 31395, + 47169: 31396, + 47170: 31399, + 47171: 31401, + 47172: 31402, + 47173: 31403, + 47174: 31406, + 47175: 31407, + 47176: 31408, + 47177: 31409, + 47178: 31410, + 47179: 31412, + 47180: 31413, + 47181: 31414, + 47182: 31415, + 47183: 31416, + 47184: 31417, + 47185: 31418, + 47186: 31419, + 47187: 31420, + 47188: 31421, + 47189: 31422, + 47190: 31424, + 47191: 31425, + 47192: 31426, + 47193: 31427, + 47194: 31428, + 47195: 31429, + 47196: 31430, + 47197: 31431, + 47198: 31432, + 47199: 31433, + 47200: 31434, + 47201: 31436, + 47202: 31437, + 47203: 31438, + 47204: 31439, + 47205: 31440, + 47206: 31441, + 47207: 31442, + 47208: 31443, + 47209: 31444, + 47210: 31445, + 47211: 31447, + 47212: 31448, + 47213: 31450, + 47214: 31451, + 47215: 31452, + 47216: 31453, + 47217: 31457, + 47218: 31458, + 47219: 31460, + 47220: 31463, + 47221: 31464, + 47222: 31465, + 47223: 31466, + 47224: 31467, + 47225: 31468, + 47226: 31470, + 47227: 31472, + 47228: 31473, + 47229: 31474, + 47230: 31475, + 47232: 31476, + 47233: 31477, + 47234: 31478, + 47235: 31479, + 47236: 31480, + 47237: 31483, + 47238: 31484, + 47239: 31486, + 47240: 31488, + 47241: 31489, + 47242: 31490, + 47243: 31493, + 47244: 31495, + 47245: 31497, + 47246: 31500, + 47247: 31501, + 47248: 31502, + 47249: 31504, + 47250: 31506, + 47251: 31507, + 47252: 31510, + 47253: 31511, + 47254: 31512, + 47255: 31514, + 47256: 31516, + 47257: 31517, + 47258: 31519, + 47259: 31521, + 47260: 31522, + 47261: 31523, + 47262: 31527, + 47263: 31529, + 47264: 31533, + 47265: 28014, + 47266: 28074, + 47267: 31119, + 47268: 34993, + 47269: 24343, + 47270: 29995, + 47271: 25242, + 47272: 36741, + 47273: 20463, + 47274: 37340, + 47275: 26023, + 47276: 33071, + 47277: 33105, + 47278: 24220, + 47279: 33104, + 47280: 36212, + 47281: 21103, + 47282: 35206, + 47283: 36171, + 47284: 22797, + 47285: 20613, + 47286: 20184, + 47287: 38428, + 47288: 29238, + 47289: 33145, + 47290: 36127, + 47291: 23500, + 47292: 35747, + 47293: 38468, + 47294: 22919, + 47295: 32538, + 47296: 21648, + 47297: 22134, + 47298: 22030, + 47299: 35813, + 47300: 25913, + 47301: 27010, + 47302: 38041, + 47303: 30422, + 47304: 28297, + 47305: 24178, + 47306: 29976, + 47307: 26438, + 47308: 26577, + 47309: 31487, + 47310: 32925, + 47311: 36214, + 47312: 24863, + 47313: 31174, + 47314: 25954, + 47315: 36195, + 47316: 20872, + 47317: 21018, + 47318: 38050, + 47319: 32568, + 47320: 32923, + 47321: 32434, + 47322: 23703, + 47323: 28207, + 47324: 26464, + 47325: 31705, + 47326: 30347, + 47327: 39640, + 47328: 33167, + 47329: 32660, + 47330: 31957, + 47331: 25630, + 47332: 38224, + 47333: 31295, + 47334: 21578, + 47335: 21733, + 47336: 27468, + 47337: 25601, + 47338: 25096, + 47339: 40509, + 47340: 33011, + 47341: 30105, + 47342: 21106, + 47343: 38761, + 47344: 33883, + 47345: 26684, + 47346: 34532, + 47347: 38401, + 47348: 38548, + 47349: 38124, + 47350: 20010, + 47351: 21508, + 47352: 32473, + 47353: 26681, + 47354: 36319, + 47355: 32789, + 47356: 26356, + 47357: 24218, + 47358: 32697, + 47424: 31535, + 47425: 31536, + 47426: 31538, + 47427: 31540, + 47428: 31541, + 47429: 31542, + 47430: 31543, + 47431: 31545, + 47432: 31547, + 47433: 31549, + 47434: 31551, + 47435: 31552, + 47436: 31553, + 47437: 31554, + 47438: 31555, + 47439: 31556, + 47440: 31558, + 47441: 31560, + 47442: 31562, + 47443: 31565, + 47444: 31566, + 47445: 31571, + 47446: 31573, + 47447: 31575, + 47448: 31577, + 47449: 31580, + 47450: 31582, + 47451: 31583, + 47452: 31585, + 47453: 31587, + 47454: 31588, + 47455: 31589, + 47456: 31590, + 47457: 31591, + 47458: 31592, + 47459: 31593, + 47460: 31594, + 47461: 31595, + 47462: 31596, + 47463: 31597, + 47464: 31599, + 47465: 31600, + 47466: 31603, + 47467: 31604, + 47468: 31606, + 47469: 31608, + 47470: 31610, + 47471: 31612, + 47472: 31613, + 47473: 31615, + 47474: 31617, + 47475: 31618, + 47476: 31619, + 47477: 31620, + 47478: 31622, + 47479: 31623, + 47480: 31624, + 47481: 31625, + 47482: 31626, + 47483: 31627, + 47484: 31628, + 47485: 31630, + 47486: 31631, + 47488: 31633, + 47489: 31634, + 47490: 31635, + 47491: 31638, + 47492: 31640, + 47493: 31641, + 47494: 31642, + 47495: 31643, + 47496: 31646, + 47497: 31647, + 47498: 31648, + 47499: 31651, + 47500: 31652, + 47501: 31653, + 47502: 31662, + 47503: 31663, + 47504: 31664, + 47505: 31666, + 47506: 31667, + 47507: 31669, + 47508: 31670, + 47509: 31671, + 47510: 31673, + 47511: 31674, + 47512: 31675, + 47513: 31676, + 47514: 31677, + 47515: 31678, + 47516: 31679, + 47517: 31680, + 47518: 31682, + 47519: 31683, + 47520: 31684, + 47521: 22466, + 47522: 32831, + 47523: 26775, + 47524: 24037, + 47525: 25915, + 47526: 21151, + 47527: 24685, + 47528: 40858, + 47529: 20379, + 47530: 36524, + 47531: 20844, + 47532: 23467, + 47533: 24339, + 47534: 24041, + 47535: 27742, + 47536: 25329, + 47537: 36129, + 47538: 20849, + 47539: 38057, + 47540: 21246, + 47541: 27807, + 47542: 33503, + 47543: 29399, + 47544: 22434, + 47545: 26500, + 47546: 36141, + 47547: 22815, + 47548: 36764, + 47549: 33735, + 47550: 21653, + 47551: 31629, + 47552: 20272, + 47553: 27837, + 47554: 23396, + 47555: 22993, + 47556: 40723, + 47557: 21476, + 47558: 34506, + 47559: 39592, + 47560: 35895, + 47561: 32929, + 47562: 25925, + 47563: 39038, + 47564: 22266, + 47565: 38599, + 47566: 21038, + 47567: 29916, + 47568: 21072, + 47569: 23521, + 47570: 25346, + 47571: 35074, + 47572: 20054, + 47573: 25296, + 47574: 24618, + 47575: 26874, + 47576: 20851, + 47577: 23448, + 47578: 20896, + 47579: 35266, + 47580: 31649, + 47581: 39302, + 47582: 32592, + 47583: 24815, + 47584: 28748, + 47585: 36143, + 47586: 20809, + 47587: 24191, + 47588: 36891, + 47589: 29808, + 47590: 35268, + 47591: 22317, + 47592: 30789, + 47593: 24402, + 47594: 40863, + 47595: 38394, + 47596: 36712, + 47597: 39740, + 47598: 35809, + 47599: 30328, + 47600: 26690, + 47601: 26588, + 47602: 36330, + 47603: 36149, + 47604: 21053, + 47605: 36746, + 47606: 28378, + 47607: 26829, + 47608: 38149, + 47609: 37101, + 47610: 22269, + 47611: 26524, + 47612: 35065, + 47613: 36807, + 47614: 21704, + 47680: 31685, + 47681: 31688, + 47682: 31689, + 47683: 31690, + 47684: 31691, + 47685: 31693, + 47686: 31694, + 47687: 31695, + 47688: 31696, + 47689: 31698, + 47690: 31700, + 47691: 31701, + 47692: 31702, + 47693: 31703, + 47694: 31704, + 47695: 31707, + 47696: 31708, + 47697: 31710, + 47698: 31711, + 47699: 31712, + 47700: 31714, + 47701: 31715, + 47702: 31716, + 47703: 31719, + 47704: 31720, + 47705: 31721, + 47706: 31723, + 47707: 31724, + 47708: 31725, + 47709: 31727, + 47710: 31728, + 47711: 31730, + 47712: 31731, + 47713: 31732, + 47714: 31733, + 47715: 31734, + 47716: 31736, + 47717: 31737, + 47718: 31738, + 47719: 31739, + 47720: 31741, + 47721: 31743, + 47722: 31744, + 47723: 31745, + 47724: 31746, + 47725: 31747, + 47726: 31748, + 47727: 31749, + 47728: 31750, + 47729: 31752, + 47730: 31753, + 47731: 31754, + 47732: 31757, + 47733: 31758, + 47734: 31760, + 47735: 31761, + 47736: 31762, + 47737: 31763, + 47738: 31764, + 47739: 31765, + 47740: 31767, + 47741: 31768, + 47742: 31769, + 47744: 31770, + 47745: 31771, + 47746: 31772, + 47747: 31773, + 47748: 31774, + 47749: 31776, + 47750: 31777, + 47751: 31778, + 47752: 31779, + 47753: 31780, + 47754: 31781, + 47755: 31784, + 47756: 31785, + 47757: 31787, + 47758: 31788, + 47759: 31789, + 47760: 31790, + 47761: 31791, + 47762: 31792, + 47763: 31793, + 47764: 31794, + 47765: 31795, + 47766: 31796, + 47767: 31797, + 47768: 31798, + 47769: 31799, + 47770: 31801, + 47771: 31802, + 47772: 31803, + 47773: 31804, + 47774: 31805, + 47775: 31806, + 47776: 31810, + 47777: 39608, + 47778: 23401, + 47779: 28023, + 47780: 27686, + 47781: 20133, + 47782: 23475, + 47783: 39559, + 47784: 37219, + 47785: 25000, + 47786: 37039, + 47787: 38889, + 47788: 21547, + 47789: 28085, + 47790: 23506, + 47791: 20989, + 47792: 21898, + 47793: 32597, + 47794: 32752, + 47795: 25788, + 47796: 25421, + 47797: 26097, + 47798: 25022, + 47799: 24717, + 47800: 28938, + 47801: 27735, + 47802: 27721, + 47803: 22831, + 47804: 26477, + 47805: 33322, + 47806: 22741, + 47807: 22158, + 47808: 35946, + 47809: 27627, + 47810: 37085, + 47811: 22909, + 47812: 32791, + 47813: 21495, + 47814: 28009, + 47815: 21621, + 47816: 21917, + 47817: 33655, + 47818: 33743, + 47819: 26680, + 47820: 31166, + 47821: 21644, + 47822: 20309, + 47823: 21512, + 47824: 30418, + 47825: 35977, + 47826: 38402, + 47827: 27827, + 47828: 28088, + 47829: 36203, + 47830: 35088, + 47831: 40548, + 47832: 36154, + 47833: 22079, + 47834: 40657, + 47835: 30165, + 47836: 24456, + 47837: 29408, + 47838: 24680, + 47839: 21756, + 47840: 20136, + 47841: 27178, + 47842: 34913, + 47843: 24658, + 47844: 36720, + 47845: 21700, + 47846: 28888, + 47847: 34425, + 47848: 40511, + 47849: 27946, + 47850: 23439, + 47851: 24344, + 47852: 32418, + 47853: 21897, + 47854: 20399, + 47855: 29492, + 47856: 21564, + 47857: 21402, + 47858: 20505, + 47859: 21518, + 47860: 21628, + 47861: 20046, + 47862: 24573, + 47863: 29786, + 47864: 22774, + 47865: 33899, + 47866: 32993, + 47867: 34676, + 47868: 29392, + 47869: 31946, + 47870: 28246, + 47936: 31811, + 47937: 31812, + 47938: 31813, + 47939: 31814, + 47940: 31815, + 47941: 31816, + 47942: 31817, + 47943: 31818, + 47944: 31819, + 47945: 31820, + 47946: 31822, + 47947: 31823, + 47948: 31824, + 47949: 31825, + 47950: 31826, + 47951: 31827, + 47952: 31828, + 47953: 31829, + 47954: 31830, + 47955: 31831, + 47956: 31832, + 47957: 31833, + 47958: 31834, + 47959: 31835, + 47960: 31836, + 47961: 31837, + 47962: 31838, + 47963: 31839, + 47964: 31840, + 47965: 31841, + 47966: 31842, + 47967: 31843, + 47968: 31844, + 47969: 31845, + 47970: 31846, + 47971: 31847, + 47972: 31848, + 47973: 31849, + 47974: 31850, + 47975: 31851, + 47976: 31852, + 47977: 31853, + 47978: 31854, + 47979: 31855, + 47980: 31856, + 47981: 31857, + 47982: 31858, + 47983: 31861, + 47984: 31862, + 47985: 31863, + 47986: 31864, + 47987: 31865, + 47988: 31866, + 47989: 31870, + 47990: 31871, + 47991: 31872, + 47992: 31873, + 47993: 31874, + 47994: 31875, + 47995: 31876, + 47996: 31877, + 47997: 31878, + 47998: 31879, + 48000: 31880, + 48001: 31882, + 48002: 31883, + 48003: 31884, + 48004: 31885, + 48005: 31886, + 48006: 31887, + 48007: 31888, + 48008: 31891, + 48009: 31892, + 48010: 31894, + 48011: 31897, + 48012: 31898, + 48013: 31899, + 48014: 31904, + 48015: 31905, + 48016: 31907, + 48017: 31910, + 48018: 31911, + 48019: 31912, + 48020: 31913, + 48021: 31915, + 48022: 31916, + 48023: 31917, + 48024: 31919, + 48025: 31920, + 48026: 31924, + 48027: 31925, + 48028: 31926, + 48029: 31927, + 48030: 31928, + 48031: 31930, + 48032: 31931, + 48033: 24359, + 48034: 34382, + 48035: 21804, + 48036: 25252, + 48037: 20114, + 48038: 27818, + 48039: 25143, + 48040: 33457, + 48041: 21719, + 48042: 21326, + 48043: 29502, + 48044: 28369, + 48045: 30011, + 48046: 21010, + 48047: 21270, + 48048: 35805, + 48049: 27088, + 48050: 24458, + 48051: 24576, + 48052: 28142, + 48053: 22351, + 48054: 27426, + 48055: 29615, + 48056: 26707, + 48057: 36824, + 48058: 32531, + 48059: 25442, + 48060: 24739, + 48061: 21796, + 48062: 30186, + 48063: 35938, + 48064: 28949, + 48065: 28067, + 48066: 23462, + 48067: 24187, + 48068: 33618, + 48069: 24908, + 48070: 40644, + 48071: 30970, + 48072: 34647, + 48073: 31783, + 48074: 30343, + 48075: 20976, + 48076: 24822, + 48077: 29004, + 48078: 26179, + 48079: 24140, + 48080: 24653, + 48081: 35854, + 48082: 28784, + 48083: 25381, + 48084: 36745, + 48085: 24509, + 48086: 24674, + 48087: 34516, + 48088: 22238, + 48089: 27585, + 48090: 24724, + 48091: 24935, + 48092: 21321, + 48093: 24800, + 48094: 26214, + 48095: 36159, + 48096: 31229, + 48097: 20250, + 48098: 28905, + 48099: 27719, + 48100: 35763, + 48101: 35826, + 48102: 32472, + 48103: 33636, + 48104: 26127, + 48105: 23130, + 48106: 39746, + 48107: 27985, + 48108: 28151, + 48109: 35905, + 48110: 27963, + 48111: 20249, + 48112: 28779, + 48113: 33719, + 48114: 25110, + 48115: 24785, + 48116: 38669, + 48117: 36135, + 48118: 31096, + 48119: 20987, + 48120: 22334, + 48121: 22522, + 48122: 26426, + 48123: 30072, + 48124: 31293, + 48125: 31215, + 48126: 31637, + 48192: 31935, + 48193: 31936, + 48194: 31938, + 48195: 31939, + 48196: 31940, + 48197: 31942, + 48198: 31945, + 48199: 31947, + 48200: 31950, + 48201: 31951, + 48202: 31952, + 48203: 31953, + 48204: 31954, + 48205: 31955, + 48206: 31956, + 48207: 31960, + 48208: 31962, + 48209: 31963, + 48210: 31965, + 48211: 31966, + 48212: 31969, + 48213: 31970, + 48214: 31971, + 48215: 31972, + 48216: 31973, + 48217: 31974, + 48218: 31975, + 48219: 31977, + 48220: 31978, + 48221: 31979, + 48222: 31980, + 48223: 31981, + 48224: 31982, + 48225: 31984, + 48226: 31985, + 48227: 31986, + 48228: 31987, + 48229: 31988, + 48230: 31989, + 48231: 31990, + 48232: 31991, + 48233: 31993, + 48234: 31994, + 48235: 31996, + 48236: 31997, + 48237: 31998, + 48238: 31999, + 48239: 32000, + 48240: 32001, + 48241: 32002, + 48242: 32003, + 48243: 32004, + 48244: 32005, + 48245: 32006, + 48246: 32007, + 48247: 32008, + 48248: 32009, + 48249: 32011, + 48250: 32012, + 48251: 32013, + 48252: 32014, + 48253: 32015, + 48254: 32016, + 48256: 32017, + 48257: 32018, + 48258: 32019, + 48259: 32020, + 48260: 32021, + 48261: 32022, + 48262: 32023, + 48263: 32024, + 48264: 32025, + 48265: 32026, + 48266: 32027, + 48267: 32028, + 48268: 32029, + 48269: 32030, + 48270: 32031, + 48271: 32033, + 48272: 32035, + 48273: 32036, + 48274: 32037, + 48275: 32038, + 48276: 32040, + 48277: 32041, + 48278: 32042, + 48279: 32044, + 48280: 32045, + 48281: 32046, + 48282: 32048, + 48283: 32049, + 48284: 32050, + 48285: 32051, + 48286: 32052, + 48287: 32053, + 48288: 32054, + 48289: 32908, + 48290: 39269, + 48291: 36857, + 48292: 28608, + 48293: 35749, + 48294: 40481, + 48295: 23020, + 48296: 32489, + 48297: 32521, + 48298: 21513, + 48299: 26497, + 48300: 26840, + 48301: 36753, + 48302: 31821, + 48303: 38598, + 48304: 21450, + 48305: 24613, + 48306: 30142, + 48307: 27762, + 48308: 21363, + 48309: 23241, + 48310: 32423, + 48311: 25380, + 48312: 20960, + 48313: 33034, + 48314: 24049, + 48315: 34015, + 48316: 25216, + 48317: 20864, + 48318: 23395, + 48319: 20238, + 48320: 31085, + 48321: 21058, + 48322: 24760, + 48323: 27982, + 48324: 23492, + 48325: 23490, + 48326: 35745, + 48327: 35760, + 48328: 26082, + 48329: 24524, + 48330: 38469, + 48331: 22931, + 48332: 32487, + 48333: 32426, + 48334: 22025, + 48335: 26551, + 48336: 22841, + 48337: 20339, + 48338: 23478, + 48339: 21152, + 48340: 33626, + 48341: 39050, + 48342: 36158, + 48343: 30002, + 48344: 38078, + 48345: 20551, + 48346: 31292, + 48347: 20215, + 48348: 26550, + 48349: 39550, + 48350: 23233, + 48351: 27516, + 48352: 30417, + 48353: 22362, + 48354: 23574, + 48355: 31546, + 48356: 38388, + 48357: 29006, + 48358: 20860, + 48359: 32937, + 48360: 33392, + 48361: 22904, + 48362: 32516, + 48363: 33575, + 48364: 26816, + 48365: 26604, + 48366: 30897, + 48367: 30839, + 48368: 25315, + 48369: 25441, + 48370: 31616, + 48371: 20461, + 48372: 21098, + 48373: 20943, + 48374: 33616, + 48375: 27099, + 48376: 37492, + 48377: 36341, + 48378: 36145, + 48379: 35265, + 48380: 38190, + 48381: 31661, + 48382: 20214, + 48448: 32055, + 48449: 32056, + 48450: 32057, + 48451: 32058, + 48452: 32059, + 48453: 32060, + 48454: 32061, + 48455: 32062, + 48456: 32063, + 48457: 32064, + 48458: 32065, + 48459: 32066, + 48460: 32067, + 48461: 32068, + 48462: 32069, + 48463: 32070, + 48464: 32071, + 48465: 32072, + 48466: 32073, + 48467: 32074, + 48468: 32075, + 48469: 32076, + 48470: 32077, + 48471: 32078, + 48472: 32079, + 48473: 32080, + 48474: 32081, + 48475: 32082, + 48476: 32083, + 48477: 32084, + 48478: 32085, + 48479: 32086, + 48480: 32087, + 48481: 32088, + 48482: 32089, + 48483: 32090, + 48484: 32091, + 48485: 32092, + 48486: 32093, + 48487: 32094, + 48488: 32095, + 48489: 32096, + 48490: 32097, + 48491: 32098, + 48492: 32099, + 48493: 32100, + 48494: 32101, + 48495: 32102, + 48496: 32103, + 48497: 32104, + 48498: 32105, + 48499: 32106, + 48500: 32107, + 48501: 32108, + 48502: 32109, + 48503: 32111, + 48504: 32112, + 48505: 32113, + 48506: 32114, + 48507: 32115, + 48508: 32116, + 48509: 32117, + 48510: 32118, + 48512: 32120, + 48513: 32121, + 48514: 32122, + 48515: 32123, + 48516: 32124, + 48517: 32125, + 48518: 32126, + 48519: 32127, + 48520: 32128, + 48521: 32129, + 48522: 32130, + 48523: 32131, + 48524: 32132, + 48525: 32133, + 48526: 32134, + 48527: 32135, + 48528: 32136, + 48529: 32137, + 48530: 32138, + 48531: 32139, + 48532: 32140, + 48533: 32141, + 48534: 32142, + 48535: 32143, + 48536: 32144, + 48537: 32145, + 48538: 32146, + 48539: 32147, + 48540: 32148, + 48541: 32149, + 48542: 32150, + 48543: 32151, + 48544: 32152, + 48545: 20581, + 48546: 33328, + 48547: 21073, + 48548: 39279, + 48549: 28176, + 48550: 28293, + 48551: 28071, + 48552: 24314, + 48553: 20725, + 48554: 23004, + 48555: 23558, + 48556: 27974, + 48557: 27743, + 48558: 30086, + 48559: 33931, + 48560: 26728, + 48561: 22870, + 48562: 35762, + 48563: 21280, + 48564: 37233, + 48565: 38477, + 48566: 34121, + 48567: 26898, + 48568: 30977, + 48569: 28966, + 48570: 33014, + 48571: 20132, + 48572: 37066, + 48573: 27975, + 48574: 39556, + 48575: 23047, + 48576: 22204, + 48577: 25605, + 48578: 38128, + 48579: 30699, + 48580: 20389, + 48581: 33050, + 48582: 29409, + 48583: 35282, + 48584: 39290, + 48585: 32564, + 48586: 32478, + 48587: 21119, + 48588: 25945, + 48589: 37237, + 48590: 36735, + 48591: 36739, + 48592: 21483, + 48593: 31382, + 48594: 25581, + 48595: 25509, + 48596: 30342, + 48597: 31224, + 48598: 34903, + 48599: 38454, + 48600: 25130, + 48601: 21163, + 48602: 33410, + 48603: 26708, + 48604: 26480, + 48605: 25463, + 48606: 30571, + 48607: 31469, + 48608: 27905, + 48609: 32467, + 48610: 35299, + 48611: 22992, + 48612: 25106, + 48613: 34249, + 48614: 33445, + 48615: 30028, + 48616: 20511, + 48617: 20171, + 48618: 30117, + 48619: 35819, + 48620: 23626, + 48621: 24062, + 48622: 31563, + 48623: 26020, + 48624: 37329, + 48625: 20170, + 48626: 27941, + 48627: 35167, + 48628: 32039, + 48629: 38182, + 48630: 20165, + 48631: 35880, + 48632: 36827, + 48633: 38771, + 48634: 26187, + 48635: 31105, + 48636: 36817, + 48637: 28908, + 48638: 28024, + 48704: 32153, + 48705: 32154, + 48706: 32155, + 48707: 32156, + 48708: 32157, + 48709: 32158, + 48710: 32159, + 48711: 32160, + 48712: 32161, + 48713: 32162, + 48714: 32163, + 48715: 32164, + 48716: 32165, + 48717: 32167, + 48718: 32168, + 48719: 32169, + 48720: 32170, + 48721: 32171, + 48722: 32172, + 48723: 32173, + 48724: 32175, + 48725: 32176, + 48726: 32177, + 48727: 32178, + 48728: 32179, + 48729: 32180, + 48730: 32181, + 48731: 32182, + 48732: 32183, + 48733: 32184, + 48734: 32185, + 48735: 32186, + 48736: 32187, + 48737: 32188, + 48738: 32189, + 48739: 32190, + 48740: 32191, + 48741: 32192, + 48742: 32193, + 48743: 32194, + 48744: 32195, + 48745: 32196, + 48746: 32197, + 48747: 32198, + 48748: 32199, + 48749: 32200, + 48750: 32201, + 48751: 32202, + 48752: 32203, + 48753: 32204, + 48754: 32205, + 48755: 32206, + 48756: 32207, + 48757: 32208, + 48758: 32209, + 48759: 32210, + 48760: 32211, + 48761: 32212, + 48762: 32213, + 48763: 32214, + 48764: 32215, + 48765: 32216, + 48766: 32217, + 48768: 32218, + 48769: 32219, + 48770: 32220, + 48771: 32221, + 48772: 32222, + 48773: 32223, + 48774: 32224, + 48775: 32225, + 48776: 32226, + 48777: 32227, + 48778: 32228, + 48779: 32229, + 48780: 32230, + 48781: 32231, + 48782: 32232, + 48783: 32233, + 48784: 32234, + 48785: 32235, + 48786: 32236, + 48787: 32237, + 48788: 32238, + 48789: 32239, + 48790: 32240, + 48791: 32241, + 48792: 32242, + 48793: 32243, + 48794: 32244, + 48795: 32245, + 48796: 32246, + 48797: 32247, + 48798: 32248, + 48799: 32249, + 48800: 32250, + 48801: 23613, + 48802: 21170, + 48803: 33606, + 48804: 20834, + 48805: 33550, + 48806: 30555, + 48807: 26230, + 48808: 40120, + 48809: 20140, + 48810: 24778, + 48811: 31934, + 48812: 31923, + 48813: 32463, + 48814: 20117, + 48815: 35686, + 48816: 26223, + 48817: 39048, + 48818: 38745, + 48819: 22659, + 48820: 25964, + 48821: 38236, + 48822: 24452, + 48823: 30153, + 48824: 38742, + 48825: 31455, + 48826: 31454, + 48827: 20928, + 48828: 28847, + 48829: 31384, + 48830: 25578, + 48831: 31350, + 48832: 32416, + 48833: 29590, + 48834: 38893, + 48835: 20037, + 48836: 28792, + 48837: 20061, + 48838: 37202, + 48839: 21417, + 48840: 25937, + 48841: 26087, + 48842: 33276, + 48843: 33285, + 48844: 21646, + 48845: 23601, + 48846: 30106, + 48847: 38816, + 48848: 25304, + 48849: 29401, + 48850: 30141, + 48851: 23621, + 48852: 39545, + 48853: 33738, + 48854: 23616, + 48855: 21632, + 48856: 30697, + 48857: 20030, + 48858: 27822, + 48859: 32858, + 48860: 25298, + 48861: 25454, + 48862: 24040, + 48863: 20855, + 48864: 36317, + 48865: 36382, + 48866: 38191, + 48867: 20465, + 48868: 21477, + 48869: 24807, + 48870: 28844, + 48871: 21095, + 48872: 25424, + 48873: 40515, + 48874: 23071, + 48875: 20518, + 48876: 30519, + 48877: 21367, + 48878: 32482, + 48879: 25733, + 48880: 25899, + 48881: 25225, + 48882: 25496, + 48883: 20500, + 48884: 29237, + 48885: 35273, + 48886: 20915, + 48887: 35776, + 48888: 32477, + 48889: 22343, + 48890: 33740, + 48891: 38055, + 48892: 20891, + 48893: 21531, + 48894: 23803, + 48960: 32251, + 48961: 32252, + 48962: 32253, + 48963: 32254, + 48964: 32255, + 48965: 32256, + 48966: 32257, + 48967: 32258, + 48968: 32259, + 48969: 32260, + 48970: 32261, + 48971: 32262, + 48972: 32263, + 48973: 32264, + 48974: 32265, + 48975: 32266, + 48976: 32267, + 48977: 32268, + 48978: 32269, + 48979: 32270, + 48980: 32271, + 48981: 32272, + 48982: 32273, + 48983: 32274, + 48984: 32275, + 48985: 32276, + 48986: 32277, + 48987: 32278, + 48988: 32279, + 48989: 32280, + 48990: 32281, + 48991: 32282, + 48992: 32283, + 48993: 32284, + 48994: 32285, + 48995: 32286, + 48996: 32287, + 48997: 32288, + 48998: 32289, + 48999: 32290, + 49000: 32291, + 49001: 32292, + 49002: 32293, + 49003: 32294, + 49004: 32295, + 49005: 32296, + 49006: 32297, + 49007: 32298, + 49008: 32299, + 49009: 32300, + 49010: 32301, + 49011: 32302, + 49012: 32303, + 49013: 32304, + 49014: 32305, + 49015: 32306, + 49016: 32307, + 49017: 32308, + 49018: 32309, + 49019: 32310, + 49020: 32311, + 49021: 32312, + 49022: 32313, + 49024: 32314, + 49025: 32316, + 49026: 32317, + 49027: 32318, + 49028: 32319, + 49029: 32320, + 49030: 32322, + 49031: 32323, + 49032: 32324, + 49033: 32325, + 49034: 32326, + 49035: 32328, + 49036: 32329, + 49037: 32330, + 49038: 32331, + 49039: 32332, + 49040: 32333, + 49041: 32334, + 49042: 32335, + 49043: 32336, + 49044: 32337, + 49045: 32338, + 49046: 32339, + 49047: 32340, + 49048: 32341, + 49049: 32342, + 49050: 32343, + 49051: 32344, + 49052: 32345, + 49053: 32346, + 49054: 32347, + 49055: 32348, + 49056: 32349, + 49057: 20426, + 49058: 31459, + 49059: 27994, + 49060: 37089, + 49061: 39567, + 49062: 21888, + 49063: 21654, + 49064: 21345, + 49065: 21679, + 49066: 24320, + 49067: 25577, + 49068: 26999, + 49069: 20975, + 49070: 24936, + 49071: 21002, + 49072: 22570, + 49073: 21208, + 49074: 22350, + 49075: 30733, + 49076: 30475, + 49077: 24247, + 49078: 24951, + 49079: 31968, + 49080: 25179, + 49081: 25239, + 49082: 20130, + 49083: 28821, + 49084: 32771, + 49085: 25335, + 49086: 28900, + 49087: 38752, + 49088: 22391, + 49089: 33499, + 49090: 26607, + 49091: 26869, + 49092: 30933, + 49093: 39063, + 49094: 31185, + 49095: 22771, + 49096: 21683, + 49097: 21487, + 49098: 28212, + 49099: 20811, + 49100: 21051, + 49101: 23458, + 49102: 35838, + 49103: 32943, + 49104: 21827, + 49105: 22438, + 49106: 24691, + 49107: 22353, + 49108: 21549, + 49109: 31354, + 49110: 24656, + 49111: 23380, + 49112: 25511, + 49113: 25248, + 49114: 21475, + 49115: 25187, + 49116: 23495, + 49117: 26543, + 49118: 21741, + 49119: 31391, + 49120: 33510, + 49121: 37239, + 49122: 24211, + 49123: 35044, + 49124: 22840, + 49125: 22446, + 49126: 25358, + 49127: 36328, + 49128: 33007, + 49129: 22359, + 49130: 31607, + 49131: 20393, + 49132: 24555, + 49133: 23485, + 49134: 27454, + 49135: 21281, + 49136: 31568, + 49137: 29378, + 49138: 26694, + 49139: 30719, + 49140: 30518, + 49141: 26103, + 49142: 20917, + 49143: 20111, + 49144: 30420, + 49145: 23743, + 49146: 31397, + 49147: 33909, + 49148: 22862, + 49149: 39745, + 49150: 20608, + 49216: 32350, + 49217: 32351, + 49218: 32352, + 49219: 32353, + 49220: 32354, + 49221: 32355, + 49222: 32356, + 49223: 32357, + 49224: 32358, + 49225: 32359, + 49226: 32360, + 49227: 32361, + 49228: 32362, + 49229: 32363, + 49230: 32364, + 49231: 32365, + 49232: 32366, + 49233: 32367, + 49234: 32368, + 49235: 32369, + 49236: 32370, + 49237: 32371, + 49238: 32372, + 49239: 32373, + 49240: 32374, + 49241: 32375, + 49242: 32376, + 49243: 32377, + 49244: 32378, + 49245: 32379, + 49246: 32380, + 49247: 32381, + 49248: 32382, + 49249: 32383, + 49250: 32384, + 49251: 32385, + 49252: 32387, + 49253: 32388, + 49254: 32389, + 49255: 32390, + 49256: 32391, + 49257: 32392, + 49258: 32393, + 49259: 32394, + 49260: 32395, + 49261: 32396, + 49262: 32397, + 49263: 32398, + 49264: 32399, + 49265: 32400, + 49266: 32401, + 49267: 32402, + 49268: 32403, + 49269: 32404, + 49270: 32405, + 49271: 32406, + 49272: 32407, + 49273: 32408, + 49274: 32409, + 49275: 32410, + 49276: 32412, + 49277: 32413, + 49278: 32414, + 49280: 32430, + 49281: 32436, + 49282: 32443, + 49283: 32444, + 49284: 32470, + 49285: 32484, + 49286: 32492, + 49287: 32505, + 49288: 32522, + 49289: 32528, + 49290: 32542, + 49291: 32567, + 49292: 32569, + 49293: 32571, + 49294: 32572, + 49295: 32573, + 49296: 32574, + 49297: 32575, + 49298: 32576, + 49299: 32577, + 49300: 32579, + 49301: 32582, + 49302: 32583, + 49303: 32584, + 49304: 32585, + 49305: 32586, + 49306: 32587, + 49307: 32588, + 49308: 32589, + 49309: 32590, + 49310: 32591, + 49311: 32594, + 49312: 32595, + 49313: 39304, + 49314: 24871, + 49315: 28291, + 49316: 22372, + 49317: 26118, + 49318: 25414, + 49319: 22256, + 49320: 25324, + 49321: 25193, + 49322: 24275, + 49323: 38420, + 49324: 22403, + 49325: 25289, + 49326: 21895, + 49327: 34593, + 49328: 33098, + 49329: 36771, + 49330: 21862, + 49331: 33713, + 49332: 26469, + 49333: 36182, + 49334: 34013, + 49335: 23146, + 49336: 26639, + 49337: 25318, + 49338: 31726, + 49339: 38417, + 49340: 20848, + 49341: 28572, + 49342: 35888, + 49343: 25597, + 49344: 35272, + 49345: 25042, + 49346: 32518, + 49347: 28866, + 49348: 28389, + 49349: 29701, + 49350: 27028, + 49351: 29436, + 49352: 24266, + 49353: 37070, + 49354: 26391, + 49355: 28010, + 49356: 25438, + 49357: 21171, + 49358: 29282, + 49359: 32769, + 49360: 20332, + 49361: 23013, + 49362: 37226, + 49363: 28889, + 49364: 28061, + 49365: 21202, + 49366: 20048, + 49367: 38647, + 49368: 38253, + 49369: 34174, + 49370: 30922, + 49371: 32047, + 49372: 20769, + 49373: 22418, + 49374: 25794, + 49375: 32907, + 49376: 31867, + 49377: 27882, + 49378: 26865, + 49379: 26974, + 49380: 20919, + 49381: 21400, + 49382: 26792, + 49383: 29313, + 49384: 40654, + 49385: 31729, + 49386: 29432, + 49387: 31163, + 49388: 28435, + 49389: 29702, + 49390: 26446, + 49391: 37324, + 49392: 40100, + 49393: 31036, + 49394: 33673, + 49395: 33620, + 49396: 21519, + 49397: 26647, + 49398: 20029, + 49399: 21385, + 49400: 21169, + 49401: 30782, + 49402: 21382, + 49403: 21033, + 49404: 20616, + 49405: 20363, + 49406: 20432, + 49472: 32598, + 49473: 32601, + 49474: 32603, + 49475: 32604, + 49476: 32605, + 49477: 32606, + 49478: 32608, + 49479: 32611, + 49480: 32612, + 49481: 32613, + 49482: 32614, + 49483: 32615, + 49484: 32619, + 49485: 32620, + 49486: 32621, + 49487: 32623, + 49488: 32624, + 49489: 32627, + 49490: 32629, + 49491: 32630, + 49492: 32631, + 49493: 32632, + 49494: 32634, + 49495: 32635, + 49496: 32636, + 49497: 32637, + 49498: 32639, + 49499: 32640, + 49500: 32642, + 49501: 32643, + 49502: 32644, + 49503: 32645, + 49504: 32646, + 49505: 32647, + 49506: 32648, + 49507: 32649, + 49508: 32651, + 49509: 32653, + 49510: 32655, + 49511: 32656, + 49512: 32657, + 49513: 32658, + 49514: 32659, + 49515: 32661, + 49516: 32662, + 49517: 32663, + 49518: 32664, + 49519: 32665, + 49520: 32667, + 49521: 32668, + 49522: 32672, + 49523: 32674, + 49524: 32675, + 49525: 32677, + 49526: 32678, + 49527: 32680, + 49528: 32681, + 49529: 32682, + 49530: 32683, + 49531: 32684, + 49532: 32685, + 49533: 32686, + 49534: 32689, + 49536: 32691, + 49537: 32692, + 49538: 32693, + 49539: 32694, + 49540: 32695, + 49541: 32698, + 49542: 32699, + 49543: 32702, + 49544: 32704, + 49545: 32706, + 49546: 32707, + 49547: 32708, + 49548: 32710, + 49549: 32711, + 49550: 32712, + 49551: 32713, + 49552: 32715, + 49553: 32717, + 49554: 32719, + 49555: 32720, + 49556: 32721, + 49557: 32722, + 49558: 32723, + 49559: 32726, + 49560: 32727, + 49561: 32729, + 49562: 32730, + 49563: 32731, + 49564: 32732, + 49565: 32733, + 49566: 32734, + 49567: 32738, + 49568: 32739, + 49569: 30178, + 49570: 31435, + 49571: 31890, + 49572: 27813, + 49573: 38582, + 49574: 21147, + 49575: 29827, + 49576: 21737, + 49577: 20457, + 49578: 32852, + 49579: 33714, + 49580: 36830, + 49581: 38256, + 49582: 24265, + 49583: 24604, + 49584: 28063, + 49585: 24088, + 49586: 25947, + 49587: 33080, + 49588: 38142, + 49589: 24651, + 49590: 28860, + 49591: 32451, + 49592: 31918, + 49593: 20937, + 49594: 26753, + 49595: 31921, + 49596: 33391, + 49597: 20004, + 49598: 36742, + 49599: 37327, + 49600: 26238, + 49601: 20142, + 49602: 35845, + 49603: 25769, + 49604: 32842, + 49605: 20698, + 49606: 30103, + 49607: 29134, + 49608: 23525, + 49609: 36797, + 49610: 28518, + 49611: 20102, + 49612: 25730, + 49613: 38243, + 49614: 24278, + 49615: 26009, + 49616: 21015, + 49617: 35010, + 49618: 28872, + 49619: 21155, + 49620: 29454, + 49621: 29747, + 49622: 26519, + 49623: 30967, + 49624: 38678, + 49625: 20020, + 49626: 37051, + 49627: 40158, + 49628: 28107, + 49629: 20955, + 49630: 36161, + 49631: 21533, + 49632: 25294, + 49633: 29618, + 49634: 33777, + 49635: 38646, + 49636: 40836, + 49637: 38083, + 49638: 20278, + 49639: 32666, + 49640: 20940, + 49641: 28789, + 49642: 38517, + 49643: 23725, + 49644: 39046, + 49645: 21478, + 49646: 20196, + 49647: 28316, + 49648: 29705, + 49649: 27060, + 49650: 30827, + 49651: 39311, + 49652: 30041, + 49653: 21016, + 49654: 30244, + 49655: 27969, + 49656: 26611, + 49657: 20845, + 49658: 40857, + 49659: 32843, + 49660: 21657, + 49661: 31548, + 49662: 31423, + 49728: 32740, + 49729: 32743, + 49730: 32744, + 49731: 32746, + 49732: 32747, + 49733: 32748, + 49734: 32749, + 49735: 32751, + 49736: 32754, + 49737: 32756, + 49738: 32757, + 49739: 32758, + 49740: 32759, + 49741: 32760, + 49742: 32761, + 49743: 32762, + 49744: 32765, + 49745: 32766, + 49746: 32767, + 49747: 32770, + 49748: 32775, + 49749: 32776, + 49750: 32777, + 49751: 32778, + 49752: 32782, + 49753: 32783, + 49754: 32785, + 49755: 32787, + 49756: 32794, + 49757: 32795, + 49758: 32797, + 49759: 32798, + 49760: 32799, + 49761: 32801, + 49762: 32803, + 49763: 32804, + 49764: 32811, + 49765: 32812, + 49766: 32813, + 49767: 32814, + 49768: 32815, + 49769: 32816, + 49770: 32818, + 49771: 32820, + 49772: 32825, + 49773: 32826, + 49774: 32828, + 49775: 32830, + 49776: 32832, + 49777: 32833, + 49778: 32836, + 49779: 32837, + 49780: 32839, + 49781: 32840, + 49782: 32841, + 49783: 32846, + 49784: 32847, + 49785: 32848, + 49786: 32849, + 49787: 32851, + 49788: 32853, + 49789: 32854, + 49790: 32855, + 49792: 32857, + 49793: 32859, + 49794: 32860, + 49795: 32861, + 49796: 32862, + 49797: 32863, + 49798: 32864, + 49799: 32865, + 49800: 32866, + 49801: 32867, + 49802: 32868, + 49803: 32869, + 49804: 32870, + 49805: 32871, + 49806: 32872, + 49807: 32875, + 49808: 32876, + 49809: 32877, + 49810: 32878, + 49811: 32879, + 49812: 32880, + 49813: 32882, + 49814: 32883, + 49815: 32884, + 49816: 32885, + 49817: 32886, + 49818: 32887, + 49819: 32888, + 49820: 32889, + 49821: 32890, + 49822: 32891, + 49823: 32892, + 49824: 32893, + 49825: 38534, + 49826: 22404, + 49827: 25314, + 49828: 38471, + 49829: 27004, + 49830: 23044, + 49831: 25602, + 49832: 31699, + 49833: 28431, + 49834: 38475, + 49835: 33446, + 49836: 21346, + 49837: 39045, + 49838: 24208, + 49839: 28809, + 49840: 25523, + 49841: 21348, + 49842: 34383, + 49843: 40065, + 49844: 40595, + 49845: 30860, + 49846: 38706, + 49847: 36335, + 49848: 36162, + 49849: 40575, + 49850: 28510, + 49851: 31108, + 49852: 24405, + 49853: 38470, + 49854: 25134, + 49855: 39540, + 49856: 21525, + 49857: 38109, + 49858: 20387, + 49859: 26053, + 49860: 23653, + 49861: 23649, + 49862: 32533, + 49863: 34385, + 49864: 27695, + 49865: 24459, + 49866: 29575, + 49867: 28388, + 49868: 32511, + 49869: 23782, + 49870: 25371, + 49871: 23402, + 49872: 28390, + 49873: 21365, + 49874: 20081, + 49875: 25504, + 49876: 30053, + 49877: 25249, + 49878: 36718, + 49879: 20262, + 49880: 20177, + 49881: 27814, + 49882: 32438, + 49883: 35770, + 49884: 33821, + 49885: 34746, + 49886: 32599, + 49887: 36923, + 49888: 38179, + 49889: 31657, + 49890: 39585, + 49891: 35064, + 49892: 33853, + 49893: 27931, + 49894: 39558, + 49895: 32476, + 49896: 22920, + 49897: 40635, + 49898: 29595, + 49899: 30721, + 49900: 34434, + 49901: 39532, + 49902: 39554, + 49903: 22043, + 49904: 21527, + 49905: 22475, + 49906: 20080, + 49907: 40614, + 49908: 21334, + 49909: 36808, + 49910: 33033, + 49911: 30610, + 49912: 39314, + 49913: 34542, + 49914: 28385, + 49915: 34067, + 49916: 26364, + 49917: 24930, + 49918: 28459, + 49984: 32894, + 49985: 32897, + 49986: 32898, + 49987: 32901, + 49988: 32904, + 49989: 32906, + 49990: 32909, + 49991: 32910, + 49992: 32911, + 49993: 32912, + 49994: 32913, + 49995: 32914, + 49996: 32916, + 49997: 32917, + 49998: 32919, + 49999: 32921, + 50000: 32926, + 50001: 32931, + 50002: 32934, + 50003: 32935, + 50004: 32936, + 50005: 32940, + 50006: 32944, + 50007: 32947, + 50008: 32949, + 50009: 32950, + 50010: 32952, + 50011: 32953, + 50012: 32955, + 50013: 32965, + 50014: 32967, + 50015: 32968, + 50016: 32969, + 50017: 32970, + 50018: 32971, + 50019: 32975, + 50020: 32976, + 50021: 32977, + 50022: 32978, + 50023: 32979, + 50024: 32980, + 50025: 32981, + 50026: 32984, + 50027: 32991, + 50028: 32992, + 50029: 32994, + 50030: 32995, + 50031: 32998, + 50032: 33006, + 50033: 33013, + 50034: 33015, + 50035: 33017, + 50036: 33019, + 50037: 33022, + 50038: 33023, + 50039: 33024, + 50040: 33025, + 50041: 33027, + 50042: 33028, + 50043: 33029, + 50044: 33031, + 50045: 33032, + 50046: 33035, + 50048: 33036, + 50049: 33045, + 50050: 33047, + 50051: 33049, + 50052: 33051, + 50053: 33052, + 50054: 33053, + 50055: 33055, + 50056: 33056, + 50057: 33057, + 50058: 33058, + 50059: 33059, + 50060: 33060, + 50061: 33061, + 50062: 33062, + 50063: 33063, + 50064: 33064, + 50065: 33065, + 50066: 33066, + 50067: 33067, + 50068: 33069, + 50069: 33070, + 50070: 33072, + 50071: 33075, + 50072: 33076, + 50073: 33077, + 50074: 33079, + 50075: 33081, + 50076: 33082, + 50077: 33083, + 50078: 33084, + 50079: 33085, + 50080: 33087, + 50081: 35881, + 50082: 33426, + 50083: 33579, + 50084: 30450, + 50085: 27667, + 50086: 24537, + 50087: 33725, + 50088: 29483, + 50089: 33541, + 50090: 38170, + 50091: 27611, + 50092: 30683, + 50093: 38086, + 50094: 21359, + 50095: 33538, + 50096: 20882, + 50097: 24125, + 50098: 35980, + 50099: 36152, + 50100: 20040, + 50101: 29611, + 50102: 26522, + 50103: 26757, + 50104: 37238, + 50105: 38665, + 50106: 29028, + 50107: 27809, + 50108: 30473, + 50109: 23186, + 50110: 38209, + 50111: 27599, + 50112: 32654, + 50113: 26151, + 50114: 23504, + 50115: 22969, + 50116: 23194, + 50117: 38376, + 50118: 38391, + 50119: 20204, + 50120: 33804, + 50121: 33945, + 50122: 27308, + 50123: 30431, + 50124: 38192, + 50125: 29467, + 50126: 26790, + 50127: 23391, + 50128: 30511, + 50129: 37274, + 50130: 38753, + 50131: 31964, + 50132: 36855, + 50133: 35868, + 50134: 24357, + 50135: 31859, + 50136: 31192, + 50137: 35269, + 50138: 27852, + 50139: 34588, + 50140: 23494, + 50141: 24130, + 50142: 26825, + 50143: 30496, + 50144: 32501, + 50145: 20885, + 50146: 20813, + 50147: 21193, + 50148: 23081, + 50149: 32517, + 50150: 38754, + 50151: 33495, + 50152: 25551, + 50153: 30596, + 50154: 34256, + 50155: 31186, + 50156: 28218, + 50157: 24217, + 50158: 22937, + 50159: 34065, + 50160: 28781, + 50161: 27665, + 50162: 25279, + 50163: 30399, + 50164: 25935, + 50165: 24751, + 50166: 38397, + 50167: 26126, + 50168: 34719, + 50169: 40483, + 50170: 38125, + 50171: 21517, + 50172: 21629, + 50173: 35884, + 50174: 25720, + 50240: 33088, + 50241: 33089, + 50242: 33090, + 50243: 33091, + 50244: 33092, + 50245: 33093, + 50246: 33095, + 50247: 33097, + 50248: 33101, + 50249: 33102, + 50250: 33103, + 50251: 33106, + 50252: 33110, + 50253: 33111, + 50254: 33112, + 50255: 33115, + 50256: 33116, + 50257: 33117, + 50258: 33118, + 50259: 33119, + 50260: 33121, + 50261: 33122, + 50262: 33123, + 50263: 33124, + 50264: 33126, + 50265: 33128, + 50266: 33130, + 50267: 33131, + 50268: 33132, + 50269: 33135, + 50270: 33138, + 50271: 33139, + 50272: 33141, + 50273: 33142, + 50274: 33143, + 50275: 33144, + 50276: 33153, + 50277: 33155, + 50278: 33156, + 50279: 33157, + 50280: 33158, + 50281: 33159, + 50282: 33161, + 50283: 33163, + 50284: 33164, + 50285: 33165, + 50286: 33166, + 50287: 33168, + 50288: 33170, + 50289: 33171, + 50290: 33172, + 50291: 33173, + 50292: 33174, + 50293: 33175, + 50294: 33177, + 50295: 33178, + 50296: 33182, + 50297: 33183, + 50298: 33184, + 50299: 33185, + 50300: 33186, + 50301: 33188, + 50302: 33189, + 50304: 33191, + 50305: 33193, + 50306: 33195, + 50307: 33196, + 50308: 33197, + 50309: 33198, + 50310: 33199, + 50311: 33200, + 50312: 33201, + 50313: 33202, + 50314: 33204, + 50315: 33205, + 50316: 33206, + 50317: 33207, + 50318: 33208, + 50319: 33209, + 50320: 33212, + 50321: 33213, + 50322: 33214, + 50323: 33215, + 50324: 33220, + 50325: 33221, + 50326: 33223, + 50327: 33224, + 50328: 33225, + 50329: 33227, + 50330: 33229, + 50331: 33230, + 50332: 33231, + 50333: 33232, + 50334: 33233, + 50335: 33234, + 50336: 33235, + 50337: 25721, + 50338: 34321, + 50339: 27169, + 50340: 33180, + 50341: 30952, + 50342: 25705, + 50343: 39764, + 50344: 25273, + 50345: 26411, + 50346: 33707, + 50347: 22696, + 50348: 40664, + 50349: 27819, + 50350: 28448, + 50351: 23518, + 50352: 38476, + 50353: 35851, + 50354: 29279, + 50355: 26576, + 50356: 25287, + 50357: 29281, + 50358: 20137, + 50359: 22982, + 50360: 27597, + 50361: 22675, + 50362: 26286, + 50363: 24149, + 50364: 21215, + 50365: 24917, + 50366: 26408, + 50367: 30446, + 50368: 30566, + 50369: 29287, + 50370: 31302, + 50371: 25343, + 50372: 21738, + 50373: 21584, + 50374: 38048, + 50375: 37027, + 50376: 23068, + 50377: 32435, + 50378: 27670, + 50379: 20035, + 50380: 22902, + 50381: 32784, + 50382: 22856, + 50383: 21335, + 50384: 30007, + 50385: 38590, + 50386: 22218, + 50387: 25376, + 50388: 33041, + 50389: 24700, + 50390: 38393, + 50391: 28118, + 50392: 21602, + 50393: 39297, + 50394: 20869, + 50395: 23273, + 50396: 33021, + 50397: 22958, + 50398: 38675, + 50399: 20522, + 50400: 27877, + 50401: 23612, + 50402: 25311, + 50403: 20320, + 50404: 21311, + 50405: 33147, + 50406: 36870, + 50407: 28346, + 50408: 34091, + 50409: 25288, + 50410: 24180, + 50411: 30910, + 50412: 25781, + 50413: 25467, + 50414: 24565, + 50415: 23064, + 50416: 37247, + 50417: 40479, + 50418: 23615, + 50419: 25423, + 50420: 32834, + 50421: 23421, + 50422: 21870, + 50423: 38218, + 50424: 38221, + 50425: 28037, + 50426: 24744, + 50427: 26592, + 50428: 29406, + 50429: 20957, + 50430: 23425, + 50496: 33236, + 50497: 33237, + 50498: 33238, + 50499: 33239, + 50500: 33240, + 50501: 33241, + 50502: 33242, + 50503: 33243, + 50504: 33244, + 50505: 33245, + 50506: 33246, + 50507: 33247, + 50508: 33248, + 50509: 33249, + 50510: 33250, + 50511: 33252, + 50512: 33253, + 50513: 33254, + 50514: 33256, + 50515: 33257, + 50516: 33259, + 50517: 33262, + 50518: 33263, + 50519: 33264, + 50520: 33265, + 50521: 33266, + 50522: 33269, + 50523: 33270, + 50524: 33271, + 50525: 33272, + 50526: 33273, + 50527: 33274, + 50528: 33277, + 50529: 33279, + 50530: 33283, + 50531: 33287, + 50532: 33288, + 50533: 33289, + 50534: 33290, + 50535: 33291, + 50536: 33294, + 50537: 33295, + 50538: 33297, + 50539: 33299, + 50540: 33301, + 50541: 33302, + 50542: 33303, + 50543: 33304, + 50544: 33305, + 50545: 33306, + 50546: 33309, + 50547: 33312, + 50548: 33316, + 50549: 33317, + 50550: 33318, + 50551: 33319, + 50552: 33321, + 50553: 33326, + 50554: 33330, + 50555: 33338, + 50556: 33340, + 50557: 33341, + 50558: 33343, + 50560: 33344, + 50561: 33345, + 50562: 33346, + 50563: 33347, + 50564: 33349, + 50565: 33350, + 50566: 33352, + 50567: 33354, + 50568: 33356, + 50569: 33357, + 50570: 33358, + 50571: 33360, + 50572: 33361, + 50573: 33362, + 50574: 33363, + 50575: 33364, + 50576: 33365, + 50577: 33366, + 50578: 33367, + 50579: 33369, + 50580: 33371, + 50581: 33372, + 50582: 33373, + 50583: 33374, + 50584: 33376, + 50585: 33377, + 50586: 33378, + 50587: 33379, + 50588: 33380, + 50589: 33381, + 50590: 33382, + 50591: 33383, + 50592: 33385, + 50593: 25319, + 50594: 27870, + 50595: 29275, + 50596: 25197, + 50597: 38062, + 50598: 32445, + 50599: 33043, + 50600: 27987, + 50601: 20892, + 50602: 24324, + 50603: 22900, + 50604: 21162, + 50605: 24594, + 50606: 22899, + 50607: 26262, + 50608: 34384, + 50609: 30111, + 50610: 25386, + 50611: 25062, + 50612: 31983, + 50613: 35834, + 50614: 21734, + 50615: 27431, + 50616: 40485, + 50617: 27572, + 50618: 34261, + 50619: 21589, + 50620: 20598, + 50621: 27812, + 50622: 21866, + 50623: 36276, + 50624: 29228, + 50625: 24085, + 50626: 24597, + 50627: 29750, + 50628: 25293, + 50629: 25490, + 50630: 29260, + 50631: 24472, + 50632: 28227, + 50633: 27966, + 50634: 25856, + 50635: 28504, + 50636: 30424, + 50637: 30928, + 50638: 30460, + 50639: 30036, + 50640: 21028, + 50641: 21467, + 50642: 20051, + 50643: 24222, + 50644: 26049, + 50645: 32810, + 50646: 32982, + 50647: 25243, + 50648: 21638, + 50649: 21032, + 50650: 28846, + 50651: 34957, + 50652: 36305, + 50653: 27873, + 50654: 21624, + 50655: 32986, + 50656: 22521, + 50657: 35060, + 50658: 36180, + 50659: 38506, + 50660: 37197, + 50661: 20329, + 50662: 27803, + 50663: 21943, + 50664: 30406, + 50665: 30768, + 50666: 25256, + 50667: 28921, + 50668: 28558, + 50669: 24429, + 50670: 34028, + 50671: 26842, + 50672: 30844, + 50673: 31735, + 50674: 33192, + 50675: 26379, + 50676: 40527, + 50677: 25447, + 50678: 30896, + 50679: 22383, + 50680: 30738, + 50681: 38713, + 50682: 25209, + 50683: 25259, + 50684: 21128, + 50685: 29749, + 50686: 27607, + 50752: 33386, + 50753: 33387, + 50754: 33388, + 50755: 33389, + 50756: 33393, + 50757: 33397, + 50758: 33398, + 50759: 33399, + 50760: 33400, + 50761: 33403, + 50762: 33404, + 50763: 33408, + 50764: 33409, + 50765: 33411, + 50766: 33413, + 50767: 33414, + 50768: 33415, + 50769: 33417, + 50770: 33420, + 50771: 33424, + 50772: 33427, + 50773: 33428, + 50774: 33429, + 50775: 33430, + 50776: 33434, + 50777: 33435, + 50778: 33438, + 50779: 33440, + 50780: 33442, + 50781: 33443, + 50782: 33447, + 50783: 33458, + 50784: 33461, + 50785: 33462, + 50786: 33466, + 50787: 33467, + 50788: 33468, + 50789: 33471, + 50790: 33472, + 50791: 33474, + 50792: 33475, + 50793: 33477, + 50794: 33478, + 50795: 33481, + 50796: 33488, + 50797: 33494, + 50798: 33497, + 50799: 33498, + 50800: 33501, + 50801: 33506, + 50802: 33511, + 50803: 33512, + 50804: 33513, + 50805: 33514, + 50806: 33516, + 50807: 33517, + 50808: 33518, + 50809: 33520, + 50810: 33522, + 50811: 33523, + 50812: 33525, + 50813: 33526, + 50814: 33528, + 50816: 33530, + 50817: 33532, + 50818: 33533, + 50819: 33534, + 50820: 33535, + 50821: 33536, + 50822: 33546, + 50823: 33547, + 50824: 33549, + 50825: 33552, + 50826: 33554, + 50827: 33555, + 50828: 33558, + 50829: 33560, + 50830: 33561, + 50831: 33565, + 50832: 33566, + 50833: 33567, + 50834: 33568, + 50835: 33569, + 50836: 33570, + 50837: 33571, + 50838: 33572, + 50839: 33573, + 50840: 33574, + 50841: 33577, + 50842: 33578, + 50843: 33582, + 50844: 33584, + 50845: 33586, + 50846: 33591, + 50847: 33595, + 50848: 33597, + 50849: 21860, + 50850: 33086, + 50851: 30130, + 50852: 30382, + 50853: 21305, + 50854: 30174, + 50855: 20731, + 50856: 23617, + 50857: 35692, + 50858: 31687, + 50859: 20559, + 50860: 29255, + 50861: 39575, + 50862: 39128, + 50863: 28418, + 50864: 29922, + 50865: 31080, + 50866: 25735, + 50867: 30629, + 50868: 25340, + 50869: 39057, + 50870: 36139, + 50871: 21697, + 50872: 32856, + 50873: 20050, + 50874: 22378, + 50875: 33529, + 50876: 33805, + 50877: 24179, + 50878: 20973, + 50879: 29942, + 50880: 35780, + 50881: 23631, + 50882: 22369, + 50883: 27900, + 50884: 39047, + 50885: 23110, + 50886: 30772, + 50887: 39748, + 50888: 36843, + 50889: 31893, + 50890: 21078, + 50891: 25169, + 50892: 38138, + 50893: 20166, + 50894: 33670, + 50895: 33889, + 50896: 33769, + 50897: 33970, + 50898: 22484, + 50899: 26420, + 50900: 22275, + 50901: 26222, + 50902: 28006, + 50903: 35889, + 50904: 26333, + 50905: 28689, + 50906: 26399, + 50907: 27450, + 50908: 26646, + 50909: 25114, + 50910: 22971, + 50911: 19971, + 50912: 20932, + 50913: 28422, + 50914: 26578, + 50915: 27791, + 50916: 20854, + 50917: 26827, + 50918: 22855, + 50919: 27495, + 50920: 30054, + 50921: 23822, + 50922: 33040, + 50923: 40784, + 50924: 26071, + 50925: 31048, + 50926: 31041, + 50927: 39569, + 50928: 36215, + 50929: 23682, + 50930: 20062, + 50931: 20225, + 50932: 21551, + 50933: 22865, + 50934: 30732, + 50935: 22120, + 50936: 27668, + 50937: 36804, + 50938: 24323, + 50939: 27773, + 50940: 27875, + 50941: 35755, + 50942: 25488, + 51008: 33598, + 51009: 33599, + 51010: 33601, + 51011: 33602, + 51012: 33604, + 51013: 33605, + 51014: 33608, + 51015: 33610, + 51016: 33611, + 51017: 33612, + 51018: 33613, + 51019: 33614, + 51020: 33619, + 51021: 33621, + 51022: 33622, + 51023: 33623, + 51024: 33624, + 51025: 33625, + 51026: 33629, + 51027: 33634, + 51028: 33648, + 51029: 33649, + 51030: 33650, + 51031: 33651, + 51032: 33652, + 51033: 33653, + 51034: 33654, + 51035: 33657, + 51036: 33658, + 51037: 33662, + 51038: 33663, + 51039: 33664, + 51040: 33665, + 51041: 33666, + 51042: 33667, + 51043: 33668, + 51044: 33671, + 51045: 33672, + 51046: 33674, + 51047: 33675, + 51048: 33676, + 51049: 33677, + 51050: 33679, + 51051: 33680, + 51052: 33681, + 51053: 33684, + 51054: 33685, + 51055: 33686, + 51056: 33687, + 51057: 33689, + 51058: 33690, + 51059: 33693, + 51060: 33695, + 51061: 33697, + 51062: 33698, + 51063: 33699, + 51064: 33700, + 51065: 33701, + 51066: 33702, + 51067: 33703, + 51068: 33708, + 51069: 33709, + 51070: 33710, + 51072: 33711, + 51073: 33717, + 51074: 33723, + 51075: 33726, + 51076: 33727, + 51077: 33730, + 51078: 33731, + 51079: 33732, + 51080: 33734, + 51081: 33736, + 51082: 33737, + 51083: 33739, + 51084: 33741, + 51085: 33742, + 51086: 33744, + 51087: 33745, + 51088: 33746, + 51089: 33747, + 51090: 33749, + 51091: 33751, + 51092: 33753, + 51093: 33754, + 51094: 33755, + 51095: 33758, + 51096: 33762, + 51097: 33763, + 51098: 33764, + 51099: 33766, + 51100: 33767, + 51101: 33768, + 51102: 33771, + 51103: 33772, + 51104: 33773, + 51105: 24688, + 51106: 27965, + 51107: 29301, + 51108: 25190, + 51109: 38030, + 51110: 38085, + 51111: 21315, + 51112: 36801, + 51113: 31614, + 51114: 20191, + 51115: 35878, + 51116: 20094, + 51117: 40660, + 51118: 38065, + 51119: 38067, + 51120: 21069, + 51121: 28508, + 51122: 36963, + 51123: 27973, + 51124: 35892, + 51125: 22545, + 51126: 23884, + 51127: 27424, + 51128: 27465, + 51129: 26538, + 51130: 21595, + 51131: 33108, + 51132: 32652, + 51133: 22681, + 51134: 34103, + 51135: 24378, + 51136: 25250, + 51137: 27207, + 51138: 38201, + 51139: 25970, + 51140: 24708, + 51141: 26725, + 51142: 30631, + 51143: 20052, + 51144: 20392, + 51145: 24039, + 51146: 38808, + 51147: 25772, + 51148: 32728, + 51149: 23789, + 51150: 20431, + 51151: 31373, + 51152: 20999, + 51153: 33540, + 51154: 19988, + 51155: 24623, + 51156: 31363, + 51157: 38054, + 51158: 20405, + 51159: 20146, + 51160: 31206, + 51161: 29748, + 51162: 21220, + 51163: 33465, + 51164: 25810, + 51165: 31165, + 51166: 23517, + 51167: 27777, + 51168: 38738, + 51169: 36731, + 51170: 27682, + 51171: 20542, + 51172: 21375, + 51173: 28165, + 51174: 25806, + 51175: 26228, + 51176: 27696, + 51177: 24773, + 51178: 39031, + 51179: 35831, + 51180: 24198, + 51181: 29756, + 51182: 31351, + 51183: 31179, + 51184: 19992, + 51185: 37041, + 51186: 29699, + 51187: 27714, + 51188: 22234, + 51189: 37195, + 51190: 27845, + 51191: 36235, + 51192: 21306, + 51193: 34502, + 51194: 26354, + 51195: 36527, + 51196: 23624, + 51197: 39537, + 51198: 28192, + 51264: 33774, + 51265: 33775, + 51266: 33779, + 51267: 33780, + 51268: 33781, + 51269: 33782, + 51270: 33783, + 51271: 33786, + 51272: 33787, + 51273: 33788, + 51274: 33790, + 51275: 33791, + 51276: 33792, + 51277: 33794, + 51278: 33797, + 51279: 33799, + 51280: 33800, + 51281: 33801, + 51282: 33802, + 51283: 33808, + 51284: 33810, + 51285: 33811, + 51286: 33812, + 51287: 33813, + 51288: 33814, + 51289: 33815, + 51290: 33817, + 51291: 33818, + 51292: 33819, + 51293: 33822, + 51294: 33823, + 51295: 33824, + 51296: 33825, + 51297: 33826, + 51298: 33827, + 51299: 33833, + 51300: 33834, + 51301: 33835, + 51302: 33836, + 51303: 33837, + 51304: 33838, + 51305: 33839, + 51306: 33840, + 51307: 33842, + 51308: 33843, + 51309: 33844, + 51310: 33845, + 51311: 33846, + 51312: 33847, + 51313: 33849, + 51314: 33850, + 51315: 33851, + 51316: 33854, + 51317: 33855, + 51318: 33856, + 51319: 33857, + 51320: 33858, + 51321: 33859, + 51322: 33860, + 51323: 33861, + 51324: 33863, + 51325: 33864, + 51326: 33865, + 51328: 33866, + 51329: 33867, + 51330: 33868, + 51331: 33869, + 51332: 33870, + 51333: 33871, + 51334: 33872, + 51335: 33874, + 51336: 33875, + 51337: 33876, + 51338: 33877, + 51339: 33878, + 51340: 33880, + 51341: 33885, + 51342: 33886, + 51343: 33887, + 51344: 33888, + 51345: 33890, + 51346: 33892, + 51347: 33893, + 51348: 33894, + 51349: 33895, + 51350: 33896, + 51351: 33898, + 51352: 33902, + 51353: 33903, + 51354: 33904, + 51355: 33906, + 51356: 33908, + 51357: 33911, + 51358: 33913, + 51359: 33915, + 51360: 33916, + 51361: 21462, + 51362: 23094, + 51363: 40843, + 51364: 36259, + 51365: 21435, + 51366: 22280, + 51367: 39079, + 51368: 26435, + 51369: 37275, + 51370: 27849, + 51371: 20840, + 51372: 30154, + 51373: 25331, + 51374: 29356, + 51375: 21048, + 51376: 21149, + 51377: 32570, + 51378: 28820, + 51379: 30264, + 51380: 21364, + 51381: 40522, + 51382: 27063, + 51383: 30830, + 51384: 38592, + 51385: 35033, + 51386: 32676, + 51387: 28982, + 51388: 29123, + 51389: 20873, + 51390: 26579, + 51391: 29924, + 51392: 22756, + 51393: 25880, + 51394: 22199, + 51395: 35753, + 51396: 39286, + 51397: 25200, + 51398: 32469, + 51399: 24825, + 51400: 28909, + 51401: 22764, + 51402: 20161, + 51403: 20154, + 51404: 24525, + 51405: 38887, + 51406: 20219, + 51407: 35748, + 51408: 20995, + 51409: 22922, + 51410: 32427, + 51411: 25172, + 51412: 20173, + 51413: 26085, + 51414: 25102, + 51415: 33592, + 51416: 33993, + 51417: 33635, + 51418: 34701, + 51419: 29076, + 51420: 28342, + 51421: 23481, + 51422: 32466, + 51423: 20887, + 51424: 25545, + 51425: 26580, + 51426: 32905, + 51427: 33593, + 51428: 34837, + 51429: 20754, + 51430: 23418, + 51431: 22914, + 51432: 36785, + 51433: 20083, + 51434: 27741, + 51435: 20837, + 51436: 35109, + 51437: 36719, + 51438: 38446, + 51439: 34122, + 51440: 29790, + 51441: 38160, + 51442: 38384, + 51443: 28070, + 51444: 33509, + 51445: 24369, + 51446: 25746, + 51447: 27922, + 51448: 33832, + 51449: 33134, + 51450: 40131, + 51451: 22622, + 51452: 36187, + 51453: 19977, + 51454: 21441, + 51520: 33917, + 51521: 33918, + 51522: 33919, + 51523: 33920, + 51524: 33921, + 51525: 33923, + 51526: 33924, + 51527: 33925, + 51528: 33926, + 51529: 33930, + 51530: 33933, + 51531: 33935, + 51532: 33936, + 51533: 33937, + 51534: 33938, + 51535: 33939, + 51536: 33940, + 51537: 33941, + 51538: 33942, + 51539: 33944, + 51540: 33946, + 51541: 33947, + 51542: 33949, + 51543: 33950, + 51544: 33951, + 51545: 33952, + 51546: 33954, + 51547: 33955, + 51548: 33956, + 51549: 33957, + 51550: 33958, + 51551: 33959, + 51552: 33960, + 51553: 33961, + 51554: 33962, + 51555: 33963, + 51556: 33964, + 51557: 33965, + 51558: 33966, + 51559: 33968, + 51560: 33969, + 51561: 33971, + 51562: 33973, + 51563: 33974, + 51564: 33975, + 51565: 33979, + 51566: 33980, + 51567: 33982, + 51568: 33984, + 51569: 33986, + 51570: 33987, + 51571: 33989, + 51572: 33990, + 51573: 33991, + 51574: 33992, + 51575: 33995, + 51576: 33996, + 51577: 33998, + 51578: 33999, + 51579: 34002, + 51580: 34004, + 51581: 34005, + 51582: 34007, + 51584: 34008, + 51585: 34009, + 51586: 34010, + 51587: 34011, + 51588: 34012, + 51589: 34014, + 51590: 34017, + 51591: 34018, + 51592: 34020, + 51593: 34023, + 51594: 34024, + 51595: 34025, + 51596: 34026, + 51597: 34027, + 51598: 34029, + 51599: 34030, + 51600: 34031, + 51601: 34033, + 51602: 34034, + 51603: 34035, + 51604: 34036, + 51605: 34037, + 51606: 34038, + 51607: 34039, + 51608: 34040, + 51609: 34041, + 51610: 34042, + 51611: 34043, + 51612: 34045, + 51613: 34046, + 51614: 34048, + 51615: 34049, + 51616: 34050, + 51617: 20254, + 51618: 25955, + 51619: 26705, + 51620: 21971, + 51621: 20007, + 51622: 25620, + 51623: 39578, + 51624: 25195, + 51625: 23234, + 51626: 29791, + 51627: 33394, + 51628: 28073, + 51629: 26862, + 51630: 20711, + 51631: 33678, + 51632: 30722, + 51633: 26432, + 51634: 21049, + 51635: 27801, + 51636: 32433, + 51637: 20667, + 51638: 21861, + 51639: 29022, + 51640: 31579, + 51641: 26194, + 51642: 29642, + 51643: 33515, + 51644: 26441, + 51645: 23665, + 51646: 21024, + 51647: 29053, + 51648: 34923, + 51649: 38378, + 51650: 38485, + 51651: 25797, + 51652: 36193, + 51653: 33203, + 51654: 21892, + 51655: 27733, + 51656: 25159, + 51657: 32558, + 51658: 22674, + 51659: 20260, + 51660: 21830, + 51661: 36175, + 51662: 26188, + 51663: 19978, + 51664: 23578, + 51665: 35059, + 51666: 26786, + 51667: 25422, + 51668: 31245, + 51669: 28903, + 51670: 33421, + 51671: 21242, + 51672: 38902, + 51673: 23569, + 51674: 21736, + 51675: 37045, + 51676: 32461, + 51677: 22882, + 51678: 36170, + 51679: 34503, + 51680: 33292, + 51681: 33293, + 51682: 36198, + 51683: 25668, + 51684: 23556, + 51685: 24913, + 51686: 28041, + 51687: 31038, + 51688: 35774, + 51689: 30775, + 51690: 30003, + 51691: 21627, + 51692: 20280, + 51693: 36523, + 51694: 28145, + 51695: 23072, + 51696: 32453, + 51697: 31070, + 51698: 27784, + 51699: 23457, + 51700: 23158, + 51701: 29978, + 51702: 32958, + 51703: 24910, + 51704: 28183, + 51705: 22768, + 51706: 29983, + 51707: 29989, + 51708: 29298, + 51709: 21319, + 51710: 32499, + 51776: 34051, + 51777: 34052, + 51778: 34053, + 51779: 34054, + 51780: 34055, + 51781: 34056, + 51782: 34057, + 51783: 34058, + 51784: 34059, + 51785: 34061, + 51786: 34062, + 51787: 34063, + 51788: 34064, + 51789: 34066, + 51790: 34068, + 51791: 34069, + 51792: 34070, + 51793: 34072, + 51794: 34073, + 51795: 34075, + 51796: 34076, + 51797: 34077, + 51798: 34078, + 51799: 34080, + 51800: 34082, + 51801: 34083, + 51802: 34084, + 51803: 34085, + 51804: 34086, + 51805: 34087, + 51806: 34088, + 51807: 34089, + 51808: 34090, + 51809: 34093, + 51810: 34094, + 51811: 34095, + 51812: 34096, + 51813: 34097, + 51814: 34098, + 51815: 34099, + 51816: 34100, + 51817: 34101, + 51818: 34102, + 51819: 34110, + 51820: 34111, + 51821: 34112, + 51822: 34113, + 51823: 34114, + 51824: 34116, + 51825: 34117, + 51826: 34118, + 51827: 34119, + 51828: 34123, + 51829: 34124, + 51830: 34125, + 51831: 34126, + 51832: 34127, + 51833: 34128, + 51834: 34129, + 51835: 34130, + 51836: 34131, + 51837: 34132, + 51838: 34133, + 51840: 34135, + 51841: 34136, + 51842: 34138, + 51843: 34139, + 51844: 34140, + 51845: 34141, + 51846: 34143, + 51847: 34144, + 51848: 34145, + 51849: 34146, + 51850: 34147, + 51851: 34149, + 51852: 34150, + 51853: 34151, + 51854: 34153, + 51855: 34154, + 51856: 34155, + 51857: 34156, + 51858: 34157, + 51859: 34158, + 51860: 34159, + 51861: 34160, + 51862: 34161, + 51863: 34163, + 51864: 34165, + 51865: 34166, + 51866: 34167, + 51867: 34168, + 51868: 34172, + 51869: 34173, + 51870: 34175, + 51871: 34176, + 51872: 34177, + 51873: 30465, + 51874: 30427, + 51875: 21097, + 51876: 32988, + 51877: 22307, + 51878: 24072, + 51879: 22833, + 51880: 29422, + 51881: 26045, + 51882: 28287, + 51883: 35799, + 51884: 23608, + 51885: 34417, + 51886: 21313, + 51887: 30707, + 51888: 25342, + 51889: 26102, + 51890: 20160, + 51891: 39135, + 51892: 34432, + 51893: 23454, + 51894: 35782, + 51895: 21490, + 51896: 30690, + 51897: 20351, + 51898: 23630, + 51899: 39542, + 51900: 22987, + 51901: 24335, + 51902: 31034, + 51903: 22763, + 51904: 19990, + 51905: 26623, + 51906: 20107, + 51907: 25325, + 51908: 35475, + 51909: 36893, + 51910: 21183, + 51911: 26159, + 51912: 21980, + 51913: 22124, + 51914: 36866, + 51915: 20181, + 51916: 20365, + 51917: 37322, + 51918: 39280, + 51919: 27663, + 51920: 24066, + 51921: 24643, + 51922: 23460, + 51923: 35270, + 51924: 35797, + 51925: 25910, + 51926: 25163, + 51927: 39318, + 51928: 23432, + 51929: 23551, + 51930: 25480, + 51931: 21806, + 51932: 21463, + 51933: 30246, + 51934: 20861, + 51935: 34092, + 51936: 26530, + 51937: 26803, + 51938: 27530, + 51939: 25234, + 51940: 36755, + 51941: 21460, + 51942: 33298, + 51943: 28113, + 51944: 30095, + 51945: 20070, + 51946: 36174, + 51947: 23408, + 51948: 29087, + 51949: 34223, + 51950: 26257, + 51951: 26329, + 51952: 32626, + 51953: 34560, + 51954: 40653, + 51955: 40736, + 51956: 23646, + 51957: 26415, + 51958: 36848, + 51959: 26641, + 51960: 26463, + 51961: 25101, + 51962: 31446, + 51963: 22661, + 51964: 24246, + 51965: 25968, + 51966: 28465, + 52032: 34178, + 52033: 34179, + 52034: 34182, + 52035: 34184, + 52036: 34185, + 52037: 34186, + 52038: 34187, + 52039: 34188, + 52040: 34189, + 52041: 34190, + 52042: 34192, + 52043: 34193, + 52044: 34194, + 52045: 34195, + 52046: 34196, + 52047: 34197, + 52048: 34198, + 52049: 34199, + 52050: 34200, + 52051: 34201, + 52052: 34202, + 52053: 34205, + 52054: 34206, + 52055: 34207, + 52056: 34208, + 52057: 34209, + 52058: 34210, + 52059: 34211, + 52060: 34213, + 52061: 34214, + 52062: 34215, + 52063: 34217, + 52064: 34219, + 52065: 34220, + 52066: 34221, + 52067: 34225, + 52068: 34226, + 52069: 34227, + 52070: 34228, + 52071: 34229, + 52072: 34230, + 52073: 34232, + 52074: 34234, + 52075: 34235, + 52076: 34236, + 52077: 34237, + 52078: 34238, + 52079: 34239, + 52080: 34240, + 52081: 34242, + 52082: 34243, + 52083: 34244, + 52084: 34245, + 52085: 34246, + 52086: 34247, + 52087: 34248, + 52088: 34250, + 52089: 34251, + 52090: 34252, + 52091: 34253, + 52092: 34254, + 52093: 34257, + 52094: 34258, + 52096: 34260, + 52097: 34262, + 52098: 34263, + 52099: 34264, + 52100: 34265, + 52101: 34266, + 52102: 34267, + 52103: 34269, + 52104: 34270, + 52105: 34271, + 52106: 34272, + 52107: 34273, + 52108: 34274, + 52109: 34275, + 52110: 34277, + 52111: 34278, + 52112: 34279, + 52113: 34280, + 52114: 34282, + 52115: 34283, + 52116: 34284, + 52117: 34285, + 52118: 34286, + 52119: 34287, + 52120: 34288, + 52121: 34289, + 52122: 34290, + 52123: 34291, + 52124: 34292, + 52125: 34293, + 52126: 34294, + 52127: 34295, + 52128: 34296, + 52129: 24661, + 52130: 21047, + 52131: 32781, + 52132: 25684, + 52133: 34928, + 52134: 29993, + 52135: 24069, + 52136: 26643, + 52137: 25332, + 52138: 38684, + 52139: 21452, + 52140: 29245, + 52141: 35841, + 52142: 27700, + 52143: 30561, + 52144: 31246, + 52145: 21550, + 52146: 30636, + 52147: 39034, + 52148: 33308, + 52149: 35828, + 52150: 30805, + 52151: 26388, + 52152: 28865, + 52153: 26031, + 52154: 25749, + 52155: 22070, + 52156: 24605, + 52157: 31169, + 52158: 21496, + 52159: 19997, + 52160: 27515, + 52161: 32902, + 52162: 23546, + 52163: 21987, + 52164: 22235, + 52165: 20282, + 52166: 20284, + 52167: 39282, + 52168: 24051, + 52169: 26494, + 52170: 32824, + 52171: 24578, + 52172: 39042, + 52173: 36865, + 52174: 23435, + 52175: 35772, + 52176: 35829, + 52177: 25628, + 52178: 33368, + 52179: 25822, + 52180: 22013, + 52181: 33487, + 52182: 37221, + 52183: 20439, + 52184: 32032, + 52185: 36895, + 52186: 31903, + 52187: 20723, + 52188: 22609, + 52189: 28335, + 52190: 23487, + 52191: 35785, + 52192: 32899, + 52193: 37240, + 52194: 33948, + 52195: 31639, + 52196: 34429, + 52197: 38539, + 52198: 38543, + 52199: 32485, + 52200: 39635, + 52201: 30862, + 52202: 23681, + 52203: 31319, + 52204: 36930, + 52205: 38567, + 52206: 31071, + 52207: 23385, + 52208: 25439, + 52209: 31499, + 52210: 34001, + 52211: 26797, + 52212: 21766, + 52213: 32553, + 52214: 29712, + 52215: 32034, + 52216: 38145, + 52217: 25152, + 52218: 22604, + 52219: 20182, + 52220: 23427, + 52221: 22905, + 52222: 22612, + 52288: 34297, + 52289: 34298, + 52290: 34300, + 52291: 34301, + 52292: 34302, + 52293: 34304, + 52294: 34305, + 52295: 34306, + 52296: 34307, + 52297: 34308, + 52298: 34310, + 52299: 34311, + 52300: 34312, + 52301: 34313, + 52302: 34314, + 52303: 34315, + 52304: 34316, + 52305: 34317, + 52306: 34318, + 52307: 34319, + 52308: 34320, + 52309: 34322, + 52310: 34323, + 52311: 34324, + 52312: 34325, + 52313: 34327, + 52314: 34328, + 52315: 34329, + 52316: 34330, + 52317: 34331, + 52318: 34332, + 52319: 34333, + 52320: 34334, + 52321: 34335, + 52322: 34336, + 52323: 34337, + 52324: 34338, + 52325: 34339, + 52326: 34340, + 52327: 34341, + 52328: 34342, + 52329: 34344, + 52330: 34346, + 52331: 34347, + 52332: 34348, + 52333: 34349, + 52334: 34350, + 52335: 34351, + 52336: 34352, + 52337: 34353, + 52338: 34354, + 52339: 34355, + 52340: 34356, + 52341: 34357, + 52342: 34358, + 52343: 34359, + 52344: 34361, + 52345: 34362, + 52346: 34363, + 52347: 34365, + 52348: 34366, + 52349: 34367, + 52350: 34368, + 52352: 34369, + 52353: 34370, + 52354: 34371, + 52355: 34372, + 52356: 34373, + 52357: 34374, + 52358: 34375, + 52359: 34376, + 52360: 34377, + 52361: 34378, + 52362: 34379, + 52363: 34380, + 52364: 34386, + 52365: 34387, + 52366: 34389, + 52367: 34390, + 52368: 34391, + 52369: 34392, + 52370: 34393, + 52371: 34395, + 52372: 34396, + 52373: 34397, + 52374: 34399, + 52375: 34400, + 52376: 34401, + 52377: 34403, + 52378: 34404, + 52379: 34405, + 52380: 34406, + 52381: 34407, + 52382: 34408, + 52383: 34409, + 52384: 34410, + 52385: 29549, + 52386: 25374, + 52387: 36427, + 52388: 36367, + 52389: 32974, + 52390: 33492, + 52391: 25260, + 52392: 21488, + 52393: 27888, + 52394: 37214, + 52395: 22826, + 52396: 24577, + 52397: 27760, + 52398: 22349, + 52399: 25674, + 52400: 36138, + 52401: 30251, + 52402: 28393, + 52403: 22363, + 52404: 27264, + 52405: 30192, + 52406: 28525, + 52407: 35885, + 52408: 35848, + 52409: 22374, + 52410: 27631, + 52411: 34962, + 52412: 30899, + 52413: 25506, + 52414: 21497, + 52415: 28845, + 52416: 27748, + 52417: 22616, + 52418: 25642, + 52419: 22530, + 52420: 26848, + 52421: 33179, + 52422: 21776, + 52423: 31958, + 52424: 20504, + 52425: 36538, + 52426: 28108, + 52427: 36255, + 52428: 28907, + 52429: 25487, + 52430: 28059, + 52431: 28372, + 52432: 32486, + 52433: 33796, + 52434: 26691, + 52435: 36867, + 52436: 28120, + 52437: 38518, + 52438: 35752, + 52439: 22871, + 52440: 29305, + 52441: 34276, + 52442: 33150, + 52443: 30140, + 52444: 35466, + 52445: 26799, + 52446: 21076, + 52447: 36386, + 52448: 38161, + 52449: 25552, + 52450: 39064, + 52451: 36420, + 52452: 21884, + 52453: 20307, + 52454: 26367, + 52455: 22159, + 52456: 24789, + 52457: 28053, + 52458: 21059, + 52459: 23625, + 52460: 22825, + 52461: 28155, + 52462: 22635, + 52463: 30000, + 52464: 29980, + 52465: 24684, + 52466: 33300, + 52467: 33094, + 52468: 25361, + 52469: 26465, + 52470: 36834, + 52471: 30522, + 52472: 36339, + 52473: 36148, + 52474: 38081, + 52475: 24086, + 52476: 21381, + 52477: 21548, + 52478: 28867, + 52544: 34413, + 52545: 34415, + 52546: 34416, + 52547: 34418, + 52548: 34419, + 52549: 34420, + 52550: 34421, + 52551: 34422, + 52552: 34423, + 52553: 34424, + 52554: 34435, + 52555: 34436, + 52556: 34437, + 52557: 34438, + 52558: 34439, + 52559: 34440, + 52560: 34441, + 52561: 34446, + 52562: 34447, + 52563: 34448, + 52564: 34449, + 52565: 34450, + 52566: 34452, + 52567: 34454, + 52568: 34455, + 52569: 34456, + 52570: 34457, + 52571: 34458, + 52572: 34459, + 52573: 34462, + 52574: 34463, + 52575: 34464, + 52576: 34465, + 52577: 34466, + 52578: 34469, + 52579: 34470, + 52580: 34475, + 52581: 34477, + 52582: 34478, + 52583: 34482, + 52584: 34483, + 52585: 34487, + 52586: 34488, + 52587: 34489, + 52588: 34491, + 52589: 34492, + 52590: 34493, + 52591: 34494, + 52592: 34495, + 52593: 34497, + 52594: 34498, + 52595: 34499, + 52596: 34501, + 52597: 34504, + 52598: 34508, + 52599: 34509, + 52600: 34514, + 52601: 34515, + 52602: 34517, + 52603: 34518, + 52604: 34519, + 52605: 34522, + 52606: 34524, + 52608: 34525, + 52609: 34528, + 52610: 34529, + 52611: 34530, + 52612: 34531, + 52613: 34533, + 52614: 34534, + 52615: 34535, + 52616: 34536, + 52617: 34538, + 52618: 34539, + 52619: 34540, + 52620: 34543, + 52621: 34549, + 52622: 34550, + 52623: 34551, + 52624: 34554, + 52625: 34555, + 52626: 34556, + 52627: 34557, + 52628: 34559, + 52629: 34561, + 52630: 34564, + 52631: 34565, + 52632: 34566, + 52633: 34571, + 52634: 34572, + 52635: 34574, + 52636: 34575, + 52637: 34576, + 52638: 34577, + 52639: 34580, + 52640: 34582, + 52641: 27712, + 52642: 24311, + 52643: 20572, + 52644: 20141, + 52645: 24237, + 52646: 25402, + 52647: 33351, + 52648: 36890, + 52649: 26704, + 52650: 37230, + 52651: 30643, + 52652: 21516, + 52653: 38108, + 52654: 24420, + 52655: 31461, + 52656: 26742, + 52657: 25413, + 52658: 31570, + 52659: 32479, + 52660: 30171, + 52661: 20599, + 52662: 25237, + 52663: 22836, + 52664: 36879, + 52665: 20984, + 52666: 31171, + 52667: 31361, + 52668: 22270, + 52669: 24466, + 52670: 36884, + 52671: 28034, + 52672: 23648, + 52673: 22303, + 52674: 21520, + 52675: 20820, + 52676: 28237, + 52677: 22242, + 52678: 25512, + 52679: 39059, + 52680: 33151, + 52681: 34581, + 52682: 35114, + 52683: 36864, + 52684: 21534, + 52685: 23663, + 52686: 33216, + 52687: 25302, + 52688: 25176, + 52689: 33073, + 52690: 40501, + 52691: 38464, + 52692: 39534, + 52693: 39548, + 52694: 26925, + 52695: 22949, + 52696: 25299, + 52697: 21822, + 52698: 25366, + 52699: 21703, + 52700: 34521, + 52701: 27964, + 52702: 23043, + 52703: 29926, + 52704: 34972, + 52705: 27498, + 52706: 22806, + 52707: 35916, + 52708: 24367, + 52709: 28286, + 52710: 29609, + 52711: 39037, + 52712: 20024, + 52713: 28919, + 52714: 23436, + 52715: 30871, + 52716: 25405, + 52717: 26202, + 52718: 30358, + 52719: 24779, + 52720: 23451, + 52721: 23113, + 52722: 19975, + 52723: 33109, + 52724: 27754, + 52725: 29579, + 52726: 20129, + 52727: 26505, + 52728: 32593, + 52729: 24448, + 52730: 26106, + 52731: 26395, + 52732: 24536, + 52733: 22916, + 52734: 23041, + 52800: 34585, + 52801: 34587, + 52802: 34589, + 52803: 34591, + 52804: 34592, + 52805: 34596, + 52806: 34598, + 52807: 34599, + 52808: 34600, + 52809: 34602, + 52810: 34603, + 52811: 34604, + 52812: 34605, + 52813: 34607, + 52814: 34608, + 52815: 34610, + 52816: 34611, + 52817: 34613, + 52818: 34614, + 52819: 34616, + 52820: 34617, + 52821: 34618, + 52822: 34620, + 52823: 34621, + 52824: 34624, + 52825: 34625, + 52826: 34626, + 52827: 34627, + 52828: 34628, + 52829: 34629, + 52830: 34630, + 52831: 34634, + 52832: 34635, + 52833: 34637, + 52834: 34639, + 52835: 34640, + 52836: 34641, + 52837: 34642, + 52838: 34644, + 52839: 34645, + 52840: 34646, + 52841: 34648, + 52842: 34650, + 52843: 34651, + 52844: 34652, + 52845: 34653, + 52846: 34654, + 52847: 34655, + 52848: 34657, + 52849: 34658, + 52850: 34662, + 52851: 34663, + 52852: 34664, + 52853: 34665, + 52854: 34666, + 52855: 34667, + 52856: 34668, + 52857: 34669, + 52858: 34671, + 52859: 34673, + 52860: 34674, + 52861: 34675, + 52862: 34677, + 52864: 34679, + 52865: 34680, + 52866: 34681, + 52867: 34682, + 52868: 34687, + 52869: 34688, + 52870: 34689, + 52871: 34692, + 52872: 34694, + 52873: 34695, + 52874: 34697, + 52875: 34698, + 52876: 34700, + 52877: 34702, + 52878: 34703, + 52879: 34704, + 52880: 34705, + 52881: 34706, + 52882: 34708, + 52883: 34709, + 52884: 34710, + 52885: 34712, + 52886: 34713, + 52887: 34714, + 52888: 34715, + 52889: 34716, + 52890: 34717, + 52891: 34718, + 52892: 34720, + 52893: 34721, + 52894: 34722, + 52895: 34723, + 52896: 34724, + 52897: 24013, + 52898: 24494, + 52899: 21361, + 52900: 38886, + 52901: 36829, + 52902: 26693, + 52903: 22260, + 52904: 21807, + 52905: 24799, + 52906: 20026, + 52907: 28493, + 52908: 32500, + 52909: 33479, + 52910: 33806, + 52911: 22996, + 52912: 20255, + 52913: 20266, + 52914: 23614, + 52915: 32428, + 52916: 26410, + 52917: 34074, + 52918: 21619, + 52919: 30031, + 52920: 32963, + 52921: 21890, + 52922: 39759, + 52923: 20301, + 52924: 28205, + 52925: 35859, + 52926: 23561, + 52927: 24944, + 52928: 21355, + 52929: 30239, + 52930: 28201, + 52931: 34442, + 52932: 25991, + 52933: 38395, + 52934: 32441, + 52935: 21563, + 52936: 31283, + 52937: 32010, + 52938: 38382, + 52939: 21985, + 52940: 32705, + 52941: 29934, + 52942: 25373, + 52943: 34583, + 52944: 28065, + 52945: 31389, + 52946: 25105, + 52947: 26017, + 52948: 21351, + 52949: 25569, + 52950: 27779, + 52951: 24043, + 52952: 21596, + 52953: 38056, + 52954: 20044, + 52955: 27745, + 52956: 35820, + 52957: 23627, + 52958: 26080, + 52959: 33436, + 52960: 26791, + 52961: 21566, + 52962: 21556, + 52963: 27595, + 52964: 27494, + 52965: 20116, + 52966: 25410, + 52967: 21320, + 52968: 33310, + 52969: 20237, + 52970: 20398, + 52971: 22366, + 52972: 25098, + 52973: 38654, + 52974: 26212, + 52975: 29289, + 52976: 21247, + 52977: 21153, + 52978: 24735, + 52979: 35823, + 52980: 26132, + 52981: 29081, + 52982: 26512, + 52983: 35199, + 52984: 30802, + 52985: 30717, + 52986: 26224, + 52987: 22075, + 52988: 21560, + 52989: 38177, + 52990: 29306, + 53056: 34725, + 53057: 34726, + 53058: 34727, + 53059: 34729, + 53060: 34730, + 53061: 34734, + 53062: 34736, + 53063: 34737, + 53064: 34738, + 53065: 34740, + 53066: 34742, + 53067: 34743, + 53068: 34744, + 53069: 34745, + 53070: 34747, + 53071: 34748, + 53072: 34750, + 53073: 34751, + 53074: 34753, + 53075: 34754, + 53076: 34755, + 53077: 34756, + 53078: 34757, + 53079: 34759, + 53080: 34760, + 53081: 34761, + 53082: 34764, + 53083: 34765, + 53084: 34766, + 53085: 34767, + 53086: 34768, + 53087: 34772, + 53088: 34773, + 53089: 34774, + 53090: 34775, + 53091: 34776, + 53092: 34777, + 53093: 34778, + 53094: 34780, + 53095: 34781, + 53096: 34782, + 53097: 34783, + 53098: 34785, + 53099: 34786, + 53100: 34787, + 53101: 34788, + 53102: 34790, + 53103: 34791, + 53104: 34792, + 53105: 34793, + 53106: 34795, + 53107: 34796, + 53108: 34797, + 53109: 34799, + 53110: 34800, + 53111: 34801, + 53112: 34802, + 53113: 34803, + 53114: 34804, + 53115: 34805, + 53116: 34806, + 53117: 34807, + 53118: 34808, + 53120: 34810, + 53121: 34811, + 53122: 34812, + 53123: 34813, + 53124: 34815, + 53125: 34816, + 53126: 34817, + 53127: 34818, + 53128: 34820, + 53129: 34821, + 53130: 34822, + 53131: 34823, + 53132: 34824, + 53133: 34825, + 53134: 34827, + 53135: 34828, + 53136: 34829, + 53137: 34830, + 53138: 34831, + 53139: 34832, + 53140: 34833, + 53141: 34834, + 53142: 34836, + 53143: 34839, + 53144: 34840, + 53145: 34841, + 53146: 34842, + 53147: 34844, + 53148: 34845, + 53149: 34846, + 53150: 34847, + 53151: 34848, + 53152: 34851, + 53153: 31232, + 53154: 24687, + 53155: 24076, + 53156: 24713, + 53157: 33181, + 53158: 22805, + 53159: 24796, + 53160: 29060, + 53161: 28911, + 53162: 28330, + 53163: 27728, + 53164: 29312, + 53165: 27268, + 53166: 34989, + 53167: 24109, + 53168: 20064, + 53169: 23219, + 53170: 21916, + 53171: 38115, + 53172: 27927, + 53173: 31995, + 53174: 38553, + 53175: 25103, + 53176: 32454, + 53177: 30606, + 53178: 34430, + 53179: 21283, + 53180: 38686, + 53181: 36758, + 53182: 26247, + 53183: 23777, + 53184: 20384, + 53185: 29421, + 53186: 19979, + 53187: 21414, + 53188: 22799, + 53189: 21523, + 53190: 25472, + 53191: 38184, + 53192: 20808, + 53193: 20185, + 53194: 40092, + 53195: 32420, + 53196: 21688, + 53197: 36132, + 53198: 34900, + 53199: 33335, + 53200: 38386, + 53201: 28046, + 53202: 24358, + 53203: 23244, + 53204: 26174, + 53205: 38505, + 53206: 29616, + 53207: 29486, + 53208: 21439, + 53209: 33146, + 53210: 39301, + 53211: 32673, + 53212: 23466, + 53213: 38519, + 53214: 38480, + 53215: 32447, + 53216: 30456, + 53217: 21410, + 53218: 38262, + 53219: 39321, + 53220: 31665, + 53221: 35140, + 53222: 28248, + 53223: 20065, + 53224: 32724, + 53225: 31077, + 53226: 35814, + 53227: 24819, + 53228: 21709, + 53229: 20139, + 53230: 39033, + 53231: 24055, + 53232: 27233, + 53233: 20687, + 53234: 21521, + 53235: 35937, + 53236: 33831, + 53237: 30813, + 53238: 38660, + 53239: 21066, + 53240: 21742, + 53241: 22179, + 53242: 38144, + 53243: 28040, + 53244: 23477, + 53245: 28102, + 53246: 26195, + 53312: 34852, + 53313: 34853, + 53314: 34854, + 53315: 34855, + 53316: 34856, + 53317: 34857, + 53318: 34858, + 53319: 34859, + 53320: 34860, + 53321: 34861, + 53322: 34862, + 53323: 34863, + 53324: 34864, + 53325: 34865, + 53326: 34867, + 53327: 34868, + 53328: 34869, + 53329: 34870, + 53330: 34871, + 53331: 34872, + 53332: 34874, + 53333: 34875, + 53334: 34877, + 53335: 34878, + 53336: 34879, + 53337: 34881, + 53338: 34882, + 53339: 34883, + 53340: 34886, + 53341: 34887, + 53342: 34888, + 53343: 34889, + 53344: 34890, + 53345: 34891, + 53346: 34894, + 53347: 34895, + 53348: 34896, + 53349: 34897, + 53350: 34898, + 53351: 34899, + 53352: 34901, + 53353: 34902, + 53354: 34904, + 53355: 34906, + 53356: 34907, + 53357: 34908, + 53358: 34909, + 53359: 34910, + 53360: 34911, + 53361: 34912, + 53362: 34918, + 53363: 34919, + 53364: 34922, + 53365: 34925, + 53366: 34927, + 53367: 34929, + 53368: 34931, + 53369: 34932, + 53370: 34933, + 53371: 34934, + 53372: 34936, + 53373: 34937, + 53374: 34938, + 53376: 34939, + 53377: 34940, + 53378: 34944, + 53379: 34947, + 53380: 34950, + 53381: 34951, + 53382: 34953, + 53383: 34954, + 53384: 34956, + 53385: 34958, + 53386: 34959, + 53387: 34960, + 53388: 34961, + 53389: 34963, + 53390: 34964, + 53391: 34965, + 53392: 34967, + 53393: 34968, + 53394: 34969, + 53395: 34970, + 53396: 34971, + 53397: 34973, + 53398: 34974, + 53399: 34975, + 53400: 34976, + 53401: 34977, + 53402: 34979, + 53403: 34981, + 53404: 34982, + 53405: 34983, + 53406: 34984, + 53407: 34985, + 53408: 34986, + 53409: 23567, + 53410: 23389, + 53411: 26657, + 53412: 32918, + 53413: 21880, + 53414: 31505, + 53415: 25928, + 53416: 26964, + 53417: 20123, + 53418: 27463, + 53419: 34638, + 53420: 38795, + 53421: 21327, + 53422: 25375, + 53423: 25658, + 53424: 37034, + 53425: 26012, + 53426: 32961, + 53427: 35856, + 53428: 20889, + 53429: 26800, + 53430: 21368, + 53431: 34809, + 53432: 25032, + 53433: 27844, + 53434: 27899, + 53435: 35874, + 53436: 23633, + 53437: 34218, + 53438: 33455, + 53439: 38156, + 53440: 27427, + 53441: 36763, + 53442: 26032, + 53443: 24571, + 53444: 24515, + 53445: 20449, + 53446: 34885, + 53447: 26143, + 53448: 33125, + 53449: 29481, + 53450: 24826, + 53451: 20852, + 53452: 21009, + 53453: 22411, + 53454: 24418, + 53455: 37026, + 53456: 34892, + 53457: 37266, + 53458: 24184, + 53459: 26447, + 53460: 24615, + 53461: 22995, + 53462: 20804, + 53463: 20982, + 53464: 33016, + 53465: 21256, + 53466: 27769, + 53467: 38596, + 53468: 29066, + 53469: 20241, + 53470: 20462, + 53471: 32670, + 53472: 26429, + 53473: 21957, + 53474: 38152, + 53475: 31168, + 53476: 34966, + 53477: 32483, + 53478: 22687, + 53479: 25100, + 53480: 38656, + 53481: 34394, + 53482: 22040, + 53483: 39035, + 53484: 24464, + 53485: 35768, + 53486: 33988, + 53487: 37207, + 53488: 21465, + 53489: 26093, + 53490: 24207, + 53491: 30044, + 53492: 24676, + 53493: 32110, + 53494: 23167, + 53495: 32490, + 53496: 32493, + 53497: 36713, + 53498: 21927, + 53499: 23459, + 53500: 24748, + 53501: 26059, + 53502: 29572, + 53568: 34988, + 53569: 34990, + 53570: 34991, + 53571: 34992, + 53572: 34994, + 53573: 34995, + 53574: 34996, + 53575: 34997, + 53576: 34998, + 53577: 35000, + 53578: 35001, + 53579: 35002, + 53580: 35003, + 53581: 35005, + 53582: 35006, + 53583: 35007, + 53584: 35008, + 53585: 35011, + 53586: 35012, + 53587: 35015, + 53588: 35016, + 53589: 35018, + 53590: 35019, + 53591: 35020, + 53592: 35021, + 53593: 35023, + 53594: 35024, + 53595: 35025, + 53596: 35027, + 53597: 35030, + 53598: 35031, + 53599: 35034, + 53600: 35035, + 53601: 35036, + 53602: 35037, + 53603: 35038, + 53604: 35040, + 53605: 35041, + 53606: 35046, + 53607: 35047, + 53608: 35049, + 53609: 35050, + 53610: 35051, + 53611: 35052, + 53612: 35053, + 53613: 35054, + 53614: 35055, + 53615: 35058, + 53616: 35061, + 53617: 35062, + 53618: 35063, + 53619: 35066, + 53620: 35067, + 53621: 35069, + 53622: 35071, + 53623: 35072, + 53624: 35073, + 53625: 35075, + 53626: 35076, + 53627: 35077, + 53628: 35078, + 53629: 35079, + 53630: 35080, + 53632: 35081, + 53633: 35083, + 53634: 35084, + 53635: 35085, + 53636: 35086, + 53637: 35087, + 53638: 35089, + 53639: 35092, + 53640: 35093, + 53641: 35094, + 53642: 35095, + 53643: 35096, + 53644: 35100, + 53645: 35101, + 53646: 35102, + 53647: 35103, + 53648: 35104, + 53649: 35106, + 53650: 35107, + 53651: 35108, + 53652: 35110, + 53653: 35111, + 53654: 35112, + 53655: 35113, + 53656: 35116, + 53657: 35117, + 53658: 35118, + 53659: 35119, + 53660: 35121, + 53661: 35122, + 53662: 35123, + 53663: 35125, + 53664: 35127, + 53665: 36873, + 53666: 30307, + 53667: 30505, + 53668: 32474, + 53669: 38772, + 53670: 34203, + 53671: 23398, + 53672: 31348, + 53673: 38634, + 53674: 34880, + 53675: 21195, + 53676: 29071, + 53677: 24490, + 53678: 26092, + 53679: 35810, + 53680: 23547, + 53681: 39535, + 53682: 24033, + 53683: 27529, + 53684: 27739, + 53685: 35757, + 53686: 35759, + 53687: 36874, + 53688: 36805, + 53689: 21387, + 53690: 25276, + 53691: 40486, + 53692: 40493, + 53693: 21568, + 53694: 20011, + 53695: 33469, + 53696: 29273, + 53697: 34460, + 53698: 23830, + 53699: 34905, + 53700: 28079, + 53701: 38597, + 53702: 21713, + 53703: 20122, + 53704: 35766, + 53705: 28937, + 53706: 21693, + 53707: 38409, + 53708: 28895, + 53709: 28153, + 53710: 30416, + 53711: 20005, + 53712: 30740, + 53713: 34578, + 53714: 23721, + 53715: 24310, + 53716: 35328, + 53717: 39068, + 53718: 38414, + 53719: 28814, + 53720: 27839, + 53721: 22852, + 53722: 25513, + 53723: 30524, + 53724: 34893, + 53725: 28436, + 53726: 33395, + 53727: 22576, + 53728: 29141, + 53729: 21388, + 53730: 30746, + 53731: 38593, + 53732: 21761, + 53733: 24422, + 53734: 28976, + 53735: 23476, + 53736: 35866, + 53737: 39564, + 53738: 27523, + 53739: 22830, + 53740: 40495, + 53741: 31207, + 53742: 26472, + 53743: 25196, + 53744: 20335, + 53745: 30113, + 53746: 32650, + 53747: 27915, + 53748: 38451, + 53749: 27687, + 53750: 20208, + 53751: 30162, + 53752: 20859, + 53753: 26679, + 53754: 28478, + 53755: 36992, + 53756: 33136, + 53757: 22934, + 53758: 29814, + 53824: 35128, + 53825: 35129, + 53826: 35130, + 53827: 35131, + 53828: 35132, + 53829: 35133, + 53830: 35134, + 53831: 35135, + 53832: 35136, + 53833: 35138, + 53834: 35139, + 53835: 35141, + 53836: 35142, + 53837: 35143, + 53838: 35144, + 53839: 35145, + 53840: 35146, + 53841: 35147, + 53842: 35148, + 53843: 35149, + 53844: 35150, + 53845: 35151, + 53846: 35152, + 53847: 35153, + 53848: 35154, + 53849: 35155, + 53850: 35156, + 53851: 35157, + 53852: 35158, + 53853: 35159, + 53854: 35160, + 53855: 35161, + 53856: 35162, + 53857: 35163, + 53858: 35164, + 53859: 35165, + 53860: 35168, + 53861: 35169, + 53862: 35170, + 53863: 35171, + 53864: 35172, + 53865: 35173, + 53866: 35175, + 53867: 35176, + 53868: 35177, + 53869: 35178, + 53870: 35179, + 53871: 35180, + 53872: 35181, + 53873: 35182, + 53874: 35183, + 53875: 35184, + 53876: 35185, + 53877: 35186, + 53878: 35187, + 53879: 35188, + 53880: 35189, + 53881: 35190, + 53882: 35191, + 53883: 35192, + 53884: 35193, + 53885: 35194, + 53886: 35196, + 53888: 35197, + 53889: 35198, + 53890: 35200, + 53891: 35202, + 53892: 35204, + 53893: 35205, + 53894: 35207, + 53895: 35208, + 53896: 35209, + 53897: 35210, + 53898: 35211, + 53899: 35212, + 53900: 35213, + 53901: 35214, + 53902: 35215, + 53903: 35216, + 53904: 35217, + 53905: 35218, + 53906: 35219, + 53907: 35220, + 53908: 35221, + 53909: 35222, + 53910: 35223, + 53911: 35224, + 53912: 35225, + 53913: 35226, + 53914: 35227, + 53915: 35228, + 53916: 35229, + 53917: 35230, + 53918: 35231, + 53919: 35232, + 53920: 35233, + 53921: 25671, + 53922: 23591, + 53923: 36965, + 53924: 31377, + 53925: 35875, + 53926: 23002, + 53927: 21676, + 53928: 33280, + 53929: 33647, + 53930: 35201, + 53931: 32768, + 53932: 26928, + 53933: 22094, + 53934: 32822, + 53935: 29239, + 53936: 37326, + 53937: 20918, + 53938: 20063, + 53939: 39029, + 53940: 25494, + 53941: 19994, + 53942: 21494, + 53943: 26355, + 53944: 33099, + 53945: 22812, + 53946: 28082, + 53947: 19968, + 53948: 22777, + 53949: 21307, + 53950: 25558, + 53951: 38129, + 53952: 20381, + 53953: 20234, + 53954: 34915, + 53955: 39056, + 53956: 22839, + 53957: 36951, + 53958: 31227, + 53959: 20202, + 53960: 33008, + 53961: 30097, + 53962: 27778, + 53963: 23452, + 53964: 23016, + 53965: 24413, + 53966: 26885, + 53967: 34433, + 53968: 20506, + 53969: 24050, + 53970: 20057, + 53971: 30691, + 53972: 20197, + 53973: 33402, + 53974: 25233, + 53975: 26131, + 53976: 37009, + 53977: 23673, + 53978: 20159, + 53979: 24441, + 53980: 33222, + 53981: 36920, + 53982: 32900, + 53983: 30123, + 53984: 20134, + 53985: 35028, + 53986: 24847, + 53987: 27589, + 53988: 24518, + 53989: 20041, + 53990: 30410, + 53991: 28322, + 53992: 35811, + 53993: 35758, + 53994: 35850, + 53995: 35793, + 53996: 24322, + 53997: 32764, + 53998: 32716, + 53999: 32462, + 54000: 33589, + 54001: 33643, + 54002: 22240, + 54003: 27575, + 54004: 38899, + 54005: 38452, + 54006: 23035, + 54007: 21535, + 54008: 38134, + 54009: 28139, + 54010: 23493, + 54011: 39278, + 54012: 23609, + 54013: 24341, + 54014: 38544, + 54080: 35234, + 54081: 35235, + 54082: 35236, + 54083: 35237, + 54084: 35238, + 54085: 35239, + 54086: 35240, + 54087: 35241, + 54088: 35242, + 54089: 35243, + 54090: 35244, + 54091: 35245, + 54092: 35246, + 54093: 35247, + 54094: 35248, + 54095: 35249, + 54096: 35250, + 54097: 35251, + 54098: 35252, + 54099: 35253, + 54100: 35254, + 54101: 35255, + 54102: 35256, + 54103: 35257, + 54104: 35258, + 54105: 35259, + 54106: 35260, + 54107: 35261, + 54108: 35262, + 54109: 35263, + 54110: 35264, + 54111: 35267, + 54112: 35277, + 54113: 35283, + 54114: 35284, + 54115: 35285, + 54116: 35287, + 54117: 35288, + 54118: 35289, + 54119: 35291, + 54120: 35293, + 54121: 35295, + 54122: 35296, + 54123: 35297, + 54124: 35298, + 54125: 35300, + 54126: 35303, + 54127: 35304, + 54128: 35305, + 54129: 35306, + 54130: 35308, + 54131: 35309, + 54132: 35310, + 54133: 35312, + 54134: 35313, + 54135: 35314, + 54136: 35316, + 54137: 35317, + 54138: 35318, + 54139: 35319, + 54140: 35320, + 54141: 35321, + 54142: 35322, + 54144: 35323, + 54145: 35324, + 54146: 35325, + 54147: 35326, + 54148: 35327, + 54149: 35329, + 54150: 35330, + 54151: 35331, + 54152: 35332, + 54153: 35333, + 54154: 35334, + 54155: 35336, + 54156: 35337, + 54157: 35338, + 54158: 35339, + 54159: 35340, + 54160: 35341, + 54161: 35342, + 54162: 35343, + 54163: 35344, + 54164: 35345, + 54165: 35346, + 54166: 35347, + 54167: 35348, + 54168: 35349, + 54169: 35350, + 54170: 35351, + 54171: 35352, + 54172: 35353, + 54173: 35354, + 54174: 35355, + 54175: 35356, + 54176: 35357, + 54177: 21360, + 54178: 33521, + 54179: 27185, + 54180: 23156, + 54181: 40560, + 54182: 24212, + 54183: 32552, + 54184: 33721, + 54185: 33828, + 54186: 33829, + 54187: 33639, + 54188: 34631, + 54189: 36814, + 54190: 36194, + 54191: 30408, + 54192: 24433, + 54193: 39062, + 54194: 30828, + 54195: 26144, + 54196: 21727, + 54197: 25317, + 54198: 20323, + 54199: 33219, + 54200: 30152, + 54201: 24248, + 54202: 38605, + 54203: 36362, + 54204: 34553, + 54205: 21647, + 54206: 27891, + 54207: 28044, + 54208: 27704, + 54209: 24703, + 54210: 21191, + 54211: 29992, + 54212: 24189, + 54213: 20248, + 54214: 24736, + 54215: 24551, + 54216: 23588, + 54217: 30001, + 54218: 37038, + 54219: 38080, + 54220: 29369, + 54221: 27833, + 54222: 28216, + 54223: 37193, + 54224: 26377, + 54225: 21451, + 54226: 21491, + 54227: 20305, + 54228: 37321, + 54229: 35825, + 54230: 21448, + 54231: 24188, + 54232: 36802, + 54233: 28132, + 54234: 20110, + 54235: 30402, + 54236: 27014, + 54237: 34398, + 54238: 24858, + 54239: 33286, + 54240: 20313, + 54241: 20446, + 54242: 36926, + 54243: 40060, + 54244: 24841, + 54245: 28189, + 54246: 28180, + 54247: 38533, + 54248: 20104, + 54249: 23089, + 54250: 38632, + 54251: 19982, + 54252: 23679, + 54253: 31161, + 54254: 23431, + 54255: 35821, + 54256: 32701, + 54257: 29577, + 54258: 22495, + 54259: 33419, + 54260: 37057, + 54261: 21505, + 54262: 36935, + 54263: 21947, + 54264: 23786, + 54265: 24481, + 54266: 24840, + 54267: 27442, + 54268: 29425, + 54269: 32946, + 54270: 35465, + 54336: 35358, + 54337: 35359, + 54338: 35360, + 54339: 35361, + 54340: 35362, + 54341: 35363, + 54342: 35364, + 54343: 35365, + 54344: 35366, + 54345: 35367, + 54346: 35368, + 54347: 35369, + 54348: 35370, + 54349: 35371, + 54350: 35372, + 54351: 35373, + 54352: 35374, + 54353: 35375, + 54354: 35376, + 54355: 35377, + 54356: 35378, + 54357: 35379, + 54358: 35380, + 54359: 35381, + 54360: 35382, + 54361: 35383, + 54362: 35384, + 54363: 35385, + 54364: 35386, + 54365: 35387, + 54366: 35388, + 54367: 35389, + 54368: 35391, + 54369: 35392, + 54370: 35393, + 54371: 35394, + 54372: 35395, + 54373: 35396, + 54374: 35397, + 54375: 35398, + 54376: 35399, + 54377: 35401, + 54378: 35402, + 54379: 35403, + 54380: 35404, + 54381: 35405, + 54382: 35406, + 54383: 35407, + 54384: 35408, + 54385: 35409, + 54386: 35410, + 54387: 35411, + 54388: 35412, + 54389: 35413, + 54390: 35414, + 54391: 35415, + 54392: 35416, + 54393: 35417, + 54394: 35418, + 54395: 35419, + 54396: 35420, + 54397: 35421, + 54398: 35422, + 54400: 35423, + 54401: 35424, + 54402: 35425, + 54403: 35426, + 54404: 35427, + 54405: 35428, + 54406: 35429, + 54407: 35430, + 54408: 35431, + 54409: 35432, + 54410: 35433, + 54411: 35434, + 54412: 35435, + 54413: 35436, + 54414: 35437, + 54415: 35438, + 54416: 35439, + 54417: 35440, + 54418: 35441, + 54419: 35442, + 54420: 35443, + 54421: 35444, + 54422: 35445, + 54423: 35446, + 54424: 35447, + 54425: 35448, + 54426: 35450, + 54427: 35451, + 54428: 35452, + 54429: 35453, + 54430: 35454, + 54431: 35455, + 54432: 35456, + 54433: 28020, + 54434: 23507, + 54435: 35029, + 54436: 39044, + 54437: 35947, + 54438: 39533, + 54439: 40499, + 54440: 28170, + 54441: 20900, + 54442: 20803, + 54443: 22435, + 54444: 34945, + 54445: 21407, + 54446: 25588, + 54447: 36757, + 54448: 22253, + 54449: 21592, + 54450: 22278, + 54451: 29503, + 54452: 28304, + 54453: 32536, + 54454: 36828, + 54455: 33489, + 54456: 24895, + 54457: 24616, + 54458: 38498, + 54459: 26352, + 54460: 32422, + 54461: 36234, + 54462: 36291, + 54463: 38053, + 54464: 23731, + 54465: 31908, + 54466: 26376, + 54467: 24742, + 54468: 38405, + 54469: 32792, + 54470: 20113, + 54471: 37095, + 54472: 21248, + 54473: 38504, + 54474: 20801, + 54475: 36816, + 54476: 34164, + 54477: 37213, + 54478: 26197, + 54479: 38901, + 54480: 23381, + 54481: 21277, + 54482: 30776, + 54483: 26434, + 54484: 26685, + 54485: 21705, + 54486: 28798, + 54487: 23472, + 54488: 36733, + 54489: 20877, + 54490: 22312, + 54491: 21681, + 54492: 25874, + 54493: 26242, + 54494: 36190, + 54495: 36163, + 54496: 33039, + 54497: 33900, + 54498: 36973, + 54499: 31967, + 54500: 20991, + 54501: 34299, + 54502: 26531, + 54503: 26089, + 54504: 28577, + 54505: 34468, + 54506: 36481, + 54507: 22122, + 54508: 36896, + 54509: 30338, + 54510: 28790, + 54511: 29157, + 54512: 36131, + 54513: 25321, + 54514: 21017, + 54515: 27901, + 54516: 36156, + 54517: 24590, + 54518: 22686, + 54519: 24974, + 54520: 26366, + 54521: 36192, + 54522: 25166, + 54523: 21939, + 54524: 28195, + 54525: 26413, + 54526: 36711, + 54592: 35457, + 54593: 35458, + 54594: 35459, + 54595: 35460, + 54596: 35461, + 54597: 35462, + 54598: 35463, + 54599: 35464, + 54600: 35467, + 54601: 35468, + 54602: 35469, + 54603: 35470, + 54604: 35471, + 54605: 35472, + 54606: 35473, + 54607: 35474, + 54608: 35476, + 54609: 35477, + 54610: 35478, + 54611: 35479, + 54612: 35480, + 54613: 35481, + 54614: 35482, + 54615: 35483, + 54616: 35484, + 54617: 35485, + 54618: 35486, + 54619: 35487, + 54620: 35488, + 54621: 35489, + 54622: 35490, + 54623: 35491, + 54624: 35492, + 54625: 35493, + 54626: 35494, + 54627: 35495, + 54628: 35496, + 54629: 35497, + 54630: 35498, + 54631: 35499, + 54632: 35500, + 54633: 35501, + 54634: 35502, + 54635: 35503, + 54636: 35504, + 54637: 35505, + 54638: 35506, + 54639: 35507, + 54640: 35508, + 54641: 35509, + 54642: 35510, + 54643: 35511, + 54644: 35512, + 54645: 35513, + 54646: 35514, + 54647: 35515, + 54648: 35516, + 54649: 35517, + 54650: 35518, + 54651: 35519, + 54652: 35520, + 54653: 35521, + 54654: 35522, + 54656: 35523, + 54657: 35524, + 54658: 35525, + 54659: 35526, + 54660: 35527, + 54661: 35528, + 54662: 35529, + 54663: 35530, + 54664: 35531, + 54665: 35532, + 54666: 35533, + 54667: 35534, + 54668: 35535, + 54669: 35536, + 54670: 35537, + 54671: 35538, + 54672: 35539, + 54673: 35540, + 54674: 35541, + 54675: 35542, + 54676: 35543, + 54677: 35544, + 54678: 35545, + 54679: 35546, + 54680: 35547, + 54681: 35548, + 54682: 35549, + 54683: 35550, + 54684: 35551, + 54685: 35552, + 54686: 35553, + 54687: 35554, + 54688: 35555, + 54689: 38113, + 54690: 38392, + 54691: 30504, + 54692: 26629, + 54693: 27048, + 54694: 21643, + 54695: 20045, + 54696: 28856, + 54697: 35784, + 54698: 25688, + 54699: 25995, + 54700: 23429, + 54701: 31364, + 54702: 20538, + 54703: 23528, + 54704: 30651, + 54705: 27617, + 54706: 35449, + 54707: 31896, + 54708: 27838, + 54709: 30415, + 54710: 26025, + 54711: 36759, + 54712: 23853, + 54713: 23637, + 54714: 34360, + 54715: 26632, + 54716: 21344, + 54717: 25112, + 54718: 31449, + 54719: 28251, + 54720: 32509, + 54721: 27167, + 54722: 31456, + 54723: 24432, + 54724: 28467, + 54725: 24352, + 54726: 25484, + 54727: 28072, + 54728: 26454, + 54729: 19976, + 54730: 24080, + 54731: 36134, + 54732: 20183, + 54733: 32960, + 54734: 30260, + 54735: 38556, + 54736: 25307, + 54737: 26157, + 54738: 25214, + 54739: 27836, + 54740: 36213, + 54741: 29031, + 54742: 32617, + 54743: 20806, + 54744: 32903, + 54745: 21484, + 54746: 36974, + 54747: 25240, + 54748: 21746, + 54749: 34544, + 54750: 36761, + 54751: 32773, + 54752: 38167, + 54753: 34071, + 54754: 36825, + 54755: 27993, + 54756: 29645, + 54757: 26015, + 54758: 30495, + 54759: 29956, + 54760: 30759, + 54761: 33275, + 54762: 36126, + 54763: 38024, + 54764: 20390, + 54765: 26517, + 54766: 30137, + 54767: 35786, + 54768: 38663, + 54769: 25391, + 54770: 38215, + 54771: 38453, + 54772: 33976, + 54773: 25379, + 54774: 30529, + 54775: 24449, + 54776: 29424, + 54777: 20105, + 54778: 24596, + 54779: 25972, + 54780: 25327, + 54781: 27491, + 54782: 25919, + 54848: 35556, + 54849: 35557, + 54850: 35558, + 54851: 35559, + 54852: 35560, + 54853: 35561, + 54854: 35562, + 54855: 35563, + 54856: 35564, + 54857: 35565, + 54858: 35566, + 54859: 35567, + 54860: 35568, + 54861: 35569, + 54862: 35570, + 54863: 35571, + 54864: 35572, + 54865: 35573, + 54866: 35574, + 54867: 35575, + 54868: 35576, + 54869: 35577, + 54870: 35578, + 54871: 35579, + 54872: 35580, + 54873: 35581, + 54874: 35582, + 54875: 35583, + 54876: 35584, + 54877: 35585, + 54878: 35586, + 54879: 35587, + 54880: 35588, + 54881: 35589, + 54882: 35590, + 54883: 35592, + 54884: 35593, + 54885: 35594, + 54886: 35595, + 54887: 35596, + 54888: 35597, + 54889: 35598, + 54890: 35599, + 54891: 35600, + 54892: 35601, + 54893: 35602, + 54894: 35603, + 54895: 35604, + 54896: 35605, + 54897: 35606, + 54898: 35607, + 54899: 35608, + 54900: 35609, + 54901: 35610, + 54902: 35611, + 54903: 35612, + 54904: 35613, + 54905: 35614, + 54906: 35615, + 54907: 35616, + 54908: 35617, + 54909: 35618, + 54910: 35619, + 54912: 35620, + 54913: 35621, + 54914: 35623, + 54915: 35624, + 54916: 35625, + 54917: 35626, + 54918: 35627, + 54919: 35628, + 54920: 35629, + 54921: 35630, + 54922: 35631, + 54923: 35632, + 54924: 35633, + 54925: 35634, + 54926: 35635, + 54927: 35636, + 54928: 35637, + 54929: 35638, + 54930: 35639, + 54931: 35640, + 54932: 35641, + 54933: 35642, + 54934: 35643, + 54935: 35644, + 54936: 35645, + 54937: 35646, + 54938: 35647, + 54939: 35648, + 54940: 35649, + 54941: 35650, + 54942: 35651, + 54943: 35652, + 54944: 35653, + 54945: 24103, + 54946: 30151, + 54947: 37073, + 54948: 35777, + 54949: 33437, + 54950: 26525, + 54951: 25903, + 54952: 21553, + 54953: 34584, + 54954: 30693, + 54955: 32930, + 54956: 33026, + 54957: 27713, + 54958: 20043, + 54959: 32455, + 54960: 32844, + 54961: 30452, + 54962: 26893, + 54963: 27542, + 54964: 25191, + 54965: 20540, + 54966: 20356, + 54967: 22336, + 54968: 25351, + 54969: 27490, + 54970: 36286, + 54971: 21482, + 54972: 26088, + 54973: 32440, + 54974: 24535, + 54975: 25370, + 54976: 25527, + 54977: 33267, + 54978: 33268, + 54979: 32622, + 54980: 24092, + 54981: 23769, + 54982: 21046, + 54983: 26234, + 54984: 31209, + 54985: 31258, + 54986: 36136, + 54987: 28825, + 54988: 30164, + 54989: 28382, + 54990: 27835, + 54991: 31378, + 54992: 20013, + 54993: 30405, + 54994: 24544, + 54995: 38047, + 54996: 34935, + 54997: 32456, + 54998: 31181, + 54999: 32959, + 55000: 37325, + 55001: 20210, + 55002: 20247, + 55003: 33311, + 55004: 21608, + 55005: 24030, + 55006: 27954, + 55007: 35788, + 55008: 31909, + 55009: 36724, + 55010: 32920, + 55011: 24090, + 55012: 21650, + 55013: 30385, + 55014: 23449, + 55015: 26172, + 55016: 39588, + 55017: 29664, + 55018: 26666, + 55019: 34523, + 55020: 26417, + 55021: 29482, + 55022: 35832, + 55023: 35803, + 55024: 36880, + 55025: 31481, + 55026: 28891, + 55027: 29038, + 55028: 25284, + 55029: 30633, + 55030: 22065, + 55031: 20027, + 55032: 33879, + 55033: 26609, + 55034: 21161, + 55035: 34496, + 55036: 36142, + 55037: 38136, + 55038: 31569, + 55104: 35654, + 55105: 35655, + 55106: 35656, + 55107: 35657, + 55108: 35658, + 55109: 35659, + 55110: 35660, + 55111: 35661, + 55112: 35662, + 55113: 35663, + 55114: 35664, + 55115: 35665, + 55116: 35666, + 55117: 35667, + 55118: 35668, + 55119: 35669, + 55120: 35670, + 55121: 35671, + 55122: 35672, + 55123: 35673, + 55124: 35674, + 55125: 35675, + 55126: 35676, + 55127: 35677, + 55128: 35678, + 55129: 35679, + 55130: 35680, + 55131: 35681, + 55132: 35682, + 55133: 35683, + 55134: 35684, + 55135: 35685, + 55136: 35687, + 55137: 35688, + 55138: 35689, + 55139: 35690, + 55140: 35691, + 55141: 35693, + 55142: 35694, + 55143: 35695, + 55144: 35696, + 55145: 35697, + 55146: 35698, + 55147: 35699, + 55148: 35700, + 55149: 35701, + 55150: 35702, + 55151: 35703, + 55152: 35704, + 55153: 35705, + 55154: 35706, + 55155: 35707, + 55156: 35708, + 55157: 35709, + 55158: 35710, + 55159: 35711, + 55160: 35712, + 55161: 35713, + 55162: 35714, + 55163: 35715, + 55164: 35716, + 55165: 35717, + 55166: 35718, + 55168: 35719, + 55169: 35720, + 55170: 35721, + 55171: 35722, + 55172: 35723, + 55173: 35724, + 55174: 35725, + 55175: 35726, + 55176: 35727, + 55177: 35728, + 55178: 35729, + 55179: 35730, + 55180: 35731, + 55181: 35732, + 55182: 35733, + 55183: 35734, + 55184: 35735, + 55185: 35736, + 55186: 35737, + 55187: 35738, + 55188: 35739, + 55189: 35740, + 55190: 35741, + 55191: 35742, + 55192: 35743, + 55193: 35756, + 55194: 35761, + 55195: 35771, + 55196: 35783, + 55197: 35792, + 55198: 35818, + 55199: 35849, + 55200: 35870, + 55201: 20303, + 55202: 27880, + 55203: 31069, + 55204: 39547, + 55205: 25235, + 55206: 29226, + 55207: 25341, + 55208: 19987, + 55209: 30742, + 55210: 36716, + 55211: 25776, + 55212: 36186, + 55213: 31686, + 55214: 26729, + 55215: 24196, + 55216: 35013, + 55217: 22918, + 55218: 25758, + 55219: 22766, + 55220: 29366, + 55221: 26894, + 55222: 38181, + 55223: 36861, + 55224: 36184, + 55225: 22368, + 55226: 32512, + 55227: 35846, + 55228: 20934, + 55229: 25417, + 55230: 25305, + 55231: 21331, + 55232: 26700, + 55233: 29730, + 55234: 33537, + 55235: 37196, + 55236: 21828, + 55237: 30528, + 55238: 28796, + 55239: 27978, + 55240: 20857, + 55241: 21672, + 55242: 36164, + 55243: 23039, + 55244: 28363, + 55245: 28100, + 55246: 23388, + 55247: 32043, + 55248: 20180, + 55249: 31869, + 55250: 28371, + 55251: 23376, + 55252: 33258, + 55253: 28173, + 55254: 23383, + 55255: 39683, + 55256: 26837, + 55257: 36394, + 55258: 23447, + 55259: 32508, + 55260: 24635, + 55261: 32437, + 55262: 37049, + 55263: 36208, + 55264: 22863, + 55265: 25549, + 55266: 31199, + 55267: 36275, + 55268: 21330, + 55269: 26063, + 55270: 31062, + 55271: 35781, + 55272: 38459, + 55273: 32452, + 55274: 38075, + 55275: 32386, + 55276: 22068, + 55277: 37257, + 55278: 26368, + 55279: 32618, + 55280: 23562, + 55281: 36981, + 55282: 26152, + 55283: 24038, + 55284: 20304, + 55285: 26590, + 55286: 20570, + 55287: 20316, + 55288: 22352, + 55289: 24231, + 55290: 59408, + 55291: 59409, + 55292: 59410, + 55293: 59411, + 55294: 59412, + 55360: 35896, + 55361: 35897, + 55362: 35898, + 55363: 35899, + 55364: 35900, + 55365: 35901, + 55366: 35902, + 55367: 35903, + 55368: 35904, + 55369: 35906, + 55370: 35907, + 55371: 35908, + 55372: 35909, + 55373: 35912, + 55374: 35914, + 55375: 35915, + 55376: 35917, + 55377: 35918, + 55378: 35919, + 55379: 35920, + 55380: 35921, + 55381: 35922, + 55382: 35923, + 55383: 35924, + 55384: 35926, + 55385: 35927, + 55386: 35928, + 55387: 35929, + 55388: 35931, + 55389: 35932, + 55390: 35933, + 55391: 35934, + 55392: 35935, + 55393: 35936, + 55394: 35939, + 55395: 35940, + 55396: 35941, + 55397: 35942, + 55398: 35943, + 55399: 35944, + 55400: 35945, + 55401: 35948, + 55402: 35949, + 55403: 35950, + 55404: 35951, + 55405: 35952, + 55406: 35953, + 55407: 35954, + 55408: 35956, + 55409: 35957, + 55410: 35958, + 55411: 35959, + 55412: 35963, + 55413: 35964, + 55414: 35965, + 55415: 35966, + 55416: 35967, + 55417: 35968, + 55418: 35969, + 55419: 35971, + 55420: 35972, + 55421: 35974, + 55422: 35975, + 55424: 35976, + 55425: 35979, + 55426: 35981, + 55427: 35982, + 55428: 35983, + 55429: 35984, + 55430: 35985, + 55431: 35986, + 55432: 35987, + 55433: 35989, + 55434: 35990, + 55435: 35991, + 55436: 35993, + 55437: 35994, + 55438: 35995, + 55439: 35996, + 55440: 35997, + 55441: 35998, + 55442: 35999, + 55443: 36000, + 55444: 36001, + 55445: 36002, + 55446: 36003, + 55447: 36004, + 55448: 36005, + 55449: 36006, + 55450: 36007, + 55451: 36008, + 55452: 36009, + 55453: 36010, + 55454: 36011, + 55455: 36012, + 55456: 36013, + 55457: 20109, + 55458: 19980, + 55459: 20800, + 55460: 19984, + 55461: 24319, + 55462: 21317, + 55463: 19989, + 55464: 20120, + 55465: 19998, + 55466: 39730, + 55467: 23404, + 55468: 22121, + 55469: 20008, + 55470: 31162, + 55471: 20031, + 55472: 21269, + 55473: 20039, + 55474: 22829, + 55475: 29243, + 55476: 21358, + 55477: 27664, + 55478: 22239, + 55479: 32996, + 55480: 39319, + 55481: 27603, + 55482: 30590, + 55483: 40727, + 55484: 20022, + 55485: 20127, + 55486: 40720, + 55487: 20060, + 55488: 20073, + 55489: 20115, + 55490: 33416, + 55491: 23387, + 55492: 21868, + 55493: 22031, + 55494: 20164, + 55495: 21389, + 55496: 21405, + 55497: 21411, + 55498: 21413, + 55499: 21422, + 55500: 38757, + 55501: 36189, + 55502: 21274, + 55503: 21493, + 55504: 21286, + 55505: 21294, + 55506: 21310, + 55507: 36188, + 55508: 21350, + 55509: 21347, + 55510: 20994, + 55511: 21000, + 55512: 21006, + 55513: 21037, + 55514: 21043, + 55515: 21055, + 55516: 21056, + 55517: 21068, + 55518: 21086, + 55519: 21089, + 55520: 21084, + 55521: 33967, + 55522: 21117, + 55523: 21122, + 55524: 21121, + 55525: 21136, + 55526: 21139, + 55527: 20866, + 55528: 32596, + 55529: 20155, + 55530: 20163, + 55531: 20169, + 55532: 20162, + 55533: 20200, + 55534: 20193, + 55535: 20203, + 55536: 20190, + 55537: 20251, + 55538: 20211, + 55539: 20258, + 55540: 20324, + 55541: 20213, + 55542: 20261, + 55543: 20263, + 55544: 20233, + 55545: 20267, + 55546: 20318, + 55547: 20327, + 55548: 25912, + 55549: 20314, + 55550: 20317, + 55616: 36014, + 55617: 36015, + 55618: 36016, + 55619: 36017, + 55620: 36018, + 55621: 36019, + 55622: 36020, + 55623: 36021, + 55624: 36022, + 55625: 36023, + 55626: 36024, + 55627: 36025, + 55628: 36026, + 55629: 36027, + 55630: 36028, + 55631: 36029, + 55632: 36030, + 55633: 36031, + 55634: 36032, + 55635: 36033, + 55636: 36034, + 55637: 36035, + 55638: 36036, + 55639: 36037, + 55640: 36038, + 55641: 36039, + 55642: 36040, + 55643: 36041, + 55644: 36042, + 55645: 36043, + 55646: 36044, + 55647: 36045, + 55648: 36046, + 55649: 36047, + 55650: 36048, + 55651: 36049, + 55652: 36050, + 55653: 36051, + 55654: 36052, + 55655: 36053, + 55656: 36054, + 55657: 36055, + 55658: 36056, + 55659: 36057, + 55660: 36058, + 55661: 36059, + 55662: 36060, + 55663: 36061, + 55664: 36062, + 55665: 36063, + 55666: 36064, + 55667: 36065, + 55668: 36066, + 55669: 36067, + 55670: 36068, + 55671: 36069, + 55672: 36070, + 55673: 36071, + 55674: 36072, + 55675: 36073, + 55676: 36074, + 55677: 36075, + 55678: 36076, + 55680: 36077, + 55681: 36078, + 55682: 36079, + 55683: 36080, + 55684: 36081, + 55685: 36082, + 55686: 36083, + 55687: 36084, + 55688: 36085, + 55689: 36086, + 55690: 36087, + 55691: 36088, + 55692: 36089, + 55693: 36090, + 55694: 36091, + 55695: 36092, + 55696: 36093, + 55697: 36094, + 55698: 36095, + 55699: 36096, + 55700: 36097, + 55701: 36098, + 55702: 36099, + 55703: 36100, + 55704: 36101, + 55705: 36102, + 55706: 36103, + 55707: 36104, + 55708: 36105, + 55709: 36106, + 55710: 36107, + 55711: 36108, + 55712: 36109, + 55713: 20319, + 55714: 20311, + 55715: 20274, + 55716: 20285, + 55717: 20342, + 55718: 20340, + 55719: 20369, + 55720: 20361, + 55721: 20355, + 55722: 20367, + 55723: 20350, + 55724: 20347, + 55725: 20394, + 55726: 20348, + 55727: 20396, + 55728: 20372, + 55729: 20454, + 55730: 20456, + 55731: 20458, + 55732: 20421, + 55733: 20442, + 55734: 20451, + 55735: 20444, + 55736: 20433, + 55737: 20447, + 55738: 20472, + 55739: 20521, + 55740: 20556, + 55741: 20467, + 55742: 20524, + 55743: 20495, + 55744: 20526, + 55745: 20525, + 55746: 20478, + 55747: 20508, + 55748: 20492, + 55749: 20517, + 55750: 20520, + 55751: 20606, + 55752: 20547, + 55753: 20565, + 55754: 20552, + 55755: 20558, + 55756: 20588, + 55757: 20603, + 55758: 20645, + 55759: 20647, + 55760: 20649, + 55761: 20666, + 55762: 20694, + 55763: 20742, + 55764: 20717, + 55765: 20716, + 55766: 20710, + 55767: 20718, + 55768: 20743, + 55769: 20747, + 55770: 20189, + 55771: 27709, + 55772: 20312, + 55773: 20325, + 55774: 20430, + 55775: 40864, + 55776: 27718, + 55777: 31860, + 55778: 20846, + 55779: 24061, + 55780: 40649, + 55781: 39320, + 55782: 20865, + 55783: 22804, + 55784: 21241, + 55785: 21261, + 55786: 35335, + 55787: 21264, + 55788: 20971, + 55789: 22809, + 55790: 20821, + 55791: 20128, + 55792: 20822, + 55793: 20147, + 55794: 34926, + 55795: 34980, + 55796: 20149, + 55797: 33044, + 55798: 35026, + 55799: 31104, + 55800: 23348, + 55801: 34819, + 55802: 32696, + 55803: 20907, + 55804: 20913, + 55805: 20925, + 55806: 20924, + 55872: 36110, + 55873: 36111, + 55874: 36112, + 55875: 36113, + 55876: 36114, + 55877: 36115, + 55878: 36116, + 55879: 36117, + 55880: 36118, + 55881: 36119, + 55882: 36120, + 55883: 36121, + 55884: 36122, + 55885: 36123, + 55886: 36124, + 55887: 36128, + 55888: 36177, + 55889: 36178, + 55890: 36183, + 55891: 36191, + 55892: 36197, + 55893: 36200, + 55894: 36201, + 55895: 36202, + 55896: 36204, + 55897: 36206, + 55898: 36207, + 55899: 36209, + 55900: 36210, + 55901: 36216, + 55902: 36217, + 55903: 36218, + 55904: 36219, + 55905: 36220, + 55906: 36221, + 55907: 36222, + 55908: 36223, + 55909: 36224, + 55910: 36226, + 55911: 36227, + 55912: 36230, + 55913: 36231, + 55914: 36232, + 55915: 36233, + 55916: 36236, + 55917: 36237, + 55918: 36238, + 55919: 36239, + 55920: 36240, + 55921: 36242, + 55922: 36243, + 55923: 36245, + 55924: 36246, + 55925: 36247, + 55926: 36248, + 55927: 36249, + 55928: 36250, + 55929: 36251, + 55930: 36252, + 55931: 36253, + 55932: 36254, + 55933: 36256, + 55934: 36257, + 55936: 36258, + 55937: 36260, + 55938: 36261, + 55939: 36262, + 55940: 36263, + 55941: 36264, + 55942: 36265, + 55943: 36266, + 55944: 36267, + 55945: 36268, + 55946: 36269, + 55947: 36270, + 55948: 36271, + 55949: 36272, + 55950: 36274, + 55951: 36278, + 55952: 36279, + 55953: 36281, + 55954: 36283, + 55955: 36285, + 55956: 36288, + 55957: 36289, + 55958: 36290, + 55959: 36293, + 55960: 36295, + 55961: 36296, + 55962: 36297, + 55963: 36298, + 55964: 36301, + 55965: 36304, + 55966: 36306, + 55967: 36307, + 55968: 36308, + 55969: 20935, + 55970: 20886, + 55971: 20898, + 55972: 20901, + 55973: 35744, + 55974: 35750, + 55975: 35751, + 55976: 35754, + 55977: 35764, + 55978: 35765, + 55979: 35767, + 55980: 35778, + 55981: 35779, + 55982: 35787, + 55983: 35791, + 55984: 35790, + 55985: 35794, + 55986: 35795, + 55987: 35796, + 55988: 35798, + 55989: 35800, + 55990: 35801, + 55991: 35804, + 55992: 35807, + 55993: 35808, + 55994: 35812, + 55995: 35816, + 55996: 35817, + 55997: 35822, + 55998: 35824, + 55999: 35827, + 56000: 35830, + 56001: 35833, + 56002: 35836, + 56003: 35839, + 56004: 35840, + 56005: 35842, + 56006: 35844, + 56007: 35847, + 56008: 35852, + 56009: 35855, + 56010: 35857, + 56011: 35858, + 56012: 35860, + 56013: 35861, + 56014: 35862, + 56015: 35865, + 56016: 35867, + 56017: 35864, + 56018: 35869, + 56019: 35871, + 56020: 35872, + 56021: 35873, + 56022: 35877, + 56023: 35879, + 56024: 35882, + 56025: 35883, + 56026: 35886, + 56027: 35887, + 56028: 35890, + 56029: 35891, + 56030: 35893, + 56031: 35894, + 56032: 21353, + 56033: 21370, + 56034: 38429, + 56035: 38434, + 56036: 38433, + 56037: 38449, + 56038: 38442, + 56039: 38461, + 56040: 38460, + 56041: 38466, + 56042: 38473, + 56043: 38484, + 56044: 38495, + 56045: 38503, + 56046: 38508, + 56047: 38514, + 56048: 38516, + 56049: 38536, + 56050: 38541, + 56051: 38551, + 56052: 38576, + 56053: 37015, + 56054: 37019, + 56055: 37021, + 56056: 37017, + 56057: 37036, + 56058: 37025, + 56059: 37044, + 56060: 37043, + 56061: 37046, + 56062: 37050, + 56128: 36309, + 56129: 36312, + 56130: 36313, + 56131: 36316, + 56132: 36320, + 56133: 36321, + 56134: 36322, + 56135: 36325, + 56136: 36326, + 56137: 36327, + 56138: 36329, + 56139: 36333, + 56140: 36334, + 56141: 36336, + 56142: 36337, + 56143: 36338, + 56144: 36340, + 56145: 36342, + 56146: 36348, + 56147: 36350, + 56148: 36351, + 56149: 36352, + 56150: 36353, + 56151: 36354, + 56152: 36355, + 56153: 36356, + 56154: 36358, + 56155: 36359, + 56156: 36360, + 56157: 36363, + 56158: 36365, + 56159: 36366, + 56160: 36368, + 56161: 36369, + 56162: 36370, + 56163: 36371, + 56164: 36373, + 56165: 36374, + 56166: 36375, + 56167: 36376, + 56168: 36377, + 56169: 36378, + 56170: 36379, + 56171: 36380, + 56172: 36384, + 56173: 36385, + 56174: 36388, + 56175: 36389, + 56176: 36390, + 56177: 36391, + 56178: 36392, + 56179: 36395, + 56180: 36397, + 56181: 36400, + 56182: 36402, + 56183: 36403, + 56184: 36404, + 56185: 36406, + 56186: 36407, + 56187: 36408, + 56188: 36411, + 56189: 36412, + 56190: 36414, + 56192: 36415, + 56193: 36419, + 56194: 36421, + 56195: 36422, + 56196: 36428, + 56197: 36429, + 56198: 36430, + 56199: 36431, + 56200: 36432, + 56201: 36435, + 56202: 36436, + 56203: 36437, + 56204: 36438, + 56205: 36439, + 56206: 36440, + 56207: 36442, + 56208: 36443, + 56209: 36444, + 56210: 36445, + 56211: 36446, + 56212: 36447, + 56213: 36448, + 56214: 36449, + 56215: 36450, + 56216: 36451, + 56217: 36452, + 56218: 36453, + 56219: 36455, + 56220: 36456, + 56221: 36458, + 56222: 36459, + 56223: 36462, + 56224: 36465, + 56225: 37048, + 56226: 37040, + 56227: 37071, + 56228: 37061, + 56229: 37054, + 56230: 37072, + 56231: 37060, + 56232: 37063, + 56233: 37075, + 56234: 37094, + 56235: 37090, + 56236: 37084, + 56237: 37079, + 56238: 37083, + 56239: 37099, + 56240: 37103, + 56241: 37118, + 56242: 37124, + 56243: 37154, + 56244: 37150, + 56245: 37155, + 56246: 37169, + 56247: 37167, + 56248: 37177, + 56249: 37187, + 56250: 37190, + 56251: 21005, + 56252: 22850, + 56253: 21154, + 56254: 21164, + 56255: 21165, + 56256: 21182, + 56257: 21759, + 56258: 21200, + 56259: 21206, + 56260: 21232, + 56261: 21471, + 56262: 29166, + 56263: 30669, + 56264: 24308, + 56265: 20981, + 56266: 20988, + 56267: 39727, + 56268: 21430, + 56269: 24321, + 56270: 30042, + 56271: 24047, + 56272: 22348, + 56273: 22441, + 56274: 22433, + 56275: 22654, + 56276: 22716, + 56277: 22725, + 56278: 22737, + 56279: 22313, + 56280: 22316, + 56281: 22314, + 56282: 22323, + 56283: 22329, + 56284: 22318, + 56285: 22319, + 56286: 22364, + 56287: 22331, + 56288: 22338, + 56289: 22377, + 56290: 22405, + 56291: 22379, + 56292: 22406, + 56293: 22396, + 56294: 22395, + 56295: 22376, + 56296: 22381, + 56297: 22390, + 56298: 22387, + 56299: 22445, + 56300: 22436, + 56301: 22412, + 56302: 22450, + 56303: 22479, + 56304: 22439, + 56305: 22452, + 56306: 22419, + 56307: 22432, + 56308: 22485, + 56309: 22488, + 56310: 22490, + 56311: 22489, + 56312: 22482, + 56313: 22456, + 56314: 22516, + 56315: 22511, + 56316: 22520, + 56317: 22500, + 56318: 22493, + 56384: 36467, + 56385: 36469, + 56386: 36471, + 56387: 36472, + 56388: 36473, + 56389: 36474, + 56390: 36475, + 56391: 36477, + 56392: 36478, + 56393: 36480, + 56394: 36482, + 56395: 36483, + 56396: 36484, + 56397: 36486, + 56398: 36488, + 56399: 36489, + 56400: 36490, + 56401: 36491, + 56402: 36492, + 56403: 36493, + 56404: 36494, + 56405: 36497, + 56406: 36498, + 56407: 36499, + 56408: 36501, + 56409: 36502, + 56410: 36503, + 56411: 36504, + 56412: 36505, + 56413: 36506, + 56414: 36507, + 56415: 36509, + 56416: 36511, + 56417: 36512, + 56418: 36513, + 56419: 36514, + 56420: 36515, + 56421: 36516, + 56422: 36517, + 56423: 36518, + 56424: 36519, + 56425: 36520, + 56426: 36521, + 56427: 36522, + 56428: 36525, + 56429: 36526, + 56430: 36528, + 56431: 36529, + 56432: 36531, + 56433: 36532, + 56434: 36533, + 56435: 36534, + 56436: 36535, + 56437: 36536, + 56438: 36537, + 56439: 36539, + 56440: 36540, + 56441: 36541, + 56442: 36542, + 56443: 36543, + 56444: 36544, + 56445: 36545, + 56446: 36546, + 56448: 36547, + 56449: 36548, + 56450: 36549, + 56451: 36550, + 56452: 36551, + 56453: 36552, + 56454: 36553, + 56455: 36554, + 56456: 36555, + 56457: 36556, + 56458: 36557, + 56459: 36559, + 56460: 36560, + 56461: 36561, + 56462: 36562, + 56463: 36563, + 56464: 36564, + 56465: 36565, + 56466: 36566, + 56467: 36567, + 56468: 36568, + 56469: 36569, + 56470: 36570, + 56471: 36571, + 56472: 36572, + 56473: 36573, + 56474: 36574, + 56475: 36575, + 56476: 36576, + 56477: 36577, + 56478: 36578, + 56479: 36579, + 56480: 36580, + 56481: 22539, + 56482: 22541, + 56483: 22525, + 56484: 22509, + 56485: 22528, + 56486: 22558, + 56487: 22553, + 56488: 22596, + 56489: 22560, + 56490: 22629, + 56491: 22636, + 56492: 22657, + 56493: 22665, + 56494: 22682, + 56495: 22656, + 56496: 39336, + 56497: 40729, + 56498: 25087, + 56499: 33401, + 56500: 33405, + 56501: 33407, + 56502: 33423, + 56503: 33418, + 56504: 33448, + 56505: 33412, + 56506: 33422, + 56507: 33425, + 56508: 33431, + 56509: 33433, + 56510: 33451, + 56511: 33464, + 56512: 33470, + 56513: 33456, + 56514: 33480, + 56515: 33482, + 56516: 33507, + 56517: 33432, + 56518: 33463, + 56519: 33454, + 56520: 33483, + 56521: 33484, + 56522: 33473, + 56523: 33449, + 56524: 33460, + 56525: 33441, + 56526: 33450, + 56527: 33439, + 56528: 33476, + 56529: 33486, + 56530: 33444, + 56531: 33505, + 56532: 33545, + 56533: 33527, + 56534: 33508, + 56535: 33551, + 56536: 33543, + 56537: 33500, + 56538: 33524, + 56539: 33490, + 56540: 33496, + 56541: 33548, + 56542: 33531, + 56543: 33491, + 56544: 33553, + 56545: 33562, + 56546: 33542, + 56547: 33556, + 56548: 33557, + 56549: 33504, + 56550: 33493, + 56551: 33564, + 56552: 33617, + 56553: 33627, + 56554: 33628, + 56555: 33544, + 56556: 33682, + 56557: 33596, + 56558: 33588, + 56559: 33585, + 56560: 33691, + 56561: 33630, + 56562: 33583, + 56563: 33615, + 56564: 33607, + 56565: 33603, + 56566: 33631, + 56567: 33600, + 56568: 33559, + 56569: 33632, + 56570: 33581, + 56571: 33594, + 56572: 33587, + 56573: 33638, + 56574: 33637, + 56640: 36581, + 56641: 36582, + 56642: 36583, + 56643: 36584, + 56644: 36585, + 56645: 36586, + 56646: 36587, + 56647: 36588, + 56648: 36589, + 56649: 36590, + 56650: 36591, + 56651: 36592, + 56652: 36593, + 56653: 36594, + 56654: 36595, + 56655: 36596, + 56656: 36597, + 56657: 36598, + 56658: 36599, + 56659: 36600, + 56660: 36601, + 56661: 36602, + 56662: 36603, + 56663: 36604, + 56664: 36605, + 56665: 36606, + 56666: 36607, + 56667: 36608, + 56668: 36609, + 56669: 36610, + 56670: 36611, + 56671: 36612, + 56672: 36613, + 56673: 36614, + 56674: 36615, + 56675: 36616, + 56676: 36617, + 56677: 36618, + 56678: 36619, + 56679: 36620, + 56680: 36621, + 56681: 36622, + 56682: 36623, + 56683: 36624, + 56684: 36625, + 56685: 36626, + 56686: 36627, + 56687: 36628, + 56688: 36629, + 56689: 36630, + 56690: 36631, + 56691: 36632, + 56692: 36633, + 56693: 36634, + 56694: 36635, + 56695: 36636, + 56696: 36637, + 56697: 36638, + 56698: 36639, + 56699: 36640, + 56700: 36641, + 56701: 36642, + 56702: 36643, + 56704: 36644, + 56705: 36645, + 56706: 36646, + 56707: 36647, + 56708: 36648, + 56709: 36649, + 56710: 36650, + 56711: 36651, + 56712: 36652, + 56713: 36653, + 56714: 36654, + 56715: 36655, + 56716: 36656, + 56717: 36657, + 56718: 36658, + 56719: 36659, + 56720: 36660, + 56721: 36661, + 56722: 36662, + 56723: 36663, + 56724: 36664, + 56725: 36665, + 56726: 36666, + 56727: 36667, + 56728: 36668, + 56729: 36669, + 56730: 36670, + 56731: 36671, + 56732: 36672, + 56733: 36673, + 56734: 36674, + 56735: 36675, + 56736: 36676, + 56737: 33640, + 56738: 33563, + 56739: 33641, + 56740: 33644, + 56741: 33642, + 56742: 33645, + 56743: 33646, + 56744: 33712, + 56745: 33656, + 56746: 33715, + 56747: 33716, + 56748: 33696, + 56749: 33706, + 56750: 33683, + 56751: 33692, + 56752: 33669, + 56753: 33660, + 56754: 33718, + 56755: 33705, + 56756: 33661, + 56757: 33720, + 56758: 33659, + 56759: 33688, + 56760: 33694, + 56761: 33704, + 56762: 33722, + 56763: 33724, + 56764: 33729, + 56765: 33793, + 56766: 33765, + 56767: 33752, + 56768: 22535, + 56769: 33816, + 56770: 33803, + 56771: 33757, + 56772: 33789, + 56773: 33750, + 56774: 33820, + 56775: 33848, + 56776: 33809, + 56777: 33798, + 56778: 33748, + 56779: 33759, + 56780: 33807, + 56781: 33795, + 56782: 33784, + 56783: 33785, + 56784: 33770, + 56785: 33733, + 56786: 33728, + 56787: 33830, + 56788: 33776, + 56789: 33761, + 56790: 33884, + 56791: 33873, + 56792: 33882, + 56793: 33881, + 56794: 33907, + 56795: 33927, + 56796: 33928, + 56797: 33914, + 56798: 33929, + 56799: 33912, + 56800: 33852, + 56801: 33862, + 56802: 33897, + 56803: 33910, + 56804: 33932, + 56805: 33934, + 56806: 33841, + 56807: 33901, + 56808: 33985, + 56809: 33997, + 56810: 34000, + 56811: 34022, + 56812: 33981, + 56813: 34003, + 56814: 33994, + 56815: 33983, + 56816: 33978, + 56817: 34016, + 56818: 33953, + 56819: 33977, + 56820: 33972, + 56821: 33943, + 56822: 34021, + 56823: 34019, + 56824: 34060, + 56825: 29965, + 56826: 34104, + 56827: 34032, + 56828: 34105, + 56829: 34079, + 56830: 34106, + 56896: 36677, + 56897: 36678, + 56898: 36679, + 56899: 36680, + 56900: 36681, + 56901: 36682, + 56902: 36683, + 56903: 36684, + 56904: 36685, + 56905: 36686, + 56906: 36687, + 56907: 36688, + 56908: 36689, + 56909: 36690, + 56910: 36691, + 56911: 36692, + 56912: 36693, + 56913: 36694, + 56914: 36695, + 56915: 36696, + 56916: 36697, + 56917: 36698, + 56918: 36699, + 56919: 36700, + 56920: 36701, + 56921: 36702, + 56922: 36703, + 56923: 36704, + 56924: 36705, + 56925: 36706, + 56926: 36707, + 56927: 36708, + 56928: 36709, + 56929: 36714, + 56930: 36736, + 56931: 36748, + 56932: 36754, + 56933: 36765, + 56934: 36768, + 56935: 36769, + 56936: 36770, + 56937: 36772, + 56938: 36773, + 56939: 36774, + 56940: 36775, + 56941: 36778, + 56942: 36780, + 56943: 36781, + 56944: 36782, + 56945: 36783, + 56946: 36786, + 56947: 36787, + 56948: 36788, + 56949: 36789, + 56950: 36791, + 56951: 36792, + 56952: 36794, + 56953: 36795, + 56954: 36796, + 56955: 36799, + 56956: 36800, + 56957: 36803, + 56958: 36806, + 56960: 36809, + 56961: 36810, + 56962: 36811, + 56963: 36812, + 56964: 36813, + 56965: 36815, + 56966: 36818, + 56967: 36822, + 56968: 36823, + 56969: 36826, + 56970: 36832, + 56971: 36833, + 56972: 36835, + 56973: 36839, + 56974: 36844, + 56975: 36847, + 56976: 36849, + 56977: 36850, + 56978: 36852, + 56979: 36853, + 56980: 36854, + 56981: 36858, + 56982: 36859, + 56983: 36860, + 56984: 36862, + 56985: 36863, + 56986: 36871, + 56987: 36872, + 56988: 36876, + 56989: 36878, + 56990: 36883, + 56991: 36885, + 56992: 36888, + 56993: 34134, + 56994: 34107, + 56995: 34047, + 56996: 34044, + 56997: 34137, + 56998: 34120, + 56999: 34152, + 57000: 34148, + 57001: 34142, + 57002: 34170, + 57003: 30626, + 57004: 34115, + 57005: 34162, + 57006: 34171, + 57007: 34212, + 57008: 34216, + 57009: 34183, + 57010: 34191, + 57011: 34169, + 57012: 34222, + 57013: 34204, + 57014: 34181, + 57015: 34233, + 57016: 34231, + 57017: 34224, + 57018: 34259, + 57019: 34241, + 57020: 34268, + 57021: 34303, + 57022: 34343, + 57023: 34309, + 57024: 34345, + 57025: 34326, + 57026: 34364, + 57027: 24318, + 57028: 24328, + 57029: 22844, + 57030: 22849, + 57031: 32823, + 57032: 22869, + 57033: 22874, + 57034: 22872, + 57035: 21263, + 57036: 23586, + 57037: 23589, + 57038: 23596, + 57039: 23604, + 57040: 25164, + 57041: 25194, + 57042: 25247, + 57043: 25275, + 57044: 25290, + 57045: 25306, + 57046: 25303, + 57047: 25326, + 57048: 25378, + 57049: 25334, + 57050: 25401, + 57051: 25419, + 57052: 25411, + 57053: 25517, + 57054: 25590, + 57055: 25457, + 57056: 25466, + 57057: 25486, + 57058: 25524, + 57059: 25453, + 57060: 25516, + 57061: 25482, + 57062: 25449, + 57063: 25518, + 57064: 25532, + 57065: 25586, + 57066: 25592, + 57067: 25568, + 57068: 25599, + 57069: 25540, + 57070: 25566, + 57071: 25550, + 57072: 25682, + 57073: 25542, + 57074: 25534, + 57075: 25669, + 57076: 25665, + 57077: 25611, + 57078: 25627, + 57079: 25632, + 57080: 25612, + 57081: 25638, + 57082: 25633, + 57083: 25694, + 57084: 25732, + 57085: 25709, + 57086: 25750, + 57152: 36889, + 57153: 36892, + 57154: 36899, + 57155: 36900, + 57156: 36901, + 57157: 36903, + 57158: 36904, + 57159: 36905, + 57160: 36906, + 57161: 36907, + 57162: 36908, + 57163: 36912, + 57164: 36913, + 57165: 36914, + 57166: 36915, + 57167: 36916, + 57168: 36919, + 57169: 36921, + 57170: 36922, + 57171: 36925, + 57172: 36927, + 57173: 36928, + 57174: 36931, + 57175: 36933, + 57176: 36934, + 57177: 36936, + 57178: 36937, + 57179: 36938, + 57180: 36939, + 57181: 36940, + 57182: 36942, + 57183: 36948, + 57184: 36949, + 57185: 36950, + 57186: 36953, + 57187: 36954, + 57188: 36956, + 57189: 36957, + 57190: 36958, + 57191: 36959, + 57192: 36960, + 57193: 36961, + 57194: 36964, + 57195: 36966, + 57196: 36967, + 57197: 36969, + 57198: 36970, + 57199: 36971, + 57200: 36972, + 57201: 36975, + 57202: 36976, + 57203: 36977, + 57204: 36978, + 57205: 36979, + 57206: 36982, + 57207: 36983, + 57208: 36984, + 57209: 36985, + 57210: 36986, + 57211: 36987, + 57212: 36988, + 57213: 36990, + 57214: 36993, + 57216: 36996, + 57217: 36997, + 57218: 36998, + 57219: 36999, + 57220: 37001, + 57221: 37002, + 57222: 37004, + 57223: 37005, + 57224: 37006, + 57225: 37007, + 57226: 37008, + 57227: 37010, + 57228: 37012, + 57229: 37014, + 57230: 37016, + 57231: 37018, + 57232: 37020, + 57233: 37022, + 57234: 37023, + 57235: 37024, + 57236: 37028, + 57237: 37029, + 57238: 37031, + 57239: 37032, + 57240: 37033, + 57241: 37035, + 57242: 37037, + 57243: 37042, + 57244: 37047, + 57245: 37052, + 57246: 37053, + 57247: 37055, + 57248: 37056, + 57249: 25722, + 57250: 25783, + 57251: 25784, + 57252: 25753, + 57253: 25786, + 57254: 25792, + 57255: 25808, + 57256: 25815, + 57257: 25828, + 57258: 25826, + 57259: 25865, + 57260: 25893, + 57261: 25902, + 57262: 24331, + 57263: 24530, + 57264: 29977, + 57265: 24337, + 57266: 21343, + 57267: 21489, + 57268: 21501, + 57269: 21481, + 57270: 21480, + 57271: 21499, + 57272: 21522, + 57273: 21526, + 57274: 21510, + 57275: 21579, + 57276: 21586, + 57277: 21587, + 57278: 21588, + 57279: 21590, + 57280: 21571, + 57281: 21537, + 57282: 21591, + 57283: 21593, + 57284: 21539, + 57285: 21554, + 57286: 21634, + 57287: 21652, + 57288: 21623, + 57289: 21617, + 57290: 21604, + 57291: 21658, + 57292: 21659, + 57293: 21636, + 57294: 21622, + 57295: 21606, + 57296: 21661, + 57297: 21712, + 57298: 21677, + 57299: 21698, + 57300: 21684, + 57301: 21714, + 57302: 21671, + 57303: 21670, + 57304: 21715, + 57305: 21716, + 57306: 21618, + 57307: 21667, + 57308: 21717, + 57309: 21691, + 57310: 21695, + 57311: 21708, + 57312: 21721, + 57313: 21722, + 57314: 21724, + 57315: 21673, + 57316: 21674, + 57317: 21668, + 57318: 21725, + 57319: 21711, + 57320: 21726, + 57321: 21787, + 57322: 21735, + 57323: 21792, + 57324: 21757, + 57325: 21780, + 57326: 21747, + 57327: 21794, + 57328: 21795, + 57329: 21775, + 57330: 21777, + 57331: 21799, + 57332: 21802, + 57333: 21863, + 57334: 21903, + 57335: 21941, + 57336: 21833, + 57337: 21869, + 57338: 21825, + 57339: 21845, + 57340: 21823, + 57341: 21840, + 57342: 21820, + 57408: 37058, + 57409: 37059, + 57410: 37062, + 57411: 37064, + 57412: 37065, + 57413: 37067, + 57414: 37068, + 57415: 37069, + 57416: 37074, + 57417: 37076, + 57418: 37077, + 57419: 37078, + 57420: 37080, + 57421: 37081, + 57422: 37082, + 57423: 37086, + 57424: 37087, + 57425: 37088, + 57426: 37091, + 57427: 37092, + 57428: 37093, + 57429: 37097, + 57430: 37098, + 57431: 37100, + 57432: 37102, + 57433: 37104, + 57434: 37105, + 57435: 37106, + 57436: 37107, + 57437: 37109, + 57438: 37110, + 57439: 37111, + 57440: 37113, + 57441: 37114, + 57442: 37115, + 57443: 37116, + 57444: 37119, + 57445: 37120, + 57446: 37121, + 57447: 37123, + 57448: 37125, + 57449: 37126, + 57450: 37127, + 57451: 37128, + 57452: 37129, + 57453: 37130, + 57454: 37131, + 57455: 37132, + 57456: 37133, + 57457: 37134, + 57458: 37135, + 57459: 37136, + 57460: 37137, + 57461: 37138, + 57462: 37139, + 57463: 37140, + 57464: 37141, + 57465: 37142, + 57466: 37143, + 57467: 37144, + 57468: 37146, + 57469: 37147, + 57470: 37148, + 57472: 37149, + 57473: 37151, + 57474: 37152, + 57475: 37153, + 57476: 37156, + 57477: 37157, + 57478: 37158, + 57479: 37159, + 57480: 37160, + 57481: 37161, + 57482: 37162, + 57483: 37163, + 57484: 37164, + 57485: 37165, + 57486: 37166, + 57487: 37168, + 57488: 37170, + 57489: 37171, + 57490: 37172, + 57491: 37173, + 57492: 37174, + 57493: 37175, + 57494: 37176, + 57495: 37178, + 57496: 37179, + 57497: 37180, + 57498: 37181, + 57499: 37182, + 57500: 37183, + 57501: 37184, + 57502: 37185, + 57503: 37186, + 57504: 37188, + 57505: 21815, + 57506: 21846, + 57507: 21877, + 57508: 21878, + 57509: 21879, + 57510: 21811, + 57511: 21808, + 57512: 21852, + 57513: 21899, + 57514: 21970, + 57515: 21891, + 57516: 21937, + 57517: 21945, + 57518: 21896, + 57519: 21889, + 57520: 21919, + 57521: 21886, + 57522: 21974, + 57523: 21905, + 57524: 21883, + 57525: 21983, + 57526: 21949, + 57527: 21950, + 57528: 21908, + 57529: 21913, + 57530: 21994, + 57531: 22007, + 57532: 21961, + 57533: 22047, + 57534: 21969, + 57535: 21995, + 57536: 21996, + 57537: 21972, + 57538: 21990, + 57539: 21981, + 57540: 21956, + 57541: 21999, + 57542: 21989, + 57543: 22002, + 57544: 22003, + 57545: 21964, + 57546: 21965, + 57547: 21992, + 57548: 22005, + 57549: 21988, + 57550: 36756, + 57551: 22046, + 57552: 22024, + 57553: 22028, + 57554: 22017, + 57555: 22052, + 57556: 22051, + 57557: 22014, + 57558: 22016, + 57559: 22055, + 57560: 22061, + 57561: 22104, + 57562: 22073, + 57563: 22103, + 57564: 22060, + 57565: 22093, + 57566: 22114, + 57567: 22105, + 57568: 22108, + 57569: 22092, + 57570: 22100, + 57571: 22150, + 57572: 22116, + 57573: 22129, + 57574: 22123, + 57575: 22139, + 57576: 22140, + 57577: 22149, + 57578: 22163, + 57579: 22191, + 57580: 22228, + 57581: 22231, + 57582: 22237, + 57583: 22241, + 57584: 22261, + 57585: 22251, + 57586: 22265, + 57587: 22271, + 57588: 22276, + 57589: 22282, + 57590: 22281, + 57591: 22300, + 57592: 24079, + 57593: 24089, + 57594: 24084, + 57595: 24081, + 57596: 24113, + 57597: 24123, + 57598: 24124, + 57664: 37189, + 57665: 37191, + 57666: 37192, + 57667: 37201, + 57668: 37203, + 57669: 37204, + 57670: 37205, + 57671: 37206, + 57672: 37208, + 57673: 37209, + 57674: 37211, + 57675: 37212, + 57676: 37215, + 57677: 37216, + 57678: 37222, + 57679: 37223, + 57680: 37224, + 57681: 37227, + 57682: 37229, + 57683: 37235, + 57684: 37242, + 57685: 37243, + 57686: 37244, + 57687: 37248, + 57688: 37249, + 57689: 37250, + 57690: 37251, + 57691: 37252, + 57692: 37254, + 57693: 37256, + 57694: 37258, + 57695: 37262, + 57696: 37263, + 57697: 37267, + 57698: 37268, + 57699: 37269, + 57700: 37270, + 57701: 37271, + 57702: 37272, + 57703: 37273, + 57704: 37276, + 57705: 37277, + 57706: 37278, + 57707: 37279, + 57708: 37280, + 57709: 37281, + 57710: 37284, + 57711: 37285, + 57712: 37286, + 57713: 37287, + 57714: 37288, + 57715: 37289, + 57716: 37291, + 57717: 37292, + 57718: 37296, + 57719: 37297, + 57720: 37298, + 57721: 37299, + 57722: 37302, + 57723: 37303, + 57724: 37304, + 57725: 37305, + 57726: 37307, + 57728: 37308, + 57729: 37309, + 57730: 37310, + 57731: 37311, + 57732: 37312, + 57733: 37313, + 57734: 37314, + 57735: 37315, + 57736: 37316, + 57737: 37317, + 57738: 37318, + 57739: 37320, + 57740: 37323, + 57741: 37328, + 57742: 37330, + 57743: 37331, + 57744: 37332, + 57745: 37333, + 57746: 37334, + 57747: 37335, + 57748: 37336, + 57749: 37337, + 57750: 37338, + 57751: 37339, + 57752: 37341, + 57753: 37342, + 57754: 37343, + 57755: 37344, + 57756: 37345, + 57757: 37346, + 57758: 37347, + 57759: 37348, + 57760: 37349, + 57761: 24119, + 57762: 24132, + 57763: 24148, + 57764: 24155, + 57765: 24158, + 57766: 24161, + 57767: 23692, + 57768: 23674, + 57769: 23693, + 57770: 23696, + 57771: 23702, + 57772: 23688, + 57773: 23704, + 57774: 23705, + 57775: 23697, + 57776: 23706, + 57777: 23708, + 57778: 23733, + 57779: 23714, + 57780: 23741, + 57781: 23724, + 57782: 23723, + 57783: 23729, + 57784: 23715, + 57785: 23745, + 57786: 23735, + 57787: 23748, + 57788: 23762, + 57789: 23780, + 57790: 23755, + 57791: 23781, + 57792: 23810, + 57793: 23811, + 57794: 23847, + 57795: 23846, + 57796: 23854, + 57797: 23844, + 57798: 23838, + 57799: 23814, + 57800: 23835, + 57801: 23896, + 57802: 23870, + 57803: 23860, + 57804: 23869, + 57805: 23916, + 57806: 23899, + 57807: 23919, + 57808: 23901, + 57809: 23915, + 57810: 23883, + 57811: 23882, + 57812: 23913, + 57813: 23924, + 57814: 23938, + 57815: 23961, + 57816: 23965, + 57817: 35955, + 57818: 23991, + 57819: 24005, + 57820: 24435, + 57821: 24439, + 57822: 24450, + 57823: 24455, + 57824: 24457, + 57825: 24460, + 57826: 24469, + 57827: 24473, + 57828: 24476, + 57829: 24488, + 57830: 24493, + 57831: 24501, + 57832: 24508, + 57833: 34914, + 57834: 24417, + 57835: 29357, + 57836: 29360, + 57837: 29364, + 57838: 29367, + 57839: 29368, + 57840: 29379, + 57841: 29377, + 57842: 29390, + 57843: 29389, + 57844: 29394, + 57845: 29416, + 57846: 29423, + 57847: 29417, + 57848: 29426, + 57849: 29428, + 57850: 29431, + 57851: 29441, + 57852: 29427, + 57853: 29443, + 57854: 29434, + 57920: 37350, + 57921: 37351, + 57922: 37352, + 57923: 37353, + 57924: 37354, + 57925: 37355, + 57926: 37356, + 57927: 37357, + 57928: 37358, + 57929: 37359, + 57930: 37360, + 57931: 37361, + 57932: 37362, + 57933: 37363, + 57934: 37364, + 57935: 37365, + 57936: 37366, + 57937: 37367, + 57938: 37368, + 57939: 37369, + 57940: 37370, + 57941: 37371, + 57942: 37372, + 57943: 37373, + 57944: 37374, + 57945: 37375, + 57946: 37376, + 57947: 37377, + 57948: 37378, + 57949: 37379, + 57950: 37380, + 57951: 37381, + 57952: 37382, + 57953: 37383, + 57954: 37384, + 57955: 37385, + 57956: 37386, + 57957: 37387, + 57958: 37388, + 57959: 37389, + 57960: 37390, + 57961: 37391, + 57962: 37392, + 57963: 37393, + 57964: 37394, + 57965: 37395, + 57966: 37396, + 57967: 37397, + 57968: 37398, + 57969: 37399, + 57970: 37400, + 57971: 37401, + 57972: 37402, + 57973: 37403, + 57974: 37404, + 57975: 37405, + 57976: 37406, + 57977: 37407, + 57978: 37408, + 57979: 37409, + 57980: 37410, + 57981: 37411, + 57982: 37412, + 57984: 37413, + 57985: 37414, + 57986: 37415, + 57987: 37416, + 57988: 37417, + 57989: 37418, + 57990: 37419, + 57991: 37420, + 57992: 37421, + 57993: 37422, + 57994: 37423, + 57995: 37424, + 57996: 37425, + 57997: 37426, + 57998: 37427, + 57999: 37428, + 58000: 37429, + 58001: 37430, + 58002: 37431, + 58003: 37432, + 58004: 37433, + 58005: 37434, + 58006: 37435, + 58007: 37436, + 58008: 37437, + 58009: 37438, + 58010: 37439, + 58011: 37440, + 58012: 37441, + 58013: 37442, + 58014: 37443, + 58015: 37444, + 58016: 37445, + 58017: 29435, + 58018: 29463, + 58019: 29459, + 58020: 29473, + 58021: 29450, + 58022: 29470, + 58023: 29469, + 58024: 29461, + 58025: 29474, + 58026: 29497, + 58027: 29477, + 58028: 29484, + 58029: 29496, + 58030: 29489, + 58031: 29520, + 58032: 29517, + 58033: 29527, + 58034: 29536, + 58035: 29548, + 58036: 29551, + 58037: 29566, + 58038: 33307, + 58039: 22821, + 58040: 39143, + 58041: 22820, + 58042: 22786, + 58043: 39267, + 58044: 39271, + 58045: 39272, + 58046: 39273, + 58047: 39274, + 58048: 39275, + 58049: 39276, + 58050: 39284, + 58051: 39287, + 58052: 39293, + 58053: 39296, + 58054: 39300, + 58055: 39303, + 58056: 39306, + 58057: 39309, + 58058: 39312, + 58059: 39313, + 58060: 39315, + 58061: 39316, + 58062: 39317, + 58063: 24192, + 58064: 24209, + 58065: 24203, + 58066: 24214, + 58067: 24229, + 58068: 24224, + 58069: 24249, + 58070: 24245, + 58071: 24254, + 58072: 24243, + 58073: 36179, + 58074: 24274, + 58075: 24273, + 58076: 24283, + 58077: 24296, + 58078: 24298, + 58079: 33210, + 58080: 24516, + 58081: 24521, + 58082: 24534, + 58083: 24527, + 58084: 24579, + 58085: 24558, + 58086: 24580, + 58087: 24545, + 58088: 24548, + 58089: 24574, + 58090: 24581, + 58091: 24582, + 58092: 24554, + 58093: 24557, + 58094: 24568, + 58095: 24601, + 58096: 24629, + 58097: 24614, + 58098: 24603, + 58099: 24591, + 58100: 24589, + 58101: 24617, + 58102: 24619, + 58103: 24586, + 58104: 24639, + 58105: 24609, + 58106: 24696, + 58107: 24697, + 58108: 24699, + 58109: 24698, + 58110: 24642, + 58176: 37446, + 58177: 37447, + 58178: 37448, + 58179: 37449, + 58180: 37450, + 58181: 37451, + 58182: 37452, + 58183: 37453, + 58184: 37454, + 58185: 37455, + 58186: 37456, + 58187: 37457, + 58188: 37458, + 58189: 37459, + 58190: 37460, + 58191: 37461, + 58192: 37462, + 58193: 37463, + 58194: 37464, + 58195: 37465, + 58196: 37466, + 58197: 37467, + 58198: 37468, + 58199: 37469, + 58200: 37470, + 58201: 37471, + 58202: 37472, + 58203: 37473, + 58204: 37474, + 58205: 37475, + 58206: 37476, + 58207: 37477, + 58208: 37478, + 58209: 37479, + 58210: 37480, + 58211: 37481, + 58212: 37482, + 58213: 37483, + 58214: 37484, + 58215: 37485, + 58216: 37486, + 58217: 37487, + 58218: 37488, + 58219: 37489, + 58220: 37490, + 58221: 37491, + 58222: 37493, + 58223: 37494, + 58224: 37495, + 58225: 37496, + 58226: 37497, + 58227: 37498, + 58228: 37499, + 58229: 37500, + 58230: 37501, + 58231: 37502, + 58232: 37503, + 58233: 37504, + 58234: 37505, + 58235: 37506, + 58236: 37507, + 58237: 37508, + 58238: 37509, + 58240: 37510, + 58241: 37511, + 58242: 37512, + 58243: 37513, + 58244: 37514, + 58245: 37515, + 58246: 37516, + 58247: 37517, + 58248: 37519, + 58249: 37520, + 58250: 37521, + 58251: 37522, + 58252: 37523, + 58253: 37524, + 58254: 37525, + 58255: 37526, + 58256: 37527, + 58257: 37528, + 58258: 37529, + 58259: 37530, + 58260: 37531, + 58261: 37532, + 58262: 37533, + 58263: 37534, + 58264: 37535, + 58265: 37536, + 58266: 37537, + 58267: 37538, + 58268: 37539, + 58269: 37540, + 58270: 37541, + 58271: 37542, + 58272: 37543, + 58273: 24682, + 58274: 24701, + 58275: 24726, + 58276: 24730, + 58277: 24749, + 58278: 24733, + 58279: 24707, + 58280: 24722, + 58281: 24716, + 58282: 24731, + 58283: 24812, + 58284: 24763, + 58285: 24753, + 58286: 24797, + 58287: 24792, + 58288: 24774, + 58289: 24794, + 58290: 24756, + 58291: 24864, + 58292: 24870, + 58293: 24853, + 58294: 24867, + 58295: 24820, + 58296: 24832, + 58297: 24846, + 58298: 24875, + 58299: 24906, + 58300: 24949, + 58301: 25004, + 58302: 24980, + 58303: 24999, + 58304: 25015, + 58305: 25044, + 58306: 25077, + 58307: 24541, + 58308: 38579, + 58309: 38377, + 58310: 38379, + 58311: 38385, + 58312: 38387, + 58313: 38389, + 58314: 38390, + 58315: 38396, + 58316: 38398, + 58317: 38403, + 58318: 38404, + 58319: 38406, + 58320: 38408, + 58321: 38410, + 58322: 38411, + 58323: 38412, + 58324: 38413, + 58325: 38415, + 58326: 38418, + 58327: 38421, + 58328: 38422, + 58329: 38423, + 58330: 38425, + 58331: 38426, + 58332: 20012, + 58333: 29247, + 58334: 25109, + 58335: 27701, + 58336: 27732, + 58337: 27740, + 58338: 27722, + 58339: 27811, + 58340: 27781, + 58341: 27792, + 58342: 27796, + 58343: 27788, + 58344: 27752, + 58345: 27753, + 58346: 27764, + 58347: 27766, + 58348: 27782, + 58349: 27817, + 58350: 27856, + 58351: 27860, + 58352: 27821, + 58353: 27895, + 58354: 27896, + 58355: 27889, + 58356: 27863, + 58357: 27826, + 58358: 27872, + 58359: 27862, + 58360: 27898, + 58361: 27883, + 58362: 27886, + 58363: 27825, + 58364: 27859, + 58365: 27887, + 58366: 27902, + 58432: 37544, + 58433: 37545, + 58434: 37546, + 58435: 37547, + 58436: 37548, + 58437: 37549, + 58438: 37551, + 58439: 37552, + 58440: 37553, + 58441: 37554, + 58442: 37555, + 58443: 37556, + 58444: 37557, + 58445: 37558, + 58446: 37559, + 58447: 37560, + 58448: 37561, + 58449: 37562, + 58450: 37563, + 58451: 37564, + 58452: 37565, + 58453: 37566, + 58454: 37567, + 58455: 37568, + 58456: 37569, + 58457: 37570, + 58458: 37571, + 58459: 37572, + 58460: 37573, + 58461: 37574, + 58462: 37575, + 58463: 37577, + 58464: 37578, + 58465: 37579, + 58466: 37580, + 58467: 37581, + 58468: 37582, + 58469: 37583, + 58470: 37584, + 58471: 37585, + 58472: 37586, + 58473: 37587, + 58474: 37588, + 58475: 37589, + 58476: 37590, + 58477: 37591, + 58478: 37592, + 58479: 37593, + 58480: 37594, + 58481: 37595, + 58482: 37596, + 58483: 37597, + 58484: 37598, + 58485: 37599, + 58486: 37600, + 58487: 37601, + 58488: 37602, + 58489: 37603, + 58490: 37604, + 58491: 37605, + 58492: 37606, + 58493: 37607, + 58494: 37608, + 58496: 37609, + 58497: 37610, + 58498: 37611, + 58499: 37612, + 58500: 37613, + 58501: 37614, + 58502: 37615, + 58503: 37616, + 58504: 37617, + 58505: 37618, + 58506: 37619, + 58507: 37620, + 58508: 37621, + 58509: 37622, + 58510: 37623, + 58511: 37624, + 58512: 37625, + 58513: 37626, + 58514: 37627, + 58515: 37628, + 58516: 37629, + 58517: 37630, + 58518: 37631, + 58519: 37632, + 58520: 37633, + 58521: 37634, + 58522: 37635, + 58523: 37636, + 58524: 37637, + 58525: 37638, + 58526: 37639, + 58527: 37640, + 58528: 37641, + 58529: 27961, + 58530: 27943, + 58531: 27916, + 58532: 27971, + 58533: 27976, + 58534: 27911, + 58535: 27908, + 58536: 27929, + 58537: 27918, + 58538: 27947, + 58539: 27981, + 58540: 27950, + 58541: 27957, + 58542: 27930, + 58543: 27983, + 58544: 27986, + 58545: 27988, + 58546: 27955, + 58547: 28049, + 58548: 28015, + 58549: 28062, + 58550: 28064, + 58551: 27998, + 58552: 28051, + 58553: 28052, + 58554: 27996, + 58555: 28000, + 58556: 28028, + 58557: 28003, + 58558: 28186, + 58559: 28103, + 58560: 28101, + 58561: 28126, + 58562: 28174, + 58563: 28095, + 58564: 28128, + 58565: 28177, + 58566: 28134, + 58567: 28125, + 58568: 28121, + 58569: 28182, + 58570: 28075, + 58571: 28172, + 58572: 28078, + 58573: 28203, + 58574: 28270, + 58575: 28238, + 58576: 28267, + 58577: 28338, + 58578: 28255, + 58579: 28294, + 58580: 28243, + 58581: 28244, + 58582: 28210, + 58583: 28197, + 58584: 28228, + 58585: 28383, + 58586: 28337, + 58587: 28312, + 58588: 28384, + 58589: 28461, + 58590: 28386, + 58591: 28325, + 58592: 28327, + 58593: 28349, + 58594: 28347, + 58595: 28343, + 58596: 28375, + 58597: 28340, + 58598: 28367, + 58599: 28303, + 58600: 28354, + 58601: 28319, + 58602: 28514, + 58603: 28486, + 58604: 28487, + 58605: 28452, + 58606: 28437, + 58607: 28409, + 58608: 28463, + 58609: 28470, + 58610: 28491, + 58611: 28532, + 58612: 28458, + 58613: 28425, + 58614: 28457, + 58615: 28553, + 58616: 28557, + 58617: 28556, + 58618: 28536, + 58619: 28530, + 58620: 28540, + 58621: 28538, + 58622: 28625, + 58688: 37642, + 58689: 37643, + 58690: 37644, + 58691: 37645, + 58692: 37646, + 58693: 37647, + 58694: 37648, + 58695: 37649, + 58696: 37650, + 58697: 37651, + 58698: 37652, + 58699: 37653, + 58700: 37654, + 58701: 37655, + 58702: 37656, + 58703: 37657, + 58704: 37658, + 58705: 37659, + 58706: 37660, + 58707: 37661, + 58708: 37662, + 58709: 37663, + 58710: 37664, + 58711: 37665, + 58712: 37666, + 58713: 37667, + 58714: 37668, + 58715: 37669, + 58716: 37670, + 58717: 37671, + 58718: 37672, + 58719: 37673, + 58720: 37674, + 58721: 37675, + 58722: 37676, + 58723: 37677, + 58724: 37678, + 58725: 37679, + 58726: 37680, + 58727: 37681, + 58728: 37682, + 58729: 37683, + 58730: 37684, + 58731: 37685, + 58732: 37686, + 58733: 37687, + 58734: 37688, + 58735: 37689, + 58736: 37690, + 58737: 37691, + 58738: 37692, + 58739: 37693, + 58740: 37695, + 58741: 37696, + 58742: 37697, + 58743: 37698, + 58744: 37699, + 58745: 37700, + 58746: 37701, + 58747: 37702, + 58748: 37703, + 58749: 37704, + 58750: 37705, + 58752: 37706, + 58753: 37707, + 58754: 37708, + 58755: 37709, + 58756: 37710, + 58757: 37711, + 58758: 37712, + 58759: 37713, + 58760: 37714, + 58761: 37715, + 58762: 37716, + 58763: 37717, + 58764: 37718, + 58765: 37719, + 58766: 37720, + 58767: 37721, + 58768: 37722, + 58769: 37723, + 58770: 37724, + 58771: 37725, + 58772: 37726, + 58773: 37727, + 58774: 37728, + 58775: 37729, + 58776: 37730, + 58777: 37731, + 58778: 37732, + 58779: 37733, + 58780: 37734, + 58781: 37735, + 58782: 37736, + 58783: 37737, + 58784: 37739, + 58785: 28617, + 58786: 28583, + 58787: 28601, + 58788: 28598, + 58789: 28610, + 58790: 28641, + 58791: 28654, + 58792: 28638, + 58793: 28640, + 58794: 28655, + 58795: 28698, + 58796: 28707, + 58797: 28699, + 58798: 28729, + 58799: 28725, + 58800: 28751, + 58801: 28766, + 58802: 23424, + 58803: 23428, + 58804: 23445, + 58805: 23443, + 58806: 23461, + 58807: 23480, + 58808: 29999, + 58809: 39582, + 58810: 25652, + 58811: 23524, + 58812: 23534, + 58813: 35120, + 58814: 23536, + 58815: 36423, + 58816: 35591, + 58817: 36790, + 58818: 36819, + 58819: 36821, + 58820: 36837, + 58821: 36846, + 58822: 36836, + 58823: 36841, + 58824: 36838, + 58825: 36851, + 58826: 36840, + 58827: 36869, + 58828: 36868, + 58829: 36875, + 58830: 36902, + 58831: 36881, + 58832: 36877, + 58833: 36886, + 58834: 36897, + 58835: 36917, + 58836: 36918, + 58837: 36909, + 58838: 36911, + 58839: 36932, + 58840: 36945, + 58841: 36946, + 58842: 36944, + 58843: 36968, + 58844: 36952, + 58845: 36962, + 58846: 36955, + 58847: 26297, + 58848: 36980, + 58849: 36989, + 58850: 36994, + 58851: 37000, + 58852: 36995, + 58853: 37003, + 58854: 24400, + 58855: 24407, + 58856: 24406, + 58857: 24408, + 58858: 23611, + 58859: 21675, + 58860: 23632, + 58861: 23641, + 58862: 23409, + 58863: 23651, + 58864: 23654, + 58865: 32700, + 58866: 24362, + 58867: 24361, + 58868: 24365, + 58869: 33396, + 58870: 24380, + 58871: 39739, + 58872: 23662, + 58873: 22913, + 58874: 22915, + 58875: 22925, + 58876: 22953, + 58877: 22954, + 58878: 22947, + 58944: 37740, + 58945: 37741, + 58946: 37742, + 58947: 37743, + 58948: 37744, + 58949: 37745, + 58950: 37746, + 58951: 37747, + 58952: 37748, + 58953: 37749, + 58954: 37750, + 58955: 37751, + 58956: 37752, + 58957: 37753, + 58958: 37754, + 58959: 37755, + 58960: 37756, + 58961: 37757, + 58962: 37758, + 58963: 37759, + 58964: 37760, + 58965: 37761, + 58966: 37762, + 58967: 37763, + 58968: 37764, + 58969: 37765, + 58970: 37766, + 58971: 37767, + 58972: 37768, + 58973: 37769, + 58974: 37770, + 58975: 37771, + 58976: 37772, + 58977: 37773, + 58978: 37774, + 58979: 37776, + 58980: 37777, + 58981: 37778, + 58982: 37779, + 58983: 37780, + 58984: 37781, + 58985: 37782, + 58986: 37783, + 58987: 37784, + 58988: 37785, + 58989: 37786, + 58990: 37787, + 58991: 37788, + 58992: 37789, + 58993: 37790, + 58994: 37791, + 58995: 37792, + 58996: 37793, + 58997: 37794, + 58998: 37795, + 58999: 37796, + 59000: 37797, + 59001: 37798, + 59002: 37799, + 59003: 37800, + 59004: 37801, + 59005: 37802, + 59006: 37803, + 59008: 37804, + 59009: 37805, + 59010: 37806, + 59011: 37807, + 59012: 37808, + 59013: 37809, + 59014: 37810, + 59015: 37811, + 59016: 37812, + 59017: 37813, + 59018: 37814, + 59019: 37815, + 59020: 37816, + 59021: 37817, + 59022: 37818, + 59023: 37819, + 59024: 37820, + 59025: 37821, + 59026: 37822, + 59027: 37823, + 59028: 37824, + 59029: 37825, + 59030: 37826, + 59031: 37827, + 59032: 37828, + 59033: 37829, + 59034: 37830, + 59035: 37831, + 59036: 37832, + 59037: 37833, + 59038: 37835, + 59039: 37836, + 59040: 37837, + 59041: 22935, + 59042: 22986, + 59043: 22955, + 59044: 22942, + 59045: 22948, + 59046: 22994, + 59047: 22962, + 59048: 22959, + 59049: 22999, + 59050: 22974, + 59051: 23045, + 59052: 23046, + 59053: 23005, + 59054: 23048, + 59055: 23011, + 59056: 23000, + 59057: 23033, + 59058: 23052, + 59059: 23049, + 59060: 23090, + 59061: 23092, + 59062: 23057, + 59063: 23075, + 59064: 23059, + 59065: 23104, + 59066: 23143, + 59067: 23114, + 59068: 23125, + 59069: 23100, + 59070: 23138, + 59071: 23157, + 59072: 33004, + 59073: 23210, + 59074: 23195, + 59075: 23159, + 59076: 23162, + 59077: 23230, + 59078: 23275, + 59079: 23218, + 59080: 23250, + 59081: 23252, + 59082: 23224, + 59083: 23264, + 59084: 23267, + 59085: 23281, + 59086: 23254, + 59087: 23270, + 59088: 23256, + 59089: 23260, + 59090: 23305, + 59091: 23319, + 59092: 23318, + 59093: 23346, + 59094: 23351, + 59095: 23360, + 59096: 23573, + 59097: 23580, + 59098: 23386, + 59099: 23397, + 59100: 23411, + 59101: 23377, + 59102: 23379, + 59103: 23394, + 59104: 39541, + 59105: 39543, + 59106: 39544, + 59107: 39546, + 59108: 39551, + 59109: 39549, + 59110: 39552, + 59111: 39553, + 59112: 39557, + 59113: 39560, + 59114: 39562, + 59115: 39568, + 59116: 39570, + 59117: 39571, + 59118: 39574, + 59119: 39576, + 59120: 39579, + 59121: 39580, + 59122: 39581, + 59123: 39583, + 59124: 39584, + 59125: 39586, + 59126: 39587, + 59127: 39589, + 59128: 39591, + 59129: 32415, + 59130: 32417, + 59131: 32419, + 59132: 32421, + 59133: 32424, + 59134: 32425, + 59200: 37838, + 59201: 37839, + 59202: 37840, + 59203: 37841, + 59204: 37842, + 59205: 37843, + 59206: 37844, + 59207: 37845, + 59208: 37847, + 59209: 37848, + 59210: 37849, + 59211: 37850, + 59212: 37851, + 59213: 37852, + 59214: 37853, + 59215: 37854, + 59216: 37855, + 59217: 37856, + 59218: 37857, + 59219: 37858, + 59220: 37859, + 59221: 37860, + 59222: 37861, + 59223: 37862, + 59224: 37863, + 59225: 37864, + 59226: 37865, + 59227: 37866, + 59228: 37867, + 59229: 37868, + 59230: 37869, + 59231: 37870, + 59232: 37871, + 59233: 37872, + 59234: 37873, + 59235: 37874, + 59236: 37875, + 59237: 37876, + 59238: 37877, + 59239: 37878, + 59240: 37879, + 59241: 37880, + 59242: 37881, + 59243: 37882, + 59244: 37883, + 59245: 37884, + 59246: 37885, + 59247: 37886, + 59248: 37887, + 59249: 37888, + 59250: 37889, + 59251: 37890, + 59252: 37891, + 59253: 37892, + 59254: 37893, + 59255: 37894, + 59256: 37895, + 59257: 37896, + 59258: 37897, + 59259: 37898, + 59260: 37899, + 59261: 37900, + 59262: 37901, + 59264: 37902, + 59265: 37903, + 59266: 37904, + 59267: 37905, + 59268: 37906, + 59269: 37907, + 59270: 37908, + 59271: 37909, + 59272: 37910, + 59273: 37911, + 59274: 37912, + 59275: 37913, + 59276: 37914, + 59277: 37915, + 59278: 37916, + 59279: 37917, + 59280: 37918, + 59281: 37919, + 59282: 37920, + 59283: 37921, + 59284: 37922, + 59285: 37923, + 59286: 37924, + 59287: 37925, + 59288: 37926, + 59289: 37927, + 59290: 37928, + 59291: 37929, + 59292: 37930, + 59293: 37931, + 59294: 37932, + 59295: 37933, + 59296: 37934, + 59297: 32429, + 59298: 32432, + 59299: 32446, + 59300: 32448, + 59301: 32449, + 59302: 32450, + 59303: 32457, + 59304: 32459, + 59305: 32460, + 59306: 32464, + 59307: 32468, + 59308: 32471, + 59309: 32475, + 59310: 32480, + 59311: 32481, + 59312: 32488, + 59313: 32491, + 59314: 32494, + 59315: 32495, + 59316: 32497, + 59317: 32498, + 59318: 32525, + 59319: 32502, + 59320: 32506, + 59321: 32507, + 59322: 32510, + 59323: 32513, + 59324: 32514, + 59325: 32515, + 59326: 32519, + 59327: 32520, + 59328: 32523, + 59329: 32524, + 59330: 32527, + 59331: 32529, + 59332: 32530, + 59333: 32535, + 59334: 32537, + 59335: 32540, + 59336: 32539, + 59337: 32543, + 59338: 32545, + 59339: 32546, + 59340: 32547, + 59341: 32548, + 59342: 32549, + 59343: 32550, + 59344: 32551, + 59345: 32554, + 59346: 32555, + 59347: 32556, + 59348: 32557, + 59349: 32559, + 59350: 32560, + 59351: 32561, + 59352: 32562, + 59353: 32563, + 59354: 32565, + 59355: 24186, + 59356: 30079, + 59357: 24027, + 59358: 30014, + 59359: 37013, + 59360: 29582, + 59361: 29585, + 59362: 29614, + 59363: 29602, + 59364: 29599, + 59365: 29647, + 59366: 29634, + 59367: 29649, + 59368: 29623, + 59369: 29619, + 59370: 29632, + 59371: 29641, + 59372: 29640, + 59373: 29669, + 59374: 29657, + 59375: 39036, + 59376: 29706, + 59377: 29673, + 59378: 29671, + 59379: 29662, + 59380: 29626, + 59381: 29682, + 59382: 29711, + 59383: 29738, + 59384: 29787, + 59385: 29734, + 59386: 29733, + 59387: 29736, + 59388: 29744, + 59389: 29742, + 59390: 29740, + 59456: 37935, + 59457: 37936, + 59458: 37937, + 59459: 37938, + 59460: 37939, + 59461: 37940, + 59462: 37941, + 59463: 37942, + 59464: 37943, + 59465: 37944, + 59466: 37945, + 59467: 37946, + 59468: 37947, + 59469: 37948, + 59470: 37949, + 59471: 37951, + 59472: 37952, + 59473: 37953, + 59474: 37954, + 59475: 37955, + 59476: 37956, + 59477: 37957, + 59478: 37958, + 59479: 37959, + 59480: 37960, + 59481: 37961, + 59482: 37962, + 59483: 37963, + 59484: 37964, + 59485: 37965, + 59486: 37966, + 59487: 37967, + 59488: 37968, + 59489: 37969, + 59490: 37970, + 59491: 37971, + 59492: 37972, + 59493: 37973, + 59494: 37974, + 59495: 37975, + 59496: 37976, + 59497: 37977, + 59498: 37978, + 59499: 37979, + 59500: 37980, + 59501: 37981, + 59502: 37982, + 59503: 37983, + 59504: 37984, + 59505: 37985, + 59506: 37986, + 59507: 37987, + 59508: 37988, + 59509: 37989, + 59510: 37990, + 59511: 37991, + 59512: 37992, + 59513: 37993, + 59514: 37994, + 59515: 37996, + 59516: 37997, + 59517: 37998, + 59518: 37999, + 59520: 38000, + 59521: 38001, + 59522: 38002, + 59523: 38003, + 59524: 38004, + 59525: 38005, + 59526: 38006, + 59527: 38007, + 59528: 38008, + 59529: 38009, + 59530: 38010, + 59531: 38011, + 59532: 38012, + 59533: 38013, + 59534: 38014, + 59535: 38015, + 59536: 38016, + 59537: 38017, + 59538: 38018, + 59539: 38019, + 59540: 38020, + 59541: 38033, + 59542: 38038, + 59543: 38040, + 59544: 38087, + 59545: 38095, + 59546: 38099, + 59547: 38100, + 59548: 38106, + 59549: 38118, + 59550: 38139, + 59551: 38172, + 59552: 38176, + 59553: 29723, + 59554: 29722, + 59555: 29761, + 59556: 29788, + 59557: 29783, + 59558: 29781, + 59559: 29785, + 59560: 29815, + 59561: 29805, + 59562: 29822, + 59563: 29852, + 59564: 29838, + 59565: 29824, + 59566: 29825, + 59567: 29831, + 59568: 29835, + 59569: 29854, + 59570: 29864, + 59571: 29865, + 59572: 29840, + 59573: 29863, + 59574: 29906, + 59575: 29882, + 59576: 38890, + 59577: 38891, + 59578: 38892, + 59579: 26444, + 59580: 26451, + 59581: 26462, + 59582: 26440, + 59583: 26473, + 59584: 26533, + 59585: 26503, + 59586: 26474, + 59587: 26483, + 59588: 26520, + 59589: 26535, + 59590: 26485, + 59591: 26536, + 59592: 26526, + 59593: 26541, + 59594: 26507, + 59595: 26487, + 59596: 26492, + 59597: 26608, + 59598: 26633, + 59599: 26584, + 59600: 26634, + 59601: 26601, + 59602: 26544, + 59603: 26636, + 59604: 26585, + 59605: 26549, + 59606: 26586, + 59607: 26547, + 59608: 26589, + 59609: 26624, + 59610: 26563, + 59611: 26552, + 59612: 26594, + 59613: 26638, + 59614: 26561, + 59615: 26621, + 59616: 26674, + 59617: 26675, + 59618: 26720, + 59619: 26721, + 59620: 26702, + 59621: 26722, + 59622: 26692, + 59623: 26724, + 59624: 26755, + 59625: 26653, + 59626: 26709, + 59627: 26726, + 59628: 26689, + 59629: 26727, + 59630: 26688, + 59631: 26686, + 59632: 26698, + 59633: 26697, + 59634: 26665, + 59635: 26805, + 59636: 26767, + 59637: 26740, + 59638: 26743, + 59639: 26771, + 59640: 26731, + 59641: 26818, + 59642: 26990, + 59643: 26876, + 59644: 26911, + 59645: 26912, + 59646: 26873, + 59712: 38183, + 59713: 38195, + 59714: 38205, + 59715: 38211, + 59716: 38216, + 59717: 38219, + 59718: 38229, + 59719: 38234, + 59720: 38240, + 59721: 38254, + 59722: 38260, + 59723: 38261, + 59724: 38263, + 59725: 38264, + 59726: 38265, + 59727: 38266, + 59728: 38267, + 59729: 38268, + 59730: 38269, + 59731: 38270, + 59732: 38272, + 59733: 38273, + 59734: 38274, + 59735: 38275, + 59736: 38276, + 59737: 38277, + 59738: 38278, + 59739: 38279, + 59740: 38280, + 59741: 38281, + 59742: 38282, + 59743: 38283, + 59744: 38284, + 59745: 38285, + 59746: 38286, + 59747: 38287, + 59748: 38288, + 59749: 38289, + 59750: 38290, + 59751: 38291, + 59752: 38292, + 59753: 38293, + 59754: 38294, + 59755: 38295, + 59756: 38296, + 59757: 38297, + 59758: 38298, + 59759: 38299, + 59760: 38300, + 59761: 38301, + 59762: 38302, + 59763: 38303, + 59764: 38304, + 59765: 38305, + 59766: 38306, + 59767: 38307, + 59768: 38308, + 59769: 38309, + 59770: 38310, + 59771: 38311, + 59772: 38312, + 59773: 38313, + 59774: 38314, + 59776: 38315, + 59777: 38316, + 59778: 38317, + 59779: 38318, + 59780: 38319, + 59781: 38320, + 59782: 38321, + 59783: 38322, + 59784: 38323, + 59785: 38324, + 59786: 38325, + 59787: 38326, + 59788: 38327, + 59789: 38328, + 59790: 38329, + 59791: 38330, + 59792: 38331, + 59793: 38332, + 59794: 38333, + 59795: 38334, + 59796: 38335, + 59797: 38336, + 59798: 38337, + 59799: 38338, + 59800: 38339, + 59801: 38340, + 59802: 38341, + 59803: 38342, + 59804: 38343, + 59805: 38344, + 59806: 38345, + 59807: 38346, + 59808: 38347, + 59809: 26916, + 59810: 26864, + 59811: 26891, + 59812: 26881, + 59813: 26967, + 59814: 26851, + 59815: 26896, + 59816: 26993, + 59817: 26937, + 59818: 26976, + 59819: 26946, + 59820: 26973, + 59821: 27012, + 59822: 26987, + 59823: 27008, + 59824: 27032, + 59825: 27000, + 59826: 26932, + 59827: 27084, + 59828: 27015, + 59829: 27016, + 59830: 27086, + 59831: 27017, + 59832: 26982, + 59833: 26979, + 59834: 27001, + 59835: 27035, + 59836: 27047, + 59837: 27067, + 59838: 27051, + 59839: 27053, + 59840: 27092, + 59841: 27057, + 59842: 27073, + 59843: 27082, + 59844: 27103, + 59845: 27029, + 59846: 27104, + 59847: 27021, + 59848: 27135, + 59849: 27183, + 59850: 27117, + 59851: 27159, + 59852: 27160, + 59853: 27237, + 59854: 27122, + 59855: 27204, + 59856: 27198, + 59857: 27296, + 59858: 27216, + 59859: 27227, + 59860: 27189, + 59861: 27278, + 59862: 27257, + 59863: 27197, + 59864: 27176, + 59865: 27224, + 59866: 27260, + 59867: 27281, + 59868: 27280, + 59869: 27305, + 59870: 27287, + 59871: 27307, + 59872: 29495, + 59873: 29522, + 59874: 27521, + 59875: 27522, + 59876: 27527, + 59877: 27524, + 59878: 27538, + 59879: 27539, + 59880: 27533, + 59881: 27546, + 59882: 27547, + 59883: 27553, + 59884: 27562, + 59885: 36715, + 59886: 36717, + 59887: 36721, + 59888: 36722, + 59889: 36723, + 59890: 36725, + 59891: 36726, + 59892: 36728, + 59893: 36727, + 59894: 36729, + 59895: 36730, + 59896: 36732, + 59897: 36734, + 59898: 36737, + 59899: 36738, + 59900: 36740, + 59901: 36743, + 59902: 36747, + 59968: 38348, + 59969: 38349, + 59970: 38350, + 59971: 38351, + 59972: 38352, + 59973: 38353, + 59974: 38354, + 59975: 38355, + 59976: 38356, + 59977: 38357, + 59978: 38358, + 59979: 38359, + 59980: 38360, + 59981: 38361, + 59982: 38362, + 59983: 38363, + 59984: 38364, + 59985: 38365, + 59986: 38366, + 59987: 38367, + 59988: 38368, + 59989: 38369, + 59990: 38370, + 59991: 38371, + 59992: 38372, + 59993: 38373, + 59994: 38374, + 59995: 38375, + 59996: 38380, + 59997: 38399, + 59998: 38407, + 59999: 38419, + 60000: 38424, + 60001: 38427, + 60002: 38430, + 60003: 38432, + 60004: 38435, + 60005: 38436, + 60006: 38437, + 60007: 38438, + 60008: 38439, + 60009: 38440, + 60010: 38441, + 60011: 38443, + 60012: 38444, + 60013: 38445, + 60014: 38447, + 60015: 38448, + 60016: 38455, + 60017: 38456, + 60018: 38457, + 60019: 38458, + 60020: 38462, + 60021: 38465, + 60022: 38467, + 60023: 38474, + 60024: 38478, + 60025: 38479, + 60026: 38481, + 60027: 38482, + 60028: 38483, + 60029: 38486, + 60030: 38487, + 60032: 38488, + 60033: 38489, + 60034: 38490, + 60035: 38492, + 60036: 38493, + 60037: 38494, + 60038: 38496, + 60039: 38499, + 60040: 38501, + 60041: 38502, + 60042: 38507, + 60043: 38509, + 60044: 38510, + 60045: 38511, + 60046: 38512, + 60047: 38513, + 60048: 38515, + 60049: 38520, + 60050: 38521, + 60051: 38522, + 60052: 38523, + 60053: 38524, + 60054: 38525, + 60055: 38526, + 60056: 38527, + 60057: 38528, + 60058: 38529, + 60059: 38530, + 60060: 38531, + 60061: 38532, + 60062: 38535, + 60063: 38537, + 60064: 38538, + 60065: 36749, + 60066: 36750, + 60067: 36751, + 60068: 36760, + 60069: 36762, + 60070: 36558, + 60071: 25099, + 60072: 25111, + 60073: 25115, + 60074: 25119, + 60075: 25122, + 60076: 25121, + 60077: 25125, + 60078: 25124, + 60079: 25132, + 60080: 33255, + 60081: 29935, + 60082: 29940, + 60083: 29951, + 60084: 29967, + 60085: 29969, + 60086: 29971, + 60087: 25908, + 60088: 26094, + 60089: 26095, + 60090: 26096, + 60091: 26122, + 60092: 26137, + 60093: 26482, + 60094: 26115, + 60095: 26133, + 60096: 26112, + 60097: 28805, + 60098: 26359, + 60099: 26141, + 60100: 26164, + 60101: 26161, + 60102: 26166, + 60103: 26165, + 60104: 32774, + 60105: 26207, + 60106: 26196, + 60107: 26177, + 60108: 26191, + 60109: 26198, + 60110: 26209, + 60111: 26199, + 60112: 26231, + 60113: 26244, + 60114: 26252, + 60115: 26279, + 60116: 26269, + 60117: 26302, + 60118: 26331, + 60119: 26332, + 60120: 26342, + 60121: 26345, + 60122: 36146, + 60123: 36147, + 60124: 36150, + 60125: 36155, + 60126: 36157, + 60127: 36160, + 60128: 36165, + 60129: 36166, + 60130: 36168, + 60131: 36169, + 60132: 36167, + 60133: 36173, + 60134: 36181, + 60135: 36185, + 60136: 35271, + 60137: 35274, + 60138: 35275, + 60139: 35276, + 60140: 35278, + 60141: 35279, + 60142: 35280, + 60143: 35281, + 60144: 29294, + 60145: 29343, + 60146: 29277, + 60147: 29286, + 60148: 29295, + 60149: 29310, + 60150: 29311, + 60151: 29316, + 60152: 29323, + 60153: 29325, + 60154: 29327, + 60155: 29330, + 60156: 25352, + 60157: 25394, + 60158: 25520, + 60224: 38540, + 60225: 38542, + 60226: 38545, + 60227: 38546, + 60228: 38547, + 60229: 38549, + 60230: 38550, + 60231: 38554, + 60232: 38555, + 60233: 38557, + 60234: 38558, + 60235: 38559, + 60236: 38560, + 60237: 38561, + 60238: 38562, + 60239: 38563, + 60240: 38564, + 60241: 38565, + 60242: 38566, + 60243: 38568, + 60244: 38569, + 60245: 38570, + 60246: 38571, + 60247: 38572, + 60248: 38573, + 60249: 38574, + 60250: 38575, + 60251: 38577, + 60252: 38578, + 60253: 38580, + 60254: 38581, + 60255: 38583, + 60256: 38584, + 60257: 38586, + 60258: 38587, + 60259: 38591, + 60260: 38594, + 60261: 38595, + 60262: 38600, + 60263: 38602, + 60264: 38603, + 60265: 38608, + 60266: 38609, + 60267: 38611, + 60268: 38612, + 60269: 38614, + 60270: 38615, + 60271: 38616, + 60272: 38617, + 60273: 38618, + 60274: 38619, + 60275: 38620, + 60276: 38621, + 60277: 38622, + 60278: 38623, + 60279: 38625, + 60280: 38626, + 60281: 38627, + 60282: 38628, + 60283: 38629, + 60284: 38630, + 60285: 38631, + 60286: 38635, + 60288: 38636, + 60289: 38637, + 60290: 38638, + 60291: 38640, + 60292: 38641, + 60293: 38642, + 60294: 38644, + 60295: 38645, + 60296: 38648, + 60297: 38650, + 60298: 38651, + 60299: 38652, + 60300: 38653, + 60301: 38655, + 60302: 38658, + 60303: 38659, + 60304: 38661, + 60305: 38666, + 60306: 38667, + 60307: 38668, + 60308: 38672, + 60309: 38673, + 60310: 38674, + 60311: 38676, + 60312: 38677, + 60313: 38679, + 60314: 38680, + 60315: 38681, + 60316: 38682, + 60317: 38683, + 60318: 38685, + 60319: 38687, + 60320: 38688, + 60321: 25663, + 60322: 25816, + 60323: 32772, + 60324: 27626, + 60325: 27635, + 60326: 27645, + 60327: 27637, + 60328: 27641, + 60329: 27653, + 60330: 27655, + 60331: 27654, + 60332: 27661, + 60333: 27669, + 60334: 27672, + 60335: 27673, + 60336: 27674, + 60337: 27681, + 60338: 27689, + 60339: 27684, + 60340: 27690, + 60341: 27698, + 60342: 25909, + 60343: 25941, + 60344: 25963, + 60345: 29261, + 60346: 29266, + 60347: 29270, + 60348: 29232, + 60349: 34402, + 60350: 21014, + 60351: 32927, + 60352: 32924, + 60353: 32915, + 60354: 32956, + 60355: 26378, + 60356: 32957, + 60357: 32945, + 60358: 32939, + 60359: 32941, + 60360: 32948, + 60361: 32951, + 60362: 32999, + 60363: 33000, + 60364: 33001, + 60365: 33002, + 60366: 32987, + 60367: 32962, + 60368: 32964, + 60369: 32985, + 60370: 32973, + 60371: 32983, + 60372: 26384, + 60373: 32989, + 60374: 33003, + 60375: 33009, + 60376: 33012, + 60377: 33005, + 60378: 33037, + 60379: 33038, + 60380: 33010, + 60381: 33020, + 60382: 26389, + 60383: 33042, + 60384: 35930, + 60385: 33078, + 60386: 33054, + 60387: 33068, + 60388: 33048, + 60389: 33074, + 60390: 33096, + 60391: 33100, + 60392: 33107, + 60393: 33140, + 60394: 33113, + 60395: 33114, + 60396: 33137, + 60397: 33120, + 60398: 33129, + 60399: 33148, + 60400: 33149, + 60401: 33133, + 60402: 33127, + 60403: 22605, + 60404: 23221, + 60405: 33160, + 60406: 33154, + 60407: 33169, + 60408: 28373, + 60409: 33187, + 60410: 33194, + 60411: 33228, + 60412: 26406, + 60413: 33226, + 60414: 33211, + 60480: 38689, + 60481: 38690, + 60482: 38691, + 60483: 38692, + 60484: 38693, + 60485: 38694, + 60486: 38695, + 60487: 38696, + 60488: 38697, + 60489: 38699, + 60490: 38700, + 60491: 38702, + 60492: 38703, + 60493: 38705, + 60494: 38707, + 60495: 38708, + 60496: 38709, + 60497: 38710, + 60498: 38711, + 60499: 38714, + 60500: 38715, + 60501: 38716, + 60502: 38717, + 60503: 38719, + 60504: 38720, + 60505: 38721, + 60506: 38722, + 60507: 38723, + 60508: 38724, + 60509: 38725, + 60510: 38726, + 60511: 38727, + 60512: 38728, + 60513: 38729, + 60514: 38730, + 60515: 38731, + 60516: 38732, + 60517: 38733, + 60518: 38734, + 60519: 38735, + 60520: 38736, + 60521: 38737, + 60522: 38740, + 60523: 38741, + 60524: 38743, + 60525: 38744, + 60526: 38746, + 60527: 38748, + 60528: 38749, + 60529: 38751, + 60530: 38755, + 60531: 38756, + 60532: 38758, + 60533: 38759, + 60534: 38760, + 60535: 38762, + 60536: 38763, + 60537: 38764, + 60538: 38765, + 60539: 38766, + 60540: 38767, + 60541: 38768, + 60542: 38769, + 60544: 38770, + 60545: 38773, + 60546: 38775, + 60547: 38776, + 60548: 38777, + 60549: 38778, + 60550: 38779, + 60551: 38781, + 60552: 38782, + 60553: 38783, + 60554: 38784, + 60555: 38785, + 60556: 38786, + 60557: 38787, + 60558: 38788, + 60559: 38790, + 60560: 38791, + 60561: 38792, + 60562: 38793, + 60563: 38794, + 60564: 38796, + 60565: 38798, + 60566: 38799, + 60567: 38800, + 60568: 38803, + 60569: 38805, + 60570: 38806, + 60571: 38807, + 60572: 38809, + 60573: 38810, + 60574: 38811, + 60575: 38812, + 60576: 38813, + 60577: 33217, + 60578: 33190, + 60579: 27428, + 60580: 27447, + 60581: 27449, + 60582: 27459, + 60583: 27462, + 60584: 27481, + 60585: 39121, + 60586: 39122, + 60587: 39123, + 60588: 39125, + 60589: 39129, + 60590: 39130, + 60591: 27571, + 60592: 24384, + 60593: 27586, + 60594: 35315, + 60595: 26000, + 60596: 40785, + 60597: 26003, + 60598: 26044, + 60599: 26054, + 60600: 26052, + 60601: 26051, + 60602: 26060, + 60603: 26062, + 60604: 26066, + 60605: 26070, + 60606: 28800, + 60607: 28828, + 60608: 28822, + 60609: 28829, + 60610: 28859, + 60611: 28864, + 60612: 28855, + 60613: 28843, + 60614: 28849, + 60615: 28904, + 60616: 28874, + 60617: 28944, + 60618: 28947, + 60619: 28950, + 60620: 28975, + 60621: 28977, + 60622: 29043, + 60623: 29020, + 60624: 29032, + 60625: 28997, + 60626: 29042, + 60627: 29002, + 60628: 29048, + 60629: 29050, + 60630: 29080, + 60631: 29107, + 60632: 29109, + 60633: 29096, + 60634: 29088, + 60635: 29152, + 60636: 29140, + 60637: 29159, + 60638: 29177, + 60639: 29213, + 60640: 29224, + 60641: 28780, + 60642: 28952, + 60643: 29030, + 60644: 29113, + 60645: 25150, + 60646: 25149, + 60647: 25155, + 60648: 25160, + 60649: 25161, + 60650: 31035, + 60651: 31040, + 60652: 31046, + 60653: 31049, + 60654: 31067, + 60655: 31068, + 60656: 31059, + 60657: 31066, + 60658: 31074, + 60659: 31063, + 60660: 31072, + 60661: 31087, + 60662: 31079, + 60663: 31098, + 60664: 31109, + 60665: 31114, + 60666: 31130, + 60667: 31143, + 60668: 31155, + 60669: 24529, + 60670: 24528, + 60736: 38814, + 60737: 38815, + 60738: 38817, + 60739: 38818, + 60740: 38820, + 60741: 38821, + 60742: 38822, + 60743: 38823, + 60744: 38824, + 60745: 38825, + 60746: 38826, + 60747: 38828, + 60748: 38830, + 60749: 38832, + 60750: 38833, + 60751: 38835, + 60752: 38837, + 60753: 38838, + 60754: 38839, + 60755: 38840, + 60756: 38841, + 60757: 38842, + 60758: 38843, + 60759: 38844, + 60760: 38845, + 60761: 38846, + 60762: 38847, + 60763: 38848, + 60764: 38849, + 60765: 38850, + 60766: 38851, + 60767: 38852, + 60768: 38853, + 60769: 38854, + 60770: 38855, + 60771: 38856, + 60772: 38857, + 60773: 38858, + 60774: 38859, + 60775: 38860, + 60776: 38861, + 60777: 38862, + 60778: 38863, + 60779: 38864, + 60780: 38865, + 60781: 38866, + 60782: 38867, + 60783: 38868, + 60784: 38869, + 60785: 38870, + 60786: 38871, + 60787: 38872, + 60788: 38873, + 60789: 38874, + 60790: 38875, + 60791: 38876, + 60792: 38877, + 60793: 38878, + 60794: 38879, + 60795: 38880, + 60796: 38881, + 60797: 38882, + 60798: 38883, + 60800: 38884, + 60801: 38885, + 60802: 38888, + 60803: 38894, + 60804: 38895, + 60805: 38896, + 60806: 38897, + 60807: 38898, + 60808: 38900, + 60809: 38903, + 60810: 38904, + 60811: 38905, + 60812: 38906, + 60813: 38907, + 60814: 38908, + 60815: 38909, + 60816: 38910, + 60817: 38911, + 60818: 38912, + 60819: 38913, + 60820: 38914, + 60821: 38915, + 60822: 38916, + 60823: 38917, + 60824: 38918, + 60825: 38919, + 60826: 38920, + 60827: 38921, + 60828: 38922, + 60829: 38923, + 60830: 38924, + 60831: 38925, + 60832: 38926, + 60833: 24636, + 60834: 24669, + 60835: 24666, + 60836: 24679, + 60837: 24641, + 60838: 24665, + 60839: 24675, + 60840: 24747, + 60841: 24838, + 60842: 24845, + 60843: 24925, + 60844: 25001, + 60845: 24989, + 60846: 25035, + 60847: 25041, + 60848: 25094, + 60849: 32896, + 60850: 32895, + 60851: 27795, + 60852: 27894, + 60853: 28156, + 60854: 30710, + 60855: 30712, + 60856: 30720, + 60857: 30729, + 60858: 30743, + 60859: 30744, + 60860: 30737, + 60861: 26027, + 60862: 30765, + 60863: 30748, + 60864: 30749, + 60865: 30777, + 60866: 30778, + 60867: 30779, + 60868: 30751, + 60869: 30780, + 60870: 30757, + 60871: 30764, + 60872: 30755, + 60873: 30761, + 60874: 30798, + 60875: 30829, + 60876: 30806, + 60877: 30807, + 60878: 30758, + 60879: 30800, + 60880: 30791, + 60881: 30796, + 60882: 30826, + 60883: 30875, + 60884: 30867, + 60885: 30874, + 60886: 30855, + 60887: 30876, + 60888: 30881, + 60889: 30883, + 60890: 30898, + 60891: 30905, + 60892: 30885, + 60893: 30932, + 60894: 30937, + 60895: 30921, + 60896: 30956, + 60897: 30962, + 60898: 30981, + 60899: 30964, + 60900: 30995, + 60901: 31012, + 60902: 31006, + 60903: 31028, + 60904: 40859, + 60905: 40697, + 60906: 40699, + 60907: 40700, + 60908: 30449, + 60909: 30468, + 60910: 30477, + 60911: 30457, + 60912: 30471, + 60913: 30472, + 60914: 30490, + 60915: 30498, + 60916: 30489, + 60917: 30509, + 60918: 30502, + 60919: 30517, + 60920: 30520, + 60921: 30544, + 60922: 30545, + 60923: 30535, + 60924: 30531, + 60925: 30554, + 60926: 30568, + 60992: 38927, + 60993: 38928, + 60994: 38929, + 60995: 38930, + 60996: 38931, + 60997: 38932, + 60998: 38933, + 60999: 38934, + 61000: 38935, + 61001: 38936, + 61002: 38937, + 61003: 38938, + 61004: 38939, + 61005: 38940, + 61006: 38941, + 61007: 38942, + 61008: 38943, + 61009: 38944, + 61010: 38945, + 61011: 38946, + 61012: 38947, + 61013: 38948, + 61014: 38949, + 61015: 38950, + 61016: 38951, + 61017: 38952, + 61018: 38953, + 61019: 38954, + 61020: 38955, + 61021: 38956, + 61022: 38957, + 61023: 38958, + 61024: 38959, + 61025: 38960, + 61026: 38961, + 61027: 38962, + 61028: 38963, + 61029: 38964, + 61030: 38965, + 61031: 38966, + 61032: 38967, + 61033: 38968, + 61034: 38969, + 61035: 38970, + 61036: 38971, + 61037: 38972, + 61038: 38973, + 61039: 38974, + 61040: 38975, + 61041: 38976, + 61042: 38977, + 61043: 38978, + 61044: 38979, + 61045: 38980, + 61046: 38981, + 61047: 38982, + 61048: 38983, + 61049: 38984, + 61050: 38985, + 61051: 38986, + 61052: 38987, + 61053: 38988, + 61054: 38989, + 61056: 38990, + 61057: 38991, + 61058: 38992, + 61059: 38993, + 61060: 38994, + 61061: 38995, + 61062: 38996, + 61063: 38997, + 61064: 38998, + 61065: 38999, + 61066: 39000, + 61067: 39001, + 61068: 39002, + 61069: 39003, + 61070: 39004, + 61071: 39005, + 61072: 39006, + 61073: 39007, + 61074: 39008, + 61075: 39009, + 61076: 39010, + 61077: 39011, + 61078: 39012, + 61079: 39013, + 61080: 39014, + 61081: 39015, + 61082: 39016, + 61083: 39017, + 61084: 39018, + 61085: 39019, + 61086: 39020, + 61087: 39021, + 61088: 39022, + 61089: 30562, + 61090: 30565, + 61091: 30591, + 61092: 30605, + 61093: 30589, + 61094: 30592, + 61095: 30604, + 61096: 30609, + 61097: 30623, + 61098: 30624, + 61099: 30640, + 61100: 30645, + 61101: 30653, + 61102: 30010, + 61103: 30016, + 61104: 30030, + 61105: 30027, + 61106: 30024, + 61107: 30043, + 61108: 30066, + 61109: 30073, + 61110: 30083, + 61111: 32600, + 61112: 32609, + 61113: 32607, + 61114: 35400, + 61115: 32616, + 61116: 32628, + 61117: 32625, + 61118: 32633, + 61119: 32641, + 61120: 32638, + 61121: 30413, + 61122: 30437, + 61123: 34866, + 61124: 38021, + 61125: 38022, + 61126: 38023, + 61127: 38027, + 61128: 38026, + 61129: 38028, + 61130: 38029, + 61131: 38031, + 61132: 38032, + 61133: 38036, + 61134: 38039, + 61135: 38037, + 61136: 38042, + 61137: 38043, + 61138: 38044, + 61139: 38051, + 61140: 38052, + 61141: 38059, + 61142: 38058, + 61143: 38061, + 61144: 38060, + 61145: 38063, + 61146: 38064, + 61147: 38066, + 61148: 38068, + 61149: 38070, + 61150: 38071, + 61151: 38072, + 61152: 38073, + 61153: 38074, + 61154: 38076, + 61155: 38077, + 61156: 38079, + 61157: 38084, + 61158: 38088, + 61159: 38089, + 61160: 38090, + 61161: 38091, + 61162: 38092, + 61163: 38093, + 61164: 38094, + 61165: 38096, + 61166: 38097, + 61167: 38098, + 61168: 38101, + 61169: 38102, + 61170: 38103, + 61171: 38105, + 61172: 38104, + 61173: 38107, + 61174: 38110, + 61175: 38111, + 61176: 38112, + 61177: 38114, + 61178: 38116, + 61179: 38117, + 61180: 38119, + 61181: 38120, + 61182: 38122, + 61248: 39023, + 61249: 39024, + 61250: 39025, + 61251: 39026, + 61252: 39027, + 61253: 39028, + 61254: 39051, + 61255: 39054, + 61256: 39058, + 61257: 39061, + 61258: 39065, + 61259: 39075, + 61260: 39080, + 61261: 39081, + 61262: 39082, + 61263: 39083, + 61264: 39084, + 61265: 39085, + 61266: 39086, + 61267: 39087, + 61268: 39088, + 61269: 39089, + 61270: 39090, + 61271: 39091, + 61272: 39092, + 61273: 39093, + 61274: 39094, + 61275: 39095, + 61276: 39096, + 61277: 39097, + 61278: 39098, + 61279: 39099, + 61280: 39100, + 61281: 39101, + 61282: 39102, + 61283: 39103, + 61284: 39104, + 61285: 39105, + 61286: 39106, + 61287: 39107, + 61288: 39108, + 61289: 39109, + 61290: 39110, + 61291: 39111, + 61292: 39112, + 61293: 39113, + 61294: 39114, + 61295: 39115, + 61296: 39116, + 61297: 39117, + 61298: 39119, + 61299: 39120, + 61300: 39124, + 61301: 39126, + 61302: 39127, + 61303: 39131, + 61304: 39132, + 61305: 39133, + 61306: 39136, + 61307: 39137, + 61308: 39138, + 61309: 39139, + 61310: 39140, + 61312: 39141, + 61313: 39142, + 61314: 39145, + 61315: 39146, + 61316: 39147, + 61317: 39148, + 61318: 39149, + 61319: 39150, + 61320: 39151, + 61321: 39152, + 61322: 39153, + 61323: 39154, + 61324: 39155, + 61325: 39156, + 61326: 39157, + 61327: 39158, + 61328: 39159, + 61329: 39160, + 61330: 39161, + 61331: 39162, + 61332: 39163, + 61333: 39164, + 61334: 39165, + 61335: 39166, + 61336: 39167, + 61337: 39168, + 61338: 39169, + 61339: 39170, + 61340: 39171, + 61341: 39172, + 61342: 39173, + 61343: 39174, + 61344: 39175, + 61345: 38121, + 61346: 38123, + 61347: 38126, + 61348: 38127, + 61349: 38131, + 61350: 38132, + 61351: 38133, + 61352: 38135, + 61353: 38137, + 61354: 38140, + 61355: 38141, + 61356: 38143, + 61357: 38147, + 61358: 38146, + 61359: 38150, + 61360: 38151, + 61361: 38153, + 61362: 38154, + 61363: 38157, + 61364: 38158, + 61365: 38159, + 61366: 38162, + 61367: 38163, + 61368: 38164, + 61369: 38165, + 61370: 38166, + 61371: 38168, + 61372: 38171, + 61373: 38173, + 61374: 38174, + 61375: 38175, + 61376: 38178, + 61377: 38186, + 61378: 38187, + 61379: 38185, + 61380: 38188, + 61381: 38193, + 61382: 38194, + 61383: 38196, + 61384: 38198, + 61385: 38199, + 61386: 38200, + 61387: 38204, + 61388: 38206, + 61389: 38207, + 61390: 38210, + 61391: 38197, + 61392: 38212, + 61393: 38213, + 61394: 38214, + 61395: 38217, + 61396: 38220, + 61397: 38222, + 61398: 38223, + 61399: 38226, + 61400: 38227, + 61401: 38228, + 61402: 38230, + 61403: 38231, + 61404: 38232, + 61405: 38233, + 61406: 38235, + 61407: 38238, + 61408: 38239, + 61409: 38237, + 61410: 38241, + 61411: 38242, + 61412: 38244, + 61413: 38245, + 61414: 38246, + 61415: 38247, + 61416: 38248, + 61417: 38249, + 61418: 38250, + 61419: 38251, + 61420: 38252, + 61421: 38255, + 61422: 38257, + 61423: 38258, + 61424: 38259, + 61425: 38202, + 61426: 30695, + 61427: 30700, + 61428: 38601, + 61429: 31189, + 61430: 31213, + 61431: 31203, + 61432: 31211, + 61433: 31238, + 61434: 23879, + 61435: 31235, + 61436: 31234, + 61437: 31262, + 61438: 31252, + 61504: 39176, + 61505: 39177, + 61506: 39178, + 61507: 39179, + 61508: 39180, + 61509: 39182, + 61510: 39183, + 61511: 39185, + 61512: 39186, + 61513: 39187, + 61514: 39188, + 61515: 39189, + 61516: 39190, + 61517: 39191, + 61518: 39192, + 61519: 39193, + 61520: 39194, + 61521: 39195, + 61522: 39196, + 61523: 39197, + 61524: 39198, + 61525: 39199, + 61526: 39200, + 61527: 39201, + 61528: 39202, + 61529: 39203, + 61530: 39204, + 61531: 39205, + 61532: 39206, + 61533: 39207, + 61534: 39208, + 61535: 39209, + 61536: 39210, + 61537: 39211, + 61538: 39212, + 61539: 39213, + 61540: 39215, + 61541: 39216, + 61542: 39217, + 61543: 39218, + 61544: 39219, + 61545: 39220, + 61546: 39221, + 61547: 39222, + 61548: 39223, + 61549: 39224, + 61550: 39225, + 61551: 39226, + 61552: 39227, + 61553: 39228, + 61554: 39229, + 61555: 39230, + 61556: 39231, + 61557: 39232, + 61558: 39233, + 61559: 39234, + 61560: 39235, + 61561: 39236, + 61562: 39237, + 61563: 39238, + 61564: 39239, + 61565: 39240, + 61566: 39241, + 61568: 39242, + 61569: 39243, + 61570: 39244, + 61571: 39245, + 61572: 39246, + 61573: 39247, + 61574: 39248, + 61575: 39249, + 61576: 39250, + 61577: 39251, + 61578: 39254, + 61579: 39255, + 61580: 39256, + 61581: 39257, + 61582: 39258, + 61583: 39259, + 61584: 39260, + 61585: 39261, + 61586: 39262, + 61587: 39263, + 61588: 39264, + 61589: 39265, + 61590: 39266, + 61591: 39268, + 61592: 39270, + 61593: 39283, + 61594: 39288, + 61595: 39289, + 61596: 39291, + 61597: 39294, + 61598: 39298, + 61599: 39299, + 61600: 39305, + 61601: 31289, + 61602: 31287, + 61603: 31313, + 61604: 40655, + 61605: 39333, + 61606: 31344, + 61607: 30344, + 61608: 30350, + 61609: 30355, + 61610: 30361, + 61611: 30372, + 61612: 29918, + 61613: 29920, + 61614: 29996, + 61615: 40480, + 61616: 40482, + 61617: 40488, + 61618: 40489, + 61619: 40490, + 61620: 40491, + 61621: 40492, + 61622: 40498, + 61623: 40497, + 61624: 40502, + 61625: 40504, + 61626: 40503, + 61627: 40505, + 61628: 40506, + 61629: 40510, + 61630: 40513, + 61631: 40514, + 61632: 40516, + 61633: 40518, + 61634: 40519, + 61635: 40520, + 61636: 40521, + 61637: 40523, + 61638: 40524, + 61639: 40526, + 61640: 40529, + 61641: 40533, + 61642: 40535, + 61643: 40538, + 61644: 40539, + 61645: 40540, + 61646: 40542, + 61647: 40547, + 61648: 40550, + 61649: 40551, + 61650: 40552, + 61651: 40553, + 61652: 40554, + 61653: 40555, + 61654: 40556, + 61655: 40561, + 61656: 40557, + 61657: 40563, + 61658: 30098, + 61659: 30100, + 61660: 30102, + 61661: 30112, + 61662: 30109, + 61663: 30124, + 61664: 30115, + 61665: 30131, + 61666: 30132, + 61667: 30136, + 61668: 30148, + 61669: 30129, + 61670: 30128, + 61671: 30147, + 61672: 30146, + 61673: 30166, + 61674: 30157, + 61675: 30179, + 61676: 30184, + 61677: 30182, + 61678: 30180, + 61679: 30187, + 61680: 30183, + 61681: 30211, + 61682: 30193, + 61683: 30204, + 61684: 30207, + 61685: 30224, + 61686: 30208, + 61687: 30213, + 61688: 30220, + 61689: 30231, + 61690: 30218, + 61691: 30245, + 61692: 30232, + 61693: 30229, + 61694: 30233, + 61760: 39308, + 61761: 39310, + 61762: 39322, + 61763: 39323, + 61764: 39324, + 61765: 39325, + 61766: 39326, + 61767: 39327, + 61768: 39328, + 61769: 39329, + 61770: 39330, + 61771: 39331, + 61772: 39332, + 61773: 39334, + 61774: 39335, + 61775: 39337, + 61776: 39338, + 61777: 39339, + 61778: 39340, + 61779: 39341, + 61780: 39342, + 61781: 39343, + 61782: 39344, + 61783: 39345, + 61784: 39346, + 61785: 39347, + 61786: 39348, + 61787: 39349, + 61788: 39350, + 61789: 39351, + 61790: 39352, + 61791: 39353, + 61792: 39354, + 61793: 39355, + 61794: 39356, + 61795: 39357, + 61796: 39358, + 61797: 39359, + 61798: 39360, + 61799: 39361, + 61800: 39362, + 61801: 39363, + 61802: 39364, + 61803: 39365, + 61804: 39366, + 61805: 39367, + 61806: 39368, + 61807: 39369, + 61808: 39370, + 61809: 39371, + 61810: 39372, + 61811: 39373, + 61812: 39374, + 61813: 39375, + 61814: 39376, + 61815: 39377, + 61816: 39378, + 61817: 39379, + 61818: 39380, + 61819: 39381, + 61820: 39382, + 61821: 39383, + 61822: 39384, + 61824: 39385, + 61825: 39386, + 61826: 39387, + 61827: 39388, + 61828: 39389, + 61829: 39390, + 61830: 39391, + 61831: 39392, + 61832: 39393, + 61833: 39394, + 61834: 39395, + 61835: 39396, + 61836: 39397, + 61837: 39398, + 61838: 39399, + 61839: 39400, + 61840: 39401, + 61841: 39402, + 61842: 39403, + 61843: 39404, + 61844: 39405, + 61845: 39406, + 61846: 39407, + 61847: 39408, + 61848: 39409, + 61849: 39410, + 61850: 39411, + 61851: 39412, + 61852: 39413, + 61853: 39414, + 61854: 39415, + 61855: 39416, + 61856: 39417, + 61857: 30235, + 61858: 30268, + 61859: 30242, + 61860: 30240, + 61861: 30272, + 61862: 30253, + 61863: 30256, + 61864: 30271, + 61865: 30261, + 61866: 30275, + 61867: 30270, + 61868: 30259, + 61869: 30285, + 61870: 30302, + 61871: 30292, + 61872: 30300, + 61873: 30294, + 61874: 30315, + 61875: 30319, + 61876: 32714, + 61877: 31462, + 61878: 31352, + 61879: 31353, + 61880: 31360, + 61881: 31366, + 61882: 31368, + 61883: 31381, + 61884: 31398, + 61885: 31392, + 61886: 31404, + 61887: 31400, + 61888: 31405, + 61889: 31411, + 61890: 34916, + 61891: 34921, + 61892: 34930, + 61893: 34941, + 61894: 34943, + 61895: 34946, + 61896: 34978, + 61897: 35014, + 61898: 34999, + 61899: 35004, + 61900: 35017, + 61901: 35042, + 61902: 35022, + 61903: 35043, + 61904: 35045, + 61905: 35057, + 61906: 35098, + 61907: 35068, + 61908: 35048, + 61909: 35070, + 61910: 35056, + 61911: 35105, + 61912: 35097, + 61913: 35091, + 61914: 35099, + 61915: 35082, + 61916: 35124, + 61917: 35115, + 61918: 35126, + 61919: 35137, + 61920: 35174, + 61921: 35195, + 61922: 30091, + 61923: 32997, + 61924: 30386, + 61925: 30388, + 61926: 30684, + 61927: 32786, + 61928: 32788, + 61929: 32790, + 61930: 32796, + 61931: 32800, + 61932: 32802, + 61933: 32805, + 61934: 32806, + 61935: 32807, + 61936: 32809, + 61937: 32808, + 61938: 32817, + 61939: 32779, + 61940: 32821, + 61941: 32835, + 61942: 32838, + 61943: 32845, + 61944: 32850, + 61945: 32873, + 61946: 32881, + 61947: 35203, + 61948: 39032, + 61949: 39040, + 61950: 39043, + 62016: 39418, + 62017: 39419, + 62018: 39420, + 62019: 39421, + 62020: 39422, + 62021: 39423, + 62022: 39424, + 62023: 39425, + 62024: 39426, + 62025: 39427, + 62026: 39428, + 62027: 39429, + 62028: 39430, + 62029: 39431, + 62030: 39432, + 62031: 39433, + 62032: 39434, + 62033: 39435, + 62034: 39436, + 62035: 39437, + 62036: 39438, + 62037: 39439, + 62038: 39440, + 62039: 39441, + 62040: 39442, + 62041: 39443, + 62042: 39444, + 62043: 39445, + 62044: 39446, + 62045: 39447, + 62046: 39448, + 62047: 39449, + 62048: 39450, + 62049: 39451, + 62050: 39452, + 62051: 39453, + 62052: 39454, + 62053: 39455, + 62054: 39456, + 62055: 39457, + 62056: 39458, + 62057: 39459, + 62058: 39460, + 62059: 39461, + 62060: 39462, + 62061: 39463, + 62062: 39464, + 62063: 39465, + 62064: 39466, + 62065: 39467, + 62066: 39468, + 62067: 39469, + 62068: 39470, + 62069: 39471, + 62070: 39472, + 62071: 39473, + 62072: 39474, + 62073: 39475, + 62074: 39476, + 62075: 39477, + 62076: 39478, + 62077: 39479, + 62078: 39480, + 62080: 39481, + 62081: 39482, + 62082: 39483, + 62083: 39484, + 62084: 39485, + 62085: 39486, + 62086: 39487, + 62087: 39488, + 62088: 39489, + 62089: 39490, + 62090: 39491, + 62091: 39492, + 62092: 39493, + 62093: 39494, + 62094: 39495, + 62095: 39496, + 62096: 39497, + 62097: 39498, + 62098: 39499, + 62099: 39500, + 62100: 39501, + 62101: 39502, + 62102: 39503, + 62103: 39504, + 62104: 39505, + 62105: 39506, + 62106: 39507, + 62107: 39508, + 62108: 39509, + 62109: 39510, + 62110: 39511, + 62111: 39512, + 62112: 39513, + 62113: 39049, + 62114: 39052, + 62115: 39053, + 62116: 39055, + 62117: 39060, + 62118: 39066, + 62119: 39067, + 62120: 39070, + 62121: 39071, + 62122: 39073, + 62123: 39074, + 62124: 39077, + 62125: 39078, + 62126: 34381, + 62127: 34388, + 62128: 34412, + 62129: 34414, + 62130: 34431, + 62131: 34426, + 62132: 34428, + 62133: 34427, + 62134: 34472, + 62135: 34445, + 62136: 34443, + 62137: 34476, + 62138: 34461, + 62139: 34471, + 62140: 34467, + 62141: 34474, + 62142: 34451, + 62143: 34473, + 62144: 34486, + 62145: 34500, + 62146: 34485, + 62147: 34510, + 62148: 34480, + 62149: 34490, + 62150: 34481, + 62151: 34479, + 62152: 34505, + 62153: 34511, + 62154: 34484, + 62155: 34537, + 62156: 34545, + 62157: 34546, + 62158: 34541, + 62159: 34547, + 62160: 34512, + 62161: 34579, + 62162: 34526, + 62163: 34548, + 62164: 34527, + 62165: 34520, + 62166: 34513, + 62167: 34563, + 62168: 34567, + 62169: 34552, + 62170: 34568, + 62171: 34570, + 62172: 34573, + 62173: 34569, + 62174: 34595, + 62175: 34619, + 62176: 34590, + 62177: 34597, + 62178: 34606, + 62179: 34586, + 62180: 34622, + 62181: 34632, + 62182: 34612, + 62183: 34609, + 62184: 34601, + 62185: 34615, + 62186: 34623, + 62187: 34690, + 62188: 34594, + 62189: 34685, + 62190: 34686, + 62191: 34683, + 62192: 34656, + 62193: 34672, + 62194: 34636, + 62195: 34670, + 62196: 34699, + 62197: 34643, + 62198: 34659, + 62199: 34684, + 62200: 34660, + 62201: 34649, + 62202: 34661, + 62203: 34707, + 62204: 34735, + 62205: 34728, + 62206: 34770, + 62272: 39514, + 62273: 39515, + 62274: 39516, + 62275: 39517, + 62276: 39518, + 62277: 39519, + 62278: 39520, + 62279: 39521, + 62280: 39522, + 62281: 39523, + 62282: 39524, + 62283: 39525, + 62284: 39526, + 62285: 39527, + 62286: 39528, + 62287: 39529, + 62288: 39530, + 62289: 39531, + 62290: 39538, + 62291: 39555, + 62292: 39561, + 62293: 39565, + 62294: 39566, + 62295: 39572, + 62296: 39573, + 62297: 39577, + 62298: 39590, + 62299: 39593, + 62300: 39594, + 62301: 39595, + 62302: 39596, + 62303: 39597, + 62304: 39598, + 62305: 39599, + 62306: 39602, + 62307: 39603, + 62308: 39604, + 62309: 39605, + 62310: 39609, + 62311: 39611, + 62312: 39613, + 62313: 39614, + 62314: 39615, + 62315: 39619, + 62316: 39620, + 62317: 39622, + 62318: 39623, + 62319: 39624, + 62320: 39625, + 62321: 39626, + 62322: 39629, + 62323: 39630, + 62324: 39631, + 62325: 39632, + 62326: 39634, + 62327: 39636, + 62328: 39637, + 62329: 39638, + 62330: 39639, + 62331: 39641, + 62332: 39642, + 62333: 39643, + 62334: 39644, + 62336: 39645, + 62337: 39646, + 62338: 39648, + 62339: 39650, + 62340: 39651, + 62341: 39652, + 62342: 39653, + 62343: 39655, + 62344: 39656, + 62345: 39657, + 62346: 39658, + 62347: 39660, + 62348: 39662, + 62349: 39664, + 62350: 39665, + 62351: 39666, + 62352: 39667, + 62353: 39668, + 62354: 39669, + 62355: 39670, + 62356: 39671, + 62357: 39672, + 62358: 39674, + 62359: 39676, + 62360: 39677, + 62361: 39678, + 62362: 39679, + 62363: 39680, + 62364: 39681, + 62365: 39682, + 62366: 39684, + 62367: 39685, + 62368: 39686, + 62369: 34758, + 62370: 34696, + 62371: 34693, + 62372: 34733, + 62373: 34711, + 62374: 34691, + 62375: 34731, + 62376: 34789, + 62377: 34732, + 62378: 34741, + 62379: 34739, + 62380: 34763, + 62381: 34771, + 62382: 34749, + 62383: 34769, + 62384: 34752, + 62385: 34762, + 62386: 34779, + 62387: 34794, + 62388: 34784, + 62389: 34798, + 62390: 34838, + 62391: 34835, + 62392: 34814, + 62393: 34826, + 62394: 34843, + 62395: 34849, + 62396: 34873, + 62397: 34876, + 62398: 32566, + 62399: 32578, + 62400: 32580, + 62401: 32581, + 62402: 33296, + 62403: 31482, + 62404: 31485, + 62405: 31496, + 62406: 31491, + 62407: 31492, + 62408: 31509, + 62409: 31498, + 62410: 31531, + 62411: 31503, + 62412: 31559, + 62413: 31544, + 62414: 31530, + 62415: 31513, + 62416: 31534, + 62417: 31537, + 62418: 31520, + 62419: 31525, + 62420: 31524, + 62421: 31539, + 62422: 31550, + 62423: 31518, + 62424: 31576, + 62425: 31578, + 62426: 31557, + 62427: 31605, + 62428: 31564, + 62429: 31581, + 62430: 31584, + 62431: 31598, + 62432: 31611, + 62433: 31586, + 62434: 31602, + 62435: 31601, + 62436: 31632, + 62437: 31654, + 62438: 31655, + 62439: 31672, + 62440: 31660, + 62441: 31645, + 62442: 31656, + 62443: 31621, + 62444: 31658, + 62445: 31644, + 62446: 31650, + 62447: 31659, + 62448: 31668, + 62449: 31697, + 62450: 31681, + 62451: 31692, + 62452: 31709, + 62453: 31706, + 62454: 31717, + 62455: 31718, + 62456: 31722, + 62457: 31756, + 62458: 31742, + 62459: 31740, + 62460: 31759, + 62461: 31766, + 62462: 31755, + 62528: 39687, + 62529: 39689, + 62530: 39690, + 62531: 39691, + 62532: 39692, + 62533: 39693, + 62534: 39694, + 62535: 39696, + 62536: 39697, + 62537: 39698, + 62538: 39700, + 62539: 39701, + 62540: 39702, + 62541: 39703, + 62542: 39704, + 62543: 39705, + 62544: 39706, + 62545: 39707, + 62546: 39708, + 62547: 39709, + 62548: 39710, + 62549: 39712, + 62550: 39713, + 62551: 39714, + 62552: 39716, + 62553: 39717, + 62554: 39718, + 62555: 39719, + 62556: 39720, + 62557: 39721, + 62558: 39722, + 62559: 39723, + 62560: 39724, + 62561: 39725, + 62562: 39726, + 62563: 39728, + 62564: 39729, + 62565: 39731, + 62566: 39732, + 62567: 39733, + 62568: 39734, + 62569: 39735, + 62570: 39736, + 62571: 39737, + 62572: 39738, + 62573: 39741, + 62574: 39742, + 62575: 39743, + 62576: 39744, + 62577: 39750, + 62578: 39754, + 62579: 39755, + 62580: 39756, + 62581: 39758, + 62582: 39760, + 62583: 39762, + 62584: 39763, + 62585: 39765, + 62586: 39766, + 62587: 39767, + 62588: 39768, + 62589: 39769, + 62590: 39770, + 62592: 39771, + 62593: 39772, + 62594: 39773, + 62595: 39774, + 62596: 39775, + 62597: 39776, + 62598: 39777, + 62599: 39778, + 62600: 39779, + 62601: 39780, + 62602: 39781, + 62603: 39782, + 62604: 39783, + 62605: 39784, + 62606: 39785, + 62607: 39786, + 62608: 39787, + 62609: 39788, + 62610: 39789, + 62611: 39790, + 62612: 39791, + 62613: 39792, + 62614: 39793, + 62615: 39794, + 62616: 39795, + 62617: 39796, + 62618: 39797, + 62619: 39798, + 62620: 39799, + 62621: 39800, + 62622: 39801, + 62623: 39802, + 62624: 39803, + 62625: 31775, + 62626: 31786, + 62627: 31782, + 62628: 31800, + 62629: 31809, + 62630: 31808, + 62631: 33278, + 62632: 33281, + 62633: 33282, + 62634: 33284, + 62635: 33260, + 62636: 34884, + 62637: 33313, + 62638: 33314, + 62639: 33315, + 62640: 33325, + 62641: 33327, + 62642: 33320, + 62643: 33323, + 62644: 33336, + 62645: 33339, + 62646: 33331, + 62647: 33332, + 62648: 33342, + 62649: 33348, + 62650: 33353, + 62651: 33355, + 62652: 33359, + 62653: 33370, + 62654: 33375, + 62655: 33384, + 62656: 34942, + 62657: 34949, + 62658: 34952, + 62659: 35032, + 62660: 35039, + 62661: 35166, + 62662: 32669, + 62663: 32671, + 62664: 32679, + 62665: 32687, + 62666: 32688, + 62667: 32690, + 62668: 31868, + 62669: 25929, + 62670: 31889, + 62671: 31901, + 62672: 31900, + 62673: 31902, + 62674: 31906, + 62675: 31922, + 62676: 31932, + 62677: 31933, + 62678: 31937, + 62679: 31943, + 62680: 31948, + 62681: 31949, + 62682: 31944, + 62683: 31941, + 62684: 31959, + 62685: 31976, + 62686: 33390, + 62687: 26280, + 62688: 32703, + 62689: 32718, + 62690: 32725, + 62691: 32741, + 62692: 32737, + 62693: 32742, + 62694: 32745, + 62695: 32750, + 62696: 32755, + 62697: 31992, + 62698: 32119, + 62699: 32166, + 62700: 32174, + 62701: 32327, + 62702: 32411, + 62703: 40632, + 62704: 40628, + 62705: 36211, + 62706: 36228, + 62707: 36244, + 62708: 36241, + 62709: 36273, + 62710: 36199, + 62711: 36205, + 62712: 35911, + 62713: 35913, + 62714: 37194, + 62715: 37200, + 62716: 37198, + 62717: 37199, + 62718: 37220, + 62784: 39804, + 62785: 39805, + 62786: 39806, + 62787: 39807, + 62788: 39808, + 62789: 39809, + 62790: 39810, + 62791: 39811, + 62792: 39812, + 62793: 39813, + 62794: 39814, + 62795: 39815, + 62796: 39816, + 62797: 39817, + 62798: 39818, + 62799: 39819, + 62800: 39820, + 62801: 39821, + 62802: 39822, + 62803: 39823, + 62804: 39824, + 62805: 39825, + 62806: 39826, + 62807: 39827, + 62808: 39828, + 62809: 39829, + 62810: 39830, + 62811: 39831, + 62812: 39832, + 62813: 39833, + 62814: 39834, + 62815: 39835, + 62816: 39836, + 62817: 39837, + 62818: 39838, + 62819: 39839, + 62820: 39840, + 62821: 39841, + 62822: 39842, + 62823: 39843, + 62824: 39844, + 62825: 39845, + 62826: 39846, + 62827: 39847, + 62828: 39848, + 62829: 39849, + 62830: 39850, + 62831: 39851, + 62832: 39852, + 62833: 39853, + 62834: 39854, + 62835: 39855, + 62836: 39856, + 62837: 39857, + 62838: 39858, + 62839: 39859, + 62840: 39860, + 62841: 39861, + 62842: 39862, + 62843: 39863, + 62844: 39864, + 62845: 39865, + 62846: 39866, + 62848: 39867, + 62849: 39868, + 62850: 39869, + 62851: 39870, + 62852: 39871, + 62853: 39872, + 62854: 39873, + 62855: 39874, + 62856: 39875, + 62857: 39876, + 62858: 39877, + 62859: 39878, + 62860: 39879, + 62861: 39880, + 62862: 39881, + 62863: 39882, + 62864: 39883, + 62865: 39884, + 62866: 39885, + 62867: 39886, + 62868: 39887, + 62869: 39888, + 62870: 39889, + 62871: 39890, + 62872: 39891, + 62873: 39892, + 62874: 39893, + 62875: 39894, + 62876: 39895, + 62877: 39896, + 62878: 39897, + 62879: 39898, + 62880: 39899, + 62881: 37218, + 62882: 37217, + 62883: 37232, + 62884: 37225, + 62885: 37231, + 62886: 37245, + 62887: 37246, + 62888: 37234, + 62889: 37236, + 62890: 37241, + 62891: 37260, + 62892: 37253, + 62893: 37264, + 62894: 37261, + 62895: 37265, + 62896: 37282, + 62897: 37283, + 62898: 37290, + 62899: 37293, + 62900: 37294, + 62901: 37295, + 62902: 37301, + 62903: 37300, + 62904: 37306, + 62905: 35925, + 62906: 40574, + 62907: 36280, + 62908: 36331, + 62909: 36357, + 62910: 36441, + 62911: 36457, + 62912: 36277, + 62913: 36287, + 62914: 36284, + 62915: 36282, + 62916: 36292, + 62917: 36310, + 62918: 36311, + 62919: 36314, + 62920: 36318, + 62921: 36302, + 62922: 36303, + 62923: 36315, + 62924: 36294, + 62925: 36332, + 62926: 36343, + 62927: 36344, + 62928: 36323, + 62929: 36345, + 62930: 36347, + 62931: 36324, + 62932: 36361, + 62933: 36349, + 62934: 36372, + 62935: 36381, + 62936: 36383, + 62937: 36396, + 62938: 36398, + 62939: 36387, + 62940: 36399, + 62941: 36410, + 62942: 36416, + 62943: 36409, + 62944: 36405, + 62945: 36413, + 62946: 36401, + 62947: 36425, + 62948: 36417, + 62949: 36418, + 62950: 36433, + 62951: 36434, + 62952: 36426, + 62953: 36464, + 62954: 36470, + 62955: 36476, + 62956: 36463, + 62957: 36468, + 62958: 36485, + 62959: 36495, + 62960: 36500, + 62961: 36496, + 62962: 36508, + 62963: 36510, + 62964: 35960, + 62965: 35970, + 62966: 35978, + 62967: 35973, + 62968: 35992, + 62969: 35988, + 62970: 26011, + 62971: 35286, + 62972: 35294, + 62973: 35290, + 62974: 35292, + 63040: 39900, + 63041: 39901, + 63042: 39902, + 63043: 39903, + 63044: 39904, + 63045: 39905, + 63046: 39906, + 63047: 39907, + 63048: 39908, + 63049: 39909, + 63050: 39910, + 63051: 39911, + 63052: 39912, + 63053: 39913, + 63054: 39914, + 63055: 39915, + 63056: 39916, + 63057: 39917, + 63058: 39918, + 63059: 39919, + 63060: 39920, + 63061: 39921, + 63062: 39922, + 63063: 39923, + 63064: 39924, + 63065: 39925, + 63066: 39926, + 63067: 39927, + 63068: 39928, + 63069: 39929, + 63070: 39930, + 63071: 39931, + 63072: 39932, + 63073: 39933, + 63074: 39934, + 63075: 39935, + 63076: 39936, + 63077: 39937, + 63078: 39938, + 63079: 39939, + 63080: 39940, + 63081: 39941, + 63082: 39942, + 63083: 39943, + 63084: 39944, + 63085: 39945, + 63086: 39946, + 63087: 39947, + 63088: 39948, + 63089: 39949, + 63090: 39950, + 63091: 39951, + 63092: 39952, + 63093: 39953, + 63094: 39954, + 63095: 39955, + 63096: 39956, + 63097: 39957, + 63098: 39958, + 63099: 39959, + 63100: 39960, + 63101: 39961, + 63102: 39962, + 63104: 39963, + 63105: 39964, + 63106: 39965, + 63107: 39966, + 63108: 39967, + 63109: 39968, + 63110: 39969, + 63111: 39970, + 63112: 39971, + 63113: 39972, + 63114: 39973, + 63115: 39974, + 63116: 39975, + 63117: 39976, + 63118: 39977, + 63119: 39978, + 63120: 39979, + 63121: 39980, + 63122: 39981, + 63123: 39982, + 63124: 39983, + 63125: 39984, + 63126: 39985, + 63127: 39986, + 63128: 39987, + 63129: 39988, + 63130: 39989, + 63131: 39990, + 63132: 39991, + 63133: 39992, + 63134: 39993, + 63135: 39994, + 63136: 39995, + 63137: 35301, + 63138: 35307, + 63139: 35311, + 63140: 35390, + 63141: 35622, + 63142: 38739, + 63143: 38633, + 63144: 38643, + 63145: 38639, + 63146: 38662, + 63147: 38657, + 63148: 38664, + 63149: 38671, + 63150: 38670, + 63151: 38698, + 63152: 38701, + 63153: 38704, + 63154: 38718, + 63155: 40832, + 63156: 40835, + 63157: 40837, + 63158: 40838, + 63159: 40839, + 63160: 40840, + 63161: 40841, + 63162: 40842, + 63163: 40844, + 63164: 40702, + 63165: 40715, + 63166: 40717, + 63167: 38585, + 63168: 38588, + 63169: 38589, + 63170: 38606, + 63171: 38610, + 63172: 30655, + 63173: 38624, + 63174: 37518, + 63175: 37550, + 63176: 37576, + 63177: 37694, + 63178: 37738, + 63179: 37834, + 63180: 37775, + 63181: 37950, + 63182: 37995, + 63183: 40063, + 63184: 40066, + 63185: 40069, + 63186: 40070, + 63187: 40071, + 63188: 40072, + 63189: 31267, + 63190: 40075, + 63191: 40078, + 63192: 40080, + 63193: 40081, + 63194: 40082, + 63195: 40084, + 63196: 40085, + 63197: 40090, + 63198: 40091, + 63199: 40094, + 63200: 40095, + 63201: 40096, + 63202: 40097, + 63203: 40098, + 63204: 40099, + 63205: 40101, + 63206: 40102, + 63207: 40103, + 63208: 40104, + 63209: 40105, + 63210: 40107, + 63211: 40109, + 63212: 40110, + 63213: 40112, + 63214: 40113, + 63215: 40114, + 63216: 40115, + 63217: 40116, + 63218: 40117, + 63219: 40118, + 63220: 40119, + 63221: 40122, + 63222: 40123, + 63223: 40124, + 63224: 40125, + 63225: 40132, + 63226: 40133, + 63227: 40134, + 63228: 40135, + 63229: 40138, + 63230: 40139, + 63296: 39996, + 63297: 39997, + 63298: 39998, + 63299: 39999, + 63300: 40000, + 63301: 40001, + 63302: 40002, + 63303: 40003, + 63304: 40004, + 63305: 40005, + 63306: 40006, + 63307: 40007, + 63308: 40008, + 63309: 40009, + 63310: 40010, + 63311: 40011, + 63312: 40012, + 63313: 40013, + 63314: 40014, + 63315: 40015, + 63316: 40016, + 63317: 40017, + 63318: 40018, + 63319: 40019, + 63320: 40020, + 63321: 40021, + 63322: 40022, + 63323: 40023, + 63324: 40024, + 63325: 40025, + 63326: 40026, + 63327: 40027, + 63328: 40028, + 63329: 40029, + 63330: 40030, + 63331: 40031, + 63332: 40032, + 63333: 40033, + 63334: 40034, + 63335: 40035, + 63336: 40036, + 63337: 40037, + 63338: 40038, + 63339: 40039, + 63340: 40040, + 63341: 40041, + 63342: 40042, + 63343: 40043, + 63344: 40044, + 63345: 40045, + 63346: 40046, + 63347: 40047, + 63348: 40048, + 63349: 40049, + 63350: 40050, + 63351: 40051, + 63352: 40052, + 63353: 40053, + 63354: 40054, + 63355: 40055, + 63356: 40056, + 63357: 40057, + 63358: 40058, + 63360: 40059, + 63361: 40061, + 63362: 40062, + 63363: 40064, + 63364: 40067, + 63365: 40068, + 63366: 40073, + 63367: 40074, + 63368: 40076, + 63369: 40079, + 63370: 40083, + 63371: 40086, + 63372: 40087, + 63373: 40088, + 63374: 40089, + 63375: 40093, + 63376: 40106, + 63377: 40108, + 63378: 40111, + 63379: 40121, + 63380: 40126, + 63381: 40127, + 63382: 40128, + 63383: 40129, + 63384: 40130, + 63385: 40136, + 63386: 40137, + 63387: 40145, + 63388: 40146, + 63389: 40154, + 63390: 40155, + 63391: 40160, + 63392: 40161, + 63393: 40140, + 63394: 40141, + 63395: 40142, + 63396: 40143, + 63397: 40144, + 63398: 40147, + 63399: 40148, + 63400: 40149, + 63401: 40151, + 63402: 40152, + 63403: 40153, + 63404: 40156, + 63405: 40157, + 63406: 40159, + 63407: 40162, + 63408: 38780, + 63409: 38789, + 63410: 38801, + 63411: 38802, + 63412: 38804, + 63413: 38831, + 63414: 38827, + 63415: 38819, + 63416: 38834, + 63417: 38836, + 63418: 39601, + 63419: 39600, + 63420: 39607, + 63421: 40536, + 63422: 39606, + 63423: 39610, + 63424: 39612, + 63425: 39617, + 63426: 39616, + 63427: 39621, + 63428: 39618, + 63429: 39627, + 63430: 39628, + 63431: 39633, + 63432: 39749, + 63433: 39747, + 63434: 39751, + 63435: 39753, + 63436: 39752, + 63437: 39757, + 63438: 39761, + 63439: 39144, + 63440: 39181, + 63441: 39214, + 63442: 39253, + 63443: 39252, + 63444: 39647, + 63445: 39649, + 63446: 39654, + 63447: 39663, + 63448: 39659, + 63449: 39675, + 63450: 39661, + 63451: 39673, + 63452: 39688, + 63453: 39695, + 63454: 39699, + 63455: 39711, + 63456: 39715, + 63457: 40637, + 63458: 40638, + 63459: 32315, + 63460: 40578, + 63461: 40583, + 63462: 40584, + 63463: 40587, + 63464: 40594, + 63465: 37846, + 63466: 40605, + 63467: 40607, + 63468: 40667, + 63469: 40668, + 63470: 40669, + 63471: 40672, + 63472: 40671, + 63473: 40674, + 63474: 40681, + 63475: 40679, + 63476: 40677, + 63477: 40682, + 63478: 40687, + 63479: 40738, + 63480: 40748, + 63481: 40751, + 63482: 40761, + 63483: 40759, + 63484: 40765, + 63485: 40766, + 63486: 40772, + 63552: 40163, + 63553: 40164, + 63554: 40165, + 63555: 40166, + 63556: 40167, + 63557: 40168, + 63558: 40169, + 63559: 40170, + 63560: 40171, + 63561: 40172, + 63562: 40173, + 63563: 40174, + 63564: 40175, + 63565: 40176, + 63566: 40177, + 63567: 40178, + 63568: 40179, + 63569: 40180, + 63570: 40181, + 63571: 40182, + 63572: 40183, + 63573: 40184, + 63574: 40185, + 63575: 40186, + 63576: 40187, + 63577: 40188, + 63578: 40189, + 63579: 40190, + 63580: 40191, + 63581: 40192, + 63582: 40193, + 63583: 40194, + 63584: 40195, + 63585: 40196, + 63586: 40197, + 63587: 40198, + 63588: 40199, + 63589: 40200, + 63590: 40201, + 63591: 40202, + 63592: 40203, + 63593: 40204, + 63594: 40205, + 63595: 40206, + 63596: 40207, + 63597: 40208, + 63598: 40209, + 63599: 40210, + 63600: 40211, + 63601: 40212, + 63602: 40213, + 63603: 40214, + 63604: 40215, + 63605: 40216, + 63606: 40217, + 63607: 40218, + 63608: 40219, + 63609: 40220, + 63610: 40221, + 63611: 40222, + 63612: 40223, + 63613: 40224, + 63614: 40225, + 63616: 40226, + 63617: 40227, + 63618: 40228, + 63619: 40229, + 63620: 40230, + 63621: 40231, + 63622: 40232, + 63623: 40233, + 63624: 40234, + 63625: 40235, + 63626: 40236, + 63627: 40237, + 63628: 40238, + 63629: 40239, + 63630: 40240, + 63631: 40241, + 63632: 40242, + 63633: 40243, + 63634: 40244, + 63635: 40245, + 63636: 40246, + 63637: 40247, + 63638: 40248, + 63639: 40249, + 63640: 40250, + 63641: 40251, + 63642: 40252, + 63643: 40253, + 63644: 40254, + 63645: 40255, + 63646: 40256, + 63647: 40257, + 63648: 40258, + 63649: 57908, + 63650: 57909, + 63651: 57910, + 63652: 57911, + 63653: 57912, + 63654: 57913, + 63655: 57914, + 63656: 57915, + 63657: 57916, + 63658: 57917, + 63659: 57918, + 63660: 57919, + 63661: 57920, + 63662: 57921, + 63663: 57922, + 63664: 57923, + 63665: 57924, + 63666: 57925, + 63667: 57926, + 63668: 57927, + 63669: 57928, + 63670: 57929, + 63671: 57930, + 63672: 57931, + 63673: 57932, + 63674: 57933, + 63675: 57934, + 63676: 57935, + 63677: 57936, + 63678: 57937, + 63679: 57938, + 63680: 57939, + 63681: 57940, + 63682: 57941, + 63683: 57942, + 63684: 57943, + 63685: 57944, + 63686: 57945, + 63687: 57946, + 63688: 57947, + 63689: 57948, + 63690: 57949, + 63691: 57950, + 63692: 57951, + 63693: 57952, + 63694: 57953, + 63695: 57954, + 63696: 57955, + 63697: 57956, + 63698: 57957, + 63699: 57958, + 63700: 57959, + 63701: 57960, + 63702: 57961, + 63703: 57962, + 63704: 57963, + 63705: 57964, + 63706: 57965, + 63707: 57966, + 63708: 57967, + 63709: 57968, + 63710: 57969, + 63711: 57970, + 63712: 57971, + 63713: 57972, + 63714: 57973, + 63715: 57974, + 63716: 57975, + 63717: 57976, + 63718: 57977, + 63719: 57978, + 63720: 57979, + 63721: 57980, + 63722: 57981, + 63723: 57982, + 63724: 57983, + 63725: 57984, + 63726: 57985, + 63727: 57986, + 63728: 57987, + 63729: 57988, + 63730: 57989, + 63731: 57990, + 63732: 57991, + 63733: 57992, + 63734: 57993, + 63735: 57994, + 63736: 57995, + 63737: 57996, + 63738: 57997, + 63739: 57998, + 63740: 57999, + 63741: 58000, + 63742: 58001, + 63808: 40259, + 63809: 40260, + 63810: 40261, + 63811: 40262, + 63812: 40263, + 63813: 40264, + 63814: 40265, + 63815: 40266, + 63816: 40267, + 63817: 40268, + 63818: 40269, + 63819: 40270, + 63820: 40271, + 63821: 40272, + 63822: 40273, + 63823: 40274, + 63824: 40275, + 63825: 40276, + 63826: 40277, + 63827: 40278, + 63828: 40279, + 63829: 40280, + 63830: 40281, + 63831: 40282, + 63832: 40283, + 63833: 40284, + 63834: 40285, + 63835: 40286, + 63836: 40287, + 63837: 40288, + 63838: 40289, + 63839: 40290, + 63840: 40291, + 63841: 40292, + 63842: 40293, + 63843: 40294, + 63844: 40295, + 63845: 40296, + 63846: 40297, + 63847: 40298, + 63848: 40299, + 63849: 40300, + 63850: 40301, + 63851: 40302, + 63852: 40303, + 63853: 40304, + 63854: 40305, + 63855: 40306, + 63856: 40307, + 63857: 40308, + 63858: 40309, + 63859: 40310, + 63860: 40311, + 63861: 40312, + 63862: 40313, + 63863: 40314, + 63864: 40315, + 63865: 40316, + 63866: 40317, + 63867: 40318, + 63868: 40319, + 63869: 40320, + 63870: 40321, + 63872: 40322, + 63873: 40323, + 63874: 40324, + 63875: 40325, + 63876: 40326, + 63877: 40327, + 63878: 40328, + 63879: 40329, + 63880: 40330, + 63881: 40331, + 63882: 40332, + 63883: 40333, + 63884: 40334, + 63885: 40335, + 63886: 40336, + 63887: 40337, + 63888: 40338, + 63889: 40339, + 63890: 40340, + 63891: 40341, + 63892: 40342, + 63893: 40343, + 63894: 40344, + 63895: 40345, + 63896: 40346, + 63897: 40347, + 63898: 40348, + 63899: 40349, + 63900: 40350, + 63901: 40351, + 63902: 40352, + 63903: 40353, + 63904: 40354, + 63905: 58002, + 63906: 58003, + 63907: 58004, + 63908: 58005, + 63909: 58006, + 63910: 58007, + 63911: 58008, + 63912: 58009, + 63913: 58010, + 63914: 58011, + 63915: 58012, + 63916: 58013, + 63917: 58014, + 63918: 58015, + 63919: 58016, + 63920: 58017, + 63921: 58018, + 63922: 58019, + 63923: 58020, + 63924: 58021, + 63925: 58022, + 63926: 58023, + 63927: 58024, + 63928: 58025, + 63929: 58026, + 63930: 58027, + 63931: 58028, + 63932: 58029, + 63933: 58030, + 63934: 58031, + 63935: 58032, + 63936: 58033, + 63937: 58034, + 63938: 58035, + 63939: 58036, + 63940: 58037, + 63941: 58038, + 63942: 58039, + 63943: 58040, + 63944: 58041, + 63945: 58042, + 63946: 58043, + 63947: 58044, + 63948: 58045, + 63949: 58046, + 63950: 58047, + 63951: 58048, + 63952: 58049, + 63953: 58050, + 63954: 58051, + 63955: 58052, + 63956: 58053, + 63957: 58054, + 63958: 58055, + 63959: 58056, + 63960: 58057, + 63961: 58058, + 63962: 58059, + 63963: 58060, + 63964: 58061, + 63965: 58062, + 63966: 58063, + 63967: 58064, + 63968: 58065, + 63969: 58066, + 63970: 58067, + 63971: 58068, + 63972: 58069, + 63973: 58070, + 63974: 58071, + 63975: 58072, + 63976: 58073, + 63977: 58074, + 63978: 58075, + 63979: 58076, + 63980: 58077, + 63981: 58078, + 63982: 58079, + 63983: 58080, + 63984: 58081, + 63985: 58082, + 63986: 58083, + 63987: 58084, + 63988: 58085, + 63989: 58086, + 63990: 58087, + 63991: 58088, + 63992: 58089, + 63993: 58090, + 63994: 58091, + 63995: 58092, + 63996: 58093, + 63997: 58094, + 63998: 58095, + 64064: 40355, + 64065: 40356, + 64066: 40357, + 64067: 40358, + 64068: 40359, + 64069: 40360, + 64070: 40361, + 64071: 40362, + 64072: 40363, + 64073: 40364, + 64074: 40365, + 64075: 40366, + 64076: 40367, + 64077: 40368, + 64078: 40369, + 64079: 40370, + 64080: 40371, + 64081: 40372, + 64082: 40373, + 64083: 40374, + 64084: 40375, + 64085: 40376, + 64086: 40377, + 64087: 40378, + 64088: 40379, + 64089: 40380, + 64090: 40381, + 64091: 40382, + 64092: 40383, + 64093: 40384, + 64094: 40385, + 64095: 40386, + 64096: 40387, + 64097: 40388, + 64098: 40389, + 64099: 40390, + 64100: 40391, + 64101: 40392, + 64102: 40393, + 64103: 40394, + 64104: 40395, + 64105: 40396, + 64106: 40397, + 64107: 40398, + 64108: 40399, + 64109: 40400, + 64110: 40401, + 64111: 40402, + 64112: 40403, + 64113: 40404, + 64114: 40405, + 64115: 40406, + 64116: 40407, + 64117: 40408, + 64118: 40409, + 64119: 40410, + 64120: 40411, + 64121: 40412, + 64122: 40413, + 64123: 40414, + 64124: 40415, + 64125: 40416, + 64126: 40417, + 64128: 40418, + 64129: 40419, + 64130: 40420, + 64131: 40421, + 64132: 40422, + 64133: 40423, + 64134: 40424, + 64135: 40425, + 64136: 40426, + 64137: 40427, + 64138: 40428, + 64139: 40429, + 64140: 40430, + 64141: 40431, + 64142: 40432, + 64143: 40433, + 64144: 40434, + 64145: 40435, + 64146: 40436, + 64147: 40437, + 64148: 40438, + 64149: 40439, + 64150: 40440, + 64151: 40441, + 64152: 40442, + 64153: 40443, + 64154: 40444, + 64155: 40445, + 64156: 40446, + 64157: 40447, + 64158: 40448, + 64159: 40449, + 64160: 40450, + 64161: 58096, + 64162: 58097, + 64163: 58098, + 64164: 58099, + 64165: 58100, + 64166: 58101, + 64167: 58102, + 64168: 58103, + 64169: 58104, + 64170: 58105, + 64171: 58106, + 64172: 58107, + 64173: 58108, + 64174: 58109, + 64175: 58110, + 64176: 58111, + 64177: 58112, + 64178: 58113, + 64179: 58114, + 64180: 58115, + 64181: 58116, + 64182: 58117, + 64183: 58118, + 64184: 58119, + 64185: 58120, + 64186: 58121, + 64187: 58122, + 64188: 58123, + 64189: 58124, + 64190: 58125, + 64191: 58126, + 64192: 58127, + 64193: 58128, + 64194: 58129, + 64195: 58130, + 64196: 58131, + 64197: 58132, + 64198: 58133, + 64199: 58134, + 64200: 58135, + 64201: 58136, + 64202: 58137, + 64203: 58138, + 64204: 58139, + 64205: 58140, + 64206: 58141, + 64207: 58142, + 64208: 58143, + 64209: 58144, + 64210: 58145, + 64211: 58146, + 64212: 58147, + 64213: 58148, + 64214: 58149, + 64215: 58150, + 64216: 58151, + 64217: 58152, + 64218: 58153, + 64219: 58154, + 64220: 58155, + 64221: 58156, + 64222: 58157, + 64223: 58158, + 64224: 58159, + 64225: 58160, + 64226: 58161, + 64227: 58162, + 64228: 58163, + 64229: 58164, + 64230: 58165, + 64231: 58166, + 64232: 58167, + 64233: 58168, + 64234: 58169, + 64235: 58170, + 64236: 58171, + 64237: 58172, + 64238: 58173, + 64239: 58174, + 64240: 58175, + 64241: 58176, + 64242: 58177, + 64243: 58178, + 64244: 58179, + 64245: 58180, + 64246: 58181, + 64247: 58182, + 64248: 58183, + 64249: 58184, + 64250: 58185, + 64251: 58186, + 64252: 58187, + 64253: 58188, + 64254: 58189, + 64320: 40451, + 64321: 40452, + 64322: 40453, + 64323: 40454, + 64324: 40455, + 64325: 40456, + 64326: 40457, + 64327: 40458, + 64328: 40459, + 64329: 40460, + 64330: 40461, + 64331: 40462, + 64332: 40463, + 64333: 40464, + 64334: 40465, + 64335: 40466, + 64336: 40467, + 64337: 40468, + 64338: 40469, + 64339: 40470, + 64340: 40471, + 64341: 40472, + 64342: 40473, + 64343: 40474, + 64344: 40475, + 64345: 40476, + 64346: 40477, + 64347: 40478, + 64348: 40484, + 64349: 40487, + 64350: 40494, + 64351: 40496, + 64352: 40500, + 64353: 40507, + 64354: 40508, + 64355: 40512, + 64356: 40525, + 64357: 40528, + 64358: 40530, + 64359: 40531, + 64360: 40532, + 64361: 40534, + 64362: 40537, + 64363: 40541, + 64364: 40543, + 64365: 40544, + 64366: 40545, + 64367: 40546, + 64368: 40549, + 64369: 40558, + 64370: 40559, + 64371: 40562, + 64372: 40564, + 64373: 40565, + 64374: 40566, + 64375: 40567, + 64376: 40568, + 64377: 40569, + 64378: 40570, + 64379: 40571, + 64380: 40572, + 64381: 40573, + 64382: 40576, + 64384: 40577, + 64385: 40579, + 64386: 40580, + 64387: 40581, + 64388: 40582, + 64389: 40585, + 64390: 40586, + 64391: 40588, + 64392: 40589, + 64393: 40590, + 64394: 40591, + 64395: 40592, + 64396: 40593, + 64397: 40596, + 64398: 40597, + 64399: 40598, + 64400: 40599, + 64401: 40600, + 64402: 40601, + 64403: 40602, + 64404: 40603, + 64405: 40604, + 64406: 40606, + 64407: 40608, + 64408: 40609, + 64409: 40610, + 64410: 40611, + 64411: 40612, + 64412: 40613, + 64413: 40615, + 64414: 40616, + 64415: 40617, + 64416: 40618, + 64417: 58190, + 64418: 58191, + 64419: 58192, + 64420: 58193, + 64421: 58194, + 64422: 58195, + 64423: 58196, + 64424: 58197, + 64425: 58198, + 64426: 58199, + 64427: 58200, + 64428: 58201, + 64429: 58202, + 64430: 58203, + 64431: 58204, + 64432: 58205, + 64433: 58206, + 64434: 58207, + 64435: 58208, + 64436: 58209, + 64437: 58210, + 64438: 58211, + 64439: 58212, + 64440: 58213, + 64441: 58214, + 64442: 58215, + 64443: 58216, + 64444: 58217, + 64445: 58218, + 64446: 58219, + 64447: 58220, + 64448: 58221, + 64449: 58222, + 64450: 58223, + 64451: 58224, + 64452: 58225, + 64453: 58226, + 64454: 58227, + 64455: 58228, + 64456: 58229, + 64457: 58230, + 64458: 58231, + 64459: 58232, + 64460: 58233, + 64461: 58234, + 64462: 58235, + 64463: 58236, + 64464: 58237, + 64465: 58238, + 64466: 58239, + 64467: 58240, + 64468: 58241, + 64469: 58242, + 64470: 58243, + 64471: 58244, + 64472: 58245, + 64473: 58246, + 64474: 58247, + 64475: 58248, + 64476: 58249, + 64477: 58250, + 64478: 58251, + 64479: 58252, + 64480: 58253, + 64481: 58254, + 64482: 58255, + 64483: 58256, + 64484: 58257, + 64485: 58258, + 64486: 58259, + 64487: 58260, + 64488: 58261, + 64489: 58262, + 64490: 58263, + 64491: 58264, + 64492: 58265, + 64493: 58266, + 64494: 58267, + 64495: 58268, + 64496: 58269, + 64497: 58270, + 64498: 58271, + 64499: 58272, + 64500: 58273, + 64501: 58274, + 64502: 58275, + 64503: 58276, + 64504: 58277, + 64505: 58278, + 64506: 58279, + 64507: 58280, + 64508: 58281, + 64509: 58282, + 64510: 58283, + 64576: 40619, + 64577: 40620, + 64578: 40621, + 64579: 40622, + 64580: 40623, + 64581: 40624, + 64582: 40625, + 64583: 40626, + 64584: 40627, + 64585: 40629, + 64586: 40630, + 64587: 40631, + 64588: 40633, + 64589: 40634, + 64590: 40636, + 64591: 40639, + 64592: 40640, + 64593: 40641, + 64594: 40642, + 64595: 40643, + 64596: 40645, + 64597: 40646, + 64598: 40647, + 64599: 40648, + 64600: 40650, + 64601: 40651, + 64602: 40652, + 64603: 40656, + 64604: 40658, + 64605: 40659, + 64606: 40661, + 64607: 40662, + 64608: 40663, + 64609: 40665, + 64610: 40666, + 64611: 40670, + 64612: 40673, + 64613: 40675, + 64614: 40676, + 64615: 40678, + 64616: 40680, + 64617: 40683, + 64618: 40684, + 64619: 40685, + 64620: 40686, + 64621: 40688, + 64622: 40689, + 64623: 40690, + 64624: 40691, + 64625: 40692, + 64626: 40693, + 64627: 40694, + 64628: 40695, + 64629: 40696, + 64630: 40698, + 64631: 40701, + 64632: 40703, + 64633: 40704, + 64634: 40705, + 64635: 40706, + 64636: 40707, + 64637: 40708, + 64638: 40709, + 64640: 40710, + 64641: 40711, + 64642: 40712, + 64643: 40713, + 64644: 40714, + 64645: 40716, + 64646: 40719, + 64647: 40721, + 64648: 40722, + 64649: 40724, + 64650: 40725, + 64651: 40726, + 64652: 40728, + 64653: 40730, + 64654: 40731, + 64655: 40732, + 64656: 40733, + 64657: 40734, + 64658: 40735, + 64659: 40737, + 64660: 40739, + 64661: 40740, + 64662: 40741, + 64663: 40742, + 64664: 40743, + 64665: 40744, + 64666: 40745, + 64667: 40746, + 64668: 40747, + 64669: 40749, + 64670: 40750, + 64671: 40752, + 64672: 40753, + 64673: 58284, + 64674: 58285, + 64675: 58286, + 64676: 58287, + 64677: 58288, + 64678: 58289, + 64679: 58290, + 64680: 58291, + 64681: 58292, + 64682: 58293, + 64683: 58294, + 64684: 58295, + 64685: 58296, + 64686: 58297, + 64687: 58298, + 64688: 58299, + 64689: 58300, + 64690: 58301, + 64691: 58302, + 64692: 58303, + 64693: 58304, + 64694: 58305, + 64695: 58306, + 64696: 58307, + 64697: 58308, + 64698: 58309, + 64699: 58310, + 64700: 58311, + 64701: 58312, + 64702: 58313, + 64703: 58314, + 64704: 58315, + 64705: 58316, + 64706: 58317, + 64707: 58318, + 64708: 58319, + 64709: 58320, + 64710: 58321, + 64711: 58322, + 64712: 58323, + 64713: 58324, + 64714: 58325, + 64715: 58326, + 64716: 58327, + 64717: 58328, + 64718: 58329, + 64719: 58330, + 64720: 58331, + 64721: 58332, + 64722: 58333, + 64723: 58334, + 64724: 58335, + 64725: 58336, + 64726: 58337, + 64727: 58338, + 64728: 58339, + 64729: 58340, + 64730: 58341, + 64731: 58342, + 64732: 58343, + 64733: 58344, + 64734: 58345, + 64735: 58346, + 64736: 58347, + 64737: 58348, + 64738: 58349, + 64739: 58350, + 64740: 58351, + 64741: 58352, + 64742: 58353, + 64743: 58354, + 64744: 58355, + 64745: 58356, + 64746: 58357, + 64747: 58358, + 64748: 58359, + 64749: 58360, + 64750: 58361, + 64751: 58362, + 64752: 58363, + 64753: 58364, + 64754: 58365, + 64755: 58366, + 64756: 58367, + 64757: 58368, + 64758: 58369, + 64759: 58370, + 64760: 58371, + 64761: 58372, + 64762: 58373, + 64763: 58374, + 64764: 58375, + 64765: 58376, + 64766: 58377, + 64832: 40754, + 64833: 40755, + 64834: 40756, + 64835: 40757, + 64836: 40758, + 64837: 40760, + 64838: 40762, + 64839: 40764, + 64840: 40767, + 64841: 40768, + 64842: 40769, + 64843: 40770, + 64844: 40771, + 64845: 40773, + 64846: 40774, + 64847: 40775, + 64848: 40776, + 64849: 40777, + 64850: 40778, + 64851: 40779, + 64852: 40780, + 64853: 40781, + 64854: 40782, + 64855: 40783, + 64856: 40786, + 64857: 40787, + 64858: 40788, + 64859: 40789, + 64860: 40790, + 64861: 40791, + 64862: 40792, + 64863: 40793, + 64864: 40794, + 64865: 40795, + 64866: 40796, + 64867: 40797, + 64868: 40798, + 64869: 40799, + 64870: 40800, + 64871: 40801, + 64872: 40802, + 64873: 40803, + 64874: 40804, + 64875: 40805, + 64876: 40806, + 64877: 40807, + 64878: 40808, + 64879: 40809, + 64880: 40810, + 64881: 40811, + 64882: 40812, + 64883: 40813, + 64884: 40814, + 64885: 40815, + 64886: 40816, + 64887: 40817, + 64888: 40818, + 64889: 40819, + 64890: 40820, + 64891: 40821, + 64892: 40822, + 64893: 40823, + 64894: 40824, + 64896: 40825, + 64897: 40826, + 64898: 40827, + 64899: 40828, + 64900: 40829, + 64901: 40830, + 64902: 40833, + 64903: 40834, + 64904: 40845, + 64905: 40846, + 64906: 40847, + 64907: 40848, + 64908: 40849, + 64909: 40850, + 64910: 40851, + 64911: 40852, + 64912: 40853, + 64913: 40854, + 64914: 40855, + 64915: 40856, + 64916: 40860, + 64917: 40861, + 64918: 40862, + 64919: 40865, + 64920: 40866, + 64921: 40867, + 64922: 40868, + 64923: 40869, + 64924: 63788, + 64925: 63865, + 64926: 63893, + 64927: 63975, + 64928: 63985, + 64929: 58378, + 64930: 58379, + 64931: 58380, + 64932: 58381, + 64933: 58382, + 64934: 58383, + 64935: 58384, + 64936: 58385, + 64937: 58386, + 64938: 58387, + 64939: 58388, + 64940: 58389, + 64941: 58390, + 64942: 58391, + 64943: 58392, + 64944: 58393, + 64945: 58394, + 64946: 58395, + 64947: 58396, + 64948: 58397, + 64949: 58398, + 64950: 58399, + 64951: 58400, + 64952: 58401, + 64953: 58402, + 64954: 58403, + 64955: 58404, + 64956: 58405, + 64957: 58406, + 64958: 58407, + 64959: 58408, + 64960: 58409, + 64961: 58410, + 64962: 58411, + 64963: 58412, + 64964: 58413, + 64965: 58414, + 64966: 58415, + 64967: 58416, + 64968: 58417, + 64969: 58418, + 64970: 58419, + 64971: 58420, + 64972: 58421, + 64973: 58422, + 64974: 58423, + 64975: 58424, + 64976: 58425, + 64977: 58426, + 64978: 58427, + 64979: 58428, + 64980: 58429, + 64981: 58430, + 64982: 58431, + 64983: 58432, + 64984: 58433, + 64985: 58434, + 64986: 58435, + 64987: 58436, + 64988: 58437, + 64989: 58438, + 64990: 58439, + 64991: 58440, + 64992: 58441, + 64993: 58442, + 64994: 58443, + 64995: 58444, + 64996: 58445, + 64997: 58446, + 64998: 58447, + 64999: 58448, + 65000: 58449, + 65001: 58450, + 65002: 58451, + 65003: 58452, + 65004: 58453, + 65005: 58454, + 65006: 58455, + 65007: 58456, + 65008: 58457, + 65009: 58458, + 65010: 58459, + 65011: 58460, + 65012: 58461, + 65013: 58462, + 65014: 58463, + 65015: 58464, + 65016: 58465, + 65017: 58466, + 65018: 58467, + 65019: 58468, + 65020: 58469, + 65021: 58470, + 65022: 58471, + 65088: 64012, + 65089: 64013, + 65090: 64014, + 65091: 64015, + 65092: 64017, + 65093: 64019, + 65094: 64020, + 65095: 64024, + 65096: 64031, + 65097: 64032, + 65098: 64033, + 65099: 64035, + 65100: 64036, + 65101: 64039, + 65102: 64040, + 65103: 64041, + 65104: 11905, + 65105: 59414, + 65106: 59415, + 65107: 59416, + 65108: 11908, + 65109: 13427, + 65110: 13383, + 65111: 11912, + 65112: 11915, + 65113: 59422, + 65114: 13726, + 65115: 13850, + 65116: 13838, + 65117: 11916, + 65118: 11927, + 65119: 14702, + 65120: 14616, + 65121: 59430, + 65122: 14799, + 65123: 14815, + 65124: 14963, + 65125: 14800, + 65126: 59435, + 65127: 59436, + 65128: 15182, + 65129: 15470, + 65130: 15584, + 65131: 11943, + 65132: 59441, + 65133: 59442, + 65134: 11946, + 65135: 16470, + 65136: 16735, + 65137: 11950, + 65138: 17207, + 65139: 11955, + 65140: 11958, + 65141: 11959, + 65142: 59451, + 65143: 17329, + 65144: 17324, + 65145: 11963, + 65146: 17373, + 65147: 17622, + 65148: 18017, + 65149: 17996, + 65150: 59459, + 65152: 18211, + 65153: 18217, + 65154: 18300, + 65155: 18317, + 65156: 11978, + 65157: 18759, + 65158: 18810, + 65159: 18813, + 65160: 18818, + 65161: 18819, + 65162: 18821, + 65163: 18822, + 65164: 18847, + 65165: 18843, + 65166: 18871, + 65167: 18870, + 65168: 59476, + 65169: 59477, + 65170: 19619, + 65171: 19615, + 65172: 19616, + 65173: 19617, + 65174: 19575, + 65175: 19618, + 65176: 19731, + 65177: 19732, + 65178: 19733, + 65179: 19734, + 65180: 19735, + 65181: 19736, + 65182: 19737, + 65183: 19886, + 65184: 59492, + 65185: 58472, + 65186: 58473, + 65187: 58474, + 65188: 58475, + 65189: 58476, + 65190: 58477, + 65191: 58478, + 65192: 58479, + 65193: 58480, + 65194: 58481, + 65195: 58482, + 65196: 58483, + 65197: 58484, + 65198: 58485, + 65199: 58486, + 65200: 58487, + 65201: 58488, + 65202: 58489, + 65203: 58490, + 65204: 58491, + 65205: 58492, + 65206: 58493, + 65207: 58494, + 65208: 58495, + 65209: 58496, + 65210: 58497, + 65211: 58498, + 65212: 58499, + 65213: 58500, + 65214: 58501, + 65215: 58502, + 65216: 58503, + 65217: 58504, + 65218: 58505, + 65219: 58506, + 65220: 58507, + 65221: 58508, + 65222: 58509, + 65223: 58510, + 65224: 58511, + 65225: 58512, + 65226: 58513, + 65227: 58514, + 65228: 58515, + 65229: 58516, + 65230: 58517, + 65231: 58518, + 65232: 58519, + 65233: 58520, + 65234: 58521, + 65235: 58522, + 65236: 58523, + 65237: 58524, + 65238: 58525, + 65239: 58526, + 65240: 58527, + 65241: 58528, + 65242: 58529, + 65243: 58530, + 65244: 58531, + 65245: 58532, + 65246: 58533, + 65247: 58534, + 65248: 58535, + 65249: 58536, + 65250: 58537, + 65251: 58538, + 65252: 58539, + 65253: 58540, + 65254: 58541, + 65255: 58542, + 65256: 58543, + 65257: 58544, + 65258: 58545, + 65259: 58546, + 65260: 58547, + 65261: 58548, + 65262: 58549, + 65263: 58550, + 65264: 58551, + 65265: 58552, + 65266: 58553, + 65267: 58554, + 65268: 58555, + 65269: 58556, + 65270: 58557, + 65271: 58558, + 65272: 58559, + 65273: 58560, + 65274: 58561, + 65275: 58562, + 65276: undefined, + 65277: null, + 65278: last + }; +} + +for (var i = 0; i < 2; i++) { + var obj = getObject(); + print(obj[33088]); + print(obj[65275]); + print(obj[65276]); + print(obj[65277]); + print(obj[65278]); + var keys = Object.keys(obj); + print(obj[keys[0]]); + print(obj[keys[keys.length - 1]]); + print(keys.length); + obj[65275] = 0; + print(obj[65275]); +} + diff --git a/nashorn/test/script/basic/JDK-8020132.js.EXPECTED b/nashorn/test/script/basic/JDK-8020132.js.EXPECTED new file mode 100644 index 00000000000..c7122927f61 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8020132.js.EXPECTED @@ -0,0 +1,18 @@ +19970 +58562 +undefined +null +58565 +19970 +58565 +23940 +0 +19970 +58562 +undefined +null +58565 +19970 +58565 +23940 +0 diff --git a/nashorn/test/script/basic/JDK-8020356.js b/nashorn/test/script/basic/JDK-8020356.js new file mode 100644 index 00000000000..062a5412372 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8020356.js @@ -0,0 +1,10435 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8020356: ClassCastException Undefined->Scope on spiltter class generated for a large switch statement + * + * @test + * @run + */ + +print(hugeSwitch.apply({i: 20})); +print(hugeArrayLiteral.apply({i: 10})); + +function hugeSwitch() { + switch (1) { + case 1: + return this.i; + case 2: + return this.i; + case 3: + return this.i; + case 4: + return this.i; + case 5: + return this.i; + case 6: + return this.i; + case 7: + return this.i; + case 8: + return this.i; + case 9: + return this.i; + case 10: + return this.i; + case 11: + return this.i; + case 12: + return this.i; + case 13: + return this.i; + case 14: + return this.i; + case 15: + return this.i; + case 16: + return this.i; + case 17: + return this.i; + case 18: + return this.i; + case 19: + return this.i; + case 20: + return this.i; + case 21: + return this.i; + case 22: + return this.i; + case 23: + return this.i; + case 24: + return this.i; + case 25: + return this.i; + case 26: + return this.i; + case 27: + return this.i; + case 28: + return this.i; + case 29: + return this.i; + case 30: + return this.i; + case 31: + return this.i; + case 32: + return this.i; + case 33: + return this.i; + case 34: + return this.i; + case 35: + return this.i; + case 36: + return this.i; + case 37: + return this.i; + case 38: + return this.i; + case 39: + return this.i; + case 40: + return this.i; + case 41: + return this.i; + case 42: + return this.i; + case 43: + return this.i; + case 44: + return this.i; + case 45: + return this.i; + case 46: + return this.i; + case 47: + return this.i; + case 48: + return this.i; + case 49: + return this.i; + case 50: + return this.i; + case 51: + return this.i; + case 52: + return this.i; + case 53: + return this.i; + case 54: + return this.i; + case 55: + return this.i; + case 56: + return this.i; + case 57: + return this.i; + case 58: + return this.i; + case 59: + return this.i; + case 60: + return this.i; + case 61: + return this.i; + case 62: + return this.i; + case 63: + return this.i; + case 64: + return this.i; + case 65: + return this.i; + case 66: + return this.i; + case 67: + return this.i; + case 68: + return this.i; + case 69: + return this.i; + case 70: + return this.i; + case 71: + return this.i; + case 72: + return this.i; + case 73: + return this.i; + case 74: + return this.i; + case 75: + return this.i; + case 76: + return this.i; + case 77: + return this.i; + case 78: + return this.i; + case 79: + return this.i; + case 80: + return this.i; + case 81: + return this.i; + case 82: + return this.i; + case 83: + return this.i; + case 84: + return this.i; + case 85: + return this.i; + case 86: + return this.i; + case 87: + return this.i; + case 88: + return this.i; + case 89: + return this.i; + case 90: + return this.i; + case 91: + return this.i; + case 92: + return this.i; + case 93: + return this.i; + case 94: + return this.i; + case 95: + return this.i; + case 96: + return this.i; + case 97: + return this.i; + case 98: + return this.i; + case 99: + return this.i; + case 100: + return this.i; + case 101: + return this.i; + case 102: + return this.i; + case 103: + return this.i; + case 104: + return this.i; + case 105: + return this.i; + case 106: + return this.i; + case 107: + return this.i; + case 108: + return this.i; + case 109: + return this.i; + case 110: + return this.i; + case 111: + return this.i; + case 112: + return this.i; + case 113: + return this.i; + case 114: + return this.i; + case 115: + return this.i; + case 116: + return this.i; + case 117: + return this.i; + case 118: + return this.i; + case 119: + return this.i; + case 120: + return this.i; + case 121: + return this.i; + case 122: + return this.i; + case 123: + return this.i; + case 124: + return this.i; + case 125: + return this.i; + case 126: + return this.i; + case 127: + return this.i; + case 128: + return this.i; + case 129: + return this.i; + case 130: + return this.i; + case 131: + return this.i; + case 132: + return this.i; + case 133: + return this.i; + case 134: + return this.i; + case 135: + return this.i; + case 136: + return this.i; + case 137: + return this.i; + case 138: + return this.i; + case 139: + return this.i; + case 140: + return this.i; + case 141: + return this.i; + case 142: + return this.i; + case 143: + return this.i; + case 144: + return this.i; + case 145: + return this.i; + case 146: + return this.i; + case 147: + return this.i; + case 148: + return this.i; + case 149: + return this.i; + case 150: + return this.i; + case 151: + return this.i; + case 152: + return this.i; + case 153: + return this.i; + case 154: + return this.i; + case 155: + return this.i; + case 156: + return this.i; + case 157: + return this.i; + case 158: + return this.i; + case 159: + return this.i; + case 160: + return this.i; + case 161: + return this.i; + case 162: + return this.i; + case 163: + return this.i; + case 164: + return this.i; + case 165: + return this.i; + case 166: + return this.i; + case 167: + return this.i; + case 168: + return this.i; + case 169: + return this.i; + case 170: + return this.i; + case 171: + return this.i; + case 172: + return this.i; + case 173: + return this.i; + case 174: + return this.i; + case 175: + return this.i; + case 176: + return this.i; + case 177: + return this.i; + case 178: + return this.i; + case 179: + return this.i; + case 180: + return this.i; + case 181: + return this.i; + case 182: + return this.i; + case 183: + return this.i; + case 184: + return this.i; + case 185: + return this.i; + case 186: + return this.i; + case 187: + return this.i; + case 188: + return this.i; + case 189: + return this.i; + case 190: + return this.i; + case 191: + return this.i; + case 192: + return this.i; + case 193: + return this.i; + case 194: + return this.i; + case 195: + return this.i; + case 196: + return this.i; + case 197: + return this.i; + case 198: + return this.i; + case 199: + return this.i; + case 200: + return this.i; + case 201: + return this.i; + case 202: + return this.i; + case 203: + return this.i; + case 204: + return this.i; + case 205: + return this.i; + case 206: + return this.i; + case 207: + return this.i; + case 208: + return this.i; + case 209: + return this.i; + case 210: + return this.i; + case 211: + return this.i; + case 212: + return this.i; + case 213: + return this.i; + case 214: + return this.i; + case 215: + return this.i; + case 216: + return this.i; + case 217: + return this.i; + case 218: + return this.i; + case 219: + return this.i; + case 220: + return this.i; + case 221: + return this.i; + case 222: + return this.i; + case 223: + return this.i; + case 224: + return this.i; + case 225: + return this.i; + case 226: + return this.i; + case 227: + return this.i; + case 228: + return this.i; + case 229: + return this.i; + case 230: + return this.i; + case 231: + return this.i; + case 232: + return this.i; + case 233: + return this.i; + case 234: + return this.i; + case 235: + return this.i; + case 236: + return this.i; + case 237: + return this.i; + case 238: + return this.i; + case 239: + return this.i; + case 240: + return this.i; + case 241: + return this.i; + case 242: + return this.i; + case 243: + return this.i; + case 244: + return this.i; + case 245: + return this.i; + case 246: + return this.i; + case 247: + return this.i; + case 248: + return this.i; + case 249: + return this.i; + case 250: + return this.i; + case 251: + return this.i; + case 252: + return this.i; + case 253: + return this.i; + case 254: + return this.i; + case 255: + return this.i; + case 256: + return this.i; + case 257: + return this.i; + case 258: + return this.i; + case 259: + return this.i; + case 260: + return this.i; + case 261: + return this.i; + case 262: + return this.i; + case 263: + return this.i; + case 264: + return this.i; + case 265: + return this.i; + case 266: + return this.i; + case 267: + return this.i; + case 268: + return this.i; + case 269: + return this.i; + case 270: + return this.i; + case 271: + return this.i; + case 272: + return this.i; + case 273: + return this.i; + case 274: + return this.i; + case 275: + return this.i; + case 276: + return this.i; + case 277: + return this.i; + case 278: + return this.i; + case 279: + return this.i; + case 280: + return this.i; + case 281: + return this.i; + case 282: + return this.i; + case 283: + return this.i; + case 284: + return this.i; + case 285: + return this.i; + case 286: + return this.i; + case 287: + return this.i; + case 288: + return this.i; + case 289: + return this.i; + case 290: + return this.i; + case 291: + return this.i; + case 292: + return this.i; + case 293: + return this.i; + case 294: + return this.i; + case 295: + return this.i; + case 296: + return this.i; + case 297: + return this.i; + case 298: + return this.i; + case 299: + return this.i; + case 300: + return this.i; + case 301: + return this.i; + case 302: + return this.i; + case 303: + return this.i; + case 304: + return this.i; + case 305: + return this.i; + case 306: + return this.i; + case 307: + return this.i; + case 308: + return this.i; + case 309: + return this.i; + case 310: + return this.i; + case 311: + return this.i; + case 312: + return this.i; + case 313: + return this.i; + case 314: + return this.i; + case 315: + return this.i; + case 316: + return this.i; + case 317: + return this.i; + case 318: + return this.i; + case 319: + return this.i; + case 320: + return this.i; + case 321: + return this.i; + case 322: + return this.i; + case 323: + return this.i; + case 324: + return this.i; + case 325: + return this.i; + case 326: + return this.i; + case 327: + return this.i; + case 328: + return this.i; + case 329: + return this.i; + case 330: + return this.i; + case 331: + return this.i; + case 332: + return this.i; + case 333: + return this.i; + case 334: + return this.i; + case 335: + return this.i; + case 336: + return this.i; + case 337: + return this.i; + case 338: + return this.i; + case 339: + return this.i; + case 340: + return this.i; + case 341: + return this.i; + case 342: + return this.i; + case 343: + return this.i; + case 344: + return this.i; + case 345: + return this.i; + case 346: + return this.i; + case 347: + return this.i; + case 348: + return this.i; + case 349: + return this.i; + case 350: + return this.i; + case 351: + return this.i; + case 352: + return this.i; + case 353: + return this.i; + case 354: + return this.i; + case 355: + return this.i; + case 356: + return this.i; + case 357: + return this.i; + case 358: + return this.i; + case 359: + return this.i; + case 360: + return this.i; + case 361: + return this.i; + case 362: + return this.i; + case 363: + return this.i; + case 364: + return this.i; + case 365: + return this.i; + case 366: + return this.i; + case 367: + return this.i; + case 368: + return this.i; + case 369: + return this.i; + case 370: + return this.i; + case 371: + return this.i; + case 372: + return this.i; + case 373: + return this.i; + case 374: + return this.i; + case 375: + return this.i; + case 376: + return this.i; + case 377: + return this.i; + case 378: + return this.i; + case 379: + return this.i; + case 380: + return this.i; + case 381: + return this.i; + case 382: + return this.i; + case 383: + return this.i; + case 384: + return this.i; + case 385: + return this.i; + case 386: + return this.i; + case 387: + return this.i; + case 388: + return this.i; + case 389: + return this.i; + case 390: + return this.i; + case 391: + return this.i; + case 392: + return this.i; + case 393: + return this.i; + case 394: + return this.i; + case 395: + return this.i; + case 396: + return this.i; + case 397: + return this.i; + case 398: + return this.i; + case 399: + return this.i; + case 400: + return this.i; + case 401: + return this.i; + case 402: + return this.i; + case 403: + return this.i; + case 404: + return this.i; + case 405: + return this.i; + case 406: + return this.i; + case 407: + return this.i; + case 408: + return this.i; + case 409: + return this.i; + case 410: + return this.i; + case 411: + return this.i; + case 412: + return this.i; + case 413: + return this.i; + case 414: + return this.i; + case 415: + return this.i; + case 416: + return this.i; + case 417: + return this.i; + case 418: + return this.i; + case 419: + return this.i; + case 420: + return this.i; + case 421: + return this.i; + case 422: + return this.i; + case 423: + return this.i; + case 424: + return this.i; + case 425: + return this.i; + case 426: + return this.i; + case 427: + return this.i; + case 428: + return this.i; + case 429: + return this.i; + case 430: + return this.i; + case 431: + return this.i; + case 432: + return this.i; + case 433: + return this.i; + case 434: + return this.i; + case 435: + return this.i; + case 436: + return this.i; + case 437: + return this.i; + case 438: + return this.i; + case 439: + return this.i; + case 440: + return this.i; + case 441: + return this.i; + case 442: + return this.i; + case 443: + return this.i; + case 444: + return this.i; + case 445: + return this.i; + case 446: + return this.i; + case 447: + return this.i; + case 448: + return this.i; + case 449: + return this.i; + case 450: + return this.i; + case 451: + return this.i; + case 452: + return this.i; + case 453: + return this.i; + case 454: + return this.i; + case 455: + return this.i; + case 456: + return this.i; + case 457: + return this.i; + case 458: + return this.i; + case 459: + return this.i; + case 460: + return this.i; + case 461: + return this.i; + case 462: + return this.i; + case 463: + return this.i; + case 464: + return this.i; + case 465: + return this.i; + case 466: + return this.i; + case 467: + return this.i; + case 468: + return this.i; + case 469: + return this.i; + case 470: + return this.i; + case 471: + return this.i; + case 472: + return this.i; + case 473: + return this.i; + case 474: + return this.i; + case 475: + return this.i; + case 476: + return this.i; + case 477: + return this.i; + case 478: + return this.i; + case 479: + return this.i; + case 480: + return this.i; + case 481: + return this.i; + case 482: + return this.i; + case 483: + return this.i; + case 484: + return this.i; + case 485: + return this.i; + case 486: + return this.i; + case 487: + return this.i; + case 488: + return this.i; + case 489: + return this.i; + case 490: + return this.i; + case 491: + return this.i; + case 492: + return this.i; + case 493: + return this.i; + case 494: + return this.i; + case 495: + return this.i; + case 496: + return this.i; + case 497: + return this.i; + case 498: + return this.i; + case 499: + return this.i; + case 500: + return this.i; + case 501: + return this.i; + case 502: + return this.i; + case 503: + return this.i; + case 504: + return this.i; + case 505: + return this.i; + case 506: + return this.i; + case 507: + return this.i; + case 508: + return this.i; + case 509: + return this.i; + case 510: + return this.i; + case 511: + return this.i; + case 512: + return this.i; + case 513: + return this.i; + case 514: + return this.i; + case 515: + return this.i; + case 516: + return this.i; + case 517: + return this.i; + case 518: + return this.i; + case 519: + return this.i; + case 520: + return this.i; + case 521: + return this.i; + case 522: + return this.i; + case 523: + return this.i; + case 524: + return this.i; + case 525: + return this.i; + case 526: + return this.i; + case 527: + return this.i; + case 528: + return this.i; + case 529: + return this.i; + case 530: + return this.i; + case 531: + return this.i; + case 532: + return this.i; + case 533: + return this.i; + case 534: + return this.i; + case 535: + return this.i; + case 536: + return this.i; + case 537: + return this.i; + case 538: + return this.i; + case 539: + return this.i; + case 540: + return this.i; + case 541: + return this.i; + case 542: + return this.i; + case 543: + return this.i; + case 544: + return this.i; + case 545: + return this.i; + case 546: + return this.i; + case 547: + return this.i; + case 548: + return this.i; + case 549: + return this.i; + case 550: + return this.i; + case 551: + return this.i; + case 552: + return this.i; + case 553: + return this.i; + case 554: + return this.i; + case 555: + return this.i; + case 556: + return this.i; + case 557: + return this.i; + case 558: + return this.i; + case 559: + return this.i; + case 560: + return this.i; + case 561: + return this.i; + case 562: + return this.i; + case 563: + return this.i; + case 564: + return this.i; + case 565: + return this.i; + case 566: + return this.i; + case 567: + return this.i; + case 568: + return this.i; + case 569: + return this.i; + case 570: + return this.i; + case 571: + return this.i; + case 572: + return this.i; + case 573: + return this.i; + case 574: + return this.i; + case 575: + return this.i; + case 576: + return this.i; + case 577: + return this.i; + case 578: + return this.i; + case 579: + return this.i; + case 580: + return this.i; + case 581: + return this.i; + case 582: + return this.i; + case 583: + return this.i; + case 584: + return this.i; + case 585: + return this.i; + case 586: + return this.i; + case 587: + return this.i; + case 588: + return this.i; + case 589: + return this.i; + case 590: + return this.i; + case 591: + return this.i; + case 592: + return this.i; + case 593: + return this.i; + case 594: + return this.i; + case 595: + return this.i; + case 596: + return this.i; + case 597: + return this.i; + case 598: + return this.i; + case 599: + return this.i; + case 600: + return this.i; + case 601: + return this.i; + case 602: + return this.i; + case 603: + return this.i; + case 604: + return this.i; + case 605: + return this.i; + case 606: + return this.i; + case 607: + return this.i; + case 608: + return this.i; + case 609: + return this.i; + case 610: + return this.i; + case 611: + return this.i; + case 612: + return this.i; + case 613: + return this.i; + case 614: + return this.i; + case 615: + return this.i; + case 616: + return this.i; + case 617: + return this.i; + case 618: + return this.i; + case 619: + return this.i; + case 620: + return this.i; + case 621: + return this.i; + case 622: + return this.i; + case 623: + return this.i; + case 624: + return this.i; + case 625: + return this.i; + case 626: + return this.i; + case 627: + return this.i; + case 628: + return this.i; + case 629: + return this.i; + case 630: + return this.i; + case 631: + return this.i; + case 632: + return this.i; + case 633: + return this.i; + case 634: + return this.i; + case 635: + return this.i; + case 636: + return this.i; + case 637: + return this.i; + case 638: + return this.i; + case 639: + return this.i; + case 640: + return this.i; + case 641: + return this.i; + case 642: + return this.i; + case 643: + return this.i; + case 644: + return this.i; + case 645: + return this.i; + case 646: + return this.i; + case 647: + return this.i; + case 648: + return this.i; + case 649: + return this.i; + case 650: + return this.i; + case 651: + return this.i; + case 652: + return this.i; + case 653: + return this.i; + case 654: + return this.i; + case 655: + return this.i; + case 656: + return this.i; + case 657: + return this.i; + case 658: + return this.i; + case 659: + return this.i; + case 660: + return this.i; + case 661: + return this.i; + case 662: + return this.i; + case 663: + return this.i; + case 664: + return this.i; + case 665: + return this.i; + case 666: + return this.i; + case 667: + return this.i; + case 668: + return this.i; + case 669: + return this.i; + case 670: + return this.i; + case 671: + return this.i; + case 672: + return this.i; + case 673: + return this.i; + case 674: + return this.i; + case 675: + return this.i; + case 676: + return this.i; + case 677: + return this.i; + case 678: + return this.i; + case 679: + return this.i; + case 680: + return this.i; + case 681: + return this.i; + case 682: + return this.i; + case 683: + return this.i; + case 684: + return this.i; + case 685: + return this.i; + case 686: + return this.i; + case 687: + return this.i; + case 688: + return this.i; + case 689: + return this.i; + case 690: + return this.i; + case 691: + return this.i; + case 692: + return this.i; + case 693: + return this.i; + case 694: + return this.i; + case 695: + return this.i; + case 696: + return this.i; + case 697: + return this.i; + case 698: + return this.i; + case 699: + return this.i; + case 700: + return this.i; + case 701: + return this.i; + case 702: + return this.i; + case 703: + return this.i; + case 704: + return this.i; + case 705: + return this.i; + case 706: + return this.i; + case 707: + return this.i; + case 708: + return this.i; + case 709: + return this.i; + case 710: + return this.i; + case 711: + return this.i; + case 712: + return this.i; + case 713: + return this.i; + case 714: + return this.i; + case 715: + return this.i; + case 716: + return this.i; + case 717: + return this.i; + case 718: + return this.i; + case 719: + return this.i; + case 720: + return this.i; + case 721: + return this.i; + case 722: + return this.i; + case 723: + return this.i; + case 724: + return this.i; + case 725: + return this.i; + case 726: + return this.i; + case 727: + return this.i; + case 728: + return this.i; + case 729: + return this.i; + case 730: + return this.i; + case 731: + return this.i; + case 732: + return this.i; + case 733: + return this.i; + case 734: + return this.i; + case 735: + return this.i; + case 736: + return this.i; + case 737: + return this.i; + case 738: + return this.i; + case 739: + return this.i; + case 740: + return this.i; + case 741: + return this.i; + case 742: + return this.i; + case 743: + return this.i; + case 744: + return this.i; + case 745: + return this.i; + case 746: + return this.i; + case 747: + return this.i; + case 748: + return this.i; + case 749: + return this.i; + case 750: + return this.i; + case 751: + return this.i; + case 752: + return this.i; + case 753: + return this.i; + case 754: + return this.i; + case 755: + return this.i; + case 756: + return this.i; + case 757: + return this.i; + case 758: + return this.i; + case 759: + return this.i; + case 760: + return this.i; + case 761: + return this.i; + case 762: + return this.i; + case 763: + return this.i; + case 764: + return this.i; + case 765: + return this.i; + case 766: + return this.i; + case 767: + return this.i; + case 768: + return this.i; + case 769: + return this.i; + case 770: + return this.i; + case 771: + return this.i; + case 772: + return this.i; + case 773: + return this.i; + case 774: + return this.i; + case 775: + return this.i; + case 776: + return this.i; + case 777: + return this.i; + case 778: + return this.i; + case 779: + return this.i; + case 780: + return this.i; + case 781: + return this.i; + case 782: + return this.i; + case 783: + return this.i; + case 784: + return this.i; + case 785: + return this.i; + case 786: + return this.i; + case 787: + return this.i; + case 788: + return this.i; + case 789: + return this.i; + case 790: + return this.i; + case 791: + return this.i; + case 792: + return this.i; + case 793: + return this.i; + case 794: + return this.i; + case 795: + return this.i; + case 796: + return this.i; + case 797: + return this.i; + case 798: + return this.i; + case 799: + return this.i; + case 800: + return this.i; + case 801: + return this.i; + case 802: + return this.i; + case 803: + return this.i; + case 804: + return this.i; + case 805: + return this.i; + case 806: + return this.i; + case 807: + return this.i; + case 808: + return this.i; + case 809: + return this.i; + case 810: + return this.i; + case 811: + return this.i; + case 812: + return this.i; + case 813: + return this.i; + case 814: + return this.i; + case 815: + return this.i; + case 816: + return this.i; + case 817: + return this.i; + case 818: + return this.i; + case 819: + return this.i; + case 820: + return this.i; + case 821: + return this.i; + case 822: + return this.i; + case 823: + return this.i; + case 824: + return this.i; + case 825: + return this.i; + case 826: + return this.i; + case 827: + return this.i; + case 828: + return this.i; + case 829: + return this.i; + case 830: + return this.i; + case 831: + return this.i; + case 832: + return this.i; + case 833: + return this.i; + case 834: + return this.i; + case 835: + return this.i; + case 836: + return this.i; + case 837: + return this.i; + case 838: + return this.i; + case 839: + return this.i; + case 840: + return this.i; + case 841: + return this.i; + case 842: + return this.i; + case 843: + return this.i; + case 844: + return this.i; + case 845: + return this.i; + case 846: + return this.i; + case 847: + return this.i; + case 848: + return this.i; + case 849: + return this.i; + case 850: + return this.i; + case 851: + return this.i; + case 852: + return this.i; + case 853: + return this.i; + case 854: + return this.i; + case 855: + return this.i; + case 856: + return this.i; + case 857: + return this.i; + case 858: + return this.i; + case 859: + return this.i; + case 860: + return this.i; + case 861: + return this.i; + case 862: + return this.i; + case 863: + return this.i; + case 864: + return this.i; + case 865: + return this.i; + case 866: + return this.i; + case 867: + return this.i; + case 868: + return this.i; + case 869: + return this.i; + case 870: + return this.i; + case 871: + return this.i; + case 872: + return this.i; + case 873: + return this.i; + case 874: + return this.i; + case 875: + return this.i; + case 876: + return this.i; + case 877: + return this.i; + case 878: + return this.i; + case 879: + return this.i; + case 880: + return this.i; + case 881: + return this.i; + case 882: + return this.i; + case 883: + return this.i; + case 884: + return this.i; + case 885: + return this.i; + case 886: + return this.i; + case 887: + return this.i; + case 888: + return this.i; + case 889: + return this.i; + case 890: + return this.i; + case 891: + return this.i; + case 892: + return this.i; + case 893: + return this.i; + case 894: + return this.i; + case 895: + return this.i; + case 896: + return this.i; + case 897: + return this.i; + case 898: + return this.i; + case 899: + return this.i; + case 900: + return this.i; + case 901: + return this.i; + case 902: + return this.i; + case 903: + return this.i; + case 904: + return this.i; + case 905: + return this.i; + case 906: + return this.i; + case 907: + return this.i; + case 908: + return this.i; + case 909: + return this.i; + case 910: + return this.i; + case 911: + return this.i; + case 912: + return this.i; + case 913: + return this.i; + case 914: + return this.i; + case 915: + return this.i; + case 916: + return this.i; + case 917: + return this.i; + case 918: + return this.i; + case 919: + return this.i; + case 920: + return this.i; + case 921: + return this.i; + case 922: + return this.i; + case 923: + return this.i; + case 924: + return this.i; + case 925: + return this.i; + case 926: + return this.i; + case 927: + return this.i; + case 928: + return this.i; + case 929: + return this.i; + case 930: + return this.i; + case 931: + return this.i; + case 932: + return this.i; + case 933: + return this.i; + case 934: + return this.i; + case 935: + return this.i; + case 936: + return this.i; + case 937: + return this.i; + case 938: + return this.i; + case 939: + return this.i; + case 940: + return this.i; + case 941: + return this.i; + case 942: + return this.i; + case 943: + return this.i; + case 944: + return this.i; + case 945: + return this.i; + case 946: + return this.i; + case 947: + return this.i; + case 948: + return this.i; + case 949: + return this.i; + case 950: + return this.i; + case 951: + return this.i; + case 952: + return this.i; + case 953: + return this.i; + case 954: + return this.i; + case 955: + return this.i; + case 956: + return this.i; + case 957: + return this.i; + case 958: + return this.i; + case 959: + return this.i; + case 960: + return this.i; + case 961: + return this.i; + case 962: + return this.i; + case 963: + return this.i; + case 964: + return this.i; + case 965: + return this.i; + case 966: + return this.i; + case 967: + return this.i; + case 968: + return this.i; + case 969: + return this.i; + case 970: + return this.i; + case 971: + return this.i; + case 972: + return this.i; + case 973: + return this.i; + case 974: + return this.i; + case 975: + return this.i; + case 976: + return this.i; + case 977: + return this.i; + case 978: + return this.i; + case 979: + return this.i; + case 980: + return this.i; + case 981: + return this.i; + case 982: + return this.i; + case 983: + return this.i; + case 984: + return this.i; + case 985: + return this.i; + case 986: + return this.i; + case 987: + return this.i; + case 988: + return this.i; + case 989: + return this.i; + case 990: + return this.i; + case 991: + return this.i; + case 992: + return this.i; + case 993: + return this.i; + case 994: + return this.i; + case 995: + return this.i; + case 996: + return this.i; + case 997: + return this.i; + case 998: + return this.i; + case 999: + return this.i; + case 1000: + return this.i; + case 1001: + return this.i; + case 1002: + return this.i; + case 1003: + return this.i; + case 1004: + return this.i; + case 1005: + return this.i; + case 1006: + return this.i; + case 1007: + return this.i; + case 1008: + return this.i; + case 1009: + return this.i; + case 1010: + return this.i; + case 1011: + return this.i; + case 1012: + return this.i; + case 1013: + return this.i; + case 1014: + return this.i; + case 1015: + return this.i; + case 1016: + return this.i; + case 1017: + return this.i; + case 1018: + return this.i; + case 1019: + return this.i; + case 1020: + return this.i; + case 1021: + return this.i; + case 1022: + return this.i; + case 1023: + return this.i; + case 1024: + return this.i; + case 1025: + return this.i; + case 1026: + return this.i; + case 1027: + return this.i; + case 1028: + return this.i; + case 1029: + return this.i; + case 1030: + return this.i; + case 1031: + return this.i; + case 1032: + return this.i; + case 1033: + return this.i; + case 1034: + return this.i; + case 1035: + return this.i; + case 1036: + return this.i; + case 1037: + return this.i; + case 1038: + return this.i; + case 1039: + return this.i; + case 1040: + return this.i; + case 1041: + return this.i; + case 1042: + return this.i; + case 1043: + return this.i; + case 1044: + return this.i; + case 1045: + return this.i; + case 1046: + return this.i; + case 1047: + return this.i; + case 1048: + return this.i; + case 1049: + return this.i; + case 1050: + return this.i; + case 1051: + return this.i; + case 1052: + return this.i; + case 1053: + return this.i; + case 1054: + return this.i; + case 1055: + return this.i; + case 1056: + return this.i; + case 1057: + return this.i; + case 1058: + return this.i; + case 1059: + return this.i; + case 1060: + return this.i; + case 1061: + return this.i; + case 1062: + return this.i; + case 1063: + return this.i; + case 1064: + return this.i; + case 1065: + return this.i; + case 1066: + return this.i; + case 1067: + return this.i; + case 1068: + return this.i; + case 1069: + return this.i; + case 1070: + return this.i; + case 1071: + return this.i; + case 1072: + return this.i; + case 1073: + return this.i; + case 1074: + return this.i; + case 1075: + return this.i; + case 1076: + return this.i; + case 1077: + return this.i; + case 1078: + return this.i; + case 1079: + return this.i; + case 1080: + return this.i; + case 1081: + return this.i; + case 1082: + return this.i; + case 1083: + return this.i; + case 1084: + return this.i; + case 1085: + return this.i; + case 1086: + return this.i; + case 1087: + return this.i; + case 1088: + return this.i; + case 1089: + return this.i; + case 1090: + return this.i; + case 1091: + return this.i; + case 1092: + return this.i; + case 1093: + return this.i; + case 1094: + return this.i; + case 1095: + return this.i; + case 1096: + return this.i; + case 1097: + return this.i; + case 1098: + return this.i; + case 1099: + return this.i; + case 1100: + return this.i; + case 1101: + return this.i; + case 1102: + return this.i; + case 1103: + return this.i; + case 1104: + return this.i; + case 1105: + return this.i; + case 1106: + return this.i; + case 1107: + return this.i; + case 1108: + return this.i; + case 1109: + return this.i; + case 1110: + return this.i; + case 1111: + return this.i; + case 1112: + return this.i; + case 1113: + return this.i; + case 1114: + return this.i; + case 1115: + return this.i; + case 1116: + return this.i; + case 1117: + return this.i; + case 1118: + return this.i; + case 1119: + return this.i; + case 1120: + return this.i; + case 1121: + return this.i; + case 1122: + return this.i; + case 1123: + return this.i; + case 1124: + return this.i; + case 1125: + return this.i; + case 1126: + return this.i; + case 1127: + return this.i; + case 1128: + return this.i; + case 1129: + return this.i; + case 1130: + return this.i; + case 1131: + return this.i; + case 1132: + return this.i; + case 1133: + return this.i; + case 1134: + return this.i; + case 1135: + return this.i; + case 1136: + return this.i; + case 1137: + return this.i; + case 1138: + return this.i; + case 1139: + return this.i; + case 1140: + return this.i; + case 1141: + return this.i; + case 1142: + return this.i; + case 1143: + return this.i; + case 1144: + return this.i; + case 1145: + return this.i; + case 1146: + return this.i; + case 1147: + return this.i; + case 1148: + return this.i; + case 1149: + return this.i; + case 1150: + return this.i; + case 1151: + return this.i; + case 1152: + return this.i; + case 1153: + return this.i; + case 1154: + return this.i; + case 1155: + return this.i; + case 1156: + return this.i; + case 1157: + return this.i; + case 1158: + return this.i; + case 1159: + return this.i; + case 1160: + return this.i; + case 1161: + return this.i; + case 1162: + return this.i; + case 1163: + return this.i; + case 1164: + return this.i; + case 1165: + return this.i; + case 1166: + return this.i; + case 1167: + return this.i; + case 1168: + return this.i; + case 1169: + return this.i; + case 1170: + return this.i; + case 1171: + return this.i; + case 1172: + return this.i; + case 1173: + return this.i; + case 1174: + return this.i; + case 1175: + return this.i; + case 1176: + return this.i; + case 1177: + return this.i; + case 1178: + return this.i; + case 1179: + return this.i; + case 1180: + return this.i; + case 1181: + return this.i; + case 1182: + return this.i; + case 1183: + return this.i; + case 1184: + return this.i; + case 1185: + return this.i; + case 1186: + return this.i; + case 1187: + return this.i; + case 1188: + return this.i; + case 1189: + return this.i; + case 1190: + return this.i; + case 1191: + return this.i; + case 1192: + return this.i; + case 1193: + return this.i; + case 1194: + return this.i; + case 1195: + return this.i; + case 1196: + return this.i; + case 1197: + return this.i; + case 1198: + return this.i; + case 1199: + return this.i; + case 1200: + return this.i; + case 1201: + return this.i; + case 1202: + return this.i; + case 1203: + return this.i; + case 1204: + return this.i; + case 1205: + return this.i; + case 1206: + return this.i; + case 1207: + return this.i; + case 1208: + return this.i; + case 1209: + return this.i; + case 1210: + return this.i; + case 1211: + return this.i; + case 1212: + return this.i; + case 1213: + return this.i; + case 1214: + return this.i; + case 1215: + return this.i; + case 1216: + return this.i; + case 1217: + return this.i; + case 1218: + return this.i; + case 1219: + return this.i; + case 1220: + return this.i; + case 1221: + return this.i; + case 1222: + return this.i; + case 1223: + return this.i; + case 1224: + return this.i; + case 1225: + return this.i; + case 1226: + return this.i; + case 1227: + return this.i; + case 1228: + return this.i; + case 1229: + return this.i; + case 1230: + return this.i; + case 1231: + return this.i; + case 1232: + return this.i; + case 1233: + return this.i; + case 1234: + return this.i; + case 1235: + return this.i; + case 1236: + return this.i; + case 1237: + return this.i; + case 1238: + return this.i; + case 1239: + return this.i; + case 1240: + return this.i; + case 1241: + return this.i; + case 1242: + return this.i; + case 1243: + return this.i; + case 1244: + return this.i; + case 1245: + return this.i; + case 1246: + return this.i; + case 1247: + return this.i; + case 1248: + return this.i; + case 1249: + return this.i; + case 1250: + return this.i; + case 1251: + return this.i; + case 1252: + return this.i; + case 1253: + return this.i; + case 1254: + return this.i; + case 1255: + return this.i; + case 1256: + return this.i; + case 1257: + return this.i; + case 1258: + return this.i; + case 1259: + return this.i; + case 1260: + return this.i; + case 1261: + return this.i; + case 1262: + return this.i; + case 1263: + return this.i; + case 1264: + return this.i; + case 1265: + return this.i; + case 1266: + return this.i; + case 1267: + return this.i; + case 1268: + return this.i; + case 1269: + return this.i; + case 1270: + return this.i; + case 1271: + return this.i; + case 1272: + return this.i; + case 1273: + return this.i; + case 1274: + return this.i; + case 1275: + return this.i; + case 1276: + return this.i; + case 1277: + return this.i; + case 1278: + return this.i; + case 1279: + return this.i; + case 1280: + return this.i; + case 1281: + return this.i; + case 1282: + return this.i; + case 1283: + return this.i; + case 1284: + return this.i; + case 1285: + return this.i; + case 1286: + return this.i; + case 1287: + return this.i; + case 1288: + return this.i; + case 1289: + return this.i; + case 1290: + return this.i; + case 1291: + return this.i; + case 1292: + return this.i; + case 1293: + return this.i; + case 1294: + return this.i; + case 1295: + return this.i; + case 1296: + return this.i; + case 1297: + return this.i; + case 1298: + return this.i; + case 1299: + return this.i; + case 1300: + return this.i; + case 1301: + return this.i; + case 1302: + return this.i; + case 1303: + return this.i; + case 1304: + return this.i; + case 1305: + return this.i; + case 1306: + return this.i; + case 1307: + return this.i; + case 1308: + return this.i; + case 1309: + return this.i; + case 1310: + return this.i; + case 1311: + return this.i; + case 1312: + return this.i; + case 1313: + return this.i; + case 1314: + return this.i; + case 1315: + return this.i; + case 1316: + return this.i; + case 1317: + return this.i; + case 1318: + return this.i; + case 1319: + return this.i; + case 1320: + return this.i; + case 1321: + return this.i; + case 1322: + return this.i; + case 1323: + return this.i; + case 1324: + return this.i; + case 1325: + return this.i; + case 1326: + return this.i; + case 1327: + return this.i; + case 1328: + return this.i; + case 1329: + return this.i; + case 1330: + return this.i; + case 1331: + return this.i; + case 1332: + return this.i; + case 1333: + return this.i; + case 1334: + return this.i; + case 1335: + return this.i; + case 1336: + return this.i; + case 1337: + return this.i; + case 1338: + return this.i; + case 1339: + return this.i; + case 1340: + return this.i; + case 1341: + return this.i; + case 1342: + return this.i; + case 1343: + return this.i; + case 1344: + return this.i; + case 1345: + return this.i; + case 1346: + return this.i; + case 1347: + return this.i; + case 1348: + return this.i; + case 1349: + return this.i; + case 1350: + return this.i; + case 1351: + return this.i; + case 1352: + return this.i; + case 1353: + return this.i; + case 1354: + return this.i; + case 1355: + return this.i; + case 1356: + return this.i; + case 1357: + return this.i; + case 1358: + return this.i; + case 1359: + return this.i; + case 1360: + return this.i; + case 1361: + return this.i; + case 1362: + return this.i; + case 1363: + return this.i; + case 1364: + return this.i; + case 1365: + return this.i; + case 1366: + return this.i; + case 1367: + return this.i; + case 1368: + return this.i; + case 1369: + return this.i; + case 1370: + return this.i; + case 1371: + return this.i; + case 1372: + return this.i; + case 1373: + return this.i; + case 1374: + return this.i; + case 1375: + return this.i; + case 1376: + return this.i; + case 1377: + return this.i; + case 1378: + return this.i; + case 1379: + return this.i; + case 1380: + return this.i; + case 1381: + return this.i; + case 1382: + return this.i; + case 1383: + return this.i; + case 1384: + return this.i; + case 1385: + return this.i; + case 1386: + return this.i; + case 1387: + return this.i; + case 1388: + return this.i; + case 1389: + return this.i; + case 1390: + return this.i; + case 1391: + return this.i; + case 1392: + return this.i; + case 1393: + return this.i; + case 1394: + return this.i; + case 1395: + return this.i; + case 1396: + return this.i; + case 1397: + return this.i; + case 1398: + return this.i; + case 1399: + return this.i; + case 1400: + return this.i; + case 1401: + return this.i; + case 1402: + return this.i; + case 1403: + return this.i; + case 1404: + return this.i; + case 1405: + return this.i; + case 1406: + return this.i; + case 1407: + return this.i; + case 1408: + return this.i; + case 1409: + return this.i; + case 1410: + return this.i; + case 1411: + return this.i; + case 1412: + return this.i; + case 1413: + return this.i; + case 1414: + return this.i; + case 1415: + return this.i; + case 1416: + return this.i; + case 1417: + return this.i; + case 1418: + return this.i; + case 1419: + return this.i; + case 1420: + return this.i; + case 1421: + return this.i; + case 1422: + return this.i; + case 1423: + return this.i; + case 1424: + return this.i; + case 1425: + return this.i; + case 1426: + return this.i; + case 1427: + return this.i; + case 1428: + return this.i; + case 1429: + return this.i; + case 1430: + return this.i; + case 1431: + return this.i; + case 1432: + return this.i; + case 1433: + return this.i; + case 1434: + return this.i; + case 1435: + return this.i; + case 1436: + return this.i; + case 1437: + return this.i; + case 1438: + return this.i; + case 1439: + return this.i; + case 1440: + return this.i; + case 1441: + return this.i; + case 1442: + return this.i; + case 1443: + return this.i; + case 1444: + return this.i; + case 1445: + return this.i; + case 1446: + return this.i; + case 1447: + return this.i; + case 1448: + return this.i; + case 1449: + return this.i; + case 1450: + return this.i; + case 1451: + return this.i; + case 1452: + return this.i; + case 1453: + return this.i; + case 1454: + return this.i; + case 1455: + return this.i; + case 1456: + return this.i; + case 1457: + return this.i; + case 1458: + return this.i; + case 1459: + return this.i; + case 1460: + return this.i; + case 1461: + return this.i; + case 1462: + return this.i; + case 1463: + return this.i; + case 1464: + return this.i; + case 1465: + return this.i; + case 1466: + return this.i; + case 1467: + return this.i; + case 1468: + return this.i; + case 1469: + return this.i; + case 1470: + return this.i; + case 1471: + return this.i; + case 1472: + return this.i; + case 1473: + return this.i; + case 1474: + return this.i; + case 1475: + return this.i; + case 1476: + return this.i; + case 1477: + return this.i; + case 1478: + return this.i; + case 1479: + return this.i; + case 1480: + return this.i; + case 1481: + return this.i; + case 1482: + return this.i; + case 1483: + return this.i; + case 1484: + return this.i; + case 1485: + return this.i; + case 1486: + return this.i; + case 1487: + return this.i; + case 1488: + return this.i; + case 1489: + return this.i; + case 1490: + return this.i; + case 1491: + return this.i; + case 1492: + return this.i; + case 1493: + return this.i; + case 1494: + return this.i; + case 1495: + return this.i; + case 1496: + return this.i; + case 1497: + return this.i; + case 1498: + return this.i; + case 1499: + return this.i; + case 1500: + return this.i; + case 1501: + return this.i; + case 1502: + return this.i; + case 1503: + return this.i; + case 1504: + return this.i; + case 1505: + return this.i; + case 1506: + return this.i; + case 1507: + return this.i; + case 1508: + return this.i; + case 1509: + return this.i; + case 1510: + return this.i; + case 1511: + return this.i; + case 1512: + return this.i; + case 1513: + return this.i; + case 1514: + return this.i; + case 1515: + return this.i; + case 1516: + return this.i; + case 1517: + return this.i; + case 1518: + return this.i; + case 1519: + return this.i; + case 1520: + return this.i; + case 1521: + return this.i; + case 1522: + return this.i; + case 1523: + return this.i; + case 1524: + return this.i; + case 1525: + return this.i; + case 1526: + return this.i; + case 1527: + return this.i; + case 1528: + return this.i; + case 1529: + return this.i; + case 1530: + return this.i; + case 1531: + return this.i; + case 1532: + return this.i; + case 1533: + return this.i; + case 1534: + return this.i; + case 1535: + return this.i; + case 1536: + return this.i; + case 1537: + return this.i; + case 1538: + return this.i; + case 1539: + return this.i; + case 1540: + return this.i; + case 1541: + return this.i; + case 1542: + return this.i; + case 1543: + return this.i; + case 1544: + return this.i; + case 1545: + return this.i; + case 1546: + return this.i; + case 1547: + return this.i; + case 1548: + return this.i; + case 1549: + return this.i; + case 1550: + return this.i; + case 1551: + return this.i; + case 1552: + return this.i; + case 1553: + return this.i; + case 1554: + return this.i; + case 1555: + return this.i; + case 1556: + return this.i; + case 1557: + return this.i; + case 1558: + return this.i; + case 1559: + return this.i; + case 1560: + return this.i; + case 1561: + return this.i; + case 1562: + return this.i; + case 1563: + return this.i; + case 1564: + return this.i; + case 1565: + return this.i; + case 1566: + return this.i; + case 1567: + return this.i; + case 1568: + return this.i; + case 1569: + return this.i; + case 1570: + return this.i; + case 1571: + return this.i; + case 1572: + return this.i; + case 1573: + return this.i; + case 1574: + return this.i; + case 1575: + return this.i; + case 1576: + return this.i; + case 1577: + return this.i; + case 1578: + return this.i; + case 1579: + return this.i; + case 1580: + return this.i; + case 1581: + return this.i; + case 1582: + return this.i; + case 1583: + return this.i; + case 1584: + return this.i; + case 1585: + return this.i; + case 1586: + return this.i; + case 1587: + return this.i; + case 1588: + return this.i; + case 1589: + return this.i; + case 1590: + return this.i; + case 1591: + return this.i; + case 1592: + return this.i; + case 1593: + return this.i; + case 1594: + return this.i; + case 1595: + return this.i; + case 1596: + return this.i; + case 1597: + return this.i; + case 1598: + return this.i; + case 1599: + return this.i; + case 1600: + return this.i; + case 1601: + return this.i; + case 1602: + return this.i; + case 1603: + return this.i; + case 1604: + return this.i; + case 1605: + return this.i; + case 1606: + return this.i; + case 1607: + return this.i; + case 1608: + return this.i; + case 1609: + return this.i; + case 1610: + return this.i; + case 1611: + return this.i; + case 1612: + return this.i; + case 1613: + return this.i; + case 1614: + return this.i; + case 1615: + return this.i; + case 1616: + return this.i; + case 1617: + return this.i; + case 1618: + return this.i; + case 1619: + return this.i; + case 1620: + return this.i; + case 1621: + return this.i; + case 1622: + return this.i; + case 1623: + return this.i; + case 1624: + return this.i; + case 1625: + return this.i; + case 1626: + return this.i; + case 1627: + return this.i; + case 1628: + return this.i; + case 1629: + return this.i; + case 1630: + return this.i; + case 1631: + return this.i; + case 1632: + return this.i; + case 1633: + return this.i; + case 1634: + return this.i; + case 1635: + return this.i; + case 1636: + return this.i; + case 1637: + return this.i; + case 1638: + return this.i; + case 1639: + return this.i; + case 1640: + return this.i; + case 1641: + return this.i; + case 1642: + return this.i; + case 1643: + return this.i; + case 1644: + return this.i; + case 1645: + return this.i; + case 1646: + return this.i; + case 1647: + return this.i; + case 1648: + return this.i; + case 1649: + return this.i; + case 1650: + return this.i; + case 1651: + return this.i; + case 1652: + return this.i; + case 1653: + return this.i; + case 1654: + return this.i; + case 1655: + return this.i; + case 1656: + return this.i; + case 1657: + return this.i; + case 1658: + return this.i; + case 1659: + return this.i; + case 1660: + return this.i; + case 1661: + return this.i; + case 1662: + return this.i; + case 1663: + return this.i; + case 1664: + return this.i; + case 1665: + return this.i; + case 1666: + return this.i; + case 1667: + return this.i; + case 1668: + return this.i; + case 1669: + return this.i; + case 1670: + return this.i; + case 1671: + return this.i; + case 1672: + return this.i; + case 1673: + return this.i; + case 1674: + return this.i; + case 1675: + return this.i; + case 1676: + return this.i; + case 1677: + return this.i; + case 1678: + return this.i; + case 1679: + return this.i; + case 1680: + return this.i; + case 1681: + return this.i; + case 1682: + return this.i; + case 1683: + return this.i; + case 1684: + return this.i; + case 1685: + return this.i; + case 1686: + return this.i; + case 1687: + return this.i; + case 1688: + return this.i; + case 1689: + return this.i; + case 1690: + return this.i; + case 1691: + return this.i; + case 1692: + return this.i; + case 1693: + return this.i; + case 1694: + return this.i; + case 1695: + return this.i; + case 1696: + return this.i; + case 1697: + return this.i; + case 1698: + return this.i; + case 1699: + return this.i; + case 1700: + return this.i; + case 1701: + return this.i; + case 1702: + return this.i; + case 1703: + return this.i; + case 1704: + return this.i; + case 1705: + return this.i; + case 1706: + return this.i; + case 1707: + return this.i; + case 1708: + return this.i; + case 1709: + return this.i; + case 1710: + return this.i; + case 1711: + return this.i; + case 1712: + return this.i; + case 1713: + return this.i; + case 1714: + return this.i; + case 1715: + return this.i; + case 1716: + return this.i; + case 1717: + return this.i; + case 1718: + return this.i; + case 1719: + return this.i; + case 1720: + return this.i; + case 1721: + return this.i; + case 1722: + return this.i; + case 1723: + return this.i; + case 1724: + return this.i; + case 1725: + return this.i; + case 1726: + return this.i; + case 1727: + return this.i; + case 1728: + return this.i; + case 1729: + return this.i; + case 1730: + return this.i; + case 1731: + return this.i; + case 1732: + return this.i; + case 1733: + return this.i; + case 1734: + return this.i; + case 1735: + return this.i; + case 1736: + return this.i; + case 1737: + return this.i; + case 1738: + return this.i; + case 1739: + return this.i; + case 1740: + return this.i; + case 1741: + return this.i; + case 1742: + return this.i; + case 1743: + return this.i; + case 1744: + return this.i; + case 1745: + return this.i; + case 1746: + return this.i; + case 1747: + return this.i; + case 1748: + return this.i; + case 1749: + return this.i; + case 1750: + return this.i; + case 1751: + return this.i; + case 1752: + return this.i; + case 1753: + return this.i; + case 1754: + return this.i; + case 1755: + return this.i; + case 1756: + return this.i; + case 1757: + return this.i; + case 1758: + return this.i; + case 1759: + return this.i; + case 1760: + return this.i; + case 1761: + return this.i; + case 1762: + return this.i; + case 1763: + return this.i; + case 1764: + return this.i; + case 1765: + return this.i; + case 1766: + return this.i; + case 1767: + return this.i; + case 1768: + return this.i; + case 1769: + return this.i; + case 1770: + return this.i; + case 1771: + return this.i; + case 1772: + return this.i; + case 1773: + return this.i; + case 1774: + return this.i; + case 1775: + return this.i; + case 1776: + return this.i; + case 1777: + return this.i; + case 1778: + return this.i; + case 1779: + return this.i; + case 1780: + return this.i; + case 1781: + return this.i; + case 1782: + return this.i; + case 1783: + return this.i; + case 1784: + return this.i; + case 1785: + return this.i; + case 1786: + return this.i; + case 1787: + return this.i; + case 1788: + return this.i; + case 1789: + return this.i; + case 1790: + return this.i; + case 1791: + return this.i; + case 1792: + return this.i; + case 1793: + return this.i; + case 1794: + return this.i; + case 1795: + return this.i; + case 1796: + return this.i; + case 1797: + return this.i; + case 1798: + return this.i; + case 1799: + return this.i; + case 1800: + return this.i; + case 1801: + return this.i; + case 1802: + return this.i; + case 1803: + return this.i; + case 1804: + return this.i; + case 1805: + return this.i; + case 1806: + return this.i; + case 1807: + return this.i; + case 1808: + return this.i; + case 1809: + return this.i; + case 1810: + return this.i; + case 1811: + return this.i; + case 1812: + return this.i; + case 1813: + return this.i; + case 1814: + return this.i; + case 1815: + return this.i; + case 1816: + return this.i; + case 1817: + return this.i; + case 1818: + return this.i; + case 1819: + return this.i; + case 1820: + return this.i; + case 1821: + return this.i; + case 1822: + return this.i; + case 1823: + return this.i; + case 1824: + return this.i; + case 1825: + return this.i; + case 1826: + return this.i; + case 1827: + return this.i; + case 1828: + return this.i; + case 1829: + return this.i; + case 1830: + return this.i; + case 1831: + return this.i; + case 1832: + return this.i; + case 1833: + return this.i; + case 1834: + return this.i; + case 1835: + return this.i; + case 1836: + return this.i; + case 1837: + return this.i; + case 1838: + return this.i; + case 1839: + return this.i; + case 1840: + return this.i; + case 1841: + return this.i; + case 1842: + return this.i; + case 1843: + return this.i; + case 1844: + return this.i; + case 1845: + return this.i; + case 1846: + return this.i; + case 1847: + return this.i; + case 1848: + return this.i; + case 1849: + return this.i; + case 1850: + return this.i; + case 1851: + return this.i; + case 1852: + return this.i; + case 1853: + return this.i; + case 1854: + return this.i; + case 1855: + return this.i; + case 1856: + return this.i; + case 1857: + return this.i; + case 1858: + return this.i; + case 1859: + return this.i; + case 1860: + return this.i; + case 1861: + return this.i; + case 1862: + return this.i; + case 1863: + return this.i; + case 1864: + return this.i; + case 1865: + return this.i; + case 1866: + return this.i; + case 1867: + return this.i; + case 1868: + return this.i; + case 1869: + return this.i; + case 1870: + return this.i; + case 1871: + return this.i; + case 1872: + return this.i; + case 1873: + return this.i; + case 1874: + return this.i; + case 1875: + return this.i; + case 1876: + return this.i; + case 1877: + return this.i; + case 1878: + return this.i; + case 1879: + return this.i; + case 1880: + return this.i; + case 1881: + return this.i; + case 1882: + return this.i; + case 1883: + return this.i; + case 1884: + return this.i; + case 1885: + return this.i; + case 1886: + return this.i; + case 1887: + return this.i; + case 1888: + return this.i; + case 1889: + return this.i; + case 1890: + return this.i; + case 1891: + return this.i; + case 1892: + return this.i; + case 1893: + return this.i; + case 1894: + return this.i; + case 1895: + return this.i; + case 1896: + return this.i; + case 1897: + return this.i; + case 1898: + return this.i; + case 1899: + return this.i; + case 1900: + return this.i; + case 1901: + return this.i; + case 1902: + return this.i; + case 1903: + return this.i; + case 1904: + return this.i; + case 1905: + return this.i; + case 1906: + return this.i; + case 1907: + return this.i; + case 1908: + return this.i; + case 1909: + return this.i; + case 1910: + return this.i; + case 1911: + return this.i; + case 1912: + return this.i; + case 1913: + return this.i; + case 1914: + return this.i; + case 1915: + return this.i; + case 1916: + return this.i; + case 1917: + return this.i; + case 1918: + return this.i; + case 1919: + return this.i; + case 1920: + return this.i; + case 1921: + return this.i; + case 1922: + return this.i; + case 1923: + return this.i; + case 1924: + return this.i; + case 1925: + return this.i; + case 1926: + return this.i; + case 1927: + return this.i; + case 1928: + return this.i; + case 1929: + return this.i; + case 1930: + return this.i; + case 1931: + return this.i; + case 1932: + return this.i; + case 1933: + return this.i; + case 1934: + return this.i; + case 1935: + return this.i; + case 1936: + return this.i; + case 1937: + return this.i; + case 1938: + return this.i; + case 1939: + return this.i; + case 1940: + return this.i; + case 1941: + return this.i; + case 1942: + return this.i; + case 1943: + return this.i; + case 1944: + return this.i; + case 1945: + return this.i; + case 1946: + return this.i; + case 1947: + return this.i; + case 1948: + return this.i; + case 1949: + return this.i; + case 1950: + return this.i; + case 1951: + return this.i; + case 1952: + return this.i; + case 1953: + return this.i; + case 1954: + return this.i; + case 1955: + return this.i; + case 1956: + return this.i; + case 1957: + return this.i; + case 1958: + return this.i; + case 1959: + return this.i; + case 1960: + return this.i; + case 1961: + return this.i; + case 1962: + return this.i; + case 1963: + return this.i; + case 1964: + return this.i; + case 1965: + return this.i; + case 1966: + return this.i; + case 1967: + return this.i; + case 1968: + return this.i; + case 1969: + return this.i; + case 1970: + return this.i; + case 1971: + return this.i; + case 1972: + return this.i; + case 1973: + return this.i; + case 1974: + return this.i; + case 1975: + return this.i; + case 1976: + return this.i; + case 1977: + return this.i; + case 1978: + return this.i; + case 1979: + return this.i; + case 1980: + return this.i; + case 1981: + return this.i; + case 1982: + return this.i; + case 1983: + return this.i; + case 1984: + return this.i; + case 1985: + return this.i; + case 1986: + return this.i; + case 1987: + return this.i; + case 1988: + return this.i; + case 1989: + return this.i; + case 1990: + return this.i; + case 1991: + return this.i; + case 1992: + return this.i; + case 1993: + return this.i; + case 1994: + return this.i; + case 1995: + return this.i; + case 1996: + return this.i; + case 1997: + return this.i; + case 1998: + return this.i; + case 1999: + return this.i; + case 2000: + return this.i; + case 2001: + return this.i; + case 2002: + return this.i; + case 2003: + return this.i; + case 2004: + return this.i; + case 2005: + return this.i; + case 2006: + return this.i; + case 2007: + return this.i; + case 2008: + return this.i; + case 2009: + return this.i; + case 2010: + return this.i; + case 2011: + return this.i; + case 2012: + return this.i; + case 2013: + return this.i; + case 2014: + return this.i; + case 2015: + return this.i; + case 2016: + return this.i; + case 2017: + return this.i; + case 2018: + return this.i; + case 2019: + return this.i; + case 2020: + return this.i; + case 2021: + return this.i; + case 2022: + return this.i; + case 2023: + return this.i; + case 2024: + return this.i; + case 2025: + return this.i; + case 2026: + return this.i; + case 2027: + return this.i; + case 2028: + return this.i; + case 2029: + return this.i; + case 2030: + return this.i; + case 2031: + return this.i; + case 2032: + return this.i; + case 2033: + return this.i; + case 2034: + return this.i; + case 2035: + return this.i; + case 2036: + return this.i; + case 2037: + return this.i; + case 2038: + return this.i; + case 2039: + return this.i; + case 2040: + return this.i; + case 2041: + return this.i; + case 2042: + return this.i; + case 2043: + return this.i; + case 2044: + return this.i; + case 2045: + return this.i; + case 2046: + return this.i; + } +} + +// Test if this is working in split array literal +function hugeArrayLiteral() { + return [ + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i, + this.i + ][30]; +} diff --git a/nashorn/test/script/basic/JDK-8020356.js.EXPECTED b/nashorn/test/script/basic/JDK-8020356.js.EXPECTED new file mode 100644 index 00000000000..8f369679332 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8020356.js.EXPECTED @@ -0,0 +1,2 @@ +20 +10 diff --git a/nashorn/test/script/basic/JDK-8021122.js b/nashorn/test/script/basic/JDK-8021122.js new file mode 100644 index 00000000000..769164f57c8 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8021122.js @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8021122: Not all callables are handled for toString and other function valued properties + * + * @test + * @run + */ + +var a = {} +var obj = new java.util.HashMap(); +Object.bindProperties(a, obj); +try { + print(a); +} catch (e) { + print(e); +} + +var a = {} +var global = loadWithNewGlobal({ name:"xx", script: "this" }); +var obj = global.eval("({ toString: function() { return 'hello'; } })"); +Object.bindProperties(a, obj); +try { + print(a); +} catch (e) { + print(e); +} + +function runLambdaTests() { + var r = new java.lang.Runnable() { + run: function() { print("I am runnable"); } + }; + + // call any @FunctionalInterface object as though it is a function + r(); + + var twice = new java.util.function.Function() { + apply: function(x) 2*x + }; + + print(twice(34)); + + var sum = new java.util.function.BiFunction() { + apply: function(x, y) x + y + }; + + print(sum(32, 12)) + + // make toString to be a @FunctionalInterface object + var a = {}; + a.toString = new java.util.function.Supplier() { + get: function() { return "MyString"; } + }; + + try { + print(a); + } catch (e) { + print(e); + } +} + +try { + // check for java.util.function.Function class + Java.type("java.util.function.Function"); + runLambdaTests(); +} catch (e) { + // fake output to match .EXPECTED values + print("I am runnable"); + print("68"); + print("44"); + print("MyString"); +} diff --git a/nashorn/test/script/basic/JDK-8021122.js.EXPECTED b/nashorn/test/script/basic/JDK-8021122.js.EXPECTED new file mode 100644 index 00000000000..ef4aebe7b0b --- /dev/null +++ b/nashorn/test/script/basic/JDK-8021122.js.EXPECTED @@ -0,0 +1,6 @@ +{} +hello +I am runnable +68 +44 +MyString diff --git a/nashorn/test/script/basic/NASHORN-473.js b/nashorn/test/script/basic/NASHORN-473.js index 3819d15b2ca..1b935aed87c 100644 --- a/nashorn/test/script/basic/NASHORN-473.js +++ b/nashorn/test/script/basic/NASHORN-473.js @@ -28,7 +28,7 @@ * @run */ -var boolArr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 2); +var boolArr = new (Java.type("boolean[]"))(2); boolArr[0] = true; boolArr[1] = false; diff --git a/nashorn/test/script/basic/NASHORN-592-dual.js b/nashorn/test/script/basic/NASHORN-592-dual.js new file mode 100644 index 00000000000..73dd815182d --- /dev/null +++ b/nashorn/test/script/basic/NASHORN-592-dual.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * NASHORN-592-dual: test all combos of field types and getters and setters + * This time use dual field representation + * + * @test + * @option -Dnashorn.fields.dual=true + * @fork + * @run/ignore-std-error + */ + +load(__DIR__ + 'NASHORN-592.js'); diff --git a/nashorn/test/script/basic/NASHORN-592-dual.js.EXPECTED b/nashorn/test/script/basic/NASHORN-592-dual.js.EXPECTED new file mode 100644 index 00000000000..8ff2cd485da --- /dev/null +++ b/nashorn/test/script/basic/NASHORN-592-dual.js.EXPECTED @@ -0,0 +1,44 @@ +0 +0 +NaN +undefinedhej! +17 +8 +34 +17hej! +17 +8 +34.9422 +17.4711hej! +0 +0 +NaN +Fame and fortune Salamander Yahoo!hej! +24 +11111 +23.23 +23 +23 +Have some pie! +4711.17 +17172 +23 +23.23 +23 +23 +Have some pie! +4711.17 +23 +111 +4711.16 +I like cake! +0 +NaN +0 +I like cake! +17 +17.4711 +salamander +4711.17 +axolotl +lizard diff --git a/nashorn/test/script/basic/classloader.js b/nashorn/test/script/basic/classloader.js new file mode 100644 index 00000000000..7676496060d --- /dev/null +++ b/nashorn/test/script/basic/classloader.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Try to extend ClassLoader. + * + * @test + * @security + */ + +try { + var l = new (Java.extend(java.lang.ClassLoader))({}); + fail("should have thrown SecurityException"); +} catch (e) { + if (e instanceof java.lang.SecurityException) { + print(e); + } else { + fail("expected SecurityException, got " + e); + } +} + diff --git a/nashorn/test/script/basic/classloader.js.EXPECTED b/nashorn/test/script/basic/classloader.js.EXPECTED new file mode 100644 index 00000000000..e08cc9f8b40 --- /dev/null +++ b/nashorn/test/script/basic/classloader.js.EXPECTED @@ -0,0 +1 @@ +java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createClassLoader") diff --git a/nashorn/test/script/basic/compile-octane-splitter.js b/nashorn/test/script/basic/compile-octane-splitter.js new file mode 100644 index 00000000000..497b5ab7b58 --- /dev/null +++ b/nashorn/test/script/basic/compile-octane-splitter.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @option -Dnashorn.compiler.splitter.threshold=1000 + * @fork + * @runif external.octane + */ + +compile_only = true; +load(__DIR__ + 'run-octane.js'); diff --git a/nashorn/test/script/basic/compile-octane-splitter.js.EXPECTED b/nashorn/test/script/basic/compile-octane-splitter.js.EXPECTED new file mode 100644 index 00000000000..153524c70b4 --- /dev/null +++ b/nashorn/test/script/basic/compile-octane-splitter.js.EXPECTED @@ -0,0 +1,13 @@ +Compiled OK: box2d +Compiled OK: code-load +Compiled OK: crypto +Compiled OK: deltablue +Compiled OK: earley-boyer +Compiled OK: gbemu +Compiled OK: mandreel +Compiled OK: navier-stokes +Compiled OK: pdfjs +Compiled OK: raytrace +Compiled OK: regexp +Compiled OK: richards +Compiled OK: splay diff --git a/nashorn/test/script/basic/javaarray.js b/nashorn/test/script/basic/javaarray.js index 389b9530096..5a1588894d6 100644 --- a/nashorn/test/script/basic/javaarray.js +++ b/nashorn/test/script/basic/javaarray.js @@ -30,7 +30,7 @@ (function() { var nargs = arguments.length; - var args = java.lang.reflect.Array.newInstance(java.lang.Object.class, nargs); + var args = new (Java.type("java.lang.Object[]"))(nargs); print(args.length); for (var i = 0; i < nargs; i++) { var arg = arguments[i]; @@ -41,7 +41,7 @@ var z; // undefined -var intArray = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 1); +var intArray = new (Java.type("int[]"))(1); intArray[0] = 10; print(intArray[0]); print(intArray.length); @@ -50,19 +50,19 @@ print(intArray[0]); intArray[0] = 10.1; print(intArray[0]); -var boolArray = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 2); +var boolArray = new (Java.type("boolean[]"))(2); boolArray[0] = true; print(boolArray[0]); print(boolArray[1]); print(boolArray.length); -var charArray = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 1); +var charArray = new (Java.type("char[]"))(1); charArray[0] = 'j'; print(charArray[0]); print(charArray.length); -var doubleArray = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 1) +var doubleArray = new (Java.type("double[]"))(1) doubleArray[0]=z print(doubleArray[0]) doubleArray[0]=1 diff --git a/nashorn/test/script/basic/runsunspider.js b/nashorn/test/script/basic/runsunspider.js index 149bd27bc81..84ce915c04f 100644 --- a/nashorn/test/script/basic/runsunspider.js +++ b/nashorn/test/script/basic/runsunspider.js @@ -1,21 +1,21 @@ /* * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. - * + * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). - * + * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * + * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. @@ -33,7 +33,7 @@ function assertEq(a, b) { if (a !== b) { - throw "ASSERTION FAILED: " + a + " should be " + b; + throw "ASSERTION FAILED: " + a + " should be " + b; } } @@ -44,19 +44,19 @@ var total_time = 0; function runbench(name) { var filename = name.split("/").pop(); if (verbose_run) { - print("Running " + filename); + print("Running " + filename); } var start = new Date; for (var i = 0; i < iterations__; i++) { - load(name); + load(name); } var stop = new Date - start; total_time += stop; - + if (verbose_run) { - print(filename + " done in " + stop + " ms"); - } + print(filename + " done in " + stop + " ms"); + } runs++; } @@ -73,27 +73,23 @@ function pseudorandom() { function runsuite(tests) { var changed = false; - + var oldRandom = Math.random; Math.random = pseudorandom; - + try { - for (var n = 0; n < tests.length; n++) { - runbench(tests[n].name); - if (typeof tests[n].actual !== 'undefined') { - assertEq(tests[n].actual(), tests[n].expected()); - } - changed = true; - } - } catch (e) { - print("error: " + e.printStackTrace()); - if (e.toString().indexOf(tests) == 1) { - throw e; - } - // no scripting or something, silently fail + for (var n = 0; n < tests.length; n++) { + path = dir + '../external/sunspider/tests/sunspider-1.0/' + tests[n].name + runbench(path); + if (typeof tests[n].actual !== 'undefined') { + assertEq(tests[n].actual(), tests[n].expected()); + } + changed = true; + } + // no scripting or something, silently fail } finally { - Math.random = oldRandom; } + Math.random = oldRandom; return changed; } @@ -103,211 +99,211 @@ function hash(str) { var h = 0; var off = 0; for (var i = 0; i < s.length; i++) { - h = 31 * h + s.charCodeAt(off++); - h &= 0x7fffffff; + h = 31 * h + s.charCodeAt(off++); + h &= 0x7fffffff; } return h ^ s.length; } var tests = [ { name: 'string-base64.js', - actual: function() { - return hash(str); + actual: function() { + return hash(str); }, expected: function() { - return 1544571068; + return 1544571068; } - }, + }, { name: 'string-validate-input.js', - actual: function() { - return hash(endResult); + actual: function() { + return hash(endResult); }, expected: function() { - return 2016572373; + return 2016572373; } - }, + }, { name: 'date-format-xparb.js', - actual: function() { - return shortFormat + longFormat; + actual: function() { + return shortFormat + longFormat; }, expected: function() { - return "2017-09-05Tuesday, September 05, 2017 8:43:48 AM"; + return "2017-09-05Tuesday, September 05, 2017 8:43:48 AM"; } - }, + }, { name: '3d-morph.js', actual: function() { - var acceptableDelta = 4e-15; - return (testOutput - 6.394884621840902e-14) < acceptableDelta; + var acceptableDelta = 4e-15; + return (testOutput - 6.394884621840902e-14) < acceptableDelta; }, expected: function() { - return true; + return true; } - }, + }, { name: 'crypto-aes.js', actual: function() { - return plainText; + return plainText; }, expected: function() { - return decryptedText; + return decryptedText; } - }, + }, { name: 'crypto-md5.js', actual: function() { - return md5Output; + return md5Output; }, expected: function() { - return "a831e91e0f70eddcb70dc61c6f82f6cd"; + return "a831e91e0f70eddcb70dc61c6f82f6cd"; } - }, + }, { name: 'crypto-sha1.js', actual: function() { - return sha1Output; + return sha1Output; }, expected: function() { - return "2524d264def74cce2498bf112bedf00e6c0b796d"; + return "2524d264def74cce2498bf112bedf00e6c0b796d"; } - }, - { name: 'bitops-bitwise-and.js', + }, + { name: 'bitops-bitwise-and.js', actual: function() { - return result; + return result; }, expected: function() { - return 0; + return 0; } - }, - { name: 'bitops-bits-in-byte.js', + }, + { name: 'bitops-bits-in-byte.js', actual: function() { - return result; + return result; }, expected: function() { - return 358400; + return 358400; } - }, - { name: 'bitops-nsieve-bits.js', + }, + { name: 'bitops-nsieve-bits.js', actual: function() { - var ret = 0; - for (var i = 0; i < result.length; ++i) { - ret += result[i]; - } - ret += result.length; - return ret; + var ret = 0; + for (var i = 0; i < result.length; ++i) { + ret += result[i]; + } + ret += result.length; + return ret; }, expected: function() { - return -1286749539853; + return -1286749539853; } - }, - { name: 'bitops-3bit-bits-in-byte.js', + }, + { name: 'bitops-3bit-bits-in-byte.js', actual: function() { - return sum; + return sum; }, expected: function() { - return 512000; + return 512000; } - }, - { name: 'access-nbody.js', + }, + { name: 'access-nbody.js', actual: function() { - return ret; + return ret; }, expected: function() { - return -0.16906933525822856; + return -1.3524862408537381; } - }, - { name: 'access-binary-trees.js', + }, + { name: 'access-binary-trees.js', actual: function() { - return ret; + return ret; }, expected: function() { - return -1; + return -4; } - }, + }, { name: 'access-fannkuch.js', actual: function() { - return ret; + return ret; }, expected: function() { - return 22; + return 22; } }, { name: 'math-spectral-norm.js', - actual: function() { - var ret = ''; - for (var i = 6; i <= 48; i *= 2) { - ret += spectralnorm(i) + ','; - } - return ret; + actual: function() { + var ret = ''; + for (var i = 6; i <= 48; i *= 2) { + ret += spectralnorm(i) + ','; + } + return ret; }, expected: function() { - return "1.2657786149754053,1.2727355112619148,1.273989979775574,1.274190125290389,"; + return "1.2657786149754053,1.2727355112619148,1.273989979775574,1.274190125290389,"; } - }, + }, { name: '3d-raytrace.js', actual: function() { - return hash(testOutput); + return hash(testOutput); }, expected: function() { - return 230692593; + return 230692593; } - }, + }, { name: 'regexp-dna.js', actual: function() { - return dnaOutputString; + return dnaOutputString; }, expected: function() { - return "undefinedagggtaaa|tttaccct 0\n[cgt]gggtaaa|tttaccc[acg] 9\na[act]ggtaaa|tttacc[agt]t 27\nag[act]gtaaa|tttac[agt]ct 24\nagg[act]taaa|ttta[agt]cct 30\naggg[acg]aaa|ttt[cgt]ccct 9\nagggt[cgt]aa|tt[acg]accct 12\nagggta[cgt]a|t[acg]taccct 9\nagggtaa[cgt]|[acg]ttaccct 15\n"; + return "agggtaaa|tttaccct 0\n[cgt]gggtaaa|tttaccc[acg] 9\na[act]ggtaaa|tttacc[agt]t 27\nag[act]gtaaa|tttac[agt]ct 24\nagg[act]taaa|ttta[agt]cct 30\naggg[acg]aaa|ttt[cgt]ccct 9\nagggt[cgt]aa|tt[acg]accct 12\nagggta[cgt]a|t[acg]taccct 9\nagggtaa[cgt]|[acg]ttaccct 15\n"; } - }, + }, { name: 'math-cordic.js', actual: function() { - return total; + return total; }, expected: function() { - return 10362.570468755888; + return 10362.570468755888; } }, { name: 'controlflow-recursive.js', actual: function() { - var ret = 0; - for (var i = 3; i <= 5; i++) { - ret += ack(3,i); - ret += fib(17.0+i); - ret += tak(3*i+3,2*i+2,i+1); - } - return ret; + var ret = 0; + for (var i = 3; i <= 5; i++) { + ret += ack(3,i); + ret += fib(17.0+i); + ret += tak(3*i+3,2*i+2,i+1); + } + return ret; }, expected: function() { - return 57775; + return 57775; } - }, + }, { name: 'date-format-tofte.js', actual: function() { - return shortFormat + longFormat; + return shortFormat + longFormat; }, expected: function() { - return "2008-05-01Thursday, May 01, 2008 6:31:22 PM"; + return "2008-05-01Thursday, May 01, 2008 6:31:22 PM"; } }, { name: 'string-tagcloud.js', actual: function() { - // The result string embeds floating-point numbers, which can vary a bit on different platforms, - // so we truncate them a bit before comparing. - var tagcloud_norm = tagcloud.replace(/([0-9.]+)px/g, function(str, p1) { return p1.substr(0, 10) + 'px' }) - return tagcloud_norm.length; + // The result string embeds floating-point numbers, which can vary a bit on different platforms, + // so we truncate them a bit before comparing. + var tagcloud_norm = tagcloud.replace(/([0-9.]+)px/g, function(str, p1) { return p1.substr(0, 10) + 'px' }) + return tagcloud_norm.length; }, expected: function() { - return 295906; + return 295906; } - }, + }, { name: 'string-unpack-code.js', actual: function() { - return decompressedMochiKit.length == 106415 && - decompressedMochiKit[2000] == '5' && - decompressedMochiKit[12000] == '_' && - decompressedMochiKit[82556] == '>'; + return decompressedMochiKit.length == 106415 && + decompressedMochiKit[2000] == '5' && + decompressedMochiKit[12000] == '_' && + decompressedMochiKit[82556] == '>'; }, expected: function() { - return true; + return true; } - }, + }, //TODO no easy way to sanity check result { name: 'string-fasta.js' }, //TODO no easy way to sanity check result @@ -315,17 +311,13 @@ var tests = [ //TODO no easy way to sanity check result { name: 'access-nsieve.js' }, //TODO no easy way to sanity check result - { name: '3d-cube.js' }, + { name: '3d-cube.js' }, ]; // handle the case this script may be run by a JS engine that doesn't // support __DIR__ global variable. var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__; -for (i in tests) { - tests[i].name = dir + '../external/sunspider/tests/sunspider-1.0/' + tests[i].name; -} - var verbose_run = false; var args = []; @@ -333,12 +325,12 @@ if (typeof $ARGS !== 'undefined') { args = $ARGS; } else if (typeof arguments !== 'undefined' && arguments.length != 0) { args = arguments; -} +} for (i in args) { if (args[i] === '--verbose') { - verbose_run = true; - break; + verbose_run = true; + break; } } diff --git a/nashorn/test/script/basic/splitter.js b/nashorn/test/script/basic/splitter.js new file mode 100644 index 00000000000..62f5ddf9e49 --- /dev/null +++ b/nashorn/test/script/basic/splitter.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Test various scripts with low splitter threshold + * + * @test + * @option -Dnashorn.compiler.splitter.threshold=200 + * @run + * @fork + */ + +load(__DIR__ + 'prototype.js'); +load(__DIR__ + 'yui.js'); +load(__DIR__ + 'NASHORN-689.js'); +load(__DIR__ + 'NASHORN-58.js'); diff --git a/nashorn/test/script/basic/splitter.js.EXPECTED b/nashorn/test/script/basic/splitter.js.EXPECTED new file mode 100644 index 00000000000..dafab972491 --- /dev/null +++ b/nashorn/test/script/basic/splitter.js.EXPECTED @@ -0,0 +1,76 @@ +parsed and compiled ok prototype.js +parsed and compiled ok yui-min.js +parsed and compiled ok yui.js +a=10 +a=9 +a=8 +a=7 +a=6 +a=5 +a=4 +a=3 +a=2 +a=1 +a=0 +10 +a=0 +a=1 +a=2 +a=3 +a=4 +a=5 +a=6 +a=7 +a=8 +a=9 +a=10 +ok +a=0 +a=1 +a=2 +a=3 +a=4 +a=5 +a=6 +a=7 +a=8 +a=9 +a=10 +done +no arg +x=0 +x=1 +x=2 +x=3 +x=4 +x=5 +x=6 +x=7 +x=8 +x=9 +x=10 +ok +done +try +finally +3 +try +finally +2 +3 +1 +2 +3 +4 +5 +5 +6 +6 +1 +2 +3 +4 +6 +Error: testing +finally +SUCCESS diff --git a/nashorn/test/script/representations/NASHORN-592a.js b/nashorn/test/script/representations/NASHORN-592a.js deleted file mode 100644 index dd75f62ee91..00000000000 --- a/nashorn/test/script/representations/NASHORN-592a.js +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * NASHORN-592a: test all combos of field types and getters and setters - * This time use dual field representation - * - * @test - * @option --dual-fields - * @run - */ - -//fortype undefined -var a; - -print(a & 0xff); -print(a >>> 1); -print(a * 2); -print(a + "hej!"); - -var b; -b = 17; //set undefined->int - -print(b & 0xff); -print(b >>> 1); -print(b * 2); -print(b + "hej!"); - -var c; -c = 17.4711 //set undefined->double - -print(c & 0xff); -print(c >>> 1); -print(c * 2); -print(c + "hej!"); - -var d; // set undefined->double -d = "Fame and fortune Salamander Yahoo!"; - -print(d & 0xff); -print(d >>> 1); -print(d * 2); -print(d + "hej!"); - -// now we have exhausted all getters and undefined->everything setters. - - -var e = 23; // int to everything setters, -e = 24; //int to int -print(e); -e = (22222 >>> 1); //int to long; -print(e); -e = 23.23; //int to double -print(e); -e = 23; //double to int - still double -print(e); -print(e & 0xff); -e = "Have some pie!" //double to string -print(e); -e = 4711.17; -print(e); //still an object not a double - - -var f = (23222 >>> 1); // long to everything setters, -f = 34344 >>> 1; //long to long -print(f); -f = 23; //long to int - still long -print(f); -f = 23.23; //long to double -print(f); -f = 23; //double to int - still double -print(f); -print(f & 0xff); -f = "Have some pie!" //double to string -print(f); -f = 4711.17; -print(f); //still an object not a double - -var g = 4811.16; -g = 23; //still double -print(g); -g = (222 >>> 1); //still double -print(g); -g = 4711.16; //double->double -print(g); -g = "I like cake!"; -print(g); //object to various -print(g & 0xff); -print(g * 2); -print(g >>> 2); -print(g); - -var h = {x:17, y:17.4711, z:"salamander"}; -print(h.x); -print(h.y); -print(h.z); -h.x = 4711.17; -h.y = "axolotl"; -h.z = "lizard"; -print(h.x); -print(h.y); -print(h.z); diff --git a/nashorn/test/script/sandbox/classloader.js.EXPECTED b/nashorn/test/script/sandbox/classloader.js.EXPECTED index e08cc9f8b40..356053d4e1d 100644 --- a/nashorn/test/script/sandbox/classloader.js.EXPECTED +++ b/nashorn/test/script/sandbox/classloader.js.EXPECTED @@ -1 +1 @@ -java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createClassLoader") +java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "nashorn.JavaReflection") diff --git a/nashorn/test/script/sandbox/nashorninternals.js b/nashorn/test/script/sandbox/nashorninternals.js index 35e8e757478..c68b6c8d16f 100644 --- a/nashorn/test/script/sandbox/nashorninternals.js +++ b/nashorn/test/script/sandbox/nashorninternals.js @@ -44,17 +44,25 @@ function checkClass(name) { // Not exhaustive - but a representative list of classes checkClass("jdk.nashorn.internal.codegen.Compiler"); -checkClass("jdk.nashorn.internal.codegen.objects.MapCreator"); checkClass("jdk.nashorn.internal.codegen.types.Type"); checkClass("jdk.nashorn.internal.ir.Node"); checkClass("jdk.nashorn.internal.ir.FunctionNode"); checkClass("jdk.nashorn.internal.ir.debug.JSONWriter"); checkClass("jdk.nashorn.internal.ir.visitor.NodeVisitor"); +checkClass("jdk.nashorn.internal.lookup.MethodHandleFactory"); +checkClass("jdk.nashorn.internal.objects.Global"); checkClass("jdk.nashorn.internal.parser.AbstractParser"); checkClass("jdk.nashorn.internal.parser.Parser"); checkClass("jdk.nashorn.internal.parser.JSONParser"); checkClass("jdk.nashorn.internal.parser.Lexer"); checkClass("jdk.nashorn.internal.parser.Scanner"); +checkClass("jdk.nashorn.internal.runtime.Context"); +checkClass("jdk.nashorn.internal.runtime.arrays.ArrayData"); +checkClass("jdk.nashorn.internal.runtime.linker.Bootstrap"); +checkClass("jdk.nashorn.internal.runtime.options.Option"); +checkClass("jdk.nashorn.internal.runtime.regexp.RegExp"); +checkClass("jdk.nashorn.internal.scripts.JO"); +checkClass("jdk.nashorn.tools.Shell"); checkClass("jdk.internal.dynalink.CallSiteDescriptor"); checkClass("jdk.internal.dynalink.beans.StaticClass"); checkClass("jdk.internal.dynalink.linker.LinkRequest"); diff --git a/nashorn/test/script/sandbox/reflection.js b/nashorn/test/script/sandbox/reflection.js index e892c646d44..4fdc58fdad8 100644 --- a/nashorn/test/script/sandbox/reflection.js +++ b/nashorn/test/script/sandbox/reflection.js @@ -35,9 +35,8 @@ function check(e) { } } -var cl = java.lang.Class.class; try { - cl.getDeclaredMethods(); + var cl = java.lang.Class.class; } catch(e) { check(e); } diff --git a/nashorn/test/script/trusted/JDK-8006529.js b/nashorn/test/script/trusted/JDK-8006529.js index a4968e6e5f7..8eb839097e3 100644 --- a/nashorn/test/script/trusted/JDK-8006529.js +++ b/nashorn/test/script/trusted/JDK-8006529.js @@ -39,19 +39,21 @@ * and FunctionNode because of package-access check and so reflective calls. */ -var Parser = Java.type("jdk.nashorn.internal.parser.Parser") -var Compiler = Java.type("jdk.nashorn.internal.codegen.Compiler") -var Context = Java.type("jdk.nashorn.internal.runtime.Context") -var ScriptEnvironment = Java.type("jdk.nashorn.internal.runtime.ScriptEnvironment") -var Source = Java.type("jdk.nashorn.internal.runtime.Source") -var FunctionNode = Java.type("jdk.nashorn.internal.ir.FunctionNode") -var Block = Java.type("jdk.nashorn.internal.ir.Block") -var VarNode = Java.type("jdk.nashorn.internal.ir.VarNode") -var ExpressionStatement = Java.type("jdk.nashorn.internal.ir.ExpressionStatement") -var UnaryNode = Java.type("jdk.nashorn.internal.ir.UnaryNode") -var BinaryNode = Java.type("jdk.nashorn.internal.ir.BinaryNode") -var ThrowErrorManager = Java.type("jdk.nashorn.internal.runtime.Context$ThrowErrorManager") -var Debug = Java.type("jdk.nashorn.internal.runtime.Debug") +var forName = java.lang.Class["forName(String)"]; +var Parser = forName("jdk.nashorn.internal.parser.Parser").static +var Compiler = forName("jdk.nashorn.internal.codegen.Compiler").static +var Context = forName("jdk.nashorn.internal.runtime.Context").static +var ScriptEnvironment = forName("jdk.nashorn.internal.runtime.ScriptEnvironment").static +var Source = forName("jdk.nashorn.internal.runtime.Source").static +var FunctionNode = forName("jdk.nashorn.internal.ir.FunctionNode").static +var Block = forName("jdk.nashorn.internal.ir.Block").static +var VarNode = forName("jdk.nashorn.internal.ir.VarNode").static +var ExpressionStatement = forName("jdk.nashorn.internal.ir.ExpressionStatement").static +var UnaryNode = forName("jdk.nashorn.internal.ir.UnaryNode").static +var BinaryNode = forName("jdk.nashorn.internal.ir.BinaryNode").static +var ThrowErrorManager = forName("jdk.nashorn.internal.runtime.Context$ThrowErrorManager").static +var ErrorManager = forName("jdk.nashorn.internal.runtime.ErrorManager").static +var Debug = forName("jdk.nashorn.internal.runtime.Debug").static var parseMethod = Parser.class.getMethod("parse"); var compileMethod = Compiler.class.getMethod("compile", FunctionNode.class); @@ -111,18 +113,22 @@ function findFunction(node) { var getContextMethod = Context.class.getMethod("getContext") var getEnvMethod = Context.class.getMethod("getEnv") +var SourceConstructor = Source.class.getConstructor(java.lang.String.class, java.lang.String.class) +var ParserConstructor = Parser.class.getConstructor(ScriptEnvironment.class, Source.class, ErrorManager.class) +var CompilerConstructor = Compiler.class.getConstructor(ScriptEnvironment.class) + // compile(script) -- compiles a script specified as a string with its // source code, returns a jdk.nashorn.internal.ir.FunctionNode object // representing it. function compile(source) { - var source = new Source("", source); + var source = SourceConstructor.newInstance("", source); var env = getEnvMethod.invoke(getContextMethod.invoke(null)) - var parser = new Parser(env, source, new ThrowErrorManager()); + var parser = ParserConstructor.newInstance(env, source, ThrowErrorManager.class.newInstance()); var func = parseMethod.invoke(parser); - var compiler = new Compiler(env); + var compiler = CompilerConstructor.newInstance(env); return compileMethod.invoke(compiler, func); }; diff --git a/nashorn/test/script/trusted/JDK-8020809.js b/nashorn/test/script/trusted/JDK-8020809.js new file mode 100644 index 00000000000..6e0296c693c --- /dev/null +++ b/nashorn/test/script/trusted/JDK-8020809.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8020809: Java adapter should not allow overriding of caller sensitive methods + * + * @test + * @run + */ + +// This test runs as trusted as we need the +// "enableContextClassLoaderOverride" runtime permission. + +var T = Java.extend(java.lang.Thread, { + getContextClassLoader: function() { + // Since getContextClassLoader is caller sensitive, this won't + // actually act as an override; it will be ignored. If we could + // invoke it, it would be an error. + throw new Error() + } +}) + +// Retrieve the context ClassLoader on our Thread adapter, ensure the +// method was not, in fact, overridden. +var cl = (new T()).contextClassLoader + +print("cl is class loader: " + (cl instanceof java.lang.ClassLoader)) diff --git a/nashorn/test/script/trusted/JDK-8020809.js.EXPECTED b/nashorn/test/script/trusted/JDK-8020809.js.EXPECTED new file mode 100644 index 00000000000..e787d7ae5c6 --- /dev/null +++ b/nashorn/test/script/trusted/JDK-8020809.js.EXPECTED @@ -0,0 +1 @@ +cl is class loader: true diff --git a/nashorn/test/script/trusted/JDK-8021129.js b/nashorn/test/script/trusted/JDK-8021129.js new file mode 100644 index 00000000000..93bf12ab69b --- /dev/null +++ b/nashorn/test/script/trusted/JDK-8021129.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8021129: Test prevention of access to members of restricted classes. + * Note that even though the script runs as trusted, we still don't allow + * access to non-public portions of restricted classes. + * + * @test + * @run + */ + +var InternalRunnableSuperclass = Java.type("jdk.nashorn.test.models.InternalRunnableSuperclass"); +var r1 = InternalRunnableSuperclass.makeInternalRunnable(); +r1.run() // Can execute method from an implemented non-restricted interface +print(r1.toString()) // Can execute public method from a superclass + +print(r1.restrictedRun === undefined) // Can't see method from a restricted interface +print(r1.canNotInvokeThis === undefined) // Can't see any other public methods +print(r1.invisibleProperty === undefined) // Can't see any other properties +print(r1.canSeeThisField === undefined) // Can't see fields from superclasses +print(r1.canNotSeeThisField === undefined) // Can't see its own fields + +var r2 = new InternalRunnableSuperclass(); +print(r2.canSeeThisField) // Superclass field works fine on its own diff --git a/nashorn/test/script/trusted/JDK-8021129.js.EXPECTED b/nashorn/test/script/trusted/JDK-8021129.js.EXPECTED new file mode 100644 index 00000000000..df7879339e5 --- /dev/null +++ b/nashorn/test/script/trusted/JDK-8021129.js.EXPECTED @@ -0,0 +1,9 @@ +InternalRunnable.run() executed! +InternalRunnable.toString() executed! + +true +true +true +true +true +19 diff --git a/nashorn/test/script/trusted/JDK-8021189.js b/nashorn/test/script/trusted/JDK-8021189.js new file mode 100644 index 00000000000..528a21b69d7 --- /dev/null +++ b/nashorn/test/script/trusted/JDK-8021189.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8021189: Prevent access to constructors of restricted classes + * + * @test + * @run + */ +var InternalRunnableSuperclass = Java.type("jdk.nashorn.test.models.InternalRunnableSuperclass"); +try { + new (InternalRunnableSuperclass.getInternalRunnableType())(); +} catch(e) { + print(e) +} diff --git a/nashorn/test/script/trusted/JDK-8021189.js.EXPECTED b/nashorn/test/script/trusted/JDK-8021189.js.EXPECTED new file mode 100644 index 00000000000..846a562c822 --- /dev/null +++ b/nashorn/test/script/trusted/JDK-8021189.js.EXPECTED @@ -0,0 +1 @@ +java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.jdk.nashorn.internal.test.models") diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java index b6e5bbcddc9..030bb1e522c 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java @@ -72,7 +72,7 @@ public class BooleanAccessTest { e.eval("var p_boolean_array = o.publicBooleanArray;"); assertEquals(o.publicBooleanArray[0], e.eval("o.publicBooleanArray[0]")); assertTrue(Arrays.equals(o.publicBooleanArray, (boolean[])e.get("p_boolean_array"))); - e.eval("var t_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" + + e.eval("var t_boolean_arr = new (Java.type(\"boolean[]\"))(3);" + "t_boolean_arr[0] = true;" + "t_boolean_arr[1] = false;" + "t_boolean_arr[2] = false;" + @@ -96,7 +96,7 @@ public class BooleanAccessTest { e.eval("var ps_boolean_array = SharedObject.publicStaticBooleanArray;"); assertEquals(SharedObject.publicStaticBooleanArray[0], e.eval("SharedObject.publicStaticBooleanArray[0]")); assertTrue(Arrays.equals(SharedObject.publicStaticBooleanArray, (boolean[])e.get("ps_boolean_array"))); - e.eval("var ts_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" + + e.eval("var ts_boolean_arr = new (Java.type(\"boolean[]\"))(3);" + "ts_boolean_arr[0] = true;" + "ts_boolean_arr[1] = false;" + "ts_boolean_arr[2] = true;" + @@ -120,7 +120,7 @@ public class BooleanAccessTest { e.eval("var pf_boolean_array = o.publicFinalBooleanArray;"); assertEquals(o.publicFinalBooleanArray[0], e.eval("o.publicFinalBooleanArray[0]")); assertTrue(Arrays.equals(o.publicFinalBooleanArray, (boolean[])e.get("pf_boolean_array"))); - e.eval("var tf_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" + + e.eval("var tf_boolean_arr = new (Java.type(\"boolean[]\"))(3);" + "tf_boolean_arr[0] = false;" + "tf_boolean_arr[1] = false;" + "tf_boolean_arr[2] = true;" + @@ -144,7 +144,7 @@ public class BooleanAccessTest { e.eval("var psf_boolean_array = SharedObject.publicStaticFinalBooleanArray;"); assertEquals(SharedObject.publicStaticFinalBooleanArray[0], e.eval("SharedObject.publicStaticFinalBooleanArray[0]")); assertTrue(Arrays.equals(SharedObject.publicStaticFinalBooleanArray, (boolean[])e.get("psf_boolean_array"))); - e.eval("var tsf_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" + + e.eval("var tsf_boolean_arr = new (Java.type(\"boolean[]\"))(3);" + "tsf_boolean_arr[0] = false;" + "tsf_boolean_arr[1] = true;" + "tsf_boolean_arr[2] = false;" + diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java index 0b7cb027b61..49f193e91bc 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java @@ -73,7 +73,7 @@ public class NumberAccessTest { e.eval("var p_long_array = o.publicLongArray;"); assertEquals(o.publicLongArray[0], e.eval("o.publicLongArray[0];")); assertArrayEquals(o.publicLongArray, (long[])e.get("p_long_array")); - e.eval("var t_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" + + e.eval("var t_long_arr = new (Java.type(\"long[]\"))(3);" + "t_long_arr[0] = -189009;" + "t_long_arr[1] = 456;" + "t_long_arr[2] = 600000001;" + @@ -97,7 +97,7 @@ public class NumberAccessTest { e.eval("var ps_long_array = SharedObject.publicStaticLongArray;"); assertEquals(SharedObject.publicStaticLongArray[0], e.eval("SharedObject.publicStaticLongArray[0];")); assertArrayEquals(SharedObject.publicStaticLongArray, (long[])e.get("ps_long_array")); - e.eval("var ts_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" + + e.eval("var ts_long_arr = new (Java.type(\"long[]\"))(3);" + "ts_long_arr[0] = -189009;" + "ts_long_arr[1] = 456;" + "ts_long_arr[2] = 600000001;" + @@ -121,7 +121,7 @@ public class NumberAccessTest { e.eval("var pf_long_array = o.publicFinalLongArray;"); assertEquals(o.publicFinalLongArray[0], e.eval("o.publicFinalLongArray[0];")); assertArrayEquals(o.publicFinalLongArray, (long[])e.get("pf_long_array")); - e.eval("var tf_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" + + e.eval("var tf_long_arr = new (Java.type(\"long[]\"))(3);" + "tf_long_arr[0] = -189009;" + "tf_long_arr[1] = 456;" + "tf_long_arr[2] = 600000001;" + @@ -145,7 +145,7 @@ public class NumberAccessTest { e.eval("var psf_long_array = SharedObject.publicStaticFinalLongArray;"); assertEquals(SharedObject.publicStaticFinalLongArray[0], e.eval("SharedObject.publicStaticFinalLongArray[0];")); assertArrayEquals(SharedObject.publicStaticFinalLongArray, (long[])e.get("psf_long_array")); - e.eval("var tsf_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" + + e.eval("var tsf_long_arr = new (Java.type(\"long[]\"))(3);" + "tsf_long_arr[0] = -189009;" + "tsf_long_arr[1] = 456;" + "tsf_long_arr[2] = 600000001;" + @@ -171,7 +171,7 @@ public class NumberAccessTest { e.eval("var p_int_array = o.publicIntArray;"); assertEquals(o.publicIntArray[0], e.eval("o.publicIntArray[0];")); assertArrayEquals(o.publicIntArray, (int[])e.get("p_int_array")); - e.eval("var t_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" + + e.eval("var t_int_arr = new (Java.type(\"int[]\"))(3);" + "t_int_arr[0] = 4;" + "t_int_arr[1] = 5;" + "t_int_arr[2] = 6;" + @@ -194,7 +194,7 @@ public class NumberAccessTest { e.eval("var ps_int_array = SharedObject.publicStaticIntArray;"); assertEquals(SharedObject.publicStaticIntArray[0], e.eval("SharedObject.publicStaticIntArray[0];")); assertArrayEquals(SharedObject.publicStaticIntArray, (int[])e.get("ps_int_array")); - e.eval("var ts_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" + + e.eval("var ts_int_arr = new (Java.type(\"int[]\"))(3);" + "ts_int_arr[0] = 4;" + "ts_int_arr[1] = 5;" + "ts_int_arr[2] = 6;" + @@ -218,7 +218,7 @@ public class NumberAccessTest { e.eval("var pf_int_array = o.publicFinalIntArray;"); assertEquals(o.publicFinalIntArray[0], e.eval("o.publicFinalIntArray[0];")); assertArrayEquals(o.publicFinalIntArray, (int[])e.get("pf_int_array")); - e.eval("var tf_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" + + e.eval("var tf_int_arr = new (Java.type(\"int[]\"))(3);" + "tf_int_arr[0] = 4;" + "tf_int_arr[1] = 5;" + "tf_int_arr[2] = 6;" + @@ -241,7 +241,7 @@ public class NumberAccessTest { e.eval("var psf_int_array = SharedObject.publicStaticFinalIntArray;"); assertEquals(SharedObject.publicStaticFinalIntArray[0], e.eval("SharedObject.publicStaticFinalIntArray[0];")); assertArrayEquals(SharedObject.publicStaticFinalIntArray, (int[])e.get("psf_int_array")); - e.eval("var tsf_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" + + e.eval("var tsf_int_arr = new (Java.type(\"int[]\"))(3);" + "tsf_int_arr[0] = 4;" + "tsf_int_arr[1] = 5;" + "tsf_int_arr[2] = 6;" + @@ -266,7 +266,7 @@ public class NumberAccessTest { e.eval("var p_byte_array = o.publicByteArray;"); assertEquals(o.publicByteArray[0], e.eval("o.publicByteArray[0];")); assertArrayEquals(o.publicByteArray, (byte[])e.get("p_byte_array")); - e.eval("var t_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" + + e.eval("var t_byte_arr = new (Java.type(\"byte[]\"))(3);" + "t_byte_arr[0] = -18;" + "t_byte_arr[1] = 56;" + "t_byte_arr[2] = 60;" + @@ -289,7 +289,7 @@ public class NumberAccessTest { e.eval("var ps_byte_array = SharedObject.publicStaticByteArray;"); assertEquals(SharedObject.publicStaticByteArray[0], e.eval("SharedObject.publicStaticByteArray[0];")); assertArrayEquals(SharedObject.publicStaticByteArray, (byte[])e.get("ps_byte_array")); - e.eval("var ts_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" + + e.eval("var ts_byte_arr = new (Java.type(\"byte[]\"))(3);" + "ts_byte_arr[0] = -18;" + "ts_byte_arr[1] = 56;" + "ts_byte_arr[2] = 60;" + @@ -312,7 +312,7 @@ public class NumberAccessTest { e.eval("var pf_byte_array = o.publicFinalByteArray;"); assertEquals(o.publicFinalByteArray[0], e.eval("o.publicFinalByteArray[0];")); assertArrayEquals(o.publicFinalByteArray, (byte[])e.get("pf_byte_array")); - e.eval("var tf_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" + + e.eval("var tf_byte_arr = new (Java.type(\"byte[]\"))(3);" + "tf_byte_arr[0] = -18;" + "tf_byte_arr[1] = 56;" + "tf_byte_arr[2] = 60;" + @@ -335,7 +335,7 @@ public class NumberAccessTest { e.eval("var psf_byte_array = SharedObject.publicStaticFinalByteArray;"); assertEquals(SharedObject.publicStaticFinalByteArray[0], e.eval("SharedObject.publicStaticFinalByteArray[0];")); assertArrayEquals(SharedObject.publicStaticFinalByteArray, (byte[])e.get("psf_byte_array")); - e.eval("var tsf_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" + + e.eval("var tsf_byte_arr = new (Java.type(\"byte[]\"))(3);" + "tsf_byte_arr[0] = -18;" + "tsf_byte_arr[1] = 56;" + "tsf_byte_arr[2] = 60;" + @@ -360,7 +360,7 @@ public class NumberAccessTest { e.eval("var p_short_array = o.publicShortArray;"); assertEquals(o.publicShortArray[0], e.eval("o.publicShortArray[0];")); assertArrayEquals(o.publicShortArray, (short[])e.get("p_short_array")); - e.eval("var t_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" + + e.eval("var t_short_arr = new (Java.type(\"short[]\"))(3);" + "t_short_arr[0] = 90;" + "t_short_arr[1] = 5;" + "t_short_arr[2] = -6000;" + @@ -383,7 +383,7 @@ public class NumberAccessTest { e.eval("var ps_short_array = SharedObject.publicStaticShortArray;"); assertEquals(SharedObject.publicStaticShortArray[0], e.eval("SharedObject.publicStaticShortArray[0];")); assertArrayEquals(SharedObject.publicStaticShortArray, (short[])e.get("ps_short_array")); - e.eval("var ts_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" + + e.eval("var ts_short_arr = new (Java.type(\"short[]\"))(3);" + "ts_short_arr[0] = 90;" + "ts_short_arr[1] = 5;" + "ts_short_arr[2] = -6000;" + @@ -406,7 +406,7 @@ public class NumberAccessTest { e.eval("var pf_short_array = o.publicFinalShortArray;"); assertEquals(o.publicFinalShortArray[0], e.eval("o.publicFinalShortArray[0];")); assertArrayEquals(o.publicFinalShortArray, (short[])e.get("pf_short_array")); - e.eval("var tf_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" + + e.eval("var tf_short_arr = new (Java.type(\"short[]\"))(3);" + "tf_short_arr[0] = 90;" + "tf_short_arr[1] = 5;" + "tf_short_arr[2] = -6000;" + @@ -429,7 +429,7 @@ public class NumberAccessTest { e.eval("var psf_short_array = SharedObject.publicStaticFinalShortArray;"); assertEquals(SharedObject.publicStaticFinalShortArray[0], e.eval("SharedObject.publicStaticFinalShortArray[0];")); assertArrayEquals(SharedObject.publicStaticFinalShortArray, (short[])e.get("psf_short_array")); - e.eval("var tsf_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" + + e.eval("var tsf_short_arr = new (Java.type(\"short[]\"))(3);" + "tsf_short_arr[0] = 90;" + "tsf_short_arr[1] = 5;" + "tsf_short_arr[2] = -6000;" + @@ -463,7 +463,7 @@ public class NumberAccessTest { e.eval("var p_char_array = o.publicCharArray;"); assertEquals(o.publicCharArray[0], e.eval("o.publicCharArray[0];")); assertArrayEquals(o.publicCharArray, (char[])e.get("p_char_array")); - e.eval("var t_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" + + e.eval("var t_char_arr = new (Java.type(\"char[]\"))(3);" + "t_char_arr[0] = 'F';" + "t_char_arr[1] = 'o';" + "t_char_arr[2] = 'o';" + @@ -486,7 +486,7 @@ public class NumberAccessTest { e.eval("var ps_char_array = SharedObject.publicStaticCharArray;"); assertEquals(SharedObject.publicStaticCharArray[0], e.eval("SharedObject.publicStaticCharArray[0];")); assertArrayEquals(SharedObject.publicStaticCharArray, (char[])e.get("ps_char_array")); - e.eval("var ts_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" + + e.eval("var ts_char_arr = new (Java.type(\"char[]\"))(3);" + "ts_char_arr[0] = 'G';" + "ts_char_arr[1] = 'o';" + "ts_char_arr[2] = 'o';" + @@ -509,7 +509,7 @@ public class NumberAccessTest { e.eval("var pf_char_array = o.publicFinalCharArray;"); assertEquals(o.publicFinalCharArray[0], e.eval("o.publicFinalCharArray[0];")); assertArrayEquals(o.publicFinalCharArray, (char[])e.get("pf_char_array")); - e.eval("var tf_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" + + e.eval("var tf_char_arr = new (Java.type(\"char[]\"))(3);" + "tf_char_arr[0] = 'F';" + "tf_char_arr[1] = 'o';" + "tf_char_arr[2] = 'o';" + @@ -532,7 +532,7 @@ public class NumberAccessTest { e.eval("var psf_char_array = SharedObject.publicStaticFinalCharArray;"); assertEquals(SharedObject.publicStaticFinalCharArray[0], e.eval("SharedObject.publicStaticFinalCharArray[0];")); assertArrayEquals(SharedObject.publicStaticFinalCharArray, (char[])e.get("psf_char_array")); - e.eval("var tsf_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" + + e.eval("var tsf_char_arr = new (Java.type(\"char[]\"))(3);" + "tsf_char_arr[0] = 'Z';" + "tsf_char_arr[1] = 'o';" + "tsf_char_arr[2] = 'o';" + @@ -569,7 +569,7 @@ public class NumberAccessTest { e.eval("var p_float_array = o.publicFloatArray;"); assertEquals(o.publicFloatArray[0], e.eval("o.publicFloatArray[0];")); assertArrayEquals(o.publicFloatArray, (float[])e.get("p_float_array"), 1e-10f); - e.eval("var t_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" + + e.eval("var t_float_arr = new (Java.type(\"float[]\"))(3);" + "t_float_arr[0] = 9.0;" + "t_float_arr[1] = 5.12345;" + "t_float_arr[2] = -60.03;" + @@ -604,7 +604,7 @@ public class NumberAccessTest { e.eval("var ps_float_array = SharedObject.publicStaticFloatArray;"); assertEquals(SharedObject.publicStaticFloatArray[0], e.eval("SharedObject.publicStaticFloatArray[0];")); assertArrayEquals(SharedObject.publicStaticFloatArray, (float[])e.get("ps_float_array"), 1e-10f); - e.eval("var ts_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" + + e.eval("var ts_float_arr = new (Java.type(\"float[]\"))(3);" + "ts_float_arr[0] = 9.0;" + "ts_float_arr[1] = 5.12345;" + "ts_float_arr[2] = -60.03;" + @@ -627,7 +627,7 @@ public class NumberAccessTest { e.eval("var pf_float_array = o.publicFinalFloatArray;"); assertEquals(o.publicFinalFloatArray[0], e.eval("o.publicFinalFloatArray[0];")); assertArrayEquals(o.publicFinalFloatArray, (float[])e.get("pf_float_array"), 1e-10f); - e.eval("var tf_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" + + e.eval("var tf_float_arr = new (Java.type(\"float[]\"))(3);" + "tf_float_arr[0] = 9.0;" + "tf_float_arr[1] = 5.12345;" + "tf_float_arr[2] = -60.03;" + @@ -650,7 +650,7 @@ public class NumberAccessTest { e.eval("var psf_float_array = SharedObject.publicStaticFinalFloatArray;"); assertEquals(SharedObject.publicStaticFinalFloatArray[0], e.eval("SharedObject.publicStaticFinalFloatArray[0];")); assertArrayEquals(SharedObject.publicStaticFinalFloatArray, (float[])e.get("psf_float_array"), 1e-10f); - e.eval("var tsf_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" + + e.eval("var tsf_float_arr = new (Java.type(\"float[]\"))(3);" + "tsf_float_arr[0] = 9.0;" + "tsf_float_arr[1] = 5.12345;" + "tsf_float_arr[2] = -60.03;" + @@ -687,7 +687,7 @@ public class NumberAccessTest { e.eval("var p_double_array = o.publicDoubleArray;"); assertEquals(o.publicDoubleArray[0], e.eval("o.publicDoubleArray[0];")); assertArrayEquals(o.publicDoubleArray, (double[])e.get("p_double_array"), 1e-10); - e.eval("var t_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" + + e.eval("var t_double_arr = new (Java.type(\"double[]\"))(3);" + "t_double_arr[0] = 9e10;" + "t_double_arr[1] = 0.677777;" + "t_double_arr[2] = -0.0000001;" + @@ -722,7 +722,7 @@ public class NumberAccessTest { e.eval("var ps_double_array = SharedObject.publicStaticDoubleArray;"); assertEquals(SharedObject.publicStaticDoubleArray[0], e.eval("SharedObject.publicStaticDoubleArray[0];")); assertArrayEquals(SharedObject.publicStaticDoubleArray, (double[])e.get("ps_double_array"), 1e-10); - e.eval("var ts_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" + + e.eval("var ts_double_arr = new (Java.type(\"double[]\"))(3);" + "ts_double_arr[0] = 9e10;" + "ts_double_arr[1] = 0.677777;" + "ts_double_arr[2] = -0.0000001;" + @@ -745,7 +745,7 @@ public class NumberAccessTest { e.eval("var pf_double_array = o.publicFinalDoubleArray;"); assertEquals(o.publicFinalDoubleArray[0], e.eval("o.publicFinalDoubleArray[0];")); assertArrayEquals(o.publicFinalDoubleArray, (double[])e.get("pf_double_array"), 1e-10); - e.eval("var tf_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" + + e.eval("var tf_double_arr = new (Java.type(\"double[]\"))(3);" + "tf_double_arr[0] = 9e10;" + "tf_double_arr[1] = 0.677777;" + "tf_double_arr[2] = -0.0000001;" + @@ -768,7 +768,7 @@ public class NumberAccessTest { e.eval("var psf_double_array = SharedObject.publicStaticFinalDoubleArray;"); assertEquals(SharedObject.publicStaticFinalDoubleArray[0], e.eval("SharedObject.publicStaticFinalDoubleArray[0];")); assertArrayEquals(SharedObject.publicStaticFinalDoubleArray, (double[])e.get("psf_double_array"), 1e-10); - e.eval("var tsf_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" + + e.eval("var tsf_double_arr = new (Java.type(\"double[]\"))(3);" + "tsf_double_arr[0] = 9e10;" + "tsf_double_arr[1] = 0.677777;" + "tsf_double_arr[2] = -0.0000001;" + diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java index 2a51e7a9ce1..de0fd8ee152 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java @@ -72,7 +72,7 @@ public class ObjectAccessTest { e.eval("var p_object_array = o.publicObjectArray;"); assertEquals(o.publicObjectArray[0], e.eval("o.publicObjectArray[0]")); assertArrayEquals(o.publicObjectArray, (Object[])e.get("p_object_array")); - e.eval("var t_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" + + e.eval("var t_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" + "t_object_arr[0] = new Person(100);" + "t_object_arr[1] = new Person(120);" + "t_object_arr[2] = new Person(140);" + @@ -96,7 +96,7 @@ public class ObjectAccessTest { e.eval("var ps_object_array = SharedObject.publicStaticObjectArray;"); assertEquals(SharedObject.publicStaticObjectArray[0], e.eval("SharedObject.publicStaticObjectArray[0]")); assertArrayEquals(SharedObject.publicStaticObjectArray, (Object[])e.get("ps_object_array")); - e.eval("var ts_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" + + e.eval("var ts_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" + "ts_object_arr[0] = new Person(100);" + "ts_object_arr[1] = new Person(120);" + "ts_object_arr[2] = new Person(140);" + @@ -120,7 +120,7 @@ public class ObjectAccessTest { e.eval("var pf_object_array = o.publicFinalObjectArray;"); assertEquals(o.publicFinalObjectArray[0], e.eval("o.publicFinalObjectArray[0]")); assertArrayEquals(o.publicFinalObjectArray, (Object[])e.get("pf_object_array")); - e.eval("var tf_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" + + e.eval("var tf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" + "tf_object_arr[0] = new Person(100);" + "tf_object_arr[1] = new Person(120);" + "tf_object_arr[2] = new Person(140);" + @@ -144,7 +144,7 @@ public class ObjectAccessTest { e.eval("var psf_object_array = SharedObject.publicStaticFinalObjectArray;"); assertEquals(SharedObject.publicStaticFinalObjectArray[0], e.eval("SharedObject.publicStaticFinalObjectArray[0]")); assertArrayEquals(SharedObject.publicStaticFinalObjectArray, (Object[])e.get("psf_object_array")); - e.eval("var tsf_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" + + e.eval("var tsf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" + "tsf_object_arr[0] = new Person(100);" + "tsf_object_arr[1] = new Person(120);" + "tsf_object_arr[2] = new Person(140);" + diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java index dd4b5020787..55624360824 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java @@ -71,7 +71,7 @@ public class StringAccessTest { e.eval("var p_string_array = o.publicStringArray;"); assertEquals(o.publicStringArray[0], e.eval("o.publicStringArray[0]")); assertArrayEquals(o.publicStringArray, (String[])e.get("p_string_array")); - e.eval("var t_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" + + e.eval("var t_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" + "t_string_arr[0] = 'abc';" + "t_string_arr[1] = '123';" + "t_string_arr[2] = 'xyzzzz';" + @@ -95,7 +95,7 @@ public class StringAccessTest { e.eval("var ps_string_array = SharedObject.publicStaticStringArray;"); assertEquals(SharedObject.publicStaticStringArray[0], e.eval("SharedObject.publicStaticStringArray[0]")); assertArrayEquals(SharedObject.publicStaticStringArray, (String[])e.get("ps_string_array")); - e.eval("var ts_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" + + e.eval("var ts_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" + "ts_string_arr[0] = 'abc';" + "ts_string_arr[1] = '123';" + "ts_string_arr[2] = 'xyzzzz';" + @@ -119,7 +119,7 @@ public class StringAccessTest { e.eval("var pf_string_array = o.publicFinalStringArray;"); assertEquals(o.publicFinalStringArray[0], e.eval("o.publicFinalStringArray[0]")); assertArrayEquals(o.publicFinalStringArray, (String[])e.get("pf_string_array")); - e.eval("var tf_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" + + e.eval("var tf_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" + "tf_string_arr[0] = 'abc';" + "tf_string_arr[1] = '123';" + "tf_string_arr[2] = 'xyzzzz';" + @@ -143,7 +143,7 @@ public class StringAccessTest { e.eval("var psf_string_array = SharedObject.publicStaticFinalStringArray;"); assertEquals(SharedObject.publicStaticFinalStringArray[0], e.eval("SharedObject.publicStaticFinalStringArray[0]")); assertArrayEquals(SharedObject.publicStaticFinalStringArray, (String[])e.get("psf_string_array")); - e.eval("var tsf_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" + + e.eval("var tsf_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" + "tsf_string_arr[0] = 'abc';" + "tsf_string_arr[1] = '123';" + "tsf_string_arr[2] = 'xyzzzz';" + diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java index 64ab25b2f55..53ca43a6f32 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java @@ -362,6 +362,90 @@ public class ScriptEngineTest { } } + @Test + /** + * Check that we can get interface out of a script object even after + * switching to use different ScriptContext. + */ + public void getInterfaceDifferentContext() { + ScriptEngineManager m = new ScriptEngineManager(); + ScriptEngine e = m.getEngineByName("nashorn"); + try { + Object obj = e.eval("({ run: function() { } })"); + + // change script context + ScriptContext ctxt = new SimpleScriptContext(); + ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE); + e.setContext(ctxt); + + Runnable r = ((Invocable)e).getInterface(obj, Runnable.class); + r.run(); + }catch (final Exception exp) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + + @Test + /** + * Check that getInterface on non-script object 'thiz' results in IllegalArgumentException. + */ + public void getInterfaceNonScriptObjectThizTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + + try { + ((Invocable)e).getInterface(new Object(), Runnable.class); + fail("should have thrown IllegalArgumentException"); + } catch (final Exception exp) { + if (! (exp instanceof IllegalArgumentException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + + @Test + /** + * Check that getInterface on null 'thiz' results in IllegalArgumentException. + */ + public void getInterfaceNullThizTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + + try { + ((Invocable)e).getInterface(null, Runnable.class); + fail("should have thrown IllegalArgumentException"); + } catch (final Exception exp) { + if (! (exp instanceof IllegalArgumentException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + + @Test + /** + * Check that calling getInterface on mirror created by another engine results in IllegalArgumentException. + */ + public void getInterfaceMixEnginesTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine engine1 = m.getEngineByName("nashorn"); + final ScriptEngine engine2 = m.getEngineByName("nashorn"); + + try { + Object obj = engine1.eval("({ run: function() {} })"); + // pass object from engine1 to engine2 as 'thiz' for getInterface + ((Invocable)engine2).getInterface(obj, Runnable.class); + fail("should have thrown IllegalArgumentException"); + } catch (final Exception exp) { + if (! (exp instanceof IllegalArgumentException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + @Test public void accessGlobalTest() { final ScriptEngineManager m = new ScriptEngineManager(); @@ -648,6 +732,133 @@ public class ScriptEngineTest { } } + @Test + /** + * Check that we can call invokeMethod on an object that we got by evaluating + * script with different Context set. + */ + public void invokeMethodDifferentContextTest() { + ScriptEngineManager m = new ScriptEngineManager(); + ScriptEngine e = m.getEngineByName("nashorn"); + + try { + // define an object with method on it + Object obj = e.eval("({ hello: function() { return 'Hello World!'; } })"); + + final ScriptContext ctxt = new SimpleScriptContext(); + ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE); + e.setContext(ctxt); + + // invoke 'func' on obj - but with current script context changed + final Object res = ((Invocable)e).invokeMethod(obj, "hello"); + assertEquals(res, "Hello World!"); + } catch (final Exception exp) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + + @Test + /** + * Check that invokeMethod throws NPE on null method name. + */ + public void invokeMethodNullNameTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + + try { + final Object obj = e.eval("({})"); + final Object res = ((Invocable)e).invokeMethod(obj, null); + fail("should have thrown NPE"); + } catch (final Exception exp) { + if (! (exp instanceof NullPointerException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + + @Test + /** + * Check that invokeMethod throws NoSuchMethodException on missing method. + */ + public void invokeMethodMissingTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + + try { + final Object obj = e.eval("({})"); + final Object res = ((Invocable)e).invokeMethod(obj, "nonExistentMethod"); + fail("should have thrown NoSuchMethodException"); + } catch (final Exception exp) { + if (! (exp instanceof NoSuchMethodException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + + @Test + /** + * Check that calling method on non-script object 'thiz' results in IllegalArgumentException. + */ + public void invokeMethodNonScriptObjectThizTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + + try { + ((Invocable)e).invokeMethod(new Object(), "toString"); + fail("should have thrown IllegalArgumentException"); + } catch (final Exception exp) { + if (! (exp instanceof IllegalArgumentException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + + @Test + /** + * Check that calling method on null 'thiz' results in IllegalArgumentException. + */ + public void invokeMethodNullThizTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + + try { + ((Invocable)e).invokeMethod(null, "toString"); + fail("should have thrown IllegalArgumentException"); + } catch (final Exception exp) { + if (! (exp instanceof IllegalArgumentException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + + + @Test + /** + * Check that calling method on mirror created by another engine results in IllegalArgumentException. + */ + public void invokeMethodMixEnginesTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine engine1 = m.getEngineByName("nashorn"); + final ScriptEngine engine2 = m.getEngineByName("nashorn"); + + try { + Object obj = engine1.eval("({ run: function() {} })"); + // pass object from engine1 to engine2 as 'thiz' for invokeMethod + ((Invocable)engine2).invokeMethod(obj, "run"); + fail("should have thrown IllegalArgumentException"); + } catch (final Exception exp) { + if (! (exp instanceof IllegalArgumentException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + @Test public void noEnumerablePropertiesTest() { final ScriptEngineManager m = new ScriptEngineManager(); @@ -766,6 +977,70 @@ public class ScriptEngineTest { } } + @Test + /** + * check that null function name results in NPE. + */ + public void invokeFunctionNullNameTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + + try { + final Object res = ((Invocable)e).invokeFunction(null); + fail("should have thrown NPE"); + } catch (final Exception exp) { + if (! (exp instanceof NullPointerException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + + @Test + /** + * Check that attempt to call missing function results in NoSuchMethodException. + */ + public void invokeFunctionMissingTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + + try { + final Object res = ((Invocable)e).invokeFunction("NonExistentFunc"); + fail("should have thrown NoSuchMethodException"); + } catch (final Exception exp) { + if (! (exp instanceof NoSuchMethodException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + + @Test + /** + * Check that invokeFunction calls functions only from current context's Bindings. + */ + public void invokeFunctionDifferentContextTest() { + ScriptEngineManager m = new ScriptEngineManager(); + ScriptEngine e = m.getEngineByName("nashorn"); + + try { + // define an object with method on it + Object obj = e.eval("function hello() { return 'Hello World!'; }"); + final ScriptContext ctxt = new SimpleScriptContext(); + ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE); + // change engine's current context + e.setContext(ctxt); + + ((Invocable)e).invokeFunction("hello"); // no 'hello' in new context! + fail("should have thrown NoSuchMethodException"); + } catch (final Exception exp) { + if (! (exp instanceof NoSuchMethodException)) { + exp.printStackTrace(); + fail(exp.getMessage()); + } + } + } + @Test public void invokeFunctionExceptionTest() { final ScriptEngineManager m = new ScriptEngineManager(); @@ -945,4 +1220,38 @@ public class ScriptEngineTest { Assert.assertEquals(itf.test1(42, "a", "b"), "i == 42, strings instanceof java.lang.String[] == true, strings == [a, b]"); Assert.assertEquals(itf.test2(44, "c", "d", "e"), "arguments[0] == 44, arguments[1] instanceof java.lang.String[] == true, arguments[1] == [c, d, e]"); } + + @Test + // check that print function prints arg followed by newline char + public void printTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + final StringWriter sw = new StringWriter(); + e.getContext().setWriter(sw); + try { + e.eval("print('hello')"); + } catch (final Throwable t) { + t.printStackTrace(); + fail(t.getMessage()); + } + + assertEquals(sw.toString(), "hello\n"); + } + + @Test + // check that print prints all arguments (more than one) + public void printManyTest() { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + final StringWriter sw = new StringWriter(); + e.getContext().setWriter(sw); + try { + e.eval("print(34, true, 'hello')"); + } catch (final Throwable t) { + t.printStackTrace(); + fail(t.getMessage()); + } + + assertEquals(sw.toString(), "34 true hello\n"); + } } diff --git a/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java b/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java index 1d0e6fad421..07ff6f969a9 100644 --- a/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java +++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java @@ -29,6 +29,7 @@ import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_CHECK_COMPI import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_COMPARE; import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_EXPECT_COMPILE_FAIL; import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_EXPECT_RUN_FAIL; +import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_FORK; import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_IGNORE_STD_ERROR; import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_RUN; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_FAIL_LIST; @@ -68,6 +69,8 @@ public abstract class AbstractScriptRunnable { protected final boolean checkCompilerMsg; // .EXPECTED file compared for this or test? protected final boolean compare; + // should test run in a separate process? + protected final boolean fork; // ignore stderr output? protected final boolean ignoreStdError; // Foo.js.OUTPUT file where test stdout messages go @@ -98,6 +101,7 @@ public abstract class AbstractScriptRunnable { this.checkCompilerMsg = testOptions.containsKey(OPTIONS_CHECK_COMPILE_MSG); this.ignoreStdError = testOptions.containsKey(OPTIONS_IGNORE_STD_ERROR); this.compare = testOptions.containsKey(OPTIONS_COMPARE); + this.fork = testOptions.containsKey(OPTIONS_FORK); final String testName = testFile.getName(); this.outputFileName = buildDir + File.separator + testName + ".OUTPUT"; @@ -105,7 +109,6 @@ public abstract class AbstractScriptRunnable { this.copyExpectedFileName = buildDir + File.separator + testName + ".EXPECTED"; this.expectedFileName = testFile.getPath() + ".EXPECTED"; - final String failListString = System.getProperty(TEST_JS_FAIL_LIST); if (failListString != null) { final String[] failedTests = failListString.split(" "); for (final String failedTest : failedTests) { @@ -147,10 +150,15 @@ public abstract class AbstractScriptRunnable { } // shared context or not? - protected static final boolean sharedContext; + protected static final boolean sharedContext = Boolean.getBoolean(TEST_JS_SHARED_CONTEXT); + protected static final String failListString = System.getProperty(TEST_JS_FAIL_LIST); + // VM options when a @fork test is executed by a separate process + protected static final String[] forkJVMOptions; static { - sharedContext = Boolean.getBoolean(TEST_JS_SHARED_CONTEXT); + String vmOptions = System.getProperty(TestConfig.TEST_FORK_JVM_OPTIONS); + forkJVMOptions = (vmOptions != null)? vmOptions.split(" ") : new String[0]; } + private static ThreadLocal evaluators = new ThreadLocal<>(); /** diff --git a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java index 20548d75a25..0f55a6fa5bf 100644 --- a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java +++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java @@ -43,6 +43,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; + +import jdk.nashorn.tools.Shell; import org.testng.Assert; import org.testng.ITest; import org.testng.annotations.Test; @@ -53,9 +55,6 @@ import org.testng.annotations.Test; * corresponding .EXPECTED file. */ public final class ScriptRunnable extends AbstractScriptRunnable implements ITest { - // when test is run in a separate process, this is the command line - protected final ArrayList separateProcessArgs; - public ScriptRunnable(final String framework, final File testFile, final List engineOptions, final Map testOptions, final List scriptArguments) { super(framework, testFile, engineOptions, testOptions, scriptArguments); @@ -63,9 +62,6 @@ public final class ScriptRunnable extends AbstractScriptRunnable implements ITes // add --dump-on-error option always so that we can get detailed error msg. engineOptions.add("-doe"); } - - final String separateProcess = System.getProperty("test.js.separateprocess"); - this.separateProcessArgs = separateProcess == null ? null : new ArrayList<>(Arrays.asList(separateProcess.split(" "))); } @Override @@ -81,7 +77,7 @@ public final class ScriptRunnable extends AbstractScriptRunnable implements ITes @Override protected void execute() { - if (separateProcessArgs != null) { + if (fork) { executeInNewProcess(); } else { executeInThisProcess(); @@ -172,15 +168,24 @@ public final class ScriptRunnable extends AbstractScriptRunnable implements ITes } private void executeInNewProcess() { - final List args = separateProcessArgs; + + final String separator = System.getProperty("file.separator"); + final List cmd = new ArrayList<>(); + + cmd.add(System.getProperty("java.home") + separator + "bin" + separator + "java"); + cmd.add("-Djava.ext.dirs=dist"); + for (String str : forkJVMOptions) { + cmd.add(str); + } + cmd.add(Shell.class.getName()); // now add the rest of the "in process" runtime arguments - args.addAll(getRuntimeArgs()); + cmd.addAll(getRuntimeArgs()); final File outputFileHandle = new File(outputFileName); final File errorFileHandle = new File(errorFileName); try { - final ProcessBuilder pb = new ProcessBuilder(args); + final ProcessBuilder pb = new ProcessBuilder(cmd); pb.redirectOutput(outputFileHandle); pb.redirectError(errorFileHandle); final Process process = pb.start(); diff --git a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java index 05d59dc13ab..3b623038e44 100644 --- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java +++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java @@ -36,6 +36,7 @@ public interface TestConfig { public static final String OPTIONS_EXPECT_RUN_FAIL = "expect-run-fail"; public static final String OPTIONS_IGNORE_STD_ERROR = "ignore-std-error"; public static final String OPTIONS_COMPARE = "compare"; + public static final String OPTIONS_FORK = "fork"; // System property names used for various test configurations @@ -73,6 +74,8 @@ public interface TestConfig { // shared context mode or not static final String TEST_JS_SHARED_CONTEXT = "test.js.shared.context"; + static final String TEST_FORK_JVM_OPTIONS = "test.fork.jvm.options"; + // file for storing last run's failed tests static final String TEST_FAILED_LIST_FILE = "test.failed.list.file"; } diff --git a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java index 776c4e7a94d..d879976d2d2 100644 --- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java +++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java @@ -29,6 +29,7 @@ import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_CHECK_COMPI import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_COMPARE; import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_EXPECT_COMPILE_FAIL; import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_EXPECT_RUN_FAIL; +import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_FORK; import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_IGNORE_STD_ERROR; import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_RUN; import static jdk.nashorn.internal.test.framework.TestConfig.TEST_FAILED_LIST_FILE; @@ -208,6 +209,7 @@ final class TestFinder { boolean checkCompilerMsg = false; boolean noCompare = false; boolean ignoreStdError = false; + boolean fork = false; final List engineOptions = new ArrayList<>(); final List scriptArguments = new ArrayList<>(); @@ -284,6 +286,9 @@ final class TestFinder { case "@option": engineOptions.add(scanner.next()); break; + case "@fork": + fork = true; + break; } // negative tests are expected to fail at runtime only @@ -324,6 +329,9 @@ final class TestFinder { if (ignoreStdError) { testOptions.put(OPTIONS_IGNORE_STD_ERROR, "true"); } + if (fork) { + testOptions.put(OPTIONS_FORK, "true"); + } tests.add(factory.createTest(framework, testFile.toFile(), engineOptions, testOptions, scriptArguments)); } else if (!isNotTest) { diff --git a/nashorn/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java b/nashorn/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java new file mode 100644 index 00000000000..ed45139dbec --- /dev/null +++ b/nashorn/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.nashorn.internal.test.models; + +import java.io.PrintWriter; +import java.io.StringWriter; + +public class InternalRunnable implements Runnable, RestrictedRunnable { + + // This is a public field in a restricted class; scripts should not see it. + public final int canNotSeeThisField = 42; + + private boolean runExecuted = false; + + @Override + public void run() { + runExecuted = true; + } + + @Override + public void restrictedRun() { + // This is a public method on a restricted interface; scripts should not see it. + throw new AssertionError(); + } + + @Override + public String toString() { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + if(runExecuted) { + pw.println("InternalRunnable.run() executed!"); + } + pw.println("InternalRunnable.toString() executed!"); + pw.flush(); + return sw.toString(); + } + + public void canNotInvokeThis() { + // This is a public method in a restricted class; scripts should not see it. + throw new AssertionError(); + } + + public void getInvisibleProperty() { + // This is a public method in a restricted class; scripts should not see it. + throw new AssertionError(); + } +} + diff --git a/nashorn/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java b/nashorn/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java new file mode 100644 index 00000000000..05fd52c0a52 --- /dev/null +++ b/nashorn/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.nashorn.internal.test.models; + +/** + * Acts as a restricted interface implemented by a restricted class. + * + */ +public interface RestrictedRunnable { + public void restrictedRun(); +} diff --git a/nashorn/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java b/nashorn/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java new file mode 100644 index 00000000000..24104c3d1cf --- /dev/null +++ b/nashorn/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.nashorn.test.models; + +import jdk.internal.dynalink.beans.StaticClass; +import jdk.nashorn.internal.test.models.InternalRunnable; + +/** + * Acts as a non-restricted superclass for a restricted class. + * + */ +public class InternalRunnableSuperclass { + public final int canSeeThisField = 19; + + public static Object makeInternalRunnable() { + return new InternalRunnable(); + } + + public static StaticClass getInternalRunnableType() { + return StaticClass.forClass(InternalRunnable.class); + } +}
                              Audio System Property Keys
                              Property KeyInterfacerate" + NL + + "rate" + NL + "
                              Defines the direction/speed at which the Timeline is expected to"}, {"./" + BUG_ID + "/C.html", @@ -63,7 +63,7 @@ public class TestJavaFX extends JavadocTester { {"./" + BUG_ID + "/C.html", "Property description:"}, {"./" + BUG_ID + "/C.html", - "
                              setTestMethodProperty() setTestMethodProperty() " + - "returnTypeTest()" + "" + + "returnTypeTest()" }, // Check return type in member detail. {BUG_ID + FS + "pkg" + FS + "PublicChild.html", diff --git a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java index db5c2f24e0f..e16fd5450f2 100644 --- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java +++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java @@ -62,7 +62,7 @@ public class TestNewLanguageFeatures extends JavadocTester { " "}, //Detail for enum constant {BUG_ID + FS + "pkg" + FS + "Coin.html", - "Dime"}, + "Dime"}, //Automatically insert documentation for values() and valueOf(). {BUG_ID + FS + "pkg" + FS + "Coin.html", "Returns an array containing the constants of this enum type,"}, @@ -320,11 +320,11 @@ public class TestNewLanguageFeatures extends JavadocTester { "Foo " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", - "ClassUseTest1<T extends " + "Foo" + " & " + - "Foo2> 
                              Methods in ClassUseTest1." + - "method" + + "method" + "(T t) " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", @@ -372,11 +372,11 @@ public class TestNewLanguageFeatures extends JavadocTester { "
                              ClassUseTest1<T extends " + "Foo" + " & " + - "Foo2> 
                              Methods in " + - "ClassUseTest1.method" + + "ClassUseTest1.method" + "(T t) " }, @@ -401,11 +401,11 @@ public class TestNewLanguageFeatures extends JavadocTester { " 
                              ClassUseTest2<T extends " + "" + "ParamTest<" + - "Foo3>> 
                              Methods in ClassUseTest2." + - "method" + + "method" + "(T t) " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", @@ -456,11 +456,11 @@ public class TestNewLanguageFeatures extends JavadocTester { "Foo3 
                              ClassUseTest2<T extends " + "" + "ParamTest<" + - "Foo3>> 
                              Methods in ClassUseTest2." + - "method" + + "method" + "(T t) " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", @@ -500,12 +500,12 @@ public class TestNewLanguageFeatures extends JavadocTester { " 
                              ClassUseTest3<T extends " + "" + "ParamTest2<java.util.List<? extends " + "" + - "Foo4>>> 
                              Methods in ClassUseTest3" + - ".method(T t) " + ".method(T t) " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "
                              <T extends " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", - "ClassUseTest3<T extends " + "" + "ParamTest2<java.util.List<? extends " + "" + - "Foo4>>> 
                              Methods in ClassUseTest3." + - "method(T t)" + + "method(T t)" + " " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", @@ -587,8 +587,8 @@ public class TestNewLanguageFeatures extends JavadocTester { "" + NL + "
                              voidClassUseTest3." + - "method(java." + + "method(java." + "util.Set<Foo4> p)