Merge
authorlana
Thu, 21 Feb 2013 17:43:57 -0800
changeset 16019 1d364f23ece0
parent 16018 3fe4876de509 (current diff)
parent 15728 6d3dcd34b5b9 (diff)
child 16020 b57c48f16179
Merge
langtools/test/tools/javac/lambda/TargetType20.out
langtools/test/tools/javac/lambda/TargetType50.out
--- a/.hgtags	Thu Feb 21 15:46:37 2013 -0800
+++ b/.hgtags	Thu Feb 21 17:43:57 2013 -0800
@@ -198,3 +198,4 @@
 f627eff819628822a0777af8062244352f2a29cf jdk8-b74
 f1478a6d25fddd311a84dcbfac50824cc1858bdd jdk8-b75
 f407160c280d1c5b00d314c535441ac26f195fee jdk8-b76
+d17eb2e13e362085e866d46235314c50cc4661cc jdk8-b77
--- a/.hgtags-top-repo	Thu Feb 21 15:46:37 2013 -0800
+++ b/.hgtags-top-repo	Thu Feb 21 17:43:57 2013 -0800
@@ -198,3 +198,4 @@
 b43aa5bd8ca5c8121336495382d35ecfa7a71536 jdk8-b74
 2a713921952cbd77a1e699626976cb6cdfe3e57e jdk8-b75
 278af9fc67e7eba2884936b49ec07345f423aabb jdk8-b76
+3933eebc659d58c597aa8cb4b3e58f2250ce3e1a jdk8-b77
--- a/NewMakefile.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/NewMakefile.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -96,6 +96,7 @@
 	$(info .  make all               # Compile everything, all repos and images)
 	$(info .  make images            # Create complete j2sdk and j2re images)
 	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
+	$(info .  make profiles          # Create complete j2re compact profile images)
 	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
 	$(info .  make install           # Install the generated images locally)
 	$(info .  make clean             # Remove all files generated by make, but not those)
--- a/common/autoconf/generated-configure.sh	Thu Feb 21 15:46:37 2013 -0800
+++ b/common/autoconf/generated-configure.sh	Thu Feb 21 17:43:57 2013 -0800
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for OpenJDK jdk8.
+# Generated by GNU Autoconf 2.68 for OpenJDK jdk8.
 #
 # Report bugs to <build-dev@openjdk.java.net>.
 #
@@ -91,6 +91,7 @@
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -216,11 +217,18 @@
   # We cannot yet assume a decent shell, so we have to provide a
 	# neutralization value for shells without unset; and this also
 	# works around shells that cannot unset nonexistent variables.
+	# Preserve -v and -x to the replacement shell.
 	BASH_ENV=/dev/null
 	ENV=/dev/null
 	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
 	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+	case $- in # ((((
+	  *v*x* | *x*v* ) as_opts=-vx ;;
+	  *v* ) as_opts=-v ;;
+	  *x* ) as_opts=-x ;;
+	  * ) as_opts= ;;
+	esac
+	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -641,6 +649,7 @@
 CXXFLAGS_JDKLIB
 CFLAGS_JDKEXE
 CFLAGS_JDKLIB
+MACOSX_REQUIRED_VERSION
 PACKAGE_PATH
 LEGACY_EXTRA_LDFLAGS
 LEGACY_EXTRA_CXXFLAGS
@@ -1433,7 +1442,7 @@
     $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
@@ -1858,7 +1867,7 @@
 if $ac_init_version; then
   cat <<\_ACEOF
 OpenJDK configure jdk8
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1904,7 +1913,7 @@
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
@@ -1942,7 +1951,7 @@
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_compile
@@ -1980,7 +1989,7 @@
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_objc_try_compile
@@ -2017,7 +2026,7 @@
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_cpp
@@ -2054,7 +2063,7 @@
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_cpp
@@ -2067,10 +2076,10 @@
 ac_fn_cxx_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval "test \"\${$3+set}\"" = set; then :
+  if eval \${$3+:} false; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2137,7 +2146,7 @@
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2146,7 +2155,7 @@
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_cxx_check_header_mongrel
 
@@ -2187,7 +2196,7 @@
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_run
@@ -2201,7 +2210,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2219,7 +2228,7 @@
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_cxx_check_header_compile
 
@@ -2396,7 +2405,7 @@
 rm -f conftest.val
 
   fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_compute_int
@@ -2442,7 +2451,7 @@
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_link
@@ -2455,7 +2464,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2510,7 +2519,7 @@
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_cxx_check_func
 
@@ -2523,7 +2532,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2541,7 +2550,7 @@
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_header_compile
 cat >config.log <<_ACEOF
@@ -2549,7 +2558,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by OpenJDK $as_me jdk8, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -2807,7 +2816,7 @@
       || { { $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
 
@@ -3723,7 +3732,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1359971740
+DATE_WHEN_GENERATED=1361218904
 
 ###############################################################################
 #
@@ -3761,7 +3770,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BASENAME+set}" = set; then :
+if ${ac_cv_path_BASENAME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $BASENAME in
@@ -3820,7 +3829,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BASH+set}" = set; then :
+if ${ac_cv_path_BASH+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $BASH in
@@ -3879,7 +3888,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CAT+set}" = set; then :
+if ${ac_cv_path_CAT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CAT in
@@ -3938,7 +3947,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHMOD+set}" = set; then :
+if ${ac_cv_path_CHMOD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHMOD in
@@ -3997,7 +4006,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CMP+set}" = set; then :
+if ${ac_cv_path_CMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CMP in
@@ -4056,7 +4065,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_COMM+set}" = set; then :
+if ${ac_cv_path_COMM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $COMM in
@@ -4115,7 +4124,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CP+set}" = set; then :
+if ${ac_cv_path_CP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CP in
@@ -4174,7 +4183,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CPIO+set}" = set; then :
+if ${ac_cv_path_CPIO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CPIO in
@@ -4233,7 +4242,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CUT+set}" = set; then :
+if ${ac_cv_path_CUT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CUT in
@@ -4292,7 +4301,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DATE+set}" = set; then :
+if ${ac_cv_path_DATE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $DATE in
@@ -4351,7 +4360,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DIFF+set}" = set; then :
+if ${ac_cv_path_DIFF+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $DIFF in
@@ -4410,7 +4419,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DIRNAME+set}" = set; then :
+if ${ac_cv_path_DIRNAME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $DIRNAME in
@@ -4469,7 +4478,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ECHO+set}" = set; then :
+if ${ac_cv_path_ECHO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ECHO in
@@ -4528,7 +4537,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_EXPR+set}" = set; then :
+if ${ac_cv_path_EXPR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $EXPR in
@@ -4587,7 +4596,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FILE+set}" = set; then :
+if ${ac_cv_path_FILE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $FILE in
@@ -4646,7 +4655,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FIND+set}" = set; then :
+if ${ac_cv_path_FIND+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $FIND in
@@ -4705,7 +4714,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HEAD+set}" = set; then :
+if ${ac_cv_path_HEAD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $HEAD in
@@ -4764,7 +4773,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LN+set}" = set; then :
+if ${ac_cv_path_LN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $LN in
@@ -4823,7 +4832,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LS+set}" = set; then :
+if ${ac_cv_path_LS+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $LS in
@@ -4882,7 +4891,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MKDIR+set}" = set; then :
+if ${ac_cv_path_MKDIR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MKDIR in
@@ -4941,7 +4950,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MKTEMP+set}" = set; then :
+if ${ac_cv_path_MKTEMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MKTEMP in
@@ -5000,7 +5009,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MV+set}" = set; then :
+if ${ac_cv_path_MV+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MV in
@@ -5059,7 +5068,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PRINTF+set}" = set; then :
+if ${ac_cv_path_PRINTF+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PRINTF in
@@ -5118,7 +5127,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_THEPWDCMD+set}" = set; then :
+if ${ac_cv_path_THEPWDCMD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $THEPWDCMD in
@@ -5177,7 +5186,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_RM+set}" = set; then :
+if ${ac_cv_path_RM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $RM in
@@ -5236,7 +5245,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SH+set}" = set; then :
+if ${ac_cv_path_SH+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $SH in
@@ -5295,7 +5304,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SORT+set}" = set; then :
+if ${ac_cv_path_SORT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $SORT in
@@ -5354,7 +5363,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TAIL+set}" = set; then :
+if ${ac_cv_path_TAIL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $TAIL in
@@ -5413,7 +5422,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TAR+set}" = set; then :
+if ${ac_cv_path_TAR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $TAR in
@@ -5472,7 +5481,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TEE+set}" = set; then :
+if ${ac_cv_path_TEE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $TEE in
@@ -5531,7 +5540,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TOUCH+set}" = set; then :
+if ${ac_cv_path_TOUCH+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $TOUCH in
@@ -5590,7 +5599,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TR+set}" = set; then :
+if ${ac_cv_path_TR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $TR in
@@ -5649,7 +5658,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNAME+set}" = set; then :
+if ${ac_cv_path_UNAME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $UNAME in
@@ -5708,7 +5717,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNIQ+set}" = set; then :
+if ${ac_cv_path_UNIQ+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $UNIQ in
@@ -5767,7 +5776,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_WC+set}" = set; then :
+if ${ac_cv_path_WC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $WC in
@@ -5826,7 +5835,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_WHICH+set}" = set; then :
+if ${ac_cv_path_WHICH+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $WHICH in
@@ -5885,7 +5894,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XARGS+set}" = set; then :
+if ${ac_cv_path_XARGS+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $XARGS in
@@ -5945,7 +5954,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -5995,7 +6004,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -6070,7 +6079,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -6149,7 +6158,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then :
+if ${ac_cv_path_FGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -6228,7 +6237,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then :
+if ${ac_cv_path_SED+:} false; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -6314,7 +6323,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_NAWK+set}" = set; then :
+if ${ac_cv_path_NAWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $NAWK in
@@ -6374,7 +6383,7 @@
 set dummy cygpath; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CYGPATH+set}" = set; then :
+if ${ac_cv_path_CYGPATH+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CYGPATH in
@@ -6414,7 +6423,7 @@
 set dummy readlink; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_READLINK+set}" = set; then :
+if ${ac_cv_path_READLINK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $READLINK in
@@ -6454,7 +6463,7 @@
 set dummy df; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DF+set}" = set; then :
+if ${ac_cv_path_DF+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $DF in
@@ -6494,7 +6503,7 @@
 set dummy SetFile; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SETFILE+set}" = set; then :
+if ${ac_cv_path_SETFILE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $SETFILE in
@@ -6540,7 +6549,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
@@ -6556,7 +6565,7 @@
 $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='-'
@@ -6574,7 +6583,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
@@ -6589,7 +6598,7 @@
 $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='-'
@@ -6607,7 +6616,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
 $as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; then :
+if ${ac_cv_target+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$target_alias" = x; then
@@ -6622,7 +6631,7 @@
 $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='-'
@@ -8088,7 +8097,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PKGHANDLER+set}" = set; then :
+if ${ac_cv_prog_PKGHANDLER+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$PKGHANDLER"; then
@@ -8453,7 +8462,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHECK_GMAKE+set}" = set; then :
+if ${ac_cv_path_CHECK_GMAKE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHECK_GMAKE in
@@ -8807,7 +8816,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHECK_MAKE+set}" = set; then :
+if ${ac_cv_path_CHECK_MAKE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHECK_MAKE in
@@ -9166,7 +9175,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHECK_TOOLSDIR_GMAKE+set}" = set; then :
+if ${ac_cv_path_CHECK_TOOLSDIR_GMAKE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHECK_TOOLSDIR_GMAKE in
@@ -9519,7 +9528,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHECK_TOOLSDIR_MAKE+set}" = set; then :
+if ${ac_cv_path_CHECK_TOOLSDIR_MAKE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHECK_TOOLSDIR_MAKE in
@@ -9915,7 +9924,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNZIP+set}" = set; then :
+if ${ac_cv_path_UNZIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $UNZIP in
@@ -9974,7 +9983,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ZIP+set}" = set; then :
+if ${ac_cv_path_ZIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ZIP in
@@ -10033,7 +10042,7 @@
 set dummy ldd; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LDD+set}" = set; then :
+if ${ac_cv_path_LDD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $LDD in
@@ -10079,7 +10088,7 @@
 set dummy otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_OTOOL+set}" = set; then :
+if ${ac_cv_path_OTOOL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $OTOOL in
@@ -10124,7 +10133,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_READELF+set}" = set; then :
+if ${ac_cv_path_READELF+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $READELF in
@@ -10167,7 +10176,7 @@
 set dummy hg; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HG+set}" = set; then :
+if ${ac_cv_path_HG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $HG in
@@ -10207,7 +10216,7 @@
 set dummy stat; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_STAT+set}" = set; then :
+if ${ac_cv_path_STAT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $STAT in
@@ -10247,7 +10256,7 @@
 set dummy time; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TIME+set}" = set; then :
+if ${ac_cv_path_TIME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $TIME in
@@ -10292,7 +10301,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_COMM+set}" = set; then :
+if ${ac_cv_path_COMM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $COMM in
@@ -10356,7 +10365,7 @@
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
@@ -10399,7 +10408,7 @@
 set dummy pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PKG_CONFIG in
@@ -10572,7 +10581,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_BDEPS_UNZIP+set}" = set; then :
+if ${ac_cv_prog_BDEPS_UNZIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$BDEPS_UNZIP"; then
@@ -10618,7 +10627,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_BDEPS_FTP+set}" = set; then :
+if ${ac_cv_prog_BDEPS_FTP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$BDEPS_FTP"; then
@@ -11885,7 +11894,7 @@
 set dummy javac; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_JAVAC_CHECK+set}" = set; then :
+if ${ac_cv_path_JAVAC_CHECK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $JAVAC_CHECK in
@@ -11925,7 +11934,7 @@
 set dummy java; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_JAVA_CHECK+set}" = set; then :
+if ${ac_cv_path_JAVA_CHECK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $JAVA_CHECK in
@@ -15984,7 +15993,7 @@
 set dummy link; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CYGWIN_LINK+set}" = set; then :
+if ${ac_cv_path_CYGWIN_LINK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CYGWIN_LINK in
@@ -16973,7 +16982,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BUILD_CC+set}" = set; then :
+if ${ac_cv_path_BUILD_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $BUILD_CC in
@@ -17284,7 +17293,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BUILD_CXX+set}" = set; then :
+if ${ac_cv_path_BUILD_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $BUILD_CXX in
@@ -17593,7 +17602,7 @@
 set dummy ld; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BUILD_LD+set}" = set; then :
+if ${ac_cv_path_BUILD_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $BUILD_LD in
@@ -18105,7 +18114,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TOOLS_DIR_CC+set}" = set; then :
+if ${ac_cv_path_TOOLS_DIR_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $TOOLS_DIR_CC in
@@ -18157,7 +18166,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_POTENTIAL_CC+set}" = set; then :
+if ${ac_cv_path_POTENTIAL_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $POTENTIAL_CC in
@@ -18570,7 +18579,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PROPER_COMPILER_CC+set}" = set; then :
+if ${ac_cv_prog_PROPER_COMPILER_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$PROPER_COMPILER_CC"; then
@@ -18614,7 +18623,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_PROPER_COMPILER_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_PROPER_COMPILER_CC"; then
@@ -19064,7 +19073,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -19108,7 +19117,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -19161,7 +19170,7 @@
 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
@@ -19276,7 +19285,7 @@
 { { $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; }
@@ -19319,7 +19328,7 @@
   { { $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
@@ -19378,7 +19387,7 @@
 $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
@@ -19389,7 +19398,7 @@
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -19430,7 +19439,7 @@
 { { $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
@@ -19440,7 +19449,7 @@
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -19477,7 +19486,7 @@
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -19555,7 +19564,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -19674,7 +19683,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TOOLS_DIR_CXX+set}" = set; then :
+if ${ac_cv_path_TOOLS_DIR_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $TOOLS_DIR_CXX in
@@ -19726,7 +19735,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_POTENTIAL_CXX+set}" = set; then :
+if ${ac_cv_path_POTENTIAL_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $POTENTIAL_CXX in
@@ -20139,7 +20148,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PROPER_COMPILER_CXX+set}" = set; then :
+if ${ac_cv_prog_PROPER_COMPILER_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$PROPER_COMPILER_CXX"; then
@@ -20183,7 +20192,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+set}" = set; then :
+if ${ac_cv_prog_ac_ct_PROPER_COMPILER_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_PROPER_COMPILER_CXX"; then
@@ -20637,7 +20646,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then :
+if ${ac_cv_prog_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CXX"; then
@@ -20681,7 +20690,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CXX"; then
@@ -20759,7 +20768,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -20796,7 +20805,7 @@
 ac_save_CXXFLAGS=$CXXFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
 $as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if test "${ac_cv_prog_cxx_g+set}" = set; then :
+if ${ac_cv_prog_cxx_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_cxx_werror_flag=$ac_cxx_werror_flag
@@ -20894,7 +20903,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJC+set}" = set; then :
+if ${ac_cv_prog_OBJC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJC"; then
@@ -20938,7 +20947,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJC"; then
@@ -21014,7 +21023,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Objective C compiler" >&5
 $as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; }
-if test "${ac_cv_objc_compiler_gnu+set}" = set; then :
+if ${ac_cv_objc_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -21051,7 +21060,7 @@
 ac_save_OBJCFLAGS=$OBJCFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5
 $as_echo_n "checking whether $OBJC accepts -g... " >&6; }
-if test "${ac_cv_prog_objc_g+set}" = set; then :
+if ${ac_cv_prog_objc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_objc_werror_flag=$ac_objc_werror_flag
@@ -21427,7 +21436,7 @@
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then :
+if ${ac_cv_prog_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
@@ -21467,7 +21476,7 @@
 set dummy ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
@@ -21809,7 +21818,7 @@
 set dummy link; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_WINLD+set}" = set; then :
+if ${ac_cv_prog_WINLD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$WINLD"; then
@@ -22148,7 +22157,7 @@
 set dummy mt; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_MT+set}" = set; then :
+if ${ac_cv_prog_MT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$MT"; then
@@ -22469,7 +22478,7 @@
 set dummy rc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RC+set}" = set; then :
+if ${ac_cv_prog_RC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RC"; then
@@ -22860,7 +22869,7 @@
 set dummy lib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_WINAR+set}" = set; then :
+if ${ac_cv_prog_WINAR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$WINAR"; then
@@ -23166,7 +23175,7 @@
 set dummy dumpbin; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_DUMPBIN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
@@ -23485,7 +23494,7 @@
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -23601,7 +23610,7 @@
   { { $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
@@ -23885,7 +23894,7 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
 $as_echo_n "checking how to run the C++ preprocessor... " >&6; }
 if test -z "$CXXCPP"; then
-  if test "${ac_cv_prog_CXXCPP+set}" = set; then :
+  if ${ac_cv_prog_CXXCPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CXXCPP needs to be expanded
@@ -24001,7 +24010,7 @@
   { { $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
@@ -24303,7 +24312,7 @@
 set dummy as; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_AS+set}" = set; then :
+if ${ac_cv_path_AS+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $AS in
@@ -24617,7 +24626,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_NM+set}" = set; then :
+if ${ac_cv_path_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $NM in
@@ -24926,7 +24935,7 @@
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_STRIP+set}" = set; then :
+if ${ac_cv_path_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $STRIP in
@@ -25232,7 +25241,7 @@
 set dummy mcs; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MCS+set}" = set; then :
+if ${ac_cv_path_MCS+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $MCS in
@@ -25540,7 +25549,7 @@
 set dummy ${ac_tool_prefix}nm; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NM+set}" = set; then :
+if ${ac_cv_prog_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
@@ -25580,7 +25589,7 @@
 set dummy nm; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NM+set}" = set; then :
+if ${ac_cv_prog_ac_ct_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NM"; then
@@ -25898,7 +25907,7 @@
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -25938,7 +25947,7 @@
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -26263,7 +26272,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJCOPY+set}" = set; then :
+if ${ac_cv_prog_OBJCOPY+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJCOPY"; then
@@ -26307,7 +26316,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJCOPY+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJCOPY+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJCOPY"; then
@@ -26634,7 +26643,7 @@
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJDUMP"; then
@@ -26678,7 +26687,7 @@
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJDUMP"; then
@@ -27002,7 +27011,7 @@
 set dummy lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LIPO+set}" = set; then :
+if ${ac_cv_path_LIPO+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $LIPO in
@@ -27317,7 +27326,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -27493,7 +27502,7 @@
 for ac_header in stdio.h
 do :
   ac_fn_cxx_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdio_h" = x""yes; then :
+if test "x$ac_cv_header_stdio_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_STDIO_H 1
 _ACEOF
@@ -27522,7 +27531,7 @@
 # This bug is HP SR number 8606223364.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5
 $as_echo_n "checking size of int *... " >&6; }
-if test "${ac_cv_sizeof_int_p+set}" = set; then :
+if ${ac_cv_sizeof_int_p+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p"        "$ac_includes_default"; then :
@@ -27532,7 +27541,7 @@
      { { $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
@@ -27579,7 +27588,7 @@
 #
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
 $as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if test "${ac_cv_c_bigendian+set}" = set; then :
+if ${ac_cv_c_bigendian+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_bigendian=unknown
@@ -28233,6 +28242,10 @@
 fi
 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE"
+    # Adding these macros will make it an error to link to mac APIs newer than OS version 10.7
+    MACOSX_REQUIRED_VERSION=1070
+
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(MACOSX_REQUIRED_VERSION) -DMAC_OS_X_VERSION_MIN_REQUIRED=\$(MACOSX_REQUIRED_VERSION)"
 fi
 if test "x$OPENJDK_TARGET_OS" = xbsd; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
@@ -28579,8 +28592,8 @@
   have_x=disabled
 else
   case $x_includes,$x_libraries in #(
-    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #(
-    *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then :
+    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
+    *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # One or both of the vars are not set, and there is no cached value.
@@ -28857,7 +28870,7 @@
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
 $as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
-if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then :
+if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28891,14 +28904,14 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; then :
+if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
 fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5
 $as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; }
-if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then :
+if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28932,7 +28945,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
 $as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
-if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = x""yes; then :
+if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
 fi
 
@@ -28951,14 +28964,14 @@
     # The functions gethostbyname, getservbyname, and inet_addr are
     # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
     ac_fn_cxx_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
-if test "x$ac_cv_func_gethostbyname" = x""yes; then :
+if test "x$ac_cv_func_gethostbyname" = xyes; then :
 
 fi
 
     if test $ac_cv_func_gethostbyname = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then :
+if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28992,14 +29005,14 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5
 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
-if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then :
+if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
 fi
 
       if test $ac_cv_lib_nsl_gethostbyname = no; then
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5
 $as_echo_n "checking for gethostbyname in -lbsd... " >&6; }
-if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then :
+if ${ac_cv_lib_bsd_gethostbyname+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29033,7 +29046,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5
 $as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; }
-if test "x$ac_cv_lib_bsd_gethostbyname" = x""yes; then :
+if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
 fi
 
@@ -29048,14 +29061,14 @@
     # must be given before -lnsl if both are needed.  We assume that
     # if connect needs -lnsl, so does gethostbyname.
     ac_fn_cxx_check_func "$LINENO" "connect" "ac_cv_func_connect"
-if test "x$ac_cv_func_connect" = x""yes; then :
+if test "x$ac_cv_func_connect" = xyes; then :
 
 fi
 
     if test $ac_cv_func_connect = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
 $as_echo_n "checking for connect in -lsocket... " >&6; }
-if test "${ac_cv_lib_socket_connect+set}" = set; then :
+if ${ac_cv_lib_socket_connect+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29089,7 +29102,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
 $as_echo "$ac_cv_lib_socket_connect" >&6; }
-if test "x$ac_cv_lib_socket_connect" = x""yes; then :
+if test "x$ac_cv_lib_socket_connect" = xyes; then :
   X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
 fi
 
@@ -29097,14 +29110,14 @@
 
     # Guillermo Gomez says -lposix is necessary on A/UX.
     ac_fn_cxx_check_func "$LINENO" "remove" "ac_cv_func_remove"
-if test "x$ac_cv_func_remove" = x""yes; then :
+if test "x$ac_cv_func_remove" = xyes; then :
 
 fi
 
     if test $ac_cv_func_remove = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5
 $as_echo_n "checking for remove in -lposix... " >&6; }
-if test "${ac_cv_lib_posix_remove+set}" = set; then :
+if ${ac_cv_lib_posix_remove+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29138,7 +29151,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5
 $as_echo "$ac_cv_lib_posix_remove" >&6; }
-if test "x$ac_cv_lib_posix_remove" = x""yes; then :
+if test "x$ac_cv_lib_posix_remove" = xyes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
 fi
 
@@ -29146,14 +29159,14 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     ac_fn_cxx_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
-if test "x$ac_cv_func_shmat" = x""yes; then :
+if test "x$ac_cv_func_shmat" = xyes; then :
 
 fi
 
     if test $ac_cv_func_shmat = no; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5
 $as_echo_n "checking for shmat in -lipc... " >&6; }
-if test "${ac_cv_lib_ipc_shmat+set}" = set; then :
+if ${ac_cv_lib_ipc_shmat+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29187,7 +29200,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5
 $as_echo "$ac_cv_lib_ipc_shmat" >&6; }
-if test "x$ac_cv_lib_ipc_shmat" = x""yes; then :
+if test "x$ac_cv_lib_ipc_shmat" = xyes; then :
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
 fi
 
@@ -29205,7 +29218,7 @@
   # John Interrante, Karl Berry
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5
 $as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; }
-if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then :
+if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29239,7 +29252,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
 $as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
-if test "x$ac_cv_lib_ICE_IceConnectionNumber" = x""yes; then :
+if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then :
   X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
 fi
 
@@ -30252,7 +30265,7 @@
             LDFLAGS="$FREETYPE2_LIBS"
             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FT_Init_FreeType in -lfreetype" >&5
 $as_echo_n "checking for FT_Init_FreeType in -lfreetype... " >&6; }
-if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then :
+if ${ac_cv_lib_freetype_FT_Init_FreeType+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30286,7 +30299,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_freetype_FT_Init_FreeType" >&5
 $as_echo "$ac_cv_lib_freetype_FT_Init_FreeType" >&6; }
-if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = x""yes; then :
+if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = xyes; then :
   FREETYPE2_FOUND=true
 else
   as_fn_error $? "Could not find freetype2! $HELP_MSG " "$LINENO" 5
@@ -30574,7 +30587,7 @@
 	    for ac_header in alsa/asoundlib.h
 do :
   ac_fn_cxx_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_alsa_asoundlib_h" = x""yes; then :
+if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_ALSA_ASOUNDLIB_H 1
 _ACEOF
@@ -30633,7 +30646,7 @@
 USE_EXTERNAL_LIBJPEG=true
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -ljpeg" >&5
 $as_echo_n "checking for main in -ljpeg... " >&6; }
-if test "${ac_cv_lib_jpeg_main+set}" = set; then :
+if ${ac_cv_lib_jpeg_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30661,7 +30674,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_main" >&5
 $as_echo "$ac_cv_lib_jpeg_main" >&6; }
-if test "x$ac_cv_lib_jpeg_main" = x""yes; then :
+if test "x$ac_cv_lib_jpeg_main" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBJPEG 1
 _ACEOF
@@ -30685,7 +30698,7 @@
 USE_EXTERNAL_LIBJPEG=true
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgif" >&5
 $as_echo_n "checking for main in -lgif... " >&6; }
-if test "${ac_cv_lib_gif_main+set}" = set; then :
+if ${ac_cv_lib_gif_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30713,7 +30726,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_main" >&5
 $as_echo "$ac_cv_lib_gif_main" >&6; }
-if test "x$ac_cv_lib_gif_main" = x""yes; then :
+if test "x$ac_cv_lib_gif_main" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBGIF 1
 _ACEOF
@@ -30743,7 +30756,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress in -lz" >&5
 $as_echo_n "checking for compress in -lz... " >&6; }
-if test "${ac_cv_lib_z_compress+set}" = set; then :
+if ${ac_cv_lib_z_compress+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30777,7 +30790,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress" >&5
 $as_echo "$ac_cv_lib_z_compress" >&6; }
-if test "x$ac_cv_lib_z_compress" = x""yes; then :
+if test "x$ac_cv_lib_z_compress" = xyes; then :
    ZLIB_FOUND=yes
 else
    ZLIB_FOUND=no
@@ -30870,7 +30883,7 @@
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
 $as_echo_n "checking for cos in -lm... " >&6; }
-if test "${ac_cv_lib_m_cos+set}" = set; then :
+if ${ac_cv_lib_m_cos+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30904,7 +30917,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
 $as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = x""yes; then :
+if test "x$ac_cv_lib_m_cos" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBM 1
 _ACEOF
@@ -30928,7 +30941,7 @@
 LIBS=""
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -30962,7 +30975,7 @@
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBDL 1
 _ACEOF
@@ -31606,7 +31619,7 @@
 set dummy ccache; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CCACHE+set}" = set; then :
+if ${ac_cv_path_CCACHE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CCACHE in
@@ -31867,10 +31880,21 @@
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
+    if test "x$cache_file" != "x/dev/null"; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -31902,7 +31926,7 @@
 
 
 
-: ${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"
@@ -32003,6 +32027,7 @@
 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
@@ -32310,7 +32335,7 @@
 # values after options handling.
 ac_log="
 This file was extended by OpenJDK $as_me jdk8, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -32373,7 +32398,7 @@
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 OpenJDK config.status jdk8
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -32502,7 +32527,7 @@
     "$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
 
@@ -32524,9 +32549,10 @@
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp=
+  tmp= ac_tmp=
   trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -32534,12 +32560,13 @@
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
+  test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -32561,7 +32588,7 @@
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -32589,7 +32616,7 @@
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -32637,7 +32664,7 @@
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -32669,7 +32696,7 @@
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
   || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
@@ -32703,7 +32730,7 @@
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -32715,8 +32742,8 @@
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
     as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
@@ -32817,7 +32844,7 @@
   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
@@ -32836,7 +32863,7 @@
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$tmp/stdin";;
+      -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -32845,7 +32872,7 @@
 	   [\\/$]*) 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'"
@@ -32871,8 +32898,8 @@
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -32997,21 +33024,22 @@
 s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  rm -f "$ac_tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
   || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
@@ -33022,20 +33050,20 @@
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
+      mv "$ac_tmp/config.h" "$ac_file" \
 	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
       || as_fn_error $? "could not create -" "$LINENO" 5
   fi
  ;;
--- a/common/autoconf/spec.gmk.in	Thu Feb 21 15:46:37 2013 -0800
+++ b/common/autoconf/spec.gmk.in	Thu Feb 21 17:43:57 2013 -0800
@@ -282,6 +282,9 @@
 X_LIBS:=@X_LIBS@
 OPENWIN_HOME:=@OPENWIN_HOME@
 
+# The lowest required version of macosx to enforce compatiblity for
+MACOSX_REQUIRED_VERSION=@MACOSX_REQUIRED_VERSION@
+
 # There are two types: CC or CL
 # CC is gcc and others behaving reasonably similar.
 # CL is cl.exe only.
--- a/common/autoconf/toolchain.m4	Thu Feb 21 15:46:37 2013 -0800
+++ b/common/autoconf/toolchain.m4	Thu Feb 21 17:43:57 2013 -0800
@@ -876,6 +876,10 @@
 fi
 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE"
+    # Adding these macros will make it an error to link to mac APIs newer than OS version 10.7
+    MACOSX_REQUIRED_VERSION=1070
+    AC_SUBST(MACOSX_REQUIRED_VERSION)
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(MACOSX_REQUIRED_VERSION) -DMAC_OS_X_VERSION_MIN_REQUIRED=\$(MACOSX_REQUIRED_VERSION)" 
 fi
 if test "x$OPENJDK_TARGET_OS" = xbsd; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
--- a/common/bin/hgforest.sh	Thu Feb 21 15:46:37 2013 -0800
+++ b/common/bin/hgforest.sh	Thu Feb 21 17:43:57 2013 -0800
@@ -64,33 +64,33 @@
 mkdir -p ${tmp}
 
 safe_interrupt () {
-  if [ -d ${tmp} ]; then 
-    if [ "`ls ${tmp}`" != "" ]; then 
-      echo "Waiting for processes ( `cat ${tmp}/* | tr '\n' ' '`) to terminate nicely!"
+  if [ -d ${tmp} ]; then
+    if [ "`ls ${tmp}/*.pid`" != "" ]; then
+      echo "Waiting for processes ( `cat ${tmp}/*.pid | tr '\n' ' '`) to terminate nicely!"
       sleep 1
       # Pipe stderr to dev/null to silence kill, that complains when trying to kill
       # a subprocess that has already exited.
-      kill -TERM `cat ${tmp}/* | tr '\n' ' '` 2> /dev/null
-      wait 
-      echo Interrupt complete! 
-    fi 
+      kill -TERM `cat ${tmp}/*.pid | tr '\n' ' '` 2> /dev/null
+      wait
+      echo Interrupt complete!
+    fi
   fi
   rm -f -r ${tmp}
   exit 1
 }
 
 nice_exit () {
-  if [ -d ${tmp} ]; then 
-    if [ "`ls ${tmp}`" != "" ]; then 
-      wait 
-    fi 
+  if [ -d ${tmp} ]; then
+    if [ "`ls ${tmp}`" != "" ]; then
+      wait
+    fi
   fi
   rm -f -r ${tmp}
 }
 
 trap 'safe_interrupt' INT QUIT
 trap 'nice_exit' EXIT
- 
+
 # Only look in specific locations for possible forests (avoids long searches)
 pull_default=""
 repos=""
@@ -172,14 +172,26 @@
       if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
         pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`"
         echo ${hg} clone ${pull_newrepo} ${i}
-        ${hg} clone ${pull_newrepo} ${i} &
+        path="`dirname ${i}`"
+        if [ "${path}" != "." ] ; then
+          times=0
+          while [ ! -d "${path}" ]   ## nested repo, ensure containing dir exists
+          do
+            times=`expr ${times} '+' 1`
+            if [ `expr ${times} '%' 10` -eq 0 ] ; then
+              echo ${path} still not created, waiting...
+            fi
+            sleep 5
+          done
+        fi
+        (${hg} clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
       else
         echo "cd ${i} && ${hg} $*"
-        cd ${i} && ${hg} "$@" &
-      fi 
+        cd ${i} && (${hg} "$@"; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
+      fi
       echo $! > ${tmp}/${repopidfile}.pid
     ) 2>&1 | sed -e "s@^@${reponame}:   @") &
-  
+
   if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then
     sleep 2
     echo Waiting 5 secs before spawning next background command.
@@ -189,6 +201,15 @@
 # Wait for all hg commands to complete
 wait
 
-# Terminate with exit 0 all the time (hard to know when to say "failed")
-exit 0
-
+# Terminate with exit 0 only if all subprocesses were successful
+ec=0
+if [ -d ${tmp} ]; then
+  for rc in ${tmp}/*.pid.rc ; do
+    exit_code=`cat ${rc} | tr -d ' \n\r'`
+    if [ "${exit_code}" != "0" ] ; then
+      echo "WARNING: ${rc} exited abnormally."
+      ec=1
+    fi
+  done
+fi
+exit ${ec}
--- a/common/makefiles/Main.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/common/makefiles/Main.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -129,7 +129,9 @@
 	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
 	@$(call TargetExit)
 
-images: source-tips demos images-only
+# Note: This double-colon rule is intentional, to support
+# custom make file integration.
+images:: source-tips demos images-only
 images-only: start-make
 	@$(call TargetEnter)
 	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
@@ -141,6 +143,17 @@
 	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
 	@$(call TargetExit)
 
+profiles: profiles-oscheck source-tips jdk hotspot profiles-only
+profiles-only: start-make
+	@$(call TargetEnter)
+	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk profiles)
+	@$(call TargetExit)
+
+profiles-oscheck:
+ifneq ($(OPENJDK_TARGET_OS), linux)
+	@echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
+endif
+
 install: images install-only
 install-only: start-make
 	@$(call TargetEnter)
@@ -167,7 +180,7 @@
 
 test: start-make
 	@$(call TargetEnter)
-	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
+	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
 	@$(call TargetExit)
 
 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be
@@ -224,5 +237,6 @@
 .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only
 .PHONY: all test clean dist-clean bootcycle-images start-make
 .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-overlay-images clean-bootcycle-build
+.PHONY: profiles profiles-only profiles-oscheck
 
 FRC: # Force target
--- a/common/makefiles/javadoc/CORE_PKGS.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/common/makefiles/javadoc/CORE_PKGS.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -128,9 +128,9 @@
   java.text                                      \
   java.text.spi                                  \
   java.time                                      \
+  java.time.chrono                               \
+  java.time.format                               \
   java.time.temporal                             \
-  java.time.calendar                             \
-  java.time.format                               \
   java.time.zone                                 \
   java.util                                      \
   java.util.concurrent                           \
--- a/common/makefiles/javadoc/Javadoc.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/common/makefiles/javadoc/Javadoc.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -267,6 +267,7 @@
                 -use					\
                 -keywords				\
 		-Xdoclint:none				\
+                -Xprofilespath $(JDK_TOPDIR)/makefiles/profile-rtjar-includes.txt \
 		$(ADDITIONAL_JAVADOCFLAGS)
 
 ifdef OPENJDK
--- a/corba/.hgtags	Thu Feb 21 15:46:37 2013 -0800
+++ b/corba/.hgtags	Thu Feb 21 17:43:57 2013 -0800
@@ -198,3 +198,4 @@
 2132845cf5f717ff5c240a2431c0c0e03e66e3a5 jdk8-b74
 d4e68ce17795601017ac2f952baad7272942c36e jdk8-b75
 58be6ca3c0603882a1ec478724e337aac85e0da0 jdk8-b76
+35684a40c5845782324dbcc9ac8969528020ff61 jdk8-b77
--- a/get_source.sh	Thu Feb 21 15:46:37 2013 -0800
+++ b/get_source.sh	Thu Feb 21 17:43:57 2013 -0800
@@ -26,7 +26,7 @@
 #
 
 # Get clones of all nested repositories
-sh ./common/bin/hgforest.sh clone "$@"
+sh ./common/bin/hgforest.sh clone "$@" || exit 1
 
 # Update all existing repositories to the latest sources
 sh ./common/bin/hgforest.sh pull -u
--- a/hotspot/.hgtags	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/.hgtags	Thu Feb 21 17:43:57 2013 -0800
@@ -314,3 +314,5 @@
 6778d0b1659323a506ca47600ca29a9d9f8b383d jdk8-b75
 20b605466ccb1b3725eb25314d9e8782199630c5 jdk8-b76
 412d722168bc23f8e6d98995202728678561417f hs25-b18
+cdb46031e7184d37301288f5719121a63c7054b5 jdk8-b77
+9f19f4a7d48a4ebe7f616b6068971ea5f8b075fa hs25-b19
--- a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Thu Feb 21 17:43:57 2013 -0800
@@ -97,7 +97,8 @@
  * Method:    init0
  * Signature: ()V
  */
-JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0(JNIEnv *env, jclass cls) {
+JNIEXPORT void JNICALL 
+Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0(JNIEnv *env, jclass cls) {
   symbolicatorID = (*env)->GetFieldID(env, cls, "symbolicator", "J");
   taskID = (*env)->GetFieldID(env, cls, "task", "J");
   CHECK_EXCEPTION;
@@ -108,7 +109,11 @@
  * Method:    lookupByName0
  * Signature: (Ljava/lang/String;Ljava/lang/String;)J
  */
-JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0(JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) {
+JNIEXPORT jlong JNICALL 
+Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0(
+  JNIEnv *env, jobject this_obj, 
+  jstring objectName, jstring symbolName) 
+{
   jlong address = 0;
 
 JNF_COCOA_ENTER(env);
@@ -137,7 +142,11 @@
  * Method:    readBytesFromProcess0
  * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
  */
-JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0(JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) {
+JNIEXPORT jbyteArray JNICALL
+Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0(
+  JNIEnv *env, jobject this_obj, 
+  jlong addr, jlong numBytes) 
+{
   if (debug) printf("readBytesFromProcess called. addr = %llx numBytes = %lld\n", addr, numBytes);
 
   // must allocate storage instead of using former parameter buf
@@ -209,12 +218,74 @@
   return array;
 }
 
+
 /*
- * Class:     sun_jvm_hotspot_debugger_macosx_MacOSXDebuggerLocal
+ * Lookup the thread_t that corresponds to the given thread_id.
+ * The thread_id should be the result from calling thread_info() with THREAD_IDENTIFIER_INFO
+ * and reading the m_ident_info.thread_id returned.
+ * The returned thread_t is the mach send right to the kernel port for the corresponding thread.
+ *
+ * We cannot simply use the OSThread._thread_id field in the JVM. This is set to ::mach_thread_self()
+ * in the VM, but that thread port is not valid for a remote debugger to access the thread.
+ */
+thread_t
+lookupThreadFromThreadId(task_t task, jlong thread_id) {
+  if (debug) {
+    printf("lookupThreadFromThreadId thread_id=0x%llx\n", thread_id);
+  }
+  
+  thread_array_t thread_list = NULL;
+  mach_msg_type_number_t thread_list_count = 0;
+  thread_t result_thread = 0;
+  int i;
+  
+  // get the list of all the send rights
+  kern_return_t result = task_threads(task, &thread_list, &thread_list_count);
+  if (result != KERN_SUCCESS) {
+    if (debug) {
+      printf("task_threads returned 0x%x\n", result);
+    }
+    return 0;
+  }
+  
+  for(i = 0 ; i < thread_list_count; i++) {
+    thread_identifier_info_data_t m_ident_info;
+    mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
+
+    // get the THREAD_IDENTIFIER_INFO for the send right
+    result = thread_info(thread_list[i], THREAD_IDENTIFIER_INFO, (thread_info_t) &m_ident_info, &count);
+    if (result != KERN_SUCCESS) {
+      if (debug) {
+        printf("thread_info returned 0x%x\n", result);
+      }
+      break;
+    }
+    
+    // if this is the one we're looking for, return the send right
+    if (thread_id == m_ident_info.thread_id)
+    {
+      result_thread = thread_list[i];
+      break;
+    }
+  }
+  
+  vm_size_t thread_list_size = (vm_size_t) (thread_list_count * sizeof (thread_t));
+  vm_deallocate(mach_task_self(), (vm_address_t) thread_list, thread_list_count);
+  
+  return result_thread;
+}
+
+
+/*
+ * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
  * Method:    getThreadIntegerRegisterSet0
- * Signature: (I)[J
+ * Signature: (J)[J
  */
-JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0(JNIEnv *env, jobject this_obj, jint lwp_id) {
+JNIEXPORT jlongArray JNICALL 
+Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0(
+  JNIEnv *env, jobject this_obj, 
+  jlong thread_id) 
+{
   if (debug)
     printf("getThreadRegisterSet0 called\n");
 
@@ -226,8 +297,9 @@
   int i;
   jlongArray registerArray;
   jlong *primitiveArray;
+  task_t gTask = getTask(env, this_obj);
 
-  tid = lwp_id;
+  tid = lookupThreadFromThreadId(gTask, thread_id);
 
   result = thread_get_state(tid, HSDB_THREAD_STATE, (thread_state_t)&state, &count);
 
@@ -328,19 +400,21 @@
 }
 
 /*
- * Class:     sun_jvm_hotspot_debugger_macosx_MacOSXDebuggerLocal
+ * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
  * Method:    translateTID0
  * Signature: (I)I
  */
 JNIEXPORT jint JNICALL
-Java_sun_jvm_hotspot_debugger_macosx_MacOSXDebuggerLocal_translateTID0(JNIEnv *env, jobject this_obj, jint tid) {
+Java_sun_jvm_hotspot_debugger_macosx_MacOSXDebuggerLocal_translateTID0(
+  JNIEnv *env, jobject this_obj, jint tid) 
+{
   if (debug)
     printf("translateTID0 called on tid = 0x%x\n", (int)tid);
 
   kern_return_t result;
   thread_t foreign_tid, usable_tid;
   mach_msg_type_name_t type;
-    
+  
   foreign_tid = tid;
     
   task_t gTask = getTask(env, this_obj);
@@ -361,7 +435,10 @@
  * Method:    attach0
  * Signature: (I)V
  */
-JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I(JNIEnv *env, jobject this_obj, jint jpid) {
+JNIEXPORT void JNICALL 
+Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I(
+  JNIEnv *env, jobject this_obj, jint jpid) 
+{
 JNF_COCOA_ENTER(env);
   if (getenv("JAVA_SAPROC_DEBUG") != NULL)
     debug = JNI_TRUE;
@@ -401,7 +478,10 @@
  * Method:    detach0
  * Signature: ()V
  */
-JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0(JNIEnv *env, jobject this_obj) {
+JNIEXPORT void JNICALL 
+Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0(
+  JNIEnv *env, jobject this_obj) 
+{
 JNF_COCOA_ENTER(env);
   if (debug) printf("detach0 called\n");
 
@@ -419,10 +499,13 @@
  * Method:    load_library
  * Signature: (Ljava/lang/String;)L
  */
-JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_asm_Disassembler_load_1library(JNIEnv * env,
-                                                                           jclass disclass,
-                                                                           jstring jrepath_s,
-                                                                           jstring libname_s) {
+JNIEXPORT jlong JNICALL
+Java_sun_jvm_hotspot_asm_Disassembler_load_1library(
+  JNIEnv * env, 
+  jclass disclass,
+  jstring jrepath_s,
+  jstring libname_s) 
+{
   uintptr_t func = 0;
   const char* error_message = NULL;
   const char* java_home;
@@ -533,13 +616,16 @@
  * Method:    decode
  * Signature: (Lsun/jvm/hotspot/asm/InstructionVisitor;J[BLjava/lang/String;J)V
  */
-JNIEXPORT void JNICALL Java_sun_jvm_hotspot_asm_Disassembler_decode(JNIEnv * env,
-                                                                    jobject dis,
-                                                                    jobject visitor,
-                                                                    jlong startPc,
-                                                                    jbyteArray code,
-                                                                    jstring options_s,
-                                                                    jlong decode_instructions_virtual) {
+JNIEXPORT void JNICALL
+Java_sun_jvm_hotspot_asm_Disassembler_decode(
+   JNIEnv * env,
+   jobject dis,
+   jobject visitor,
+   jlong startPc,
+   jbyteArray code,
+   jstring options_s,
+   jlong decode_instructions_virtual) 
+{
   jboolean isCopy;
   jbyte* start = (*env)->GetByteArrayElements(env, code, &isCopy);
   jbyte* end = start + (*env)->GetArrayLength(env, code);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java	Thu Feb 21 17:43:57 2013 -0800
@@ -49,7 +49,7 @@
   public BsdAddress readCompKlassAddress(long address) throws DebuggerException;
   public BsdOopHandle readOopHandle(long address) throws DebuggerException;
   public BsdOopHandle readCompOopHandle(long address) throws DebuggerException;
-  public long[]       getThreadIntegerRegisterSet(int lwp_id) throws DebuggerException;
+  public long[]       getThreadIntegerRegisterSet(long unique_thread_id) throws DebuggerException;
   public long         getAddressValue(Address addr) throws DebuggerException;
   public Address      newAddress(long value) throws DebuggerException;
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java	Thu Feb 21 17:43:57 2013 -0800
@@ -90,7 +90,7 @@
                                 throws DebuggerException;
     private native ClosestSymbol lookupByAddress0(long address)
                                 throws DebuggerException;
-    private native long[] getThreadIntegerRegisterSet0(int lwp_id)
+    private native long[] getThreadIntegerRegisterSet0(long unique_thread_id)
                                 throws DebuggerException;
     private native byte[] readBytesFromProcess0(long address, long numBytes)
                                 throws DebuggerException;
@@ -400,10 +400,15 @@
     //
 
     /** From the ThreadAccess interface via Debugger and JVMDebugger */
+    public ThreadProxy getThreadForIdentifierAddress(Address threadIdAddr, Address uniqueThreadIdAddr) {
+        return new BsdThread(this, threadIdAddr, uniqueThreadIdAddr);
+    }
+    @Override
     public ThreadProxy getThreadForIdentifierAddress(Address addr) {
-        return new BsdThread(this, addr);
+        throw new RuntimeException("unimplemented");
     }
 
+
     /** From the ThreadAccess interface via Debugger and JVMDebugger */
     public ThreadProxy getThreadForThreadId(long id) {
         return new BsdThread(this, id);
@@ -455,22 +460,22 @@
     // Thread context access
     //
 
-    public synchronized long[] getThreadIntegerRegisterSet(int lwp_id)
+    public synchronized long[] getThreadIntegerRegisterSet(long unique_thread_id)
                                             throws DebuggerException {
         requireAttach();
         if (isCore) {
-            return getThreadIntegerRegisterSet0(lwp_id);
+            return getThreadIntegerRegisterSet0(unique_thread_id);
         } else {
             class GetThreadIntegerRegisterSetTask implements WorkerThreadTask {
-                int lwp_id;
+                long unique_thread_id;
                 long[] result;
                 public void doit(BsdDebuggerLocal debugger) {
-                    result = debugger.getThreadIntegerRegisterSet0(lwp_id);
+                    result = debugger.getThreadIntegerRegisterSet0(unique_thread_id);
                 }
             }
 
             GetThreadIntegerRegisterSetTask task = new GetThreadIntegerRegisterSetTask();
-            task.lwp_id = lwp_id;
+            task.unique_thread_id = unique_thread_id;
             workerThread.execute(task);
             return task.result;
         }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThread.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThread.java	Thu Feb 21 17:43:57 2013 -0800
@@ -28,21 +28,23 @@
 
 class BsdThread implements ThreadProxy {
     private BsdDebugger debugger;
-    private int           lwp_id;
+    private int         thread_id;
+    private long        unique_thread_id;
 
     /** The address argument must be the address of the _thread_id in the
         OSThread. It's value is result ::gettid() call. */
-    BsdThread(BsdDebugger debugger, Address addr) {
+    BsdThread(BsdDebugger debugger, Address threadIdAddr, Address uniqueThreadIdAddr) {
         this.debugger = debugger;
         // FIXME: size of data fetched here should be configurable.
         // However, making it so would produce a dependency on the "types"
         // package from the debugger package, which is not desired.
-        this.lwp_id = (int) addr.getCIntegerAt(0, 4, true);
+        this.thread_id = (int) threadIdAddr.getCIntegerAt(0, 4, true);
+        this.unique_thread_id = uniqueThreadIdAddr.getCIntegerAt(0, 8, true);
     }
 
     BsdThread(BsdDebugger debugger, long id) {
         this.debugger = debugger;
-        this.lwp_id = (int) id;
+        this.thread_id = (int) id;
     }
 
     public boolean equals(Object obj) {
@@ -50,19 +52,19 @@
             return false;
         }
 
-        return (((BsdThread) obj).lwp_id == lwp_id);
+        return (((BsdThread) obj).thread_id == thread_id);
     }
 
     public int hashCode() {
-        return lwp_id;
+        return thread_id;
     }
 
     public String toString() {
-        return Integer.toString(lwp_id);
+        return Integer.toString(thread_id);
     }
 
     public ThreadContext getContext() throws IllegalThreadStateException {
-        long[] data = debugger.getThreadIntegerRegisterSet(lwp_id);
+        long[] data = debugger.getThreadIntegerRegisterSet(unique_thread_id);
         ThreadContext context = BsdThreadContextFactory.createThreadContext(debugger);
         for (int i = 0; i < data.length; i++) {
             context.setRegister(i, data[i]);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -49,12 +49,18 @@
   private static int HAS_LOCALVARIABLE_TABLE;
   private static int HAS_EXCEPTION_TABLE;
   private static int HAS_GENERIC_SIGNATURE;
+  private static int HAS_METHOD_ANNOTATIONS;
+  private static int HAS_PARAMETER_ANNOTATIONS;
+  private static int HAS_DEFAULT_ANNOTATIONS;
+  private static int HAS_TYPE_ANNOTATIONS;
+
+  private static final int sizeofShort = 2;
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
     Type type                  = db.lookupType("ConstMethod");
     constants                  = new MetadataField(type.getAddressField("_constants"), 0);
     constMethodSize            = new CIntField(type.getCIntegerField("_constMethod_size"), 0);
-    flags                      = new ByteField(type.getJByteField("_flags"), 0);
+    flags                      = new CIntField(type.getCIntegerField("_flags"), 0);
 
     // enum constants for flags
     HAS_LINENUMBER_TABLE      = db.lookupIntConstant("ConstMethod::_has_linenumber_table").intValue();
@@ -62,6 +68,10 @@
     HAS_LOCALVARIABLE_TABLE   = db.lookupIntConstant("ConstMethod::_has_localvariable_table").intValue();
     HAS_EXCEPTION_TABLE       = db.lookupIntConstant("ConstMethod::_has_exception_table").intValue();
     HAS_GENERIC_SIGNATURE     = db.lookupIntConstant("ConstMethod::_has_generic_signature").intValue();
+    HAS_METHOD_ANNOTATIONS    = db.lookupIntConstant("ConstMethod::_has_method_annotations").intValue();
+    HAS_PARAMETER_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_parameter_annotations").intValue();
+    HAS_DEFAULT_ANNOTATIONS   = db.lookupIntConstant("ConstMethod::_has_default_annotations").intValue();
+    HAS_TYPE_ANNOTATIONS      = db.lookupIntConstant("ConstMethod::_has_type_annotations").intValue();
 
     // Size of Java bytecodes allocated immediately after ConstMethod*.
     codeSize                   = new CIntField(type.getCIntegerField("_code_size"), 0);
@@ -92,7 +102,7 @@
   // Fields
   private static MetadataField constants;
   private static CIntField constMethodSize;
-  private static ByteField flags;
+  private static CIntField flags;
   private static CIntField codeSize;
   private static CIntField nameIndex;
   private static CIntField signatureIndex;
@@ -123,7 +133,7 @@
     return constMethodSize.getValue(this);
   }
 
-  public byte getFlags() {
+  public long getFlags() {
     return flags.getValue(this);
   }
 
@@ -253,7 +263,7 @@
   public void iterateFields(MetadataVisitor visitor) {
     visitor.doMetadata(constants, true);
       visitor.doCInt(constMethodSize, true);
-      visitor.doByte(flags, true);
+      visitor.doCInt(flags, true);
       visitor.doCInt(codeSize, true);
       visitor.doCInt(nameIndex, true);
       visitor.doCInt(signatureIndex, true);
@@ -381,6 +391,22 @@
     return (getFlags() & HAS_GENERIC_SIGNATURE) != 0;
   }
 
+  private boolean hasMethodAnnotations() {
+    return (getFlags() & HAS_METHOD_ANNOTATIONS) != 0;
+  }
+
+  private boolean hasParameterAnnotations() {
+    return (getFlags() & HAS_PARAMETER_ANNOTATIONS) != 0;
+  }
+
+  private boolean hasDefaultAnnotations() {
+    return (getFlags() & HAS_DEFAULT_ANNOTATIONS) != 0;
+  }
+
+  private boolean hasTypeAnnotations() {
+    return (getFlags() & HAS_TYPE_ANNOTATIONS) != 0;
+  }
+
 
   //---------------------------------------------------------------------------
   // Internals only below this point
@@ -400,9 +426,15 @@
     return offsetOfCodeEnd() + (isNative() ? 2 * VM.getVM().getAddressSize() : 0);
   }
 
-  // Offset of last short in Method*
+  // Offset of last short in Method* before annotations, if present
   private long offsetOfLastU2Element() {
-    return getSize() * VM.getVM().getObjectHeap().getOopSize() - 2;
+    int offset = 0;
+    if (hasMethodAnnotations()) offset++;
+    if (hasParameterAnnotations()) offset++;
+    if (hasTypeAnnotations()) offset++;
+    if (hasDefaultAnnotations()) offset++;
+    long wordSize = VM.getVM().getObjectHeap().getOopSize();
+    return (getSize() * wordSize) - (offset * wordSize) - sizeofShort;
   }
 
   // Offset of the generic signature index
@@ -411,7 +443,7 @@
   }
 
   private long offsetOfCheckedExceptionsLength() {
-    return hasGenericSignature() ? offsetOfLastU2Element() - 2 :
+    return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
                                    offsetOfLastU2Element();
   }
 
@@ -461,11 +493,11 @@
     }
 
     if (hasExceptionTable()) {
-      return offsetOfExceptionTable() - 2;
+      return offsetOfExceptionTable() - sizeofShort;
     } else if (hasCheckedExceptions()) {
-      return offsetOfCheckedExceptions() - 2;
+      return offsetOfCheckedExceptions() - sizeofShort;
     } else {
-      return hasGenericSignature() ? offsetOfLastU2Element() - 2 :
+      return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
                                      offsetOfLastU2Element();
     }
   }
@@ -493,9 +525,9 @@
       Assert.that(hasExceptionTable(), "should only be called if table is present");
     }
     if (hasCheckedExceptions()) {
-      return offsetOfCheckedExceptions() - 2;
+      return offsetOfCheckedExceptions() - sizeofShort;
     } else {
-      return hasGenericSignature() ? offsetOfLastU2Element() - 2 :
+      return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
                                      offsetOfLastU2Element();
     }
   }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java	Thu Feb 21 17:43:57 2013 -0800
@@ -28,6 +28,8 @@
 import java.util.*;
 import sun.jvm.hotspot.debugger.*;
 import sun.jvm.hotspot.debugger.amd64.*;
+import sun.jvm.hotspot.debugger.bsd.BsdDebugger;
+import sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.runtime.amd64.*;
 import sun.jvm.hotspot.runtime.x86.*;
@@ -38,8 +40,9 @@
   private static AddressField  lastJavaFPField;
   private static AddressField  osThreadField;
 
-  // Field from OSThread
+  // Fields from OSThread
   private static CIntegerField osThreadThreadIDField;
+  private static CIntegerField osThreadUniqueThreadIDField;
 
   // This is currently unneeded but is being kept in case we change
   // the currentFrameGuess algorithm
@@ -61,7 +64,8 @@
     lastJavaFPField         = anchorType.getAddressField("_last_Java_fp");
 
     Type osThreadType = db.lookupType("OSThread");
-    osThreadThreadIDField   = osThreadType.getCIntegerField("_thread_id");
+    osThreadThreadIDField = osThreadType.getCIntegerField("_thread_id");
+    osThreadUniqueThreadIDField = osThreadType.getCIntegerField("_unique_thread_id");
   }
 
   public    Address getLastJavaFP(Address addr) {
@@ -125,8 +129,9 @@
     Address osThreadAddr = osThreadField.getValue(addr);
     // Get the address of the _thread_id from the OSThread
     Address threadIdAddr = osThreadAddr.addOffsetTo(osThreadThreadIDField.getOffset());
+    Address uniqueThreadIdAddr = osThreadAddr.addOffsetTo(osThreadUniqueThreadIDField.getOffset());
 
-    JVMDebugger debugger = VM.getVM().getDebugger();
-    return debugger.getThreadForIdentifierAddress(threadIdAddr);
+    BsdDebuggerLocal debugger = (BsdDebuggerLocal) VM.getVM().getDebugger();
+    return debugger.getThreadForIdentifierAddress(threadIdAddr, uniqueThreadIdAddr);
   }
 }
--- a/hotspot/make/hotspot_version	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/make/hotspot_version	Thu Feb 21 17:43:57 2013 -0800
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=18
+HS_BUILD_NUMBER=19
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -2270,10 +2270,11 @@
 }
 
 void Assembler::vpermq(XMMRegister dst, XMMRegister src, int imm8, bool vector256) {
-    int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, true, vector256);
-    emit_int8(0x00);
-    emit_int8(0xC0 | encode);
-    emit_int8(imm8);
+  assert(VM_Version::supports_avx2(), "");
+  int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, true, vector256);
+  emit_int8(0x00);
+  emit_int8(0xC0 | encode);
+  emit_int8(imm8);
 }
 
 void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) {
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -5691,7 +5691,7 @@
   Address::ScaleFactor scale = Address::times_2;
   int stride = 8;
 
-  if (UseAVX >= 2) {
+  if (UseAVX >= 2 && UseSSE42Intrinsics) {
     Label COMPARE_WIDE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_WIDE_TAIL, COMPARE_SMALL_STR;
     Label COMPARE_WIDE_VECTORS_LOOP, COMPARE_16_CHARS, COMPARE_INDEX_CHAR;
     Label COMPARE_TAIL_LONG;
--- a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
  * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -51,7 +51,7 @@
 define_pd_global(intx,     OnStackReplacePercentage,     933  );
 define_pd_global(intx,     FreqInlineSize,               325  );
 define_pd_global(intx,     InlineSmallCode,              1000 );
-define_pd_global(intx,     NewRatio,                     12   );
+define_pd_global(uintx,    NewRatio,                     12   );
 define_pd_global(intx,     NewSizeThreadIncrease,        4*K  );
 define_pd_global(intx,     InitialCodeCacheSize,         160*K);
 define_pd_global(intx,     ReservedCodeCacheSize,        32*M );
--- a/hotspot/src/os/bsd/vm/osThread_bsd.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/os/bsd/vm/osThread_bsd.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -49,6 +49,11 @@
   // (e.g. pthread_kill).
   pthread_t _pthread_id;
 
+  // This is the "thread_id" from struct thread_identifier_info. According to a
+  // comment in thread_info.h, this is a "system-wide unique 64-bit thread id".
+  // The value is used by SA to correlate threads.
+  uint64_t _unique_thread_id;
+
   sigset_t _caller_sigmask; // Caller's signal mask
 
  public:
@@ -77,6 +82,10 @@
     _pthread_id = tid;
   }
 
+  void set_unique_thread_id(uint64_t id) {
+    _unique_thread_id = id;
+  }
+
   // ***************************************************************
   // suspension support.
   // ***************************************************************
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -657,6 +657,18 @@
 objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction = NULL;
 #endif
 
+#ifdef __APPLE__
+static uint64_t locate_unique_thread_id() {
+  // Additional thread_id used to correlate threads in SA
+  thread_identifier_info_data_t     m_ident_info;
+  mach_msg_type_number_t            count = THREAD_IDENTIFIER_INFO_COUNT;
+
+  thread_info(::mach_thread_self(), THREAD_IDENTIFIER_INFO,
+              (thread_info_t) &m_ident_info, &count);
+  return m_ident_info.thread_id;
+}
+#endif
+
 // Thread start routine for all newly created threads
 static void *java_start(Thread *thread) {
   // Try to randomize the cache line index of hot stack frames.
@@ -685,6 +697,7 @@
 #ifdef __APPLE__
   // thread_id is mach thread on macos
   osthread->set_thread_id(::mach_thread_self());
+  osthread->set_unique_thread_id(locate_unique_thread_id());
 #else
   // thread_id is pthread_id on BSD
   osthread->set_thread_id(::pthread_self());
@@ -847,6 +860,7 @@
   // Store pthread info into the OSThread
 #ifdef __APPLE__
   osthread->set_thread_id(::mach_thread_self());
+  osthread->set_unique_thread_id(locate_unique_thread_id());
 #else
   osthread->set_thread_id(::pthread_self());
 #endif
--- a/hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -42,7 +42,7 @@
 #endif // AMD64
 
 define_pd_global(intx, CompilerThreadStackSize,  0);
-define_pd_global(intx, SurvivorRatio,            8);
+define_pd_global(uintx, SurvivorRatio,           8);
 
 define_pd_global(uintx, JVMInvokeMethodSlack,    8192);
 
--- a/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -35,17 +35,16 @@
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
   nonstatic_field(OSThread,                      _thread_id,                                      OSThread::thread_id_t)             \
-  nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)
+  nonstatic_field(OSThread,                      _unique_thread_id,                               uint64_t)
 
 
 #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
                                                                           \
   /**********************/                                                \
-  /* Posix Thread IDs   */                                                \
+  /* Thread IDs         */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
-  declare_unsigned_integer_type(pthread_t)
+  declare_unsigned_integer_type(OSThread::thread_id_t)
 
 #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
--- a/hotspot/src/share/tools/whitebox/sun/hotspot/WhiteBox.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/tools/whitebox/sun/hotspot/WhiteBox.java	Thu Feb 21 17:43:57 2013 -0800
@@ -23,6 +23,8 @@
  */
 
 package sun.hotspot;
+
+import java.lang.reflect.Method;
 import java.security.BasicPermission;
 import sun.hotspot.parser.DiagnosticCommand;
 
@@ -81,4 +83,15 @@
   public native boolean NMTAllocTest();
   public native boolean NMTFreeTestMemory();
   public native boolean NMTWaitForDataMerge();
+
+  // Compiler
+  public native void    deoptimizeAll();
+  public native boolean isMethodCompiled(Method method);
+  public native boolean isMethodCompilable(Method method);
+  public native boolean isMethodQueuedForCompilation(Method method);
+  public native int     deoptimizeMethod(Method method);
+  public native void    makeMethodNotCompilable(Method method);
+  public native int     getMethodCompilationLevel(Method method);
+  public native boolean setDontInlineMethod(Method method, boolean value);
+  public native int     getCompileQueuesSize();
 }
--- a/hotspot/src/share/vm/asm/macroAssembler.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/asm/macroAssembler.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -37,10 +37,10 @@
 # include "assembler_zero.hpp"
 #endif
 #ifdef TARGET_ARCH_arm
-# include "assembler_arm.hpp"
+# include "macroAssembler_arm.hpp"
 #endif
 #ifdef TARGET_ARCH_ppc
-# include "assembler_ppc.hpp"
+# include "macroAssembler_ppc.hpp"
 #endif
 
 #endif // SHARE_VM_ASM_MACROASSEMBLER_HPP
--- a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -37,10 +37,10 @@
 # include "assembler_zero.inline.hpp"
 #endif
 #ifdef TARGET_ARCH_arm
-# include "assembler_arm.inline.hpp"
+# include "macroAssembler_arm.inline.hpp"
 #endif
 #ifdef TARGET_ARCH_ppc
-# include "assembler_ppc.inline.hpp"
+# include "macroAssembler_ppc.inline.hpp"
 #endif
 
 #endif // SHARE_VM_ASM_MACROASSEMBLER_INLINE_HPP
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1856,6 +1856,154 @@
 #define MAX_CODE_SIZE 65535
 #define INITIAL_MAX_LVT_NUMBER 256
 
+/* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
+ *
+ * Rules for LVT's and LVTT's are:
+ *   - There can be any number of LVT's and LVTT's.
+ *   - If there are n LVT's, it is the same as if there was just
+ *     one LVT containing all the entries from the n LVT's.
+ *   - There may be no more than one LVT entry per local variable.
+ *     Two LVT entries are 'equal' if these fields are the same:
+ *        start_pc, length, name, slot
+ *   - There may be no more than one LVTT entry per each LVT entry.
+ *     Each LVTT entry has to match some LVT entry.
+ *   - HotSpot internal LVT keeps natural ordering of class file LVT entries.
+ */
+void ClassFileParser::copy_localvariable_table(ConstMethod* cm,
+                                               int lvt_cnt,
+                                               u2* localvariable_table_length,
+                                               u2** localvariable_table_start,
+                                               int lvtt_cnt,
+                                               u2* localvariable_type_table_length,
+                                               u2** localvariable_type_table_start,
+                                               TRAPS) {
+
+  LVT_Hash** lvt_Hash = NEW_RESOURCE_ARRAY(LVT_Hash*, HASH_ROW_SIZE);
+  initialize_hashtable(lvt_Hash);
+
+  // To fill LocalVariableTable in
+  Classfile_LVT_Element*  cf_lvt;
+  LocalVariableTableElement* lvt = cm->localvariable_table_start();
+
+  for (int tbl_no = 0; tbl_no < lvt_cnt; tbl_no++) {
+    cf_lvt = (Classfile_LVT_Element *) localvariable_table_start[tbl_no];
+    for (int idx = 0; idx < localvariable_table_length[tbl_no]; idx++, lvt++) {
+      copy_lvt_element(&cf_lvt[idx], lvt);
+      // If no duplicates, add LVT elem in hashtable lvt_Hash.
+      if (LVT_put_after_lookup(lvt, lvt_Hash) == false
+          && _need_verify
+          && _major_version >= JAVA_1_5_VERSION) {
+        clear_hashtable(lvt_Hash);
+        ConstantPool* cp = cm->constants();
+        classfile_parse_error("Duplicated LocalVariableTable attribute "
+                              "entry for '%s' in class file %s",
+                               cp->symbol_at(lvt->name_cp_index)->as_utf8(),
+                               CHECK);
+      }
+    }
+  }
+
+  // To merge LocalVariableTable and LocalVariableTypeTable
+  Classfile_LVT_Element* cf_lvtt;
+  LocalVariableTableElement lvtt_elem;
+
+  for (int tbl_no = 0; tbl_no < lvtt_cnt; tbl_no++) {
+    cf_lvtt = (Classfile_LVT_Element *) localvariable_type_table_start[tbl_no];
+    for (int idx = 0; idx < localvariable_type_table_length[tbl_no]; idx++) {
+      copy_lvt_element(&cf_lvtt[idx], &lvtt_elem);
+      int index = hash(&lvtt_elem);
+      LVT_Hash* entry = LVT_lookup(&lvtt_elem, index, lvt_Hash);
+      if (entry == NULL) {
+        if (_need_verify) {
+          clear_hashtable(lvt_Hash);
+          ConstantPool* cp = cm->constants();
+          classfile_parse_error("LVTT entry for '%s' in class file %s "
+                                "does not match any LVT entry",
+                                 cp->symbol_at(lvtt_elem.name_cp_index)->as_utf8(),
+                                 CHECK);
+        }
+      } else if (entry->_elem->signature_cp_index != 0 && _need_verify) {
+        clear_hashtable(lvt_Hash);
+        ConstantPool* cp = cm->constants();
+        classfile_parse_error("Duplicated LocalVariableTypeTable attribute "
+                              "entry for '%s' in class file %s",
+                               cp->symbol_at(lvtt_elem.name_cp_index)->as_utf8(),
+                               CHECK);
+      } else {
+        // to add generic signatures into LocalVariableTable
+        entry->_elem->signature_cp_index = lvtt_elem.descriptor_cp_index;
+      }
+    }
+  }
+  clear_hashtable(lvt_Hash);
+}
+
+
+void ClassFileParser::copy_method_annotations(ClassLoaderData* loader_data,
+                                       ConstMethod* cm,
+                                       u1* runtime_visible_annotations,
+                                       int runtime_visible_annotations_length,
+                                       u1* runtime_invisible_annotations,
+                                       int runtime_invisible_annotations_length,
+                                       u1* runtime_visible_parameter_annotations,
+                                       int runtime_visible_parameter_annotations_length,
+                                       u1* runtime_invisible_parameter_annotations,
+                                       int runtime_invisible_parameter_annotations_length,
+                                       u1* runtime_visible_type_annotations,
+                                       int runtime_visible_type_annotations_length,
+                                       u1* runtime_invisible_type_annotations,
+                                       int runtime_invisible_type_annotations_length,
+                                       u1* annotation_default,
+                                       int annotation_default_length,
+                                       TRAPS) {
+
+  AnnotationArray* a;
+
+  if (runtime_visible_annotations_length +
+      runtime_invisible_annotations_length > 0) {
+     a = assemble_annotations(loader_data,
+                              runtime_visible_annotations,
+                              runtime_visible_annotations_length,
+                              runtime_invisible_annotations,
+                              runtime_invisible_annotations_length,
+                              CHECK);
+     cm->set_method_annotations(a);
+  }
+
+  if (runtime_visible_parameter_annotations_length +
+      runtime_invisible_parameter_annotations_length > 0) {
+    a = assemble_annotations(loader_data,
+                             runtime_visible_parameter_annotations,
+                             runtime_visible_parameter_annotations_length,
+                             runtime_invisible_parameter_annotations,
+                             runtime_invisible_parameter_annotations_length,
+                             CHECK);
+    cm->set_parameter_annotations(a);
+  }
+
+  if (annotation_default_length > 0) {
+    a = assemble_annotations(loader_data,
+                             annotation_default,
+                             annotation_default_length,
+                             NULL,
+                             0,
+                             CHECK);
+    cm->set_default_annotations(a);
+  }
+
+  if (runtime_visible_type_annotations_length +
+      runtime_invisible_type_annotations_length > 0) {
+    a = assemble_annotations(loader_data,
+                             runtime_visible_type_annotations,
+                             runtime_visible_type_annotations_length,
+                             runtime_invisible_type_annotations,
+                             runtime_invisible_type_annotations_length,
+                             CHECK);
+    cm->set_type_annotations(a);
+  }
+}
+
+
 // Note: the parse_method below is big and clunky because all parsing of the code and exceptions
 // attribute is inlined. This is cumbersome to avoid since we inline most of the parts in the
 // Method* to save footprint, so we only know the size of the resulting Method* when the
@@ -1869,10 +2017,6 @@
                                            constantPoolHandle cp,
                                            bool is_interface,
                                            AccessFlags *promoted_flags,
-                                           AnnotationArray** method_annotations,
-                                           AnnotationArray** method_parameter_annotations,
-                                           AnnotationArray** method_default_annotations,
-                                           AnnotationArray** method_type_annotations,
                                            TRAPS) {
   ClassFileStream* cfs = stream();
   methodHandle nullHandle;
@@ -2273,10 +2417,24 @@
   }
 
   // All sizing information for a Method* is finally available, now create it
+  InlineTableSizes sizes(
+      total_lvt_length,
+      linenumber_table_length,
+      exception_table_length,
+      checked_exceptions_length,
+      method_parameters_length,
+      generic_signature_index,
+      runtime_visible_annotations_length +
+           runtime_invisible_annotations_length,
+      runtime_visible_parameter_annotations_length +
+           runtime_invisible_parameter_annotations_length,
+      runtime_visible_type_annotations_length +
+           runtime_invisible_type_annotations_length,
+      annotation_default_length,
+      0);
+
   Method* m = Method::allocate(
-      loader_data, code_length, access_flags, linenumber_table_length,
-      total_lvt_length, exception_table_length, checked_exceptions_length,
-      method_parameters_length, generic_signature_index,
+      loader_data, code_length, access_flags, &sizes,
       ConstMethod::NORMAL, CHECK_(nullHandle));
 
   ClassLoadingService::add_class_method_size(m->size()*HeapWordSize);
@@ -2347,107 +2505,37 @@
     copy_u2_with_conversion((u2*) m->checked_exceptions_start(), checked_exceptions_start, size);
   }
 
-  /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
-   *
-   * Rules for LVT's and LVTT's are:
-   *   - There can be any number of LVT's and LVTT's.
-   *   - If there are n LVT's, it is the same as if there was just
-   *     one LVT containing all the entries from the n LVT's.
-   *   - There may be no more than one LVT entry per local variable.
-   *     Two LVT entries are 'equal' if these fields are the same:
-   *        start_pc, length, name, slot
-   *   - There may be no more than one LVTT entry per each LVT entry.
-   *     Each LVTT entry has to match some LVT entry.
-   *   - HotSpot internal LVT keeps natural ordering of class file LVT entries.
-   */
+  // Copy class file LVT's/LVTT's into the HotSpot internal LVT.
   if (total_lvt_length > 0) {
-    int tbl_no, idx;
-
     promoted_flags->set_has_localvariable_table();
-
-    LVT_Hash** lvt_Hash = NEW_RESOURCE_ARRAY(LVT_Hash*, HASH_ROW_SIZE);
-    initialize_hashtable(lvt_Hash);
-
-    // To fill LocalVariableTable in
-    Classfile_LVT_Element*  cf_lvt;
-    LocalVariableTableElement* lvt = m->localvariable_table_start();
-
-    for (tbl_no = 0; tbl_no < lvt_cnt; tbl_no++) {
-      cf_lvt = (Classfile_LVT_Element *) localvariable_table_start[tbl_no];
-      for (idx = 0; idx < localvariable_table_length[tbl_no]; idx++, lvt++) {
-        copy_lvt_element(&cf_lvt[idx], lvt);
-        // If no duplicates, add LVT elem in hashtable lvt_Hash.
-        if (LVT_put_after_lookup(lvt, lvt_Hash) == false
-          && _need_verify
-          && _major_version >= JAVA_1_5_VERSION ) {
-          clear_hashtable(lvt_Hash);
-          classfile_parse_error("Duplicated LocalVariableTable attribute "
-                                "entry for '%s' in class file %s",
-                                 cp->symbol_at(lvt->name_cp_index)->as_utf8(),
-                                 CHECK_(nullHandle));
-        }
-      }
-    }
-
-    // To merge LocalVariableTable and LocalVariableTypeTable
-    Classfile_LVT_Element* cf_lvtt;
-    LocalVariableTableElement lvtt_elem;
-
-    for (tbl_no = 0; tbl_no < lvtt_cnt; tbl_no++) {
-      cf_lvtt = (Classfile_LVT_Element *) localvariable_type_table_start[tbl_no];
-      for (idx = 0; idx < localvariable_type_table_length[tbl_no]; idx++) {
-        copy_lvt_element(&cf_lvtt[idx], &lvtt_elem);
-        int index = hash(&lvtt_elem);
-        LVT_Hash* entry = LVT_lookup(&lvtt_elem, index, lvt_Hash);
-        if (entry == NULL) {
-          if (_need_verify) {
-            clear_hashtable(lvt_Hash);
-            classfile_parse_error("LVTT entry for '%s' in class file %s "
-                                  "does not match any LVT entry",
-                                   cp->symbol_at(lvtt_elem.name_cp_index)->as_utf8(),
-                                   CHECK_(nullHandle));
-          }
-        } else if (entry->_elem->signature_cp_index != 0 && _need_verify) {
-          clear_hashtable(lvt_Hash);
-          classfile_parse_error("Duplicated LocalVariableTypeTable attribute "
-                                "entry for '%s' in class file %s",
-                                 cp->symbol_at(lvtt_elem.name_cp_index)->as_utf8(),
-                                 CHECK_(nullHandle));
-        } else {
-          // to add generic signatures into LocalVariableTable
-          entry->_elem->signature_cp_index = lvtt_elem.descriptor_cp_index;
-        }
-      }
-    }
-    clear_hashtable(lvt_Hash);
+    copy_localvariable_table(m->constMethod(), lvt_cnt,
+                             localvariable_table_length,
+                             localvariable_table_start,
+                             lvtt_cnt,
+                             localvariable_type_table_length,
+                             localvariable_type_table_start, CHECK_NULL);
   }
 
   if (parsed_annotations.has_any_annotations())
     parsed_annotations.apply_to(m);
-  *method_annotations = assemble_annotations(loader_data,
-                                             runtime_visible_annotations,
-                                             runtime_visible_annotations_length,
-                                             runtime_invisible_annotations,
-                                             runtime_invisible_annotations_length,
-                                             CHECK_(nullHandle));
-  *method_parameter_annotations = assemble_annotations(loader_data,
-                                                       runtime_visible_parameter_annotations,
-                                                       runtime_visible_parameter_annotations_length,
-                                                       runtime_invisible_parameter_annotations,
-                                                       runtime_invisible_parameter_annotations_length,
-                                                       CHECK_(nullHandle));
-  *method_default_annotations = assemble_annotations(loader_data,
-                                                     annotation_default,
-                                                     annotation_default_length,
-                                                     NULL,
-                                                     0,
-                                                     CHECK_(nullHandle));
-  *method_type_annotations = assemble_annotations(loader_data,
-                                                  runtime_visible_type_annotations,
-                                                  runtime_visible_type_annotations_length,
-                                                  runtime_invisible_type_annotations,
-                                                  runtime_invisible_type_annotations_length,
-                                                  CHECK_(nullHandle));
+
+  // Copy annotations
+  copy_method_annotations(loader_data, m->constMethod(),
+                          runtime_visible_annotations,
+                          runtime_visible_annotations_length,
+                          runtime_invisible_annotations,
+                          runtime_invisible_annotations_length,
+                          runtime_visible_parameter_annotations,
+                          runtime_visible_parameter_annotations_length,
+                          runtime_invisible_parameter_annotations,
+                          runtime_invisible_parameter_annotations_length,
+                          runtime_visible_type_annotations,
+                          runtime_visible_type_annotations_length,
+                          runtime_invisible_type_annotations,
+                          runtime_invisible_type_annotations_length,
+                          annotation_default,
+                          annotation_default_length,
+                          CHECK_NULL);
 
   if (name == vmSymbols::finalize_method_name() &&
       signature == vmSymbols::void_method_signature()) {
@@ -2463,6 +2551,7 @@
     _has_vanilla_constructor = true;
   }
 
+  NOT_PRODUCT(m->verify());
   return m;
 }
 
@@ -2476,17 +2565,9 @@
                                                bool is_interface,
                                                AccessFlags* promoted_flags,
                                                bool* has_final_method,
-                                               Array<AnnotationArray*>** methods_annotations,
-                                               Array<AnnotationArray*>** methods_parameter_annotations,
-                                               Array<AnnotationArray*>** methods_default_annotations,
-                                               Array<AnnotationArray*>** methods_type_annotations,
                                                bool* has_default_methods,
                                                TRAPS) {
   ClassFileStream* cfs = stream();
-  AnnotationArray* method_annotations = NULL;
-  AnnotationArray* method_parameter_annotations = NULL;
-  AnnotationArray* method_default_annotations = NULL;
-  AnnotationArray* method_type_annotations = NULL;
   cfs->guarantee_more(2, CHECK_NULL);  // length
   u2 length = cfs->get_u2_fast();
   if (length == 0) {
@@ -2500,10 +2581,6 @@
       methodHandle method = parse_method(loader_data,
                                          cp, is_interface,
                                          promoted_flags,
-                                         &method_annotations,
-                                         &method_parameter_annotations,
-                                         &method_default_annotations,
-                                         &method_type_annotations,
                                          CHECK_NULL);
 
       if (method->is_final()) {
@@ -2514,38 +2591,6 @@
         *has_default_methods = true;
       }
       methods->at_put(index, method());
-
-      if (method_annotations != NULL) {
-        if (*methods_annotations == NULL) {
-          *methods_annotations =
-              MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
-        }
-        (*methods_annotations)->at_put(index, method_annotations);
-      }
-
-      if (method_parameter_annotations != NULL) {
-        if (*methods_parameter_annotations == NULL) {
-          *methods_parameter_annotations =
-              MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
-        }
-        (*methods_parameter_annotations)->at_put(index, method_parameter_annotations);
-      }
-
-      if (method_default_annotations != NULL) {
-        if (*methods_default_annotations == NULL) {
-          *methods_default_annotations =
-              MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
-        }
-        (*methods_default_annotations)->at_put(index, method_default_annotations);
-      }
-
-      if (method_type_annotations != NULL) {
-        if (*methods_type_annotations == NULL) {
-          *methods_type_annotations =
-              MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
-        }
-        (*methods_type_annotations)->at_put(index, method_type_annotations);
-      }
     }
 
     if (_need_verify && length > 1) {
@@ -2578,11 +2623,7 @@
 
 Array<int>* ClassFileParser::sort_methods(ClassLoaderData* loader_data,
                                           Array<Method*>* methods,
-                                          Array<AnnotationArray*>* methods_annotations,
-                                          Array<AnnotationArray*>* methods_parameter_annotations,
-                                          Array<AnnotationArray*>* methods_default_annotations,
-                                          Array<AnnotationArray*>* methods_type_annotations,
-                                              TRAPS) {
+                                          TRAPS) {
   int length = methods->length();
   // If JVMTI original method ordering or sharing is enabled we have to
   // remember the original class file ordering.
@@ -2598,10 +2639,7 @@
   }
   // Sort method array by ascending method name (for faster lookups & vtable construction)
   // Note that the ordering is not alphabetical, see Symbol::fast_compare
-  Method::sort_methods(methods, methods_annotations,
-                       methods_parameter_annotations,
-                       methods_default_annotations,
-                       methods_type_annotations);
+  Method::sort_methods(methods);
 
   // If JVMTI original method ordering or sharing is enabled construct int
   // array remembering the original ordering
@@ -3048,9 +3086,6 @@
     k->set_source_debug_extension(_sde_buffer, _sde_length);
   }
   k->set_inner_classes(_inner_classes);
-  if (_annotations != NULL) {
-    k->annotations()->set_class_annotations(_annotations);
-  }
 }
 
 AnnotationArray* ClassFileParser::assemble_annotations(ClassLoaderData* loader_data,
@@ -3361,19 +3396,10 @@
     bool has_final_method = false;
     AccessFlags promoted_flags;
     promoted_flags.set_flags(0);
-
-    Array<AnnotationArray*>* methods_annotations = NULL;
-    Array<AnnotationArray*>* methods_parameter_annotations = NULL;
-    Array<AnnotationArray*>* methods_default_annotations = NULL;
-    Array<AnnotationArray*>* methods_type_annotations = NULL;
     Array<Method*>* methods = parse_methods(loader_data,
                                             cp, access_flags.is_interface(),
                                             &promoted_flags,
                                             &has_final_method,
-                                            &methods_annotations,
-                                            &methods_parameter_annotations,
-                                            &methods_default_annotations,
-                                            &methods_type_annotations,
                                             &has_default_methods,
                                             CHECK_(nullHandle));
 
@@ -3432,10 +3458,6 @@
     // sort methods
     Array<int>* method_ordering = sort_methods(loader_data,
                                                methods,
-                                               methods_annotations,
-                                               methods_parameter_annotations,
-                                               methods_default_annotations,
-                                               methods_type_annotations,
                                                CHECK_(nullHandle));
 
     // promote flags from parse_methods() to the klass' flags
@@ -4035,7 +4057,6 @@
     const unsigned int total_oop_map_count =
       compute_oop_map_count(super_klass, nonstatic_oop_map_count,
                             first_nonstatic_oop_offset);
-
     // Compute reference type
     ReferenceType rt;
     if (super_klass() == NULL) {
@@ -4057,7 +4078,7 @@
                                                        access_flags,
                                                        name,
                                                        super_klass(),
-                                                       host_klass,
+                                                       !host_klass.is_null(),
                                                        CHECK_(nullHandle));
 
     // Add all classes to our internal class loader list here,
@@ -4103,31 +4124,15 @@
     if (is_anonymous())  // I am well known to myself
       cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve
 
-    // Allocate an annotation type if needed.
-    if (fields_annotations != NULL ||
-        methods_annotations != NULL ||
-        methods_parameter_annotations != NULL ||
-        methods_default_annotations != NULL ||
-        fields_type_annotations != NULL ||
-        methods_type_annotations != NULL) {
-      Annotations* anno = Annotations::allocate(loader_data,
-                            fields_annotations, methods_annotations,
-                            methods_parameter_annotations,
-                            methods_default_annotations, CHECK_(nullHandle));
-      this_klass->set_annotations(anno);
-    } else {
-      this_klass->set_annotations(NULL);
-    }
-
-    if (fields_type_annotations != NULL ||
-        methods_type_annotations != NULL) {
-      assert(this_klass->annotations() != NULL, "annotations should have been allocated");
-      Annotations* anno = Annotations::allocate(loader_data,
-                                                fields_type_annotations,
-                                                methods_type_annotations,
-                                                NULL,
-                                                NULL, CHECK_(nullHandle));
-      this_klass->annotations()->set_type_annotations(anno);
+    // Assign allocations if needed
+    if (_annotations != NULL || _type_annotations != NULL ||
+        fields_annotations != NULL || fields_type_annotations != NULL) {
+      Annotations* annotations = Annotations::allocate(loader_data, CHECK_NULL);
+      annotations->set_class_annotations(_annotations);
+      annotations->set_class_type_annotations(_type_annotations);
+      annotations->set_fields_annotations(fields_annotations);
+      annotations->set_fields_type_annotations(fields_type_annotations);
+      this_klass->set_annotations(annotations);
     }
 
     this_klass->set_minor_version(minor_version);
@@ -4153,27 +4158,8 @@
     // Fill in field values obtained by parse_classfile_attributes
     if (parsed_annotations.has_any_annotations())
       parsed_annotations.apply_to(this_klass);
-
-    // Create annotations
-    if (_annotations != NULL && this_klass->annotations() == NULL) {
-      Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
-      this_klass->set_annotations(anno);
-    }
     apply_parsed_class_attributes(this_klass);
 
-    // Create type annotations
-    if (_type_annotations != NULL) {
-      if (this_klass->annotations() == NULL) {
-        Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
-        this_klass->set_annotations(anno);
-      }
-      if (this_klass->annotations()->type_annotations() == NULL) {
-        Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
-        this_klass->annotations()->set_type_annotations(anno);
-      }
-      this_klass->annotations()->type_annotations()->set_class_annotations(_type_annotations);
-    }
-
     // Miranda methods
     if ((num_miranda_methods > 0) ||
         // if this class introduced new miranda methods or
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -199,29 +199,17 @@
                             constantPoolHandle cp,
                             bool is_interface,
                             AccessFlags* promoted_flags,
-                            AnnotationArray** method_annotations,
-                            AnnotationArray** method_parameter_annotations,
-                            AnnotationArray** method_default_annotations,
-                            AnnotationArray** method_type_annotations,
                             TRAPS);
   Array<Method*>* parse_methods(ClassLoaderData* loader_data,
                                 constantPoolHandle cp,
                                 bool is_interface,
                                 AccessFlags* promoted_flags,
                                 bool* has_final_method,
-                                Array<AnnotationArray*>** methods_annotations,
-                                Array<AnnotationArray*>** methods_parameter_annotations,
-                                Array<AnnotationArray*>** methods_default_annotations,
-                                Array<AnnotationArray*>** methods_type_annotations,
                                 bool* has_default_method,
                                 TRAPS);
   Array<int>* sort_methods(ClassLoaderData* loader_data,
                            Array<Method*>* methods,
-                           Array<AnnotationArray*>* methods_annotations,
-                           Array<AnnotationArray*>* methods_parameter_annotations,
-                           Array<AnnotationArray*>* methods_default_annotations,
-                           Array<AnnotationArray*>* methods_type_annotations,
-                                TRAPS);
+                           TRAPS);
   u2* parse_exception_table(ClassLoaderData* loader_data,
                             u4 code_length, u4 exception_table_length,
                             constantPoolHandle cp, TRAPS);
@@ -377,6 +365,32 @@
             : cp->tag_at(index).is_klass_reference());
   }
 
+  void copy_localvariable_table(ConstMethod* cm, int lvt_cnt,
+                                u2* localvariable_table_length,
+                                u2** localvariable_table_start,
+                                int lvtt_cnt,
+                                u2* localvariable_type_table_length,
+                                u2** localvariable_type_table_start,
+                                TRAPS);
+
+  void copy_method_annotations(ClassLoaderData* loader_data,
+                               ConstMethod* cm,
+                               u1* runtime_visible_annotations,
+                               int runtime_visible_annotations_length,
+                               u1* runtime_invisible_annotations,
+                               int runtime_invisible_annotations_length,
+                               u1* runtime_visible_parameter_annotations,
+                               int runtime_visible_parameter_annotations_length,
+                               u1* runtime_invisible_parameter_annotations,
+                               int runtime_invisible_parameter_annotations_length,
+                               u1* runtime_visible_type_annotations,
+                               int runtime_visible_type_annotations_length,
+                               u1* runtime_invisible_type_annotations,
+                               int runtime_invisible_type_annotations_length,
+                               u1* annotation_default,
+                               int annotation_default_length,
+                               TRAPS);
+
  public:
   // Constructor
   ClassFileParser(ClassFileStream* st) { set_stream(st); }
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -1146,9 +1146,10 @@
 
   address code_start = static_cast<address>(bytecodes->adr_at(0));
   int code_length = bytecodes->length();
+  InlineTableSizes sizes;
 
   Method* m = Method::allocate(cp->pool_holder()->class_loader_data(),
-                               code_length, flags, 0, 0, 0, 0, 0, 0,
+                               code_length, flags, &sizes,
                                mt, CHECK_NULL);
 
   m->set_constants(NULL); // This will get filled in later
@@ -1285,33 +1286,15 @@
 
   enum { ANNOTATIONS, PARAMETERS, DEFAULTS, NUM_ARRAYS };
 
-  Array<AnnotationArray*>* original_annots[NUM_ARRAYS] = { NULL };
-
   Array<Method*>* original_methods = klass->methods();
-  Annotations* annots = klass->annotations();
-  if (annots != NULL) {
-    original_annots[ANNOTATIONS] = annots->methods_annotations();
-    original_annots[PARAMETERS]  = annots->methods_parameter_annotations();
-    original_annots[DEFAULTS]    = annots->methods_default_annotations();
-  }
-
   Array<int>* original_ordering = klass->method_ordering();
   Array<int>* merged_ordering = Universe::the_empty_int_array();
 
   int new_size = klass->methods()->length() + new_methods->length();
 
-  Array<AnnotationArray*>* merged_annots[NUM_ARRAYS];
-
   Array<Method*>* merged_methods = MetadataFactory::new_array<Method*>(
       klass->class_loader_data(), new_size, NULL, CHECK);
-  for (int i = 0; i < NUM_ARRAYS; ++i) {
-    if (original_annots[i] != NULL) {
-      merged_annots[i] = MetadataFactory::new_array<AnnotationArray*>(
-          klass->class_loader_data(), new_size, CHECK);
-    } else {
-      merged_annots[i] = NULL;
-    }
-  }
+
   if (original_ordering != NULL && original_ordering->length() > 0) {
     merged_ordering = MetadataFactory::new_array<int>(
         klass->class_loader_data(), new_size, CHECK);
@@ -1338,12 +1321,6 @@
         (new_method == NULL || orig_method->name() < new_method->name())) {
       merged_methods->at_put(i, orig_method);
       original_methods->at_put(orig_idx, NULL);
-      for (int j = 0; j < NUM_ARRAYS; ++j) {
-        if (merged_annots[j] != NULL) {
-          merged_annots[j]->at_put(i, original_annots[j]->at(orig_idx));
-          original_annots[j]->at_put(orig_idx, NULL);
-        }
-      }
       if (merged_ordering->length() > 0) {
         merged_ordering->at_put(i, original_ordering->at(orig_idx));
       }
@@ -1372,21 +1349,9 @@
 
   // Replace klass methods with new merged lists
   klass->set_methods(merged_methods);
-  if (annots != NULL) {
-    annots->set_methods_annotations(merged_annots[ANNOTATIONS]);
-    annots->set_methods_parameter_annotations(merged_annots[PARAMETERS]);
-    annots->set_methods_default_annotations(merged_annots[DEFAULTS]);
-  } else {
-    assert(merged_annots[ANNOTATIONS] == NULL, "Must be");
-    assert(merged_annots[PARAMETERS] == NULL, "Must be");
-    assert(merged_annots[DEFAULTS] == NULL, "Must be");
-  }
 
   ClassLoaderData* cld = klass->class_loader_data();
   MetadataFactory::free_array(cld, original_methods);
-  for (int i = 0; i < NUM_ARRAYS; ++i) {
-    MetadataFactory::free_array(cld, original_annots[i]);
-  }
   if (original_ordering->length() > 0) {
     klass->set_method_ordering(merged_ordering);
     MetadataFactory::free_array(cld, original_ordering);
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -274,8 +274,8 @@
 // end of a collection, we let CMSTriggerRatio of the (purported) free
 // space be allocated before initiating a new collection cycle.
 //
-void ConcurrentMarkSweepGeneration::init_initiating_occupancy(intx io, intx tr) {
-  assert(io <= 100 && tr >= 0 && tr <= 100, "Check the arguments");
+void ConcurrentMarkSweepGeneration::init_initiating_occupancy(intx io, uintx tr) {
+  assert(io <= 100 && tr <= 100, "Check the arguments");
   if (io >= 0) {
     _initiating_occupancy = (double)io / 100.0;
   } else {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -1093,7 +1093,7 @@
 
   // getter and initializer for _initiating_occupancy field.
   double initiating_occupancy() const { return _initiating_occupancy; }
-  void   init_initiating_occupancy(intx io, intx tr);
+  void   init_initiating_occupancy(intx io, uintx tr);
 
  public:
   ConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size,
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -4062,15 +4062,36 @@
       if (_cm->verbose_low()) {
         gclog_or_tty->print_cr("[%u] we're scanning part "
                                "["PTR_FORMAT", "PTR_FORMAT") "
-                               "of region "PTR_FORMAT,
-                               _worker_id, _finger, _region_limit, _curr_region);
+                               "of region "HR_FORMAT,
+                               _worker_id, _finger, _region_limit,
+                               HR_FORMAT_PARAMS(_curr_region));
       }
 
-      // Let's iterate over the bitmap of the part of the
-      // region that is left.
-      if (mr.is_empty() || _nextMarkBitMap->iterate(&bitmap_closure, mr)) {
-        // We successfully completed iterating over the region. Now,
-        // let's give up the region.
+      assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(),
+             "humongous regions should go around loop once only");
+
+      // Some special cases:
+      // If the memory region is empty, we can just give up the region.
+      // If the current region is humongous then we only need to check
+      // the bitmap for the bit associated with the start of the object,
+      // scan the object if it's live, and give up the region.
+      // Otherwise, let's iterate over the bitmap of the part of the region
+      // that is left.
+      // If the iteration is successful, give up the region.
+      if (mr.is_empty()) {
+        giveup_current_region();
+        regular_clock_call();
+      } else if (_curr_region->isHumongous() && mr.start() == _curr_region->bottom()) {
+        if (_nextMarkBitMap->isMarked(mr.start())) {
+          // The object is marked - apply the closure
+          BitMap::idx_t offset = _nextMarkBitMap->heapWordToOffset(mr.start());
+          bitmap_closure.do_bit(offset);
+        }
+        // Even if this task aborted while scanning the humongous object
+        // we can (and should) give up the current region.
+        giveup_current_region();
+        regular_clock_call();
+      } else if (_nextMarkBitMap->iterate(&bitmap_closure, mr)) {
         giveup_current_region();
         regular_clock_call();
       } else {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1893,7 +1893,6 @@
   _ref_processor_stw(NULL),
   _process_strong_tasks(new SubTasksDone(G1H_PS_NumElements)),
   _bot_shared(NULL),
-  _objs_with_preserved_marks(NULL), _preserved_marks_of_objs(NULL),
   _evac_failure_scan_stack(NULL) ,
   _mark_in_progress(false),
   _cg1r(NULL), _summary_bytes_used(0),
@@ -4215,22 +4214,15 @@
   assert(check_cset_heap_region_claim_values(HeapRegion::InitialClaimValue), "sanity");
 
   // Now restore saved marks, if any.
-  if (_objs_with_preserved_marks != NULL) {
-    assert(_preserved_marks_of_objs != NULL, "Both or none.");
-    guarantee(_objs_with_preserved_marks->length() ==
-              _preserved_marks_of_objs->length(), "Both or none.");
-    for (int i = 0; i < _objs_with_preserved_marks->length(); i++) {
-      oop obj   = _objs_with_preserved_marks->at(i);
-      markOop m = _preserved_marks_of_objs->at(i);
-      obj->set_mark(m);
-    }
-
-    // Delete the preserved marks growable arrays (allocated on the C heap).
-    delete _objs_with_preserved_marks;
-    delete _preserved_marks_of_objs;
-    _objs_with_preserved_marks = NULL;
-    _preserved_marks_of_objs = NULL;
-  }
+  assert(_objs_with_preserved_marks.size() ==
+            _preserved_marks_of_objs.size(), "Both or none.");
+  while (!_objs_with_preserved_marks.is_empty()) {
+    oop obj = _objs_with_preserved_marks.pop();
+    markOop m = _preserved_marks_of_objs.pop();
+    obj->set_mark(m);
+  }
+  _objs_with_preserved_marks.clear(true);
+  _preserved_marks_of_objs.clear(true);
 }
 
 void G1CollectedHeap::push_on_evac_failure_scan_stack(oop obj) {
@@ -4313,15 +4305,8 @@
   // We want to call the "for_promotion_failure" version only in the
   // case of a promotion failure.
   if (m->must_be_preserved_for_promotion_failure(obj)) {
-    if (_objs_with_preserved_marks == NULL) {
-      assert(_preserved_marks_of_objs == NULL, "Both or none.");
-      _objs_with_preserved_marks =
-        new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(40, true);
-      _preserved_marks_of_objs =
-        new (ResourceObj::C_HEAP, mtGC) GrowableArray<markOop>(40, true);
-    }
-    _objs_with_preserved_marks->push(obj);
-    _preserved_marks_of_objs->push(m);
+    _objs_with_preserved_marks.push(obj);
+    _preserved_marks_of_objs.push(m);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -37,6 +37,7 @@
 #include "memory/barrierSet.hpp"
 #include "memory/memRegion.hpp"
 #include "memory/sharedHeap.hpp"
+#include "utilities/stack.hpp"
 
 // A "G1CollectedHeap" is an implementation of a java heap for HotSpot.
 // It uses the "Garbage First" heap organization and algorithm, which
@@ -877,10 +878,9 @@
   // forwarding pointers to themselves.  Reset them.
   void remove_self_forwarding_pointers();
 
-  // When one is non-null, so is the other.  Together, they each pair is
-  // an object with a preserved mark, and its mark value.
-  GrowableArray<oop>*     _objs_with_preserved_marks;
-  GrowableArray<markOop>* _preserved_marks_of_objs;
+  // Together, these store an object with a preserved mark, and its mark value.
+  Stack<oop, mtGC>     _objs_with_preserved_marks;
+  Stack<markOop, mtGC> _preserved_marks_of_objs;
 
   // Preserve the mark of "obj", if necessary, in preparation for its mark
   // word being overwritten with a self-forwarding-pointer.
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -101,9 +101,6 @@
           "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(intx, G1InitYoungSurvRatio, 50,                                   \
-          "Expected Survival Rate for newly allocated bytes")               \
-                                                                            \
   develop(bool, G1SATBPrintStubs, false,                                    \
           "If true, print generated stubs for the SATB barrier")            \
                                                                             \
--- a/hotspot/src/share/vm/memory/heapInspection.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/memory/heapInspection.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -85,16 +85,20 @@
         "Number of bytes used by the InstanceKlass::singers() array") \
     f(class_annotations_bytes, class_annotations, \
         "Size of class annotations") \
+    f(class_type_annotations_bytes, class_type_annotations, \
+        "Size of class type annotations") \
     f(fields_annotations_bytes, fields_annotations, \
         "Size of field annotations") \
+    f(fields_type_annotations_bytes, fields_type_annotations, \
+        "Size of field type annotations") \
     f(methods_annotations_bytes, methods_annotations, \
         "Size of method annotations") \
     f(methods_parameter_annotations_bytes, methods_parameter_annotations, \
         "Size of method parameter annotations") \
+    f(methods_type_annotations_bytes, methods_type_annotations, \
+        "Size of methods type annotations") \
     f(methods_default_annotations_bytes, methods_default_annotations, \
         "Size of methods default annotations") \
-    f(type_annotations_bytes, type_annotations, \
-        "Size of type annotations") \
     f(annotations_bytes, annotations, \
         "Size of all annotations") \
     f(cp_bytes, Cp, \
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1064,11 +1064,11 @@
 //
 // After the GC the compute_new_size() for MetaspaceGC is called to
 // resize the capacity of the metaspaces.  The current implementation
-// is based on the flags MinHeapFreeRatio and MaxHeapFreeRatio used
+// is based on the flags MinMetaspaceFreeRatio and MaxHeapFreeRatio used
 // to resize the Java heap by some GC's.  New flags can be implemented
 // if really needed.  MinHeapFreeRatio is used to calculate how much
 // free space is desirable in the metaspace capacity to decide how much
-// to increase the HWM.  MaxHeapFreeRatio is used to decide how much
+// to increase the HWM.  MaxMetaspaceFreeRatio is used to decide how much
 // free space is desirable in the metaspace capacity before decreasing
 // the HWM.
 
@@ -1166,7 +1166,7 @@
   size_t capacity_until_GC = vsl->capacity_bytes_sum();
   size_t free_after_gc = capacity_until_GC - used_after_gc;
 
-  const double minimum_free_percentage = MinHeapFreeRatio / 100.0;
+  const double minimum_free_percentage = MinMetaspaceFreeRatio / 100.0;
   const double maximum_used_percentage = 1.0 - minimum_free_percentage;
 
   const double min_tmp = used_after_gc / maximum_used_percentage;
@@ -1232,8 +1232,8 @@
     max_shrink_words));
 
   // Should shrinking be considered?
-  if (MaxHeapFreeRatio < 100) {
-    const double maximum_free_percentage = MaxHeapFreeRatio / 100.0;
+  if (MaxMetaspaceFreeRatio < 100) {
+    const double maximum_free_percentage = MaxMetaspaceFreeRatio / 100.0;
     const double minimum_used_percentage = 1.0 - maximum_free_percentage;
     const double max_tmp = used_after_gc / minimum_used_percentage;
     size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
--- a/hotspot/src/share/vm/oops/annotations.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/annotations.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -36,16 +36,8 @@
   return new (loader_data, size(), true, THREAD) Annotations();
 }
 
-Annotations* Annotations::allocate(ClassLoaderData* loader_data,
-                                   Array<AnnotationArray*>* fa,
-                                   Array<AnnotationArray*>* ma,
-                                   Array<AnnotationArray*>* mpa,
-                                   Array<AnnotationArray*>* mda, TRAPS) {
-  return new (loader_data, size(), true, THREAD) Annotations(fa, ma, mpa, mda);
-}
-
 // helper
-static void free_contents(ClassLoaderData* loader_data, Array<AnnotationArray*>* p) {
+void Annotations::free_contents(ClassLoaderData* loader_data, Array<AnnotationArray*>* p) {
   if (p != NULL) {
     for (int i = 0; i < p->length(); i++) {
       MetadataFactory::free_array<u1>(loader_data, p->at(i));
@@ -59,44 +51,16 @@
     MetadataFactory::free_array<u1>(loader_data, class_annotations());
   }
   free_contents(loader_data, fields_annotations());
-  free_contents(loader_data, methods_annotations());
-  free_contents(loader_data, methods_parameter_annotations());
-  free_contents(loader_data, methods_default_annotations());
 
-  // Recursively deallocate optional Annotations linked through this one
-  MetadataFactory::free_metadata(loader_data, type_annotations());
+  if (class_type_annotations() != NULL) {
+    MetadataFactory::free_array<u1>(loader_data, class_type_annotations());
+  }
+  free_contents(loader_data, fields_type_annotations());
 }
 
-// Set the annotation at 'idnum' to 'anno'.
-// We don't want to create or extend the array if 'anno' is NULL, since that is the
-// default value.  However, if the array exists and is long enough, we must set NULL values.
-void Annotations::set_methods_annotations_of(instanceKlassHandle ik,
-                                             int idnum, AnnotationArray* anno,
-                                             Array<AnnotationArray*>** md_p,
-                                             TRAPS) {
-  Array<AnnotationArray*>* md = *md_p;
-  if (md != NULL && md->length() > idnum) {
-    md->at_put(idnum, anno);
-  } else if (anno != NULL) {
-    // create the array
-    int length = MAX2(idnum+1, (int)ik->idnum_allocated_count());
-    md = MetadataFactory::new_array<AnnotationArray*>(ik->class_loader_data(), length, CHECK);
-    if (*md_p != NULL) {
-      // copy the existing entries
-      for (int index = 0; index < (*md_p)->length(); index++) {
-        md->at_put(index, (*md_p)->at(index));
-      }
-    }
-    set_annotations(md, md_p);
-    md->at_put(idnum, anno);
-  } // if no array and idnum isn't included there is nothing to do
-}
-
-// Keep created annotations in a global growable array (should be hashtable)
-// need to add, search, delete when class is unloaded.
-// Does it need a lock?  yes.  This sucks.
-
 // Copy annotations to JVM call or reflection to the java heap.
+// The alternative to creating this array and adding to Java heap pressure
+// is to have a hashtable of the already created typeArrayOops
 typeArrayOop Annotations::make_java_array(AnnotationArray* annotations, TRAPS) {
   if (annotations != NULL) {
     int length = annotations->length();
@@ -132,28 +96,15 @@
 void Annotations::collect_statistics(KlassSizeStats *sz) const {
   sz->_annotations_bytes = sz->count(this);
   sz->_class_annotations_bytes = sz->count(class_annotations());
+  sz->_class_type_annotations_bytes = sz->count(class_type_annotations());
   sz->_fields_annotations_bytes = count_bytes(fields_annotations());
-  sz->_methods_annotations_bytes = count_bytes(methods_annotations());
-  sz->_methods_parameter_annotations_bytes =
-                          count_bytes(methods_parameter_annotations());
-  sz->_methods_default_annotations_bytes =
-                          count_bytes(methods_default_annotations());
-
-  const Annotations* type_anno = type_annotations();
-  if (type_anno != NULL) {
-    sz->_type_annotations_bytes = sz->count(type_anno);
-    sz->_type_annotations_bytes += sz->count(type_anno->class_annotations());
-    sz->_type_annotations_bytes += count_bytes(type_anno->fields_annotations());
-    sz->_type_annotations_bytes += count_bytes(type_anno->methods_annotations());
-  }
+  sz->_fields_type_annotations_bytes = count_bytes(fields_type_annotations());
 
   sz->_annotations_bytes +=
       sz->_class_annotations_bytes +
+      sz->_class_type_annotations_bytes +
       sz->_fields_annotations_bytes +
-      sz->_methods_annotations_bytes +
-      sz->_methods_parameter_annotations_bytes +
-      sz->_methods_default_annotations_bytes +
-      sz->_type_annotations_bytes;
+      sz->_fields_type_annotations_bytes;
 
   sz->_ro_bytes += sz->_annotations_bytes;
 }
@@ -165,8 +116,7 @@
 void Annotations::print_on(outputStream* st) const {
   st->print(BULLET"class_annotations            "); class_annotations()->print_value_on(st);
   st->print(BULLET"fields_annotations           "); fields_annotations()->print_value_on(st);
-  st->print(BULLET"methods_annotations          "); methods_annotations()->print_value_on(st);
-  st->print(BULLET"methods_parameter_annotations"); methods_parameter_annotations()->print_value_on(st);
-  st->print(BULLET"methods_default_annotations  "); methods_default_annotations()->print_value_on(st);
+  st->print(BULLET"class_type_annotations       "); class_type_annotations()->print_value_on(st);
+  st->print(BULLET"fields_type_annotations      "); fields_type_annotations()->print_value_on(st);
 }
 #endif // PRODUCT
--- a/hotspot/src/share/vm/oops/annotations.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/annotations.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -49,38 +49,15 @@
   // Annotation objects (byte arrays) for fields, or null if no annotations.
   // Indices correspond to entries (not indices) in fields array.
   Array<AnnotationArray*>*     _fields_annotations;
-  // Annotation objects (byte arrays) for methods, or null if no annotations.
-  // Index is the idnum, which is initially the same as the methods array index.
-  Array<AnnotationArray*>*     _methods_annotations;
-  // Annotation objects (byte arrays) for methods' parameters, or null if no
-  // such annotations.
-  // Index is the idnum, which is initially the same as the methods array index.
-  Array<AnnotationArray*>*     _methods_parameter_annotations;
-  // Annotation objects (byte arrays) for methods' default values, or null if no
-  // such annotations.
-  // Index is the idnum, which is initially the same as the methods array index.
-  Array<AnnotationArray*>*     _methods_default_annotations;
   // Type annotations for this class, or null if none.
-  Annotations*                 _type_annotations;
-
-  // Constructor where some some values are known to not be null
-  Annotations(Array<AnnotationArray*>* fa, Array<AnnotationArray*>* ma,
-              Array<AnnotationArray*>* mpa, Array<AnnotationArray*>* mda) :
-                 _class_annotations(NULL),
-                 _fields_annotations(fa),
-                 _methods_annotations(ma),
-                 _methods_parameter_annotations(mpa),
-                 _methods_default_annotations(mda),
-                 _type_annotations(NULL) {}
+  AnnotationArray*             _class_type_annotations;
+  Array<AnnotationArray*>*     _fields_type_annotations;
 
  public:
   // Allocate instance of this class
   static Annotations* allocate(ClassLoaderData* loader_data, TRAPS);
-  static Annotations* allocate(ClassLoaderData* loader_data,
-                               Array<AnnotationArray*>* fa,
-                               Array<AnnotationArray*>* ma,
-                               Array<AnnotationArray*>* mpa,
-                               Array<AnnotationArray*>* mda, TRAPS);
+
+  static void free_contents(ClassLoaderData* loader_data, Array<AnnotationArray*>* p);
   void deallocate_contents(ClassLoaderData* loader_data);
   DEBUG_ONLY(bool on_stack() { return false; })  // for template
 
@@ -93,61 +70,24 @@
   // Constructor to initialize to null
   Annotations() : _class_annotations(NULL),
                   _fields_annotations(NULL),
-                  _methods_annotations(NULL),
-                  _methods_parameter_annotations(NULL),
-                  _methods_default_annotations(NULL),
-                  _type_annotations(NULL) {}
+                  _class_type_annotations(NULL),
+                  _fields_type_annotations(NULL) {}
 
   AnnotationArray* class_annotations() const                       { return _class_annotations; }
   Array<AnnotationArray*>* fields_annotations() const              { return _fields_annotations; }
-  Array<AnnotationArray*>* methods_annotations() const             { return _methods_annotations; }
-  Array<AnnotationArray*>* methods_parameter_annotations() const   { return _methods_parameter_annotations; }
-  Array<AnnotationArray*>* methods_default_annotations() const     { return _methods_default_annotations; }
-  Annotations* type_annotations() const                            { return _type_annotations; }
+  AnnotationArray* class_type_annotations() const                  { return _class_type_annotations; }
+  Array<AnnotationArray*>* fields_type_annotations() const         { return _fields_type_annotations; }
 
   void set_class_annotations(AnnotationArray* md)                     { _class_annotations = md; }
   void set_fields_annotations(Array<AnnotationArray*>* md)            { _fields_annotations = md; }
-  void set_methods_annotations(Array<AnnotationArray*>* md)           { _methods_annotations = md; }
-  void set_methods_parameter_annotations(Array<AnnotationArray*>* md) { _methods_parameter_annotations = md; }
-  void set_methods_default_annotations(Array<AnnotationArray*>* md)   { _methods_default_annotations = md; }
-  void set_type_annotations(Annotations* annos)                       { _type_annotations = annos; }
-
-  // Redefine classes support
-  AnnotationArray* get_method_annotations_of(int idnum)
-                                                { return get_method_annotations_from(idnum, _methods_annotations); }
-
-  AnnotationArray* get_method_parameter_annotations_of(int idnum)
-                                                { return get_method_annotations_from(idnum, _methods_parameter_annotations); }
-  AnnotationArray* get_method_default_annotations_of(int idnum)
-                                                { return get_method_annotations_from(idnum, _methods_default_annotations); }
-
-
-  void set_method_annotations_of(instanceKlassHandle ik,
-                                 int idnum, AnnotationArray* anno, TRAPS) {
-    set_methods_annotations_of(ik, idnum, anno, &_methods_annotations, THREAD);
-  }
-
-  void set_method_parameter_annotations_of(instanceKlassHandle ik,
-                                 int idnum, AnnotationArray* anno, TRAPS) {
-    set_methods_annotations_of(ik, idnum, anno, &_methods_parameter_annotations, THREAD);
-  }
-
-  void set_method_default_annotations_of(instanceKlassHandle ik,
-                                 int idnum, AnnotationArray* anno, TRAPS) {
-    set_methods_annotations_of(ik, idnum, anno, &_methods_default_annotations, THREAD);
-  }
+  void set_class_type_annotations(AnnotationArray* cta)               { _class_type_annotations = cta; }
+  void set_fields_type_annotations(Array<AnnotationArray*>* fta)      { _fields_type_annotations = fta; }
 
   // Turn metadata annotations into a Java heap object (oop)
   static typeArrayOop make_java_array(AnnotationArray* annotations, TRAPS);
 
-  inline AnnotationArray* get_method_annotations_from(int idnum, Array<AnnotationArray*>* annos);
-  void set_annotations(Array<AnnotationArray*>* md, Array<AnnotationArray*>** md_p)  { *md_p = md; }
-
   bool is_klass() const { return false; }
  private:
-  void set_methods_annotations_of(instanceKlassHandle ik,
-                                  int idnum, AnnotationArray* anno,
-                                  Array<AnnotationArray*>** md_p, TRAPS);
   static julong count_bytes(Array<AnnotationArray*>* p);
  public:
   const char* internal_name() const { return "{constant pool}"; }
@@ -156,13 +96,4 @@
 #endif
   void print_value_on(outputStream* st) const;
 };
-
-
-// For method with idnum get the method's Annotations
-inline AnnotationArray* Annotations::get_method_annotations_from(int idnum, Array<AnnotationArray*>* annos) {
-  if (annos == NULL || annos->length() <= idnum) {
-    return NULL;
-  }
-  return annos->at(idnum);
-}
 #endif // SHARE_VM_OOPS_ANNOTATIONS_HPP
--- a/hotspot/src/share/vm/oops/constMethod.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/constMethod.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -36,51 +36,26 @@
 
 ConstMethod* ConstMethod::allocate(ClassLoaderData* loader_data,
                                    int byte_code_size,
-                                   int compressed_line_number_size,
-                                   int localvariable_table_length,
-                                   int exception_table_length,
-                                   int checked_exceptions_length,
-                                   int method_parameters_length,
-                                   u2  generic_signature_index,
+                                   InlineTableSizes* sizes,
                                    MethodType method_type,
                                    TRAPS) {
-  int size = ConstMethod::size(byte_code_size,
-                               compressed_line_number_size,
-                               localvariable_table_length,
-                               exception_table_length,
-                               checked_exceptions_length,
-                               method_parameters_length,
-                               generic_signature_index);
+  int size = ConstMethod::size(byte_code_size, sizes);
   return new (loader_data, size, true, THREAD) ConstMethod(
-      byte_code_size, compressed_line_number_size, localvariable_table_length,
-      exception_table_length, checked_exceptions_length,
-      method_parameters_length, generic_signature_index,
-      method_type, size);
+      byte_code_size, sizes, method_type, size);
 }
 
 ConstMethod::ConstMethod(int byte_code_size,
-                         int compressed_line_number_size,
-                         int localvariable_table_length,
-                         int exception_table_length,
-                         int checked_exceptions_length,
-                         int method_parameters_length,
-                         u2  generic_signature_index,
+                         InlineTableSizes* sizes,
                          MethodType method_type,
                          int size) {
 
   No_Safepoint_Verifier no_safepoint;
-  set_interpreter_kind(Interpreter::invalid);
   init_fingerprint();
   set_constants(NULL);
   set_stackmap_data(NULL);
   set_code_size(byte_code_size);
   set_constMethod_size(size);
-  set_inlined_tables_length(generic_signature_index,
-                            checked_exceptions_length,
-                            compressed_line_number_size,
-                            localvariable_table_length,
-                            exception_table_length,
-                            method_parameters_length);
+  set_inlined_tables_length(sizes);
   set_method_type(method_type);
   assert(this->size() == size, "wrong size for object");
 }
@@ -88,47 +63,70 @@
 
 // Deallocate metadata fields associated with ConstMethod*
 void ConstMethod::deallocate_contents(ClassLoaderData* loader_data) {
-  set_interpreter_kind(Interpreter::invalid);
   if (stackmap_data() != NULL) {
     MetadataFactory::free_array<u1>(loader_data, stackmap_data());
   }
   set_stackmap_data(NULL);
+
+  // deallocate annotation arrays
+  if (has_method_annotations())
+    MetadataFactory::free_array<u1>(loader_data, method_annotations());
+  if (has_parameter_annotations())
+    MetadataFactory::free_array<u1>(loader_data, parameter_annotations());
+  if (has_type_annotations())
+    MetadataFactory::free_array<u1>(loader_data, type_annotations());
+  if (has_default_annotations())
+    MetadataFactory::free_array<u1>(loader_data, default_annotations());
 }
 
 // How big must this constMethodObject be?
 
 int ConstMethod::size(int code_size,
-                      int compressed_line_number_size,
-                      int local_variable_table_length,
-                      int exception_table_length,
-                      int checked_exceptions_length,
-                      int method_parameters_length,
-                      u2  generic_signature_index) {
+                      InlineTableSizes* sizes) {
   int extra_bytes = code_size;
-  if (compressed_line_number_size > 0) {
-    extra_bytes += compressed_line_number_size;
+  if (sizes->compressed_linenumber_size() > 0) {
+    extra_bytes += sizes->compressed_linenumber_size();
   }
-  if (checked_exceptions_length > 0) {
+  if (sizes->checked_exceptions_length() > 0) {
     extra_bytes += sizeof(u2);
-    extra_bytes += checked_exceptions_length * sizeof(CheckedExceptionElement);
+    extra_bytes += sizes->checked_exceptions_length() * sizeof(CheckedExceptionElement);
   }
-  if (local_variable_table_length > 0) {
+  if (sizes->localvariable_table_length() > 0) {
     extra_bytes += sizeof(u2);
     extra_bytes +=
-              local_variable_table_length * sizeof(LocalVariableTableElement);
+              sizes->localvariable_table_length() * sizeof(LocalVariableTableElement);
   }
-  if (exception_table_length > 0) {
+  if (sizes->exception_table_length() > 0) {
     extra_bytes += sizeof(u2);
-    extra_bytes += exception_table_length * sizeof(ExceptionTableElement);
+    extra_bytes += sizes->exception_table_length() * sizeof(ExceptionTableElement);
   }
-  if (generic_signature_index != 0) {
+  if (sizes->generic_signature_index() != 0) {
     extra_bytes += sizeof(u2);
   }
-  if (method_parameters_length > 0) {
+  if (sizes->method_parameters_length() > 0) {
     extra_bytes += sizeof(u2);
-    extra_bytes += method_parameters_length * sizeof(MethodParametersElement);
+    extra_bytes += sizes->method_parameters_length() * sizeof(MethodParametersElement);
+  }
+
+  // Align sizes up to a word.
+  extra_bytes = align_size_up(extra_bytes, BytesPerWord);
+
+  // One pointer per annotation array
+  if (sizes->method_annotations_length() > 0) {
+    extra_bytes += sizeof(AnnotationArray*);
   }
+  if (sizes->parameter_annotations_length() > 0) {
+    extra_bytes += sizeof(AnnotationArray*);
+  }
+  if (sizes->type_annotations_length() > 0) {
+    extra_bytes += sizeof(AnnotationArray*);
+  }
+  if (sizes->default_annotations_length() > 0) {
+    extra_bytes += sizeof(AnnotationArray*);
+  }
+
   int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
+  assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned");
   return align_object_size(header_size() + extra_words);
 }
 
@@ -145,12 +143,28 @@
   return code_end();
 }
 
+// Last short in ConstMethod* before annotations
+u2* ConstMethod::last_u2_element() const {
+  int offset = 0;
+  if (has_method_annotations()) offset++;
+  if (has_parameter_annotations()) offset++;
+  if (has_type_annotations()) offset++;
+  if (has_default_annotations()) offset++;
+  return (u2*)((AnnotationArray**)constMethod_end() - offset) - 1;
+}
+
 u2* ConstMethod::generic_signature_index_addr() const {
   // Located at the end of the constMethod.
   assert(has_generic_signature(), "called only if generic signature exists");
   return last_u2_element();
 }
 
+u2* ConstMethod::method_parameters_length_addr() const {
+  assert(has_method_parameters(), "called only if table is present");
+  return has_generic_signature() ? (last_u2_element() - 1) :
+                                    last_u2_element();
+}
+
 u2* ConstMethod::checked_exceptions_length_addr() const {
   // Located immediately before the generic signature index.
   assert(has_checked_exceptions(), "called only if table is present");
@@ -164,12 +178,6 @@
   }
 }
 
-u2* ConstMethod::method_parameters_length_addr() const {
-  assert(has_method_parameters(), "called only if table is present");
-  return has_generic_signature() ? (last_u2_element() - 1) :
-                                    last_u2_element();
-}
-
 u2* ConstMethod::exception_table_length_addr() const {
   assert(has_exception_handler(), "called only if table is present");
   if (has_checked_exceptions()) {
@@ -181,9 +189,9 @@
       return (u2*)method_parameters_start() - 1;
     } else {
       // Else, the exception table is at the end of the constMethod.
-    return has_generic_signature() ? (last_u2_element() - 1) :
-                                      last_u2_element();
-  }
+      return has_generic_signature() ? (last_u2_element() - 1) :
+                                        last_u2_element();
+    }
   }
 }
 
@@ -204,32 +212,38 @@
         // Else, the exception table is at the end of the constMethod.
       return has_generic_signature() ? (last_u2_element() - 1) :
                                         last_u2_element();
+      }
     }
   }
-  }
 }
 
 // Update the flags to indicate the presence of these optional fields.
-void ConstMethod::set_inlined_tables_length(u2  generic_signature_index,
-                                            int checked_exceptions_len,
-                                            int compressed_line_number_size,
-                                            int localvariable_table_len,
-                                            int exception_table_len,
-                                            int method_parameters_len) {
-  assert(_flags == 0, "Error");
-  if (compressed_line_number_size > 0)
+void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) {
+  _flags = 0;
+  if (sizes->compressed_linenumber_size() > 0)
     _flags |= _has_linenumber_table;
-  if (generic_signature_index != 0)
+  if (sizes->generic_signature_index() != 0)
     _flags |= _has_generic_signature;
-  if (method_parameters_len > 0)
+  if (sizes->method_parameters_length() > 0)
     _flags |= _has_method_parameters;
-  if (checked_exceptions_len > 0)
+  if (sizes->checked_exceptions_length() > 0)
     _flags |= _has_checked_exceptions;
-  if (exception_table_len > 0)
+  if (sizes->exception_table_length() > 0)
     _flags |= _has_exception_table;
-  if (localvariable_table_len > 0)
+  if (sizes->localvariable_table_length() > 0)
     _flags |= _has_localvariable_table;
 
+  // annotations, they are all pointer sized embedded objects so don't have
+  // a length embedded also.
+  if (sizes->method_annotations_length() > 0)
+    _flags |= _has_method_annotations;
+  if (sizes->parameter_annotations_length() > 0)
+    _flags |= _has_parameter_annotations;
+  if (sizes->type_annotations_length() > 0)
+    _flags |= _has_type_annotations;
+  if (sizes->default_annotations_length() > 0)
+    _flags |= _has_default_annotations;
+
   // This code is extremely brittle and should possibly be revised.
   // The *_length_addr functions walk backwards through the
   // constMethod data, using each of the length indexes ahead of them,
@@ -242,17 +256,17 @@
   // Also, the servicability agent needs to be informed anytime
   // anything is added here.  It might be advisable to have some sort
   // of indication of this inline.
-  if (generic_signature_index != 0)
-    *(generic_signature_index_addr()) = generic_signature_index;
+  if (sizes->generic_signature_index() != 0)
+    *(generic_signature_index_addr()) = sizes->generic_signature_index();
   // New data should probably go here.
-  if (method_parameters_len > 0)
-    *(method_parameters_length_addr()) = method_parameters_len;
-  if (checked_exceptions_len > 0)
-    *(checked_exceptions_length_addr()) = checked_exceptions_len;
-  if (exception_table_len > 0)
-    *(exception_table_length_addr()) = exception_table_len;
-  if (localvariable_table_len > 0)
-    *(localvariable_table_length_addr()) = localvariable_table_len;
+  if (sizes->method_parameters_length() > 0)
+    *(method_parameters_length_addr()) = sizes->method_parameters_length();
+  if (sizes->checked_exceptions_length() > 0)
+    *(checked_exceptions_length_addr()) = sizes->checked_exceptions_length();
+  if (sizes->exception_table_length() > 0)
+    *(exception_table_length_addr()) = sizes->exception_table_length();
+  if (sizes->localvariable_table_length() > 0)
+    *(localvariable_table_length_addr()) = sizes->localvariable_table_length();
 }
 
 int ConstMethod::method_parameters_length() const {
@@ -307,6 +321,34 @@
   return (ExceptionTableElement*)addr;
 }
 
+AnnotationArray** ConstMethod::method_annotations_addr() const {
+  assert(has_method_annotations(), "should only be called if method annotations are present");
+  return (AnnotationArray**)constMethod_end() - 1;
+}
+
+AnnotationArray** ConstMethod::parameter_annotations_addr() const {
+  assert(has_parameter_annotations(), "should only be called if method parameter annotations are present");
+  int offset = 1;
+  if (has_method_annotations()) offset++;
+  return (AnnotationArray**)constMethod_end() - offset;
+}
+
+AnnotationArray** ConstMethod::type_annotations_addr() const {
+  assert(has_type_annotations(), "should only be called if method type annotations are present");
+  int offset = 1;
+  if (has_method_annotations()) offset++;
+  if (has_parameter_annotations()) offset++;
+  return (AnnotationArray**)constMethod_end() - offset;
+}
+
+AnnotationArray** ConstMethod::default_annotations_addr() const {
+  assert(has_default_annotations(), "should only be called if method default annotations are present");
+  int offset = 1;
+  if (has_method_annotations()) offset++;
+  if (has_parameter_annotations()) offset++;
+  if (has_type_annotations()) offset++;
+  return (AnnotationArray**)constMethod_end() - offset;
+}
 
 // Printing
 
@@ -339,8 +381,25 @@
   sz->_bytecode_bytes     += (n2 = code_size());
   sz->_stackmap_bytes     += (n3 = sz->count_array(stackmap_data()));
 
-  sz->_method_all_bytes += n1 + n3; // note: n2 is part of n3
-  sz->_ro_bytes += n1 + n3;
+  // Count method annotations
+  int a1 = 0, a2 = 0, a3 = 0, a4 = 0;
+  if (has_method_annotations()) {
+    sz->_methods_annotations_bytes += (a1 = sz->count_array(method_annotations()));
+  }
+  if (has_parameter_annotations()) {
+    sz->_methods_parameter_annotations_bytes += (a2 = sz->count_array(parameter_annotations()));
+  }
+  if (has_type_annotations()) {
+    sz->_methods_type_annotations_bytes += (a3 = sz->count_array(type_annotations()));
+  }
+  if (has_default_annotations()) {
+    sz->_methods_default_annotations_bytes += (a4 = sz->count_array(default_annotations()));
+  }
+
+  int size_annotations = a1 + a2 + a3 + a4;
+
+  sz->_method_all_bytes += n1 + n3 + size_annotations; // note: n2 is part of n3
+  sz->_ro_bytes += n1 + n3 + size_annotations;
 }
 #endif // INCLUDE_SERVICES
 
@@ -352,10 +411,9 @@
 
   // Verification can occur during oop construction before the method or
   // other fields have been initialized.
-  guarantee(is_metadata(), err_msg("Should be metadata " PTR_FORMAT, this));
   guarantee(method()->is_method(), "should be method");
 
-  address m_end = (address)((oop*) this + size());
+  address m_end = (address)((intptr_t) this + size());
   address compressed_table_start = code_end();
   guarantee(compressed_table_start <= m_end, "invalid method layout");
   address compressed_table_end = compressed_table_start;
--- a/hotspot/src/share/vm/oops/constMethod.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/constMethod.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -86,19 +86,22 @@
 // | generic signature index (u2)                         |
 // |  (indexed from start of constMethodOop)              |
 // |------------------------------------------------------|
+// | annotations arrays - method, parameter, type, default|
+// | pointer to Array<u1> if annotation is present        |
+// |------------------------------------------------------|
 //
 // IMPORTANT: If anything gets added here, there need to be changes to
 // ensure that ServicabilityAgent doesn't get broken as a result!
 
 
-// Utitily class decribing elements in checked exceptions table inlined in Method*.
+// Utility class describing elements in checked exceptions table inlined in Method*.
 class CheckedExceptionElement VALUE_OBJ_CLASS_SPEC {
  public:
   u2 class_cp_index;
 };
 
 
-// Utitily class decribing elements in local variable table inlined in Method*.
+// Utility class describing elements in local variable table inlined in Method*.
 class LocalVariableTableElement VALUE_OBJ_CLASS_SPEC {
  public:
   u2 start_bci;
@@ -109,7 +112,7 @@
   u2 slot;
 };
 
-// Utitily class describing elements in exception table
+// Utility class describing elements in exception table
 class ExceptionTableElement VALUE_OBJ_CLASS_SPEC {
  public:
   u2 start_pc;
@@ -127,6 +130,51 @@
 
 class KlassSizeStats;
 
+// Class to collect the sizes of ConstMethod inline tables
+#define INLINE_TABLES_DO(do_element)            \
+  do_element(localvariable_table_length)        \
+  do_element(compressed_linenumber_size)        \
+  do_element(exception_table_length)            \
+  do_element(checked_exceptions_length)         \
+  do_element(method_parameters_length)          \
+  do_element(generic_signature_index)           \
+  do_element(method_annotations_length)         \
+  do_element(parameter_annotations_length)      \
+  do_element(type_annotations_length)           \
+  do_element(default_annotations_length)
+
+#define INLINE_TABLE_DECLARE(sym)    int _##sym;
+#define INLINE_TABLE_PARAM(sym)      int sym,
+#define INLINE_TABLE_INIT(sym)       _##sym(sym),
+#define INLINE_TABLE_NULL(sym)       _##sym(0),
+#define INLINE_TABLE_ACCESSOR(sym)   int sym() const { return _##sym; }
+
+class InlineTableSizes : StackObj {
+  // declarations
+  INLINE_TABLES_DO(INLINE_TABLE_DECLARE)
+  int _end;
+ public:
+  InlineTableSizes(
+      INLINE_TABLES_DO(INLINE_TABLE_PARAM)
+      int end) :
+      INLINE_TABLES_DO(INLINE_TABLE_INIT)
+      _end(end) {}
+
+  // Default constructor for no inlined tables
+  InlineTableSizes() :
+      INLINE_TABLES_DO(INLINE_TABLE_NULL)
+      _end(0) {}
+
+  // Accessors
+  INLINE_TABLES_DO(INLINE_TABLE_ACCESSOR)
+};
+#undef INLINE_TABLE_ACCESSOR
+#undef INLINE_TABLE_NULL
+#undef INLINE_TABLE_INIT
+#undef INLINE_TABLE_PARAM
+#undef INLINE_TABLE_DECLARE
+
+
 class ConstMethod : public MetaspaceObj {
   friend class VMStructs;
 
@@ -135,13 +183,17 @@
 
 private:
   enum {
-    _has_linenumber_table = 1,
-    _has_checked_exceptions = 2,
-    _has_localvariable_table = 4,
-    _has_exception_table = 8,
-    _has_generic_signature = 16,
-    _has_method_parameters = 32,
-    _is_overpass = 64
+    _has_linenumber_table = 0x0001,
+    _has_checked_exceptions = 0x0002,
+    _has_localvariable_table = 0x0004,
+    _has_exception_table = 0x0008,
+    _has_generic_signature = 0x0010,
+    _has_method_parameters = 0x0020,
+    _is_overpass = 0x0040,
+    _has_method_annotations = 0x0080,
+    _has_parameter_annotations = 0x0100,
+    _has_type_annotations = 0x0200,
+    _has_default_annotations = 0x0400
   };
 
   // Bit vector of signature
@@ -158,8 +210,7 @@
   Array<u1>*        _stackmap_data;
 
   int               _constMethod_size;
-  jbyte             _interpreter_kind;
-  jbyte             _flags;
+  u2                _flags;
 
   // Size of Java bytecodes allocated immediately after Method*.
   u2                _code_size;
@@ -174,36 +225,21 @@
 
   // Constructor
   ConstMethod(int byte_code_size,
-              int compressed_line_number_size,
-              int localvariable_table_length,
-              int exception_table_length,
-              int checked_exceptions_length,
-              int method_parameters_length,
-              u2  generic_signature_index,
+              InlineTableSizes* sizes,
               MethodType is_overpass,
               int size);
 public:
 
   static ConstMethod* allocate(ClassLoaderData* loader_data,
                                int byte_code_size,
-                               int compressed_line_number_size,
-                               int localvariable_table_length,
-                               int exception_table_length,
-                               int checked_exceptions_length,
-                               int method_parameters_length,
-                               u2  generic_signature_index,
+                               InlineTableSizes* sizes,
                                MethodType mt,
                                TRAPS);
 
   bool is_constMethod() const { return true; }
 
   // Inlined tables
-  void set_inlined_tables_length(u2  generic_signature_index,
-                                 int checked_exceptions_len,
-                                 int compressed_line_number_size,
-                                 int localvariable_table_len,
-                                 int exception_table_len,
-                                 int method_parameters_length);
+  void set_inlined_tables_length(InlineTableSizes* sizes);
 
   bool has_generic_signature() const
     { return (_flags & _has_generic_signature) != 0; }
@@ -235,10 +271,6 @@
     }
   }
 
-
-  void set_interpreter_kind(int kind)      { _interpreter_kind = kind; }
-  int  interpreter_kind(void) const        { return _interpreter_kind; }
-
   // constant pool
   ConstantPool* constants() const        { return _constants; }
   void set_constants(ConstantPool* c)    { _constants = c; }
@@ -307,12 +339,7 @@
   }
 
   // Size needed
-  static int size(int code_size, int compressed_line_number_size,
-                  int local_variable_table_length,
-                  int exception_table_length,
-                  int checked_exceptions_length,
-                  int method_parameters_length,
-                  u2  generic_signature_index);
+  static int size(int code_size, InlineTableSizes* sizes);
 
   int size() const                    { return _constMethod_size;}
   void set_constMethod_size(int size)     { _constMethod_size = size; }
@@ -354,6 +381,65 @@
   int method_parameters_length() const;
   MethodParametersElement* method_parameters_start() const;
 
+  // method annotations
+  bool has_method_annotations() const
+    { return (_flags & _has_method_annotations) != 0; }
+
+  bool has_parameter_annotations() const
+    { return (_flags & _has_parameter_annotations) != 0; }
+
+  bool has_type_annotations() const
+    { return (_flags & _has_type_annotations) != 0; }
+
+  bool has_default_annotations() const
+    { return (_flags & _has_default_annotations) != 0; }
+
+
+  AnnotationArray** method_annotations_addr() const;
+  AnnotationArray* method_annotations() const  {
+    return has_method_annotations() ? *(method_annotations_addr()) : NULL;
+  }
+  void set_method_annotations(AnnotationArray* anno) {
+    *(method_annotations_addr()) = anno;
+  }
+
+  AnnotationArray** parameter_annotations_addr() const;
+  AnnotationArray* parameter_annotations() const {
+    return has_parameter_annotations() ? *(parameter_annotations_addr()) : NULL;
+  }
+  void set_parameter_annotations(AnnotationArray* anno) {
+    *(parameter_annotations_addr()) = anno;
+  }
+
+  AnnotationArray** type_annotations_addr() const;
+  AnnotationArray* type_annotations() const {
+    return has_type_annotations() ? *(type_annotations_addr()) : NULL;
+  }
+  void set_type_annotations(AnnotationArray* anno) {
+    *(type_annotations_addr()) = anno;
+  }
+
+  AnnotationArray** default_annotations_addr() const;
+  AnnotationArray* default_annotations() const {
+    return has_default_annotations() ? *(default_annotations_addr()) : NULL;
+  }
+  void set_default_annotations(AnnotationArray* anno) {
+    *(default_annotations_addr()) = anno;
+  }
+
+  int method_annotations_length() const {
+    return has_method_annotations() ? method_annotations()->length() : 0;
+  }
+  int parameter_annotations_length() const {
+    return has_parameter_annotations() ? parameter_annotations()->length() : 0;
+  }
+  int type_annotations_length() const {
+    return has_type_annotations() ? type_annotations()->length() : 0;
+  }
+  int default_annotations_length() const {
+    return has_default_annotations() ? default_annotations()->length() : 0;
+  }
+
   // byte codes
   void    set_code(address code) {
     if (code_size() > 0) {
@@ -409,11 +495,10 @@
 
   // First byte after ConstMethod*
   address constMethod_end() const
-                          { return (address)((oop*)this + _constMethod_size); }
+                          { return (address)((intptr_t*)this + _constMethod_size); }
 
   // Last short in ConstMethod*
-  u2* last_u2_element() const
-                                         { return (u2*)constMethod_end() - 1; }
+  u2* last_u2_element() const;
 
  public:
   // Printing
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, 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
@@ -402,8 +402,9 @@
 }
 
 
+#if INCLUDE_JVMTI
 // RedefineClasses() API support:
-// If this constantPoolCacheEntry refers to old_method then update it
+// If this ConstantPoolCacheEntry refers to old_method then update it
 // to refer to new_method.
 bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
        Method* new_method, bool * trace_name_printed) {
@@ -461,16 +462,24 @@
   return false;
 }
 
-#ifndef PRODUCT
-bool ConstantPoolCacheEntry::check_no_old_entries() {
+// a constant pool cache entry should never contain old or obsolete methods
+bool ConstantPoolCacheEntry::check_no_old_or_obsolete_entries() {
   if (is_vfinal()) {
+    // virtual and final so _f2 contains method ptr instead of vtable index
     Metadata* f2 = (Metadata*)_f2;
-    return (f2->is_valid() && f2->is_method() && !((Method*)f2)->is_old());
-  } else {
-    return (_f1 == NULL || (_f1->is_valid() && _f1->is_method() && !((Method*)_f1)->is_old()));
+    // Return false if _f2 refers to an old or an obsolete method.
+    // _f2 == NULL || !_f2->is_method() are just as unexpected here.
+    return (f2 != NULL NOT_PRODUCT(&& f2->is_valid()) && f2->is_method() &&
+            !((Method*)f2)->is_old() && !((Method*)f2)->is_obsolete());
+  } else if (_f1 == NULL ||
+             (NOT_PRODUCT(_f1->is_valid() &&) !_f1->is_method())) {
+    // _f1 == NULL || !_f1->is_method() are OK here
+    return true;
   }
+  // return false if _f1 refers to an old or an obsolete method
+  return (NOT_PRODUCT(_f1->is_valid() &&) _f1->is_method() &&
+          !((Method*)_f1)->is_old() && !((Method*)_f1)->is_obsolete());
 }
-#endif
 
 bool ConstantPoolCacheEntry::is_interesting_method_entry(Klass* k) {
   if (!is_method_entry()) {
@@ -503,13 +512,15 @@
   // the method is in the interesting class so the entry is interesting
   return true;
 }
+#endif // INCLUDE_JVMTI
 
 void ConstantPoolCacheEntry::print(outputStream* st, int index) const {
   // print separator
   if (index == 0) st->print_cr("                 -------------");
   // print entry
   st->print("%3d  ("PTR_FORMAT")  ", index, (intptr_t)this);
-    st->print_cr("[%02x|%02x|%5d]", bytecode_2(), bytecode_1(), constant_pool_index());
+  st->print_cr("[%02x|%02x|%5d]", bytecode_2(), bytecode_1(),
+               constant_pool_index());
   st->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)_f1);
   st->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)_f2);
   st->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)_flags);
@@ -553,8 +564,9 @@
   }
 }
 
+#if INCLUDE_JVMTI
 // RedefineClasses() API support:
-// If any entry of this constantPoolCache points to any of
+// If any entry of this ConstantPoolCache points to any of
 // old_methods, replace it with the corresponding new_method.
 void ConstantPoolCache::adjust_method_entries(Method** old_methods, Method** new_methods,
                                                      int methods_length, bool * trace_name_printed) {
@@ -573,7 +585,7 @@
       continue;
     }
 
-    // The constantPoolCache contains entries for several different
+    // The ConstantPoolCache contains entries for several different
     // things, but we only care about methods. In fact, we only care
     // about methods in the same class as the one that contains the
     // old_methods. At this point, we have an interesting entry.
@@ -592,17 +604,25 @@
   }
 }
 
-#ifndef PRODUCT
-bool ConstantPoolCache::check_no_old_entries() {
+// the constant pool cache should never contain old or obsolete methods
+bool ConstantPoolCache::check_no_old_or_obsolete_entries() {
   for (int i = 1; i < length(); i++) {
     if (entry_at(i)->is_interesting_method_entry(NULL) &&
-       !entry_at(i)->check_no_old_entries()) {
+        !entry_at(i)->check_no_old_or_obsolete_entries()) {
       return false;
     }
   }
   return true;
 }
-#endif // PRODUCT
+
+void ConstantPoolCache::dump_cache() {
+  for (int i = 1; i < length(); i++) {
+    if (entry_at(i)->is_interesting_method_entry(NULL)) {
+      entry_at(i)->print(tty, i);
+    }
+  }
+}
+#endif // INCLUDE_JVMTI
 
 
 // Printing
--- a/hotspot/src/share/vm/oops/cpCache.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/cpCache.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, 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
@@ -337,16 +337,18 @@
   static ByteSize f2_offset()                    { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
   static ByteSize flags_offset()                 { return byte_offset_of(ConstantPoolCacheEntry, _flags); }
 
+#if INCLUDE_JVMTI
   // RedefineClasses() API support:
-  // If this constantPoolCacheEntry refers to old_method then update it
+  // If this ConstantPoolCacheEntry refers to old_method then update it
   // to refer to new_method.
   // trace_name_printed is set to true if the current call has
   // printed the klass name so that other routines in the adjust_*
   // group don't print the klass name.
   bool adjust_method_entry(Method* old_method, Method* new_method,
          bool * trace_name_printed);
-  NOT_PRODUCT(bool check_no_old_entries();)
+  bool check_no_old_or_obsolete_entries();
   bool is_interesting_method_entry(Klass* k);
+#endif // INCLUDE_JVMTI
 
   // Debugging & Printing
   void print (outputStream* st, int index) const;
@@ -423,15 +425,18 @@
     return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
   }
 
+#if INCLUDE_JVMTI
   // RedefineClasses() API support:
-  // If any entry of this constantPoolCache points to any of
+  // If any entry of this ConstantPoolCache points to any of
   // old_methods, replace it with the corresponding new_method.
   // trace_name_printed is set to true if the current call has
   // printed the klass name so that other routines in the adjust_*
   // group don't print the klass name.
   void adjust_method_entries(Method** old_methods, Method** new_methods,
                              int methods_length, bool * trace_name_printed);
-  NOT_PRODUCT(bool check_no_old_entries();)
+  bool check_no_old_or_obsolete_entries();
+  void dump_cache();
+#endif // INCLUDE_JVMTI
 
   // Deallocate - no fields to deallocate
   DEBUG_ONLY(bool on_stack() { return false; })
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -166,20 +166,19 @@
 volatile int InstanceKlass::_total_instanceKlass_count = 0;
 
 Klass* InstanceKlass::allocate_instance_klass(ClassLoaderData* loader_data,
-                                                int vtable_len,
-                                                int itable_len,
-                                                int static_field_size,
-                                                int nonstatic_oop_map_size,
-                                                ReferenceType rt,
-                                                AccessFlags access_flags,
-                                                Symbol* name,
+                                              int vtable_len,
+                                              int itable_len,
+                                              int static_field_size,
+                                              int nonstatic_oop_map_size,
+                                              ReferenceType rt,
+                                              AccessFlags access_flags,
+                                              Symbol* name,
                                               Klass* super_klass,
-                                                KlassHandle host_klass,
-                                                TRAPS) {
+                                              bool is_anonymous,
+                                              TRAPS) {
 
   int size = InstanceKlass::size(vtable_len, itable_len, nonstatic_oop_map_size,
-                                 access_flags.is_interface(),
-                                 !host_klass.is_null());
+                                 access_flags.is_interface(), is_anonymous);
 
   // Allocation
   InstanceKlass* ik;
@@ -187,25 +186,25 @@
     if (name == vmSymbols::java_lang_Class()) {
       ik = new (loader_data, size, THREAD) InstanceMirrorKlass(
         vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
-        access_flags, !host_klass.is_null());
+        access_flags, is_anonymous);
     } else if (name == vmSymbols::java_lang_ClassLoader() ||
           (SystemDictionary::ClassLoader_klass_loaded() &&
           super_klass != NULL &&
           super_klass->is_subtype_of(SystemDictionary::ClassLoader_klass()))) {
       ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(
         vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
-        access_flags, !host_klass.is_null());
+        access_flags, is_anonymous);
     } else {
       // normal class
       ik = new (loader_data, size, THREAD) InstanceKlass(
         vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
-        access_flags, !host_klass.is_null());
+        access_flags, is_anonymous);
     }
   } else {
     // reference klass
     ik = new (loader_data, size, THREAD) InstanceRefKlass(
         vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
-        access_flags, !host_klass.is_null());
+        access_flags, is_anonymous);
   }
 
   Atomic::inc(&_total_instanceKlass_count);
@@ -2793,7 +2792,10 @@
     st->print("%s", source_debug_extension());
     st->cr();
   }
-  st->print(BULLET"annotations:       "); annotations()->print_value_on(st); st->cr();
+  st->print(BULLET"class annotations:       "); class_annotations()->print_value_on(st); st->cr();
+  st->print(BULLET"class type annotations:  "); class_type_annotations()->print_value_on(st); st->cr();
+  st->print(BULLET"field annotations:       "); fields_annotations()->print_value_on(st); st->cr();
+  st->print(BULLET"field type annotations:  "); fields_type_annotations()->print_value_on(st); st->cr();
   {
     ResourceMark rm;
     // PreviousVersionInfo objects returned via PreviousVersionWalker
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -155,8 +155,8 @@
                                           ReferenceType rt,
                                           AccessFlags access_flags,
                                           Symbol* name,
-                                        Klass* super_klass,
-                                          KlassHandle host_klass,
+                                          Klass* super_klass,
+                                          bool is_anonymous,
                                           TRAPS);
 
   InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
@@ -679,19 +679,19 @@
   // annotations support
   Annotations* annotations() const          { return _annotations; }
   void set_annotations(Annotations* anno)   { _annotations = anno; }
+
   AnnotationArray* class_annotations() const {
-    if (annotations() == NULL) return NULL;
-    return annotations()->class_annotations();
+    return (_annotations != NULL) ? _annotations->class_annotations() : NULL;
   }
   Array<AnnotationArray*>* fields_annotations() const {
-    if (annotations() == NULL) return NULL;
-    return annotations()->fields_annotations();
+    return (_annotations != NULL) ? _annotations->fields_annotations() : NULL;
   }
-  Annotations* type_annotations() const {
-    if (annotations() == NULL) return NULL;
-    return annotations()->type_annotations();
+  AnnotationArray* class_type_annotations() const {
+    return (_annotations != NULL) ? _annotations->class_type_annotations() : NULL;
   }
-
+  Array<AnnotationArray*>* fields_type_annotations() const {
+    return (_annotations != NULL) ? _annotations->fields_type_annotations() : NULL;
+  }
   // allocation
   instanceOop allocate_instance(TRAPS);
 
@@ -810,6 +810,7 @@
 
   // Sizing (in words)
   static int header_size()            { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
+
   static int size(int vtable_length, int itable_length,
                   int nonstatic_oop_map_size,
                   bool is_interface, bool is_anonymous) {
@@ -847,10 +848,14 @@
     return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length()));
   }
 
+  Klass** end_of_nonstatic_oop_maps() const {
+    return (Klass**)(start_of_nonstatic_oop_maps() +
+                     nonstatic_oop_map_count());
+  }
+
   Klass** adr_implementor() const {
     if (is_interface()) {
-      return (Klass**)(start_of_nonstatic_oop_maps() +
-                    nonstatic_oop_map_count());
+      return (Klass**)end_of_nonstatic_oop_maps();
     } else {
       return NULL;
     }
@@ -862,8 +867,7 @@
       if (adr_impl != NULL) {
         return adr_impl + 1;
       } else {
-        return (Klass**)(start_of_nonstatic_oop_maps() +
-                      nonstatic_oop_map_count());
+        return end_of_nonstatic_oop_maps();
       }
     } else {
       return NULL;
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -610,6 +610,7 @@
   Copy::disjoint_words((HeapWord*)table(), (HeapWord*)start, _length * vtableEntry::size());
 }
 
+#if INCLUDE_JVMTI
 void klassVtable::adjust_method_entries(Method** old_methods, Method** new_methods,
                                         int methods_length, bool * trace_name_printed) {
   // search the vtable for uses of either obsolete or EMCP methods
@@ -638,11 +639,39 @@
                                 new_method->name()->as_C_string(),
                                 new_method->signature()->as_C_string()));
         }
+        // cannot 'break' here; see for-loop comment above.
       }
     }
   }
 }
 
+// a vtable should never contain old or obsolete methods
+bool klassVtable::check_no_old_or_obsolete_entries() {
+  for (int i = 0; i < length(); i++) {
+    Method* m = unchecked_method_at(i);
+    if (m != NULL &&
+        (NOT_PRODUCT(!m->is_valid() ||) m->is_old() || m->is_obsolete())) {
+      return false;
+    }
+  }
+  return true;
+}
+
+void klassVtable::dump_vtable() {
+  tty->print_cr("vtable dump --");
+  for (int i = 0; i < length(); i++) {
+    Method* m = unchecked_method_at(i);
+    if (m != NULL) {
+      tty->print("      (%5d)  ", i);
+      m->access_flags().print_on(tty);
+      tty->print(" --  ");
+      m->print_name(tty);
+      tty->cr();
+    }
+  }
+}
+#endif // INCLUDE_JVMTI
+
 // CDS/RedefineClasses support - clear vtables so they can be reinitialized
 void klassVtable::clear_vtable() {
   for (int i = 0; i < _length; i++) table()[i].clear();
@@ -805,6 +834,7 @@
   }
 }
 
+#if INCLUDE_JVMTI
 void klassItable::adjust_method_entries(Method** old_methods, Method** new_methods,
                                         int methods_length, bool * trace_name_printed) {
   // search the itable for uses of either obsolete or EMCP methods
@@ -833,13 +863,44 @@
             new_method->name()->as_C_string(),
             new_method->signature()->as_C_string()));
         }
-        // Cannot break because there might be another entry for this method
+        // cannot 'break' here; see for-loop comment above.
       }
       ime++;
     }
   }
 }
 
+// an itable should never contain old or obsolete methods
+bool klassItable::check_no_old_or_obsolete_entries() {
+  itableMethodEntry* ime = method_entry(0);
+  for (int i = 0; i < _size_method_table; i++) {
+    Method* m = ime->method();
+    if (m != NULL &&
+        (NOT_PRODUCT(!m->is_valid() ||) m->is_old() || m->is_obsolete())) {
+      return false;
+    }
+    ime++;
+  }
+  return true;
+}
+
+void klassItable::dump_itable() {
+  itableMethodEntry* ime = method_entry(0);
+  tty->print_cr("itable dump --");
+  for (int i = 0; i < _size_method_table; i++) {
+    Method* m = ime->method();
+    if (m != NULL) {
+      tty->print("      (%5d)  ", i);
+      m->access_flags().print_on(tty);
+      tty->print(" --  ");
+      m->print_name(tty);
+      tty->cr();
+    }
+    ime++;
+  }
+}
+#endif // INCLUDE_JVMTI
+
 
 // Setup
 class InterfaceVisiterClosure : public StackObj {
@@ -1126,43 +1187,6 @@
   tty->print_cr("%6d bytes total", total);
 }
 
-bool klassVtable::check_no_old_entries() {
-  // Check that there really is no entry
-  for (int i = 0; i < length(); i++) {
-    Method* m = unchecked_method_at(i);
-    if (m != NULL) {
-        if (!m->is_valid() || m->is_old()) {
-            return false;
-        }
-    }
-  }
-  return true;
-}
-
-void klassVtable::dump_vtable() {
-  tty->print_cr("vtable dump --");
-  for (int i = 0; i < length(); i++) {
-    Method* m = unchecked_method_at(i);
-    if (m != NULL) {
-      tty->print("      (%5d)  ", i);
-      m->access_flags().print_on(tty);
-      tty->print(" --  ");
-      m->print_name(tty);
-      tty->cr();
-    }
-  }
-}
-
-bool klassItable::check_no_old_entries() {
-  itableMethodEntry* ime = method_entry(0);
-  for(int i = 0; i < _size_method_table; i++) {
-    Method* m = ime->method();
-    if (m != NULL && (!m->is_valid() || m->is_old())) return false;
-    ime++;
-  }
-  return true;
-}
-
 int  klassItable::_total_classes;   // Total no. of classes with itables
 long klassItable::_total_size;      // Total no. of bytes used for itables
 
--- a/hotspot/src/share/vm/oops/klassVtable.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/klassVtable.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -90,6 +90,7 @@
       Array<Method*>* methods, AccessFlags class_flags, Handle classloader,
       Symbol* classname, Array<Klass*>* local_interfaces, TRAPS);
 
+#if INCLUDE_JVMTI
   // RedefineClasses() API support:
   // If any entry of this vtable points to any of old_methods,
   // replace it with the corresponding new_method.
@@ -98,17 +99,15 @@
   // group don't print the klass name.
   void adjust_method_entries(Method** old_methods, Method** new_methods,
                              int methods_length, bool * trace_name_printed);
+  bool check_no_old_or_obsolete_entries();
+  void dump_vtable();
+#endif // INCLUDE_JVMTI
 
   // Debugging code
   void print()                                              PRODUCT_RETURN;
   void verify(outputStream* st, bool force = false);
   static void print_statistics()                            PRODUCT_RETURN;
 
-#ifndef PRODUCT
-  bool check_no_old_entries();
-  void dump_vtable();
-#endif
-
  protected:
   friend class vtableEntry;
  private:
@@ -275,6 +274,7 @@
   // Updates
   void initialize_with_method(Method* m);
 
+#if INCLUDE_JVMTI
   // RedefineClasses() API support:
   // if any entry of this itable points to any of old_methods,
   // replace it with the corresponding new_method.
@@ -283,6 +283,9 @@
   // group don't print the klass name.
   void adjust_method_entries(Method** old_methods, Method** new_methods,
                              int methods_length, bool * trace_name_printed);
+  bool check_no_old_or_obsolete_entries();
+  void dump_itable();
+#endif // INCLUDE_JVMTI
 
   // Setup of itable
   static int compute_itable_size(Array<Klass*>* transitive_interfaces);
@@ -307,11 +310,6 @@
   NOT_PRODUCT(static long _total_size;)      // Total no. of bytes used for itables
 
   static void update_stats(int size) PRODUCT_RETURN NOT_PRODUCT({ _total_classes++; _total_size += size; })
-
- public:
-#ifndef PRODUCT
-  bool check_no_old_entries();
-#endif
 };
 
 #endif // SHARE_VM_OOPS_KLASSVTABLE_HPP
--- a/hotspot/src/share/vm/oops/method.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/method.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -61,24 +61,14 @@
 Method* Method::allocate(ClassLoaderData* loader_data,
                          int byte_code_size,
                          AccessFlags access_flags,
-                         int compressed_line_number_size,
-                         int localvariable_table_length,
-                         int exception_table_length,
-                         int checked_exceptions_length,
-                         int method_parameters_length,
-                         u2  generic_signature_index,
+                         InlineTableSizes* sizes,
                          ConstMethod::MethodType method_type,
                          TRAPS) {
   assert(!access_flags.is_native() || byte_code_size == 0,
          "native methods should not contain byte codes");
   ConstMethod* cm = ConstMethod::allocate(loader_data,
                                           byte_code_size,
-                                          compressed_line_number_size,
-                                          localvariable_table_length,
-                                          exception_table_length,
-                                          checked_exceptions_length,
-                                          method_parameters_length,
-                                          generic_signature_index,
+                                          sizes,
                                           method_type,
                                           CHECK_NULL);
 
@@ -317,14 +307,6 @@
 }
 
 
-void Method::set_interpreter_kind() {
-  int kind = Interpreter::method_kind(this);
-  assert(kind != Interpreter::invalid,
-         "interpreter entry must be valid");
-  set_interpreter_kind(kind);
-}
-
-
 // Attempt to return method oop to original state.  Clear any pointers
 // (to objects outside the shared spaces).  We won't be able to predict
 // where they should point in a new JVM.  Further initialize some
@@ -332,7 +314,6 @@
 
 void Method::remove_unshareable_info() {
   unlink_method();
-  set_interpreter_kind();
 }
 
 
@@ -1045,9 +1026,9 @@
 
   methodHandle m;
   {
+    InlineTableSizes sizes;
     Method* m_oop = Method::allocate(loader_data, 0,
-                                     accessFlags_from(flags_bits),
-                                     0, 0, 0, 0, 0, 0,
+                                     accessFlags_from(flags_bits), &sizes,
                                      ConstMethod::NORMAL, CHECK_(empty));
     m = methodHandle(THREAD, m_oop);
   }
@@ -1096,22 +1077,35 @@
   assert(!m->is_native(), "cannot rewrite native methods");
   // Allocate new Method*
   AccessFlags flags = m->access_flags();
-  u2  generic_signature_index = m->generic_signature_index();
-  int checked_exceptions_len = m->checked_exceptions_length();
-  int localvariable_len = m->localvariable_table_length();
-  int exception_table_len = m->exception_table_length();
-  int method_parameters_len = m->method_parameters_length();
+
+  ConstMethod* cm = m->constMethod();
+  int checked_exceptions_len = cm->checked_exceptions_length();
+  int localvariable_len = cm->localvariable_table_length();
+  int exception_table_len = cm->exception_table_length();
+  int method_parameters_len = cm->method_parameters_length();
+  int method_annotations_len = cm->method_annotations_length();
+  int parameter_annotations_len = cm->parameter_annotations_length();
+  int type_annotations_len = cm->type_annotations_length();
+  int default_annotations_len = cm->default_annotations_length();
+
+  InlineTableSizes sizes(
+      localvariable_len,
+      new_compressed_linenumber_size,
+      exception_table_len,
+      checked_exceptions_len,
+      method_parameters_len,
+      cm->generic_signature_index(),
+      method_annotations_len,
+      parameter_annotations_len,
+      type_annotations_len,
+      default_annotations_len,
+      0);
 
   ClassLoaderData* loader_data = m->method_holder()->class_loader_data();
   Method* newm_oop = Method::allocate(loader_data,
                                       new_code_length,
                                       flags,
-                                      new_compressed_linenumber_size,
-                                      localvariable_len,
-                                      exception_table_len,
-                                      checked_exceptions_len,
-                                      method_parameters_len,
-                                      generic_signature_index,
+                                      &sizes,
                                       m->method_type(),
                                       CHECK_(methodHandle()));
   methodHandle newm (THREAD, newm_oop);
@@ -1311,29 +1305,6 @@
     MethodHandles::print_as_basic_type_signature_on(st, signature(), true);
 }
 
-// This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
-static void reorder_based_on_method_index(Array<Method*>* methods,
-                                          Array<AnnotationArray*>* annotations,
-                                          GrowableArray<AnnotationArray*>* temp_array) {
-  if (annotations == NULL) {
-    return;
-  }
-
-  int length = methods->length();
-  int i;
-  // Copy to temp array
-  temp_array->clear();
-  for (i = 0; i < length; i++) {
-    temp_array->append(annotations->at(i));
-  }
-
-  // Copy back using old method indices
-  for (i = 0; i < length; i++) {
-    Method* m = methods->at(i);
-    annotations->at_put(i, temp_array->at(m->method_idnum()));
-  }
-}
-
 // Comparer for sorting an object array containing
 // Method*s.
 static int method_comparator(Method* a, Method* b) {
@@ -1341,48 +1312,13 @@
 }
 
 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
-void Method::sort_methods(Array<Method*>* methods,
-                                 Array<AnnotationArray*>* methods_annotations,
-                                 Array<AnnotationArray*>* methods_parameter_annotations,
-                                 Array<AnnotationArray*>* methods_default_annotations,
-                                 Array<AnnotationArray*>* methods_type_annotations,
-                                 bool idempotent) {
+void Method::sort_methods(Array<Method*>* methods, bool idempotent) {
   int length = methods->length();
   if (length > 1) {
-    bool do_annotations = false;
-    if (methods_annotations != NULL ||
-        methods_parameter_annotations != NULL ||
-        methods_default_annotations != NULL ||
-        methods_type_annotations != NULL) {
-      do_annotations = true;
-    }
-    if (do_annotations) {
-      // Remember current method ordering so we can reorder annotations
-      for (int i = 0; i < length; i++) {
-        Method* m = methods->at(i);
-        m->set_method_idnum(i);
-      }
-    }
     {
       No_Safepoint_Verifier nsv;
       QuickSort::sort<Method*>(methods->data(), length, method_comparator, idempotent);
     }
-
-    // Sort annotations if necessary
-    assert(methods_annotations == NULL           || methods_annotations->length() == methods->length(), "");
-    assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), "");
-    assert(methods_default_annotations == NULL   || methods_default_annotations->length() == methods->length(), "");
-    assert(methods_type_annotations == NULL   || methods_type_annotations->length() == methods->length(), "");
-    if (do_annotations) {
-      ResourceMark rm;
-      // Allocate temporary storage
-      GrowableArray<AnnotationArray*>* temp_array = new GrowableArray<AnnotationArray*>(length);
-      reorder_based_on_method_index(methods, methods_annotations, temp_array);
-      reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array);
-      reorder_based_on_method_index(methods, methods_default_annotations, temp_array);
-      reorder_based_on_method_index(methods, methods_type_annotations, temp_array);
-    }
-
     // Reset method ordering
     for (int i = 0; i < length; i++) {
       Method* m = methods->at(i);
@@ -1393,9 +1329,9 @@
 
 
 //-----------------------------------------------------------------------------------
-// Non-product code
+// Non-product code unless JVM/TI needs it
 
-#ifndef PRODUCT
+#if !defined(PRODUCT) || INCLUDE_JVMTI
 class SignatureTypePrinter : public SignatureTypeNames {
  private:
   outputStream* _st;
@@ -1430,8 +1366,13 @@
   sig.print_parameters();
   st->print(")");
 }
+#endif // !PRODUCT || INCLUDE_JVMTI
 
 
+//-----------------------------------------------------------------------------------
+// Non-product code
+
+#ifndef PRODUCT
 void Method::print_codes_on(outputStream* st) const {
   print_codes_on(0, code_size(), st);
 }
--- a/hotspot/src/share/vm/oops/method.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/oops/method.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -101,6 +101,7 @@
 class AdapterHandlerEntry;
 class MethodData;
 class ConstMethod;
+class InlineTableSizes;
 class KlassSizeStats;
 
 class Method : public Metadata {
@@ -157,12 +158,7 @@
   static Method* allocate(ClassLoaderData* loader_data,
                           int byte_code_size,
                           AccessFlags access_flags,
-                          int compressed_line_number_size,
-                          int localvariable_table_length,
-                          int exception_table_length,
-                          int checked_exceptions_length,
-                          int method_parameters_length,
-                          u2 generic_signature_index,
+                          InlineTableSizes* sizes,
                           ConstMethod::MethodType method_type,
                           TRAPS);
 
@@ -207,33 +203,17 @@
 
   // annotations support
   AnnotationArray* annotations() const           {
-    InstanceKlass* ik = method_holder();
-    if (ik->annotations() == NULL) {
-      return NULL;
-    }
-    return ik->annotations()->get_method_annotations_of(method_idnum());
+    return constMethod()->method_annotations();
   }
   AnnotationArray* parameter_annotations() const {
-    InstanceKlass* ik = method_holder();
-    if (ik->annotations() == NULL) {
-      return NULL;
-    }
-    return ik->annotations()->get_method_parameter_annotations_of(method_idnum());
+    return constMethod()->parameter_annotations();
   }
   AnnotationArray* annotation_default() const    {
-    InstanceKlass* ik = method_holder();
-    if (ik->annotations() == NULL) {
-      return NULL;
-    }
-    return ik->annotations()->get_method_default_annotations_of(method_idnum());
+    return constMethod()->default_annotations();
   }
-  AnnotationArray* type_annotations() const {
-  InstanceKlass* ik = method_holder();
-  Annotations* type_annos = ik->type_annotations();
-  if (type_annos == NULL)
-    return NULL;
-  return type_annos->get_method_annotations_of(method_idnum());
-}
+  AnnotationArray* type_annotations() const      {
+    return constMethod()->type_annotations();
+  }
 
 #ifdef CC_INTERP
   void set_result_index(BasicType type);
@@ -439,13 +419,6 @@
   address interpreter_entry() const              { return _i2i_entry; }
   // Only used when first initialize so we can set _i2i_entry and _from_interpreted_entry
   void set_interpreter_entry(address entry)      { _i2i_entry = entry;  _from_interpreted_entry = entry; }
-  int  interpreter_kind(void) {
-     return constMethod()->interpreter_kind();
-  }
-  void set_interpreter_kind();
-  void set_interpreter_kind(int kind) {
-    constMethod()->set_interpreter_kind(kind);
-  }
 
   // native function (used for native methods only)
   enum {
@@ -800,16 +773,15 @@
   static bool has_unloaded_classes_in_signature(methodHandle m, TRAPS);
 
   // Printing
-  void print_short_name(outputStream* st = tty)  /*PRODUCT_RETURN*/; // prints as klassname::methodname; Exposed so field engineers can debug VM
+  void print_short_name(outputStream* st = tty); // prints as klassname::methodname; Exposed so field engineers can debug VM
+#if INCLUDE_JVMTI
+  void print_name(outputStream* st = tty); // prints as "virtual void foo(int)"; exposed for TraceRedefineClasses
+#else
   void print_name(outputStream* st = tty)        PRODUCT_RETURN; // prints as "virtual void foo(int)"
+#endif
 
   // Helper routine used for method sorting
-  static void sort_methods(Array<Method*>* methods,
-                           Array<AnnotationArray*>* methods_annotations,
-                           Array<AnnotationArray*>* methods_parameter_annotations,
-                           Array<AnnotationArray*>* methods_default_annotations,
-                           Array<AnnotationArray*>* methods_type_annotations,
-                           bool idempotent = false);
+  static void sort_methods(Array<Method*>* methods, bool idempotent = false);
 
   // Deallocation function for redefine classes or if an error occurs
   void deallocate_contents(ClassLoaderData* loader_data);
--- a/hotspot/src/share/vm/opto/c2_globals.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -618,6 +618,9 @@
                                                                             \
   product(intx, LiveNodeCountInliningCutoff, 20000,                         \
           "max number of live nodes in a method")                           \
+                                                                            \
+  diagnostic(bool, OptimizeExpensiveOps, true,                              \
+          "Find best control for expensive operations")                     \
 
 
 C2_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG)
--- a/hotspot/src/share/vm/opto/compile.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/compile.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -409,6 +409,13 @@
       remove_macro_node(n);
     }
   }
+  // Remove useless expensive node
+  for (int i = C->expensive_count()-1; i >= 0; i--) {
+    Node* n = C->expensive_node(i);
+    if (!useful.member(n)) {
+      remove_expensive_node(n);
+    }
+  }
   // clean up the late inline lists
   remove_useless_late_inlines(&_string_late_inlines, useful);
   remove_useless_late_inlines(&_late_inlines, useful);
@@ -1061,6 +1068,7 @@
   _intrinsics = NULL;
   _macro_nodes = new(comp_arena()) GrowableArray<Node*>(comp_arena(), 8,  0, NULL);
   _predicate_opaqs = new(comp_arena()) GrowableArray<Node*>(comp_arena(), 8,  0, NULL);
+  _expensive_nodes = new(comp_arena()) GrowableArray<Node*>(comp_arena(), 8,  0, NULL);
   register_library_intrinsics();
 }
 
@@ -1927,6 +1935,10 @@
 
   if (failing())  return;
 
+  // No more new expensive nodes will be added to the list from here
+  // so keep only the actual candidates for optimizations.
+  cleanup_expensive_nodes(igvn);
+
   // Perform escape analysis
   if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) {
     if (has_loops()) {
@@ -3010,6 +3022,15 @@
     return true;
   }
 
+  // Expensive nodes have their control input set to prevent the GVN
+  // from freely commoning them. There's no GVN beyond this point so
+  // no need to keep the control input. We want the expensive nodes to
+  // be freely moved to the least frequent code path by gcm.
+  assert(OptimizeExpensiveOps || expensive_count() == 0, "optimization off but list non empty?");
+  for (int i = 0; i < expensive_count(); i++) {
+    _expensive_nodes->at(i)->set_req(0, NULL);
+  }
+
   Final_Reshape_Counts frc;
 
   // Visit everybody reachable!
@@ -3525,3 +3546,126 @@
     }
   }
 }
+
+int Compile::cmp_expensive_nodes(Node* n1, Node* n2) {
+  if (n1->Opcode() < n2->Opcode())      return -1;
+  else if (n1->Opcode() > n2->Opcode()) return 1;
+
+  assert(n1->req() == n2->req(), err_msg_res("can't compare %s nodes: n1->req() = %d, n2->req() = %d", NodeClassNames[n1->Opcode()], n1->req(), n2->req()));
+  for (uint i = 1; i < n1->req(); i++) {
+    if (n1->in(i) < n2->in(i))      return -1;
+    else if (n1->in(i) > n2->in(i)) return 1;
+  }
+
+  return 0;
+}
+
+int Compile::cmp_expensive_nodes(Node** n1p, Node** n2p) {
+  Node* n1 = *n1p;
+  Node* n2 = *n2p;
+
+  return cmp_expensive_nodes(n1, n2);
+}
+
+void Compile::sort_expensive_nodes() {
+  if (!expensive_nodes_sorted()) {
+    _expensive_nodes->sort(cmp_expensive_nodes);
+  }
+}
+
+bool Compile::expensive_nodes_sorted() const {
+  for (int i = 1; i < _expensive_nodes->length(); i++) {
+    if (cmp_expensive_nodes(_expensive_nodes->adr_at(i), _expensive_nodes->adr_at(i-1)) < 0) {
+      return false;
+    }
+  }
+  return true;
+}
+
+bool Compile::should_optimize_expensive_nodes(PhaseIterGVN &igvn) {
+  if (_expensive_nodes->length() == 0) {
+    return false;
+  }
+
+  assert(OptimizeExpensiveOps, "optimization off?");
+
+  // Take this opportunity to remove dead nodes from the list
+  int j = 0;
+  for (int i = 0; i < _expensive_nodes->length(); i++) {
+    Node* n = _expensive_nodes->at(i);
+    if (!n->is_unreachable(igvn)) {
+      assert(n->is_expensive(), "should be expensive");
+      _expensive_nodes->at_put(j, n);
+      j++;
+    }
+  }
+  _expensive_nodes->trunc_to(j);
+
+  // Then sort the list so that similar nodes are next to each other
+  // and check for at least two nodes of identical kind with same data
+  // inputs.
+  sort_expensive_nodes();
+
+  for (int i = 0; i < _expensive_nodes->length()-1; i++) {
+    if (cmp_expensive_nodes(_expensive_nodes->adr_at(i), _expensive_nodes->adr_at(i+1)) == 0) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+void Compile::cleanup_expensive_nodes(PhaseIterGVN &igvn) {
+  if (_expensive_nodes->length() == 0) {
+    return;
+  }
+
+  assert(OptimizeExpensiveOps, "optimization off?");
+
+  // Sort to bring similar nodes next to each other and clear the
+  // control input of nodes for which there's only a single copy.
+  sort_expensive_nodes();
+
+  int j = 0;
+  int identical = 0;
+  int i = 0;
+  for (; i < _expensive_nodes->length()-1; i++) {
+    assert(j <= i, "can't write beyond current index");
+    if (_expensive_nodes->at(i)->Opcode() == _expensive_nodes->at(i+1)->Opcode()) {
+      identical++;
+      _expensive_nodes->at_put(j++, _expensive_nodes->at(i));
+      continue;
+    }
+    if (identical > 0) {
+      _expensive_nodes->at_put(j++, _expensive_nodes->at(i));
+      identical = 0;
+    } else {
+      Node* n = _expensive_nodes->at(i);
+      igvn.hash_delete(n);
+      n->set_req(0, NULL);
+      igvn.hash_insert(n);
+    }
+  }
+  if (identical > 0) {
+    _expensive_nodes->at_put(j++, _expensive_nodes->at(i));
+  } else if (_expensive_nodes->length() >= 1) {
+    Node* n = _expensive_nodes->at(i);
+    igvn.hash_delete(n);
+    n->set_req(0, NULL);
+    igvn.hash_insert(n);
+  }
+  _expensive_nodes->trunc_to(j);
+}
+
+void Compile::add_expensive_node(Node * n) {
+  assert(!_expensive_nodes->contains(n), "duplicate entry in expensive list");
+  assert(n->is_expensive(), "expensive nodes with non-null control here only");
+  assert(!n->is_CFG() && !n->is_Mem(), "no cfg or memory nodes here");
+  if (OptimizeExpensiveOps) {
+    _expensive_nodes->append(n);
+  } else {
+    // Clear control input and let IGVN optimize expensive nodes if
+    // OptimizeExpensiveOps is off.
+    n->set_req(0, NULL);
+  }
+}
--- a/hotspot/src/share/vm/opto/compile.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/compile.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -314,6 +314,7 @@
   GrowableArray<CallGenerator*>* _intrinsics;   // List of intrinsics.
   GrowableArray<Node*>* _macro_nodes;           // List of nodes which need to be expanded before matching.
   GrowableArray<Node*>* _predicate_opaqs;       // List of Opaque1 nodes for the loop predicates.
+  GrowableArray<Node*>* _expensive_nodes;       // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
   ConnectionGraph*      _congraph;
 #ifndef PRODUCT
   IdealGraphPrinter*    _printer;
@@ -398,6 +399,13 @@
   GrowableArray<PrintInliningBuffer>* _print_inlining_list;
   int _print_inlining;
 
+  // Only keep nodes in the expensive node list that need to be optimized
+  void cleanup_expensive_nodes(PhaseIterGVN &igvn);
+  // Use for sorting expensive nodes to bring similar nodes together
+  static int cmp_expensive_nodes(Node** n1, Node** n2);
+  // Expensive nodes list already sorted?
+  bool expensive_nodes_sorted() const;
+
  public:
 
   outputStream* print_inlining_stream() const {
@@ -573,8 +581,10 @@
 
   int           macro_count()                   { return _macro_nodes->length(); }
   int           predicate_count()               { return _predicate_opaqs->length();}
+  int           expensive_count()               { return _expensive_nodes->length(); }
   Node*         macro_node(int idx)             { return _macro_nodes->at(idx); }
   Node*         predicate_opaque1_node(int idx) { return _predicate_opaqs->at(idx);}
+  Node*         expensive_node(int idx)         { return _expensive_nodes->at(idx); }
   ConnectionGraph* congraph()                   { return _congraph;}
   void set_congraph(ConnectionGraph* congraph)  { _congraph = congraph;}
   void add_macro_node(Node * n) {
@@ -592,6 +602,12 @@
       _predicate_opaqs->remove(n);
     }
   }
+  void add_expensive_node(Node * n);
+  void remove_expensive_node(Node * n) {
+    if (_expensive_nodes->contains(n)) {
+      _expensive_nodes->remove(n);
+    }
+  }
   void add_predicate_opaq(Node * n) {
     assert(!_predicate_opaqs->contains(n), " duplicate entry in predicate opaque1");
     assert(_macro_nodes->contains(n), "should have already been in macro list");
@@ -604,6 +620,13 @@
     return _predicate_opaqs->contains(n);
   }
 
+  // Are there candidate expensive nodes for optimization?
+  bool should_optimize_expensive_nodes(PhaseIterGVN &igvn);
+  // Check whether n1 and n2 are similar
+  static int cmp_expensive_nodes(Node* n1, Node* n2);
+  // Sort expensive nodes to locate similar expensive nodes
+  void sort_expensive_nodes();
+
   // Compilation environment.
   Arena*            comp_arena()                { return &_comp_arena; }
   ciEnv*            env() const                 { return _env; }
--- a/hotspot/src/share/vm/opto/library_call.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1653,7 +1653,7 @@
 // really odd corner cases (+/- Infinity).  Just uncommon-trap them.
 bool LibraryCallKit::inline_exp() {
   Node* arg = round_double_node(argument(0));
-  Node* n   = _gvn.transform(new (C) ExpDNode(0, arg));
+  Node* n   = _gvn.transform(new (C) ExpDNode(C, control(), arg));
 
   finish_pow_exp(n, arg, NULL, OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
 
@@ -1688,7 +1688,7 @@
 
   if (!too_many_traps(Deoptimization::Reason_intrinsic)) {
     // Short form: skip the fancy tests and just check for NaN result.
-    result = _gvn.transform(new (C) PowDNode(0, x, y));
+    result = _gvn.transform(new (C) PowDNode(C, control(), x, y));
   } else {
     // If this inlining ever returned NaN in the past, include all
     // checks + call to the runtime.
@@ -1715,7 +1715,7 @@
     Node *complex_path = _gvn.transform( new (C) IfTrueNode(if1) );
 
     // Set fast path result
-    Node *fast_result = _gvn.transform( new (C) PowDNode(0, x, y) );
+    Node *fast_result = _gvn.transform( new (C) PowDNode(C, control(), x, y) );
     phi->init_req(3, fast_result);
 
     // Complex path
@@ -1775,7 +1775,7 @@
     // abs(x)
     Node *absx=_gvn.transform( new (C) AbsDNode(x));
     // abs(x)^y
-    Node *absxpowy = _gvn.transform( new (C) PowDNode(0, absx, y) );
+    Node *absxpowy = _gvn.transform( new (C) PowDNode(C, control(), absx, y) );
     // -abs(x)^y
     Node *negabsxpowy = _gvn.transform(new (C) NegDNode (absxpowy));
     // (1&(long)y)==1?-DPow(abs(x), y):DPow(abs(x), y)
--- a/hotspot/src/share/vm/opto/loopnode.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -88,9 +88,9 @@
   assert( !n->is_Phi() && !n->is_CFG(), "this code only handles data nodes" );
   uint i;
   Node *early;
-  if( n->in(0) ) {
+  if (n->in(0) && !n->is_expensive()) {
     early = n->in(0);
-    if( !early->is_CFG() ) // Might be a non-CFG multi-def
+    if (!early->is_CFG()) // Might be a non-CFG multi-def
       early = get_ctrl(early);        // So treat input as a straight data input
     i = 1;
   } else {
@@ -99,28 +99,28 @@
   }
   uint e_d = dom_depth(early);
   assert( early, "" );
-  for( ; i < n->req(); i++ ) {
+  for (; i < n->req(); i++) {
     Node *cin = get_ctrl(n->in(i));
     assert( cin, "" );
     // Keep deepest dominator depth
     uint c_d = dom_depth(cin);
-    if( c_d > e_d ) {           // Deeper guy?
+    if (c_d > e_d) {           // Deeper guy?
       early = cin;              // Keep deepest found so far
       e_d = c_d;
-    } else if( c_d == e_d &&    // Same depth?
-               early != cin ) { // If not equal, must use slower algorithm
+    } else if (c_d == e_d &&    // Same depth?
+               early != cin) { // If not equal, must use slower algorithm
       // If same depth but not equal, one _must_ dominate the other
       // and we want the deeper (i.e., dominated) guy.
       Node *n1 = early;
       Node *n2 = cin;
-      while( 1 ) {
+      while (1) {
         n1 = idom(n1);          // Walk up until break cycle
         n2 = idom(n2);
-        if( n1 == cin ||        // Walked early up to cin
-            dom_depth(n2) < c_d )
+        if (n1 == cin ||        // Walked early up to cin
+            dom_depth(n2) < c_d)
           break;                // early is deeper; keep him
-        if( n2 == early ||      // Walked cin up to early
-            dom_depth(n1) < c_d ) {
+        if (n2 == early ||      // Walked cin up to early
+            dom_depth(n1) < c_d) {
           early = cin;          // cin is deeper; keep him
           break;
         }
@@ -132,9 +132,108 @@
   // Return earliest legal location
   assert(early == find_non_split_ctrl(early), "unexpected early control");
 
+  if (n->is_expensive()) {
+    assert(n->in(0), "should have control input");
+    early = get_early_ctrl_for_expensive(n, early);
+  }
+
   return early;
 }
 
+//------------------------------get_early_ctrl_for_expensive---------------------------------
+// Move node up the dominator tree as high as legal while still beneficial
+Node *PhaseIdealLoop::get_early_ctrl_for_expensive(Node *n, Node* earliest) {
+  assert(n->in(0) && n->is_expensive(), "expensive node with control input here");
+  assert(OptimizeExpensiveOps, "optimization off?");
+
+  Node* ctl = n->in(0);
+  assert(ctl->is_CFG(), "expensive input 0 must be cfg");
+  uint min_dom_depth = dom_depth(earliest);
+#ifdef ASSERT
+  if (!is_dominator(ctl, earliest) && !is_dominator(earliest, ctl)) {
+    dump_bad_graph("Bad graph detected in get_early_ctrl_for_expensive", n, earliest, ctl);
+    assert(false, "Bad graph detected in get_early_ctrl_for_expensive");
+  }
+#endif
+  if (dom_depth(ctl) < min_dom_depth) {
+    return earliest;
+  }
+
+  while (1) {
+    Node *next = ctl;
+    // Moving the node out of a loop on the projection of a If
+    // confuses loop predication. So once we hit a Loop in a If branch
+    // that doesn't branch to an UNC, we stop. The code that process
+    // expensive nodes will notice the loop and skip over it to try to
+    // move the node further up.
+    if (ctl->is_CountedLoop() && ctl->in(1) != NULL && ctl->in(1)->in(0) != NULL && ctl->in(1)->in(0)->is_If()) {
+      if (!is_uncommon_trap_if_pattern(ctl->in(1)->as_Proj(), Deoptimization::Reason_none)) {
+        break;
+      }
+      next = idom(ctl->in(1)->in(0));
+    } else if (ctl->is_Proj()) {
+      // We only move it up along a projection if the projection is
+      // the single control projection for its parent: same code path,
+      // if it's a If with UNC or fallthrough of a call.
+      Node* parent_ctl = ctl->in(0);
+      if (parent_ctl == NULL) {
+        break;
+      } else if (parent_ctl->is_CountedLoopEnd() && parent_ctl->as_CountedLoopEnd()->loopnode() != NULL) {
+        next = parent_ctl->as_CountedLoopEnd()->loopnode()->init_control();
+      } else if (parent_ctl->is_If()) {
+        if (!is_uncommon_trap_if_pattern(ctl->as_Proj(), Deoptimization::Reason_none)) {
+          break;
+        }
+        assert(idom(ctl) == parent_ctl, "strange");
+        next = idom(parent_ctl);
+      } else if (ctl->is_CatchProj()) {
+        if (ctl->as_Proj()->_con != CatchProjNode::fall_through_index) {
+          break;
+        }
+        assert(parent_ctl->in(0)->in(0)->is_Call(), "strange graph");
+        next = parent_ctl->in(0)->in(0)->in(0);
+      } else {
+        // Check if parent control has a single projection (this
+        // control is the only possible successor of the parent
+        // control). If so, we can try to move the node above the
+        // parent control.
+        int nb_ctl_proj = 0;
+        for (DUIterator_Fast imax, i = parent_ctl->fast_outs(imax); i < imax; i++) {
+          Node *p = parent_ctl->fast_out(i);
+          if (p->is_Proj() && p->is_CFG()) {
+            nb_ctl_proj++;
+            if (nb_ctl_proj > 1) {
+              break;
+            }
+          }
+        }
+
+        if (nb_ctl_proj > 1) {
+          break;
+        }
+        assert(parent_ctl->is_Start() || parent_ctl->is_MemBar() || parent_ctl->is_Call(), "unexpected node");
+        assert(idom(ctl) == parent_ctl, "strange");
+        next = idom(parent_ctl);
+      }
+    } else {
+      next = idom(ctl);
+    }
+    if (next->is_Root() || next->is_Start() || dom_depth(next) < min_dom_depth) {
+      break;
+    }
+    ctl = next;
+  }
+
+  if (ctl != n->in(0)) {
+    _igvn.hash_delete(n);
+    n->set_req(0, ctl);
+    _igvn.hash_insert(n);
+  }
+
+  return ctl;
+}
+
+
 //------------------------------set_early_ctrl---------------------------------
 // Set earliest legal control
 void PhaseIdealLoop::set_early_ctrl( Node *n ) {
@@ -1892,6 +1991,98 @@
   }
 }
 
+//------------------------process_expensive_nodes-----------------------------
+// Expensive nodes have their control input set to prevent the GVN
+// from commoning them and as a result forcing the resulting node to
+// be in a more frequent path. Use CFG information here, to change the
+// control inputs so that some expensive nodes can be commoned while
+// not executed more frequently.
+bool PhaseIdealLoop::process_expensive_nodes() {
+  assert(OptimizeExpensiveOps, "optimization off?");
+
+  // Sort nodes to bring similar nodes together
+  C->sort_expensive_nodes();
+
+  bool progress = false;
+
+  for (int i = 0; i < C->expensive_count(); ) {
+    Node* n = C->expensive_node(i);
+    int start = i;
+    // Find nodes similar to n
+    i++;
+    for (; i < C->expensive_count() && Compile::cmp_expensive_nodes(n, C->expensive_node(i)) == 0; i++);
+    int end = i;
+    // And compare them two by two
+    for (int j = start; j < end; j++) {
+      Node* n1 = C->expensive_node(j);
+      if (is_node_unreachable(n1)) {
+        continue;
+      }
+      for (int k = j+1; k < end; k++) {
+        Node* n2 = C->expensive_node(k);
+        if (is_node_unreachable(n2)) {
+          continue;
+        }
+
+        assert(n1 != n2, "should be pair of nodes");
+
+        Node* c1 = n1->in(0);
+        Node* c2 = n2->in(0);
+
+        Node* parent_c1 = c1;
+        Node* parent_c2 = c2;
+
+        // The call to get_early_ctrl_for_expensive() moves the
+        // expensive nodes up but stops at loops that are in a if
+        // branch. See whether we can exit the loop and move above the
+        // If.
+        if (c1->is_Loop()) {
+          parent_c1 = c1->in(1);
+        }
+        if (c2->is_Loop()) {
+          parent_c2 = c2->in(1);
+        }
+
+        if (parent_c1 == parent_c2) {
+          _igvn._worklist.push(n1);
+          _igvn._worklist.push(n2);
+          continue;
+        }
+
+        // Look for identical expensive node up the dominator chain.
+        if (is_dominator(c1, c2)) {
+          c2 = c1;
+        } else if (is_dominator(c2, c1)) {
+          c1 = c2;
+        } else if (parent_c1->is_Proj() && parent_c1->in(0)->is_If() &&
+                   parent_c2->is_Proj() && parent_c1->in(0) == parent_c2->in(0)) {
+          // Both branches have the same expensive node so move it up
+          // before the if.
+          c1 = c2 = idom(parent_c1->in(0));
+        }
+        // Do the actual moves
+        if (n1->in(0) != c1) {
+          _igvn.hash_delete(n1);
+          n1->set_req(0, c1);
+          _igvn.hash_insert(n1);
+          _igvn._worklist.push(n1);
+          progress = true;
+        }
+        if (n2->in(0) != c2) {
+          _igvn.hash_delete(n2);
+          n2->set_req(0, c2);
+          _igvn.hash_insert(n2);
+          _igvn._worklist.push(n2);
+          progress = true;
+        }
+      }
+    }
+  }
+
+  return progress;
+}
+
+
 //=============================================================================
 //----------------------------build_and_optimize-------------------------------
 // Create a PhaseLoop.  Build the ideal Loop tree.  Map each Ideal Node to
@@ -1960,7 +2151,9 @@
   }
 
   // Nothing to do, so get out
-  if( !C->has_loops() && !skip_loop_opts && !do_split_ifs && !_verify_me && !_verify_only ) {
+  bool stop_early = !C->has_loops() && !skip_loop_opts && !do_split_ifs && !_verify_me && !_verify_only;
+  bool do_expensive_nodes = C->should_optimize_expensive_nodes(_igvn);
+  if (stop_early && !do_expensive_nodes) {
     _igvn.optimize();           // Cleanup NeverBranches
     return;
   }
@@ -2058,6 +2251,21 @@
     return;
   }
 
+  if (stop_early) {
+    assert(do_expensive_nodes, "why are we here?");
+    if (process_expensive_nodes()) {
+      // If we made some progress when processing expensive nodes then
+      // the IGVN may modify the graph in a way that will allow us to
+      // make some more progress: we need to try processing expensive
+      // nodes again.
+      C->set_major_progress();
+    }
+
+    _igvn.optimize();
+
+    return;
+  }
+
   // Some parser-inserted loop predicates could never be used by loop
   // predication or they were moved away from loop during some optimizations.
   // For example, peeling. Eliminate them before next loop optimizations.
@@ -2120,6 +2328,10 @@
     NOT_PRODUCT( if( VerifyLoopOptimizations ) verify(); );
   }
 
+  if (!C->major_progress() && do_expensive_nodes && process_expensive_nodes()) {
+    C->set_major_progress();
+  }
+
   // Perform loop predication before iteration splitting
   if (C->has_loops() && !C->major_progress() && (C->predicate_count() > 0)) {
     _ltree_root->_child->loop_predication(this);
@@ -3299,7 +3511,7 @@
 #ifdef ASSERT
     if (legal->is_Start() && !early->is_Root()) {
       // Bad graph. Print idom path and fail.
-      dump_bad_graph(n, early, LCA);
+      dump_bad_graph("Bad graph detected in build_loop_late", n, early, LCA);
       assert(false, "Bad graph detected in build_loop_late");
     }
 #endif
@@ -3350,8 +3562,8 @@
 }
 
 #ifdef ASSERT
-void PhaseIdealLoop::dump_bad_graph(Node* n, Node* early, Node* LCA) {
-  tty->print_cr( "Bad graph detected in build_loop_late");
+void PhaseIdealLoop::dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA) {
+  tty->print_cr(msg);
   tty->print("n: "); n->dump();
   tty->print("early(n): "); early->dump();
   if (n->in(0) != NULL  && !n->in(0)->is_top() &&
--- a/hotspot/src/share/vm/opto/loopnode.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/loopnode.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -263,9 +263,18 @@
   bool stride_is_con() const        { Node *tmp = stride  (); return (tmp != NULL && tmp->is_Con()); }
   BoolTest::mask test_trip() const  { return in(TestValue)->as_Bool()->_test._test; }
   CountedLoopNode *loopnode() const {
+    // The CountedLoopNode that goes with this CountedLoopEndNode may
+    // have been optimized out by the IGVN so be cautious with the
+    // pattern matching on the graph
+    if (phi() == NULL) {
+      return NULL;
+    }
     Node *ln = phi()->in(0);
-    assert( ln->Opcode() == Op_CountedLoop, "malformed loop" );
-    return (CountedLoopNode*)ln; }
+    if (ln->is_CountedLoop() && ln->as_CountedLoop()->loopexit() == this) {
+      return (CountedLoopNode*)ln;
+    }
+    return NULL;
+  }
 
 #ifndef PRODUCT
   virtual void dump_spec(outputStream *st) const;
@@ -598,6 +607,7 @@
   // check if transform created new nodes that need _ctrl recorded
   Node *get_late_ctrl( Node *n, Node *early );
   Node *get_early_ctrl( Node *n );
+  Node *get_early_ctrl_for_expensive(Node *n, Node* earliest);
   void set_early_ctrl( Node *n );
   void set_subtree_ctrl( Node *root );
   void set_ctrl( Node *n, Node *ctrl ) {
@@ -905,6 +915,16 @@
   void collect_potentially_useful_predicates(IdealLoopTree *loop, Unique_Node_List &predicate_opaque1);
   void eliminate_useless_predicates();
 
+  // Change the control input of expensive nodes to allow commoning by
+  // IGVN when it is guaranteed to not result in a more frequent
+  // execution of the expensive node. Return true if progress.
+  bool process_expensive_nodes();
+
+  // Check whether node has become unreachable
+  bool is_node_unreachable(Node *n) const {
+    return !has_node(n) || n->is_unreachable(_igvn);
+  }
+
   // Eliminate range-checks and other trip-counter vs loop-invariant tests.
   void do_range_check( IdealLoopTree *loop, Node_List &old_new );
 
@@ -1043,7 +1063,7 @@
   void register_new_node( Node *n, Node *blk );
 
 #ifdef ASSERT
-void dump_bad_graph(Node* n, Node* early, Node* LCA);
+  void dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA);
 #endif
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/opto/node.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/node.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -493,6 +493,8 @@
   }
   if (is_macro())
     compile->add_macro_node(n);
+  if (is_expensive())
+    compile->add_expensive_node(n);
 
   n->set_idx(compile->next_unique()); // Get new unique index as well
   debug_only( n->verify_construction() );
@@ -616,6 +618,9 @@
   if (is_macro()) {
     compile->remove_macro_node(this);
   }
+  if (is_expensive()) {
+    compile->remove_expensive_node(this);
+  }
 #ifdef ASSERT
   // We will not actually delete the storage, but we'll make the node unusable.
   *(address*)this = badAddress;  // smash the C++ vtbl, probably
@@ -689,6 +694,13 @@
 }
 #endif
 
+
+//------------------------------is_unreachable---------------------------------
+bool Node::is_unreachable(PhaseIterGVN &igvn) const {
+  assert(!is_Mach(), "doesn't work with MachNodes");
+  return outcnt() == 0 || igvn.type(this) == Type::TOP || in(0)->is_top();
+}
+
 //------------------------------add_req----------------------------------------
 // Add a new required input at the end
 void Node::add_req( Node *n ) {
@@ -1246,6 +1258,9 @@
       if (dead->is_macro()) {
         igvn->C->remove_macro_node(dead);
       }
+      if (dead->is_expensive()) {
+        igvn->C->remove_expensive_node(dead);
+      }
       // Kill all inputs to the dead guy
       for (uint i=0; i < dead->req(); i++) {
         Node *n = dead->in(i);      // Get input to dead guy
--- a/hotspot/src/share/vm/opto/node.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/node.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -378,6 +378,8 @@
   bool is_dead() const;
 #define is_not_dead(n) ((n) == NULL || !VerifyIterativeGVN || !((n)->is_dead()))
 #endif
+  // Check whether node has become unreachable
+  bool is_unreachable(PhaseIterGVN &igvn) const;
 
   // Set a required input edge, also updates corresponding output edge
   void add_req( Node *n ); // Append a NEW required input
@@ -646,7 +648,8 @@
     Flag_may_be_short_branch = Flag_is_dead_loop_safe << 1,
     Flag_avoid_back_to_back  = Flag_may_be_short_branch << 1,
     Flag_has_call            = Flag_avoid_back_to_back << 1,
-    _max_flags = (Flag_has_call << 1) - 1 // allow flags combination
+    Flag_is_expensive        = Flag_has_call << 1,
+    _max_flags = (Flag_is_expensive << 1) - 1 // allow flags combination
   };
 
 private:
@@ -819,6 +822,8 @@
 
   // The node is a "macro" node which needs to be expanded before matching
   bool is_macro() const { return (_flags & Flag_is_macro) != 0; }
+  // The node is expensive: the best control is set during loop opts
+  bool is_expensive() const { return (_flags & Flag_is_expensive) != 0 && in(0) != NULL; }
 
 //----------------- Optimization
 
--- a/hotspot/src/share/vm/opto/phaseX.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/phaseX.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1203,6 +1203,9 @@
         if (dead->is_macro()) {
           C->remove_macro_node(dead);
         }
+        if (dead->is_expensive()) {
+          C->remove_expensive_node(dead);
+        }
 
         if (recurse) {
           continue;
--- a/hotspot/src/share/vm/opto/regmask.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/regmask.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -241,7 +241,8 @@
       } else {                  // Else its a split-pair case
         if( bit != _A[i] ) return false; // Found many bits, so fail
         i++;                    // Skip iteration forward
-        if( _A[i] != 1 ) return false; // Require 1 lo bit in next word
+        if( i >= RM_SIZE || _A[i] != 1 )
+          return false; // Require 1 lo bit in next word
       }
     }
   }
@@ -254,7 +255,7 @@
 // Find the lowest-numbered register set in the mask.  Return the
 // HIGHEST register number in the set, or BAD if no sets.
 // Works also for size 1.
-OptoReg::Name RegMask::find_first_set(int size) const {
+OptoReg::Name RegMask::find_first_set(const int size) const {
   verify_sets(size);
   for (int i = 0; i < RM_SIZE; i++) {
     if (_A[i]) {                // Found some bits
@@ -268,7 +269,7 @@
 
 //------------------------------clear_to_sets----------------------------------
 // Clear out partial bits; leave only aligned adjacent bit pairs
-void RegMask::clear_to_sets(int size) {
+void RegMask::clear_to_sets(const int size) {
   if (size == 1) return;
   assert(2 <= size && size <= 8, "update low bits table");
   assert(is_power_of_2(size), "sanity");
@@ -293,7 +294,7 @@
 
 //------------------------------smear_to_sets----------------------------------
 // Smear out partial bits to aligned adjacent bit sets
-void RegMask::smear_to_sets(int size) {
+void RegMask::smear_to_sets(const int size) {
   if (size == 1) return;
   assert(2 <= size && size <= 8, "update low bits table");
   assert(is_power_of_2(size), "sanity");
@@ -318,7 +319,7 @@
 }
 
 //------------------------------is_aligned_set--------------------------------
-bool RegMask::is_aligned_sets(int size) const {
+bool RegMask::is_aligned_sets(const int size) const {
   if (size == 1) return true;
   assert(2 <= size && size <= 8, "update low bits table");
   assert(is_power_of_2(size), "sanity");
@@ -344,7 +345,7 @@
 //------------------------------is_bound_set-----------------------------------
 // Return TRUE if the mask contains one adjacent set of bits and no other bits.
 // Works also for size 1.
-int RegMask::is_bound_set(int size) const {
+int RegMask::is_bound_set(const int size) const {
   if( is_AllStack() ) return false;
   assert(1 <= size && size <= 8, "update low bits table");
   int bit = -1;                 // Set to hold the one bit allowed
@@ -352,7 +353,7 @@
     if (_A[i] ) {               // Found some bits
       if (bit != -1)
        return false;            // Already had bits, so fail
-      bit = _A[i] & -_A[i];     // Extract 1 bit from mask
+      bit = _A[i] & -_A[i];     // Extract low bit from mask
       int hi_bit = bit << (size-1); // high bit
       if (hi_bit != 0) {        // Bit set stays in same word?
         int set = hi_bit + ((hi_bit-1) & ~(bit-1));
@@ -362,12 +363,12 @@
         if (((-1) & ~(bit-1)) != _A[i])
           return false;         // Found many bits, so fail
         i++;                    // Skip iteration forward and check high part
-        assert(size <= 8, "update next code");
         // The lower 24 bits should be 0 since it is split case and size <= 8.
         int set = bit>>24;
         set = set & -set; // Remove sign extension.
         set = (((set << size) - 1) >> 8);
-        if (_A[i] != set) return false; // Require 1 lo bit in next word
+        if (i >= RM_SIZE || _A[i] != set)
+          return false; // Require expected low bits in next word
       }
     }
   }
--- a/hotspot/src/share/vm/opto/regmask.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/regmask.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -225,22 +225,22 @@
   // Find the lowest-numbered register set in the mask.  Return the
   // HIGHEST register number in the set, or BAD if no sets.
   // Assert that the mask contains only bit sets.
-  OptoReg::Name find_first_set(int size) const;
+  OptoReg::Name find_first_set(const int size) const;
 
   // Clear out partial bits; leave only aligned adjacent bit sets of size.
-  void clear_to_sets(int size);
+  void clear_to_sets(const int size);
   // Smear out partial bits to aligned adjacent bit sets.
-  void smear_to_sets(int size);
+  void smear_to_sets(const int size);
   // Verify that the mask contains only aligned adjacent bit sets
   void verify_sets(int size) const { assert(is_aligned_sets(size), "mask is not aligned, adjacent sets"); }
   // Test that the mask contains only aligned adjacent bit sets
-  bool is_aligned_sets(int size) const;
+  bool is_aligned_sets(const int size) const;
 
   // mask is a set of misaligned registers
   bool is_misaligned_set(int size) const { return (int)Size()==size && !is_aligned_sets(size);}
 
   // Test for a single adjacent set
-  int is_bound_set(int size) const;
+  int is_bound_set(const int size) const;
 
   static bool is_vector(uint ireg);
   static int num_registers(uint ireg);
--- a/hotspot/src/share/vm/opto/subnode.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/opto/subnode.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -456,7 +456,10 @@
 //  Exponentiate a double
 class ExpDNode : public Node {
 public:
-  ExpDNode( Node *c, Node *in1 ) : Node(c, in1) {}
+  ExpDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
+    init_flags(Flag_is_expensive);
+    C->add_expensive_node(this);
+  }
   virtual int Opcode() const;
   const Type *bottom_type() const { return Type::DOUBLE; }
   virtual uint ideal_reg() const { return Op_RegD; }
@@ -489,7 +492,10 @@
 // Raise a double to a double power
 class PowDNode : public Node {
 public:
-  PowDNode(Node *c, Node *in1, Node *in2  ) : Node(c, in1, in2) {}
+  PowDNode(Compile* C, Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {
+    init_flags(Flag_is_expensive);
+    C->add_expensive_node(this);
+  }
   virtual int Opcode() const;
   const Type *bottom_type() const { return Type::DOUBLE; }
   virtual uint ideal_reg() const { return Op_RegD; }
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1573,9 +1573,9 @@
   if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
     Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
     if (k->oop_is_instance()) {
-      Annotations* type_annotations = InstanceKlass::cast(k)->type_annotations();
+      AnnotationArray* type_annotations = InstanceKlass::cast(k)->class_type_annotations();
       if (type_annotations != NULL) {
-        typeArrayOop a = Annotations::make_java_array(type_annotations->class_annotations(), CHECK_NULL);
+        typeArrayOop a = Annotations::make_java_array(type_annotations, CHECK_NULL);
         return (jbyteArray) JNIHandles::make_local(env, a);
       }
     }
@@ -4528,6 +4528,5 @@
   // consider to expose this new capability in the sun.rt.jvmCapabilities jvmstat
   // counter defined in runtimeService.cpp.
   info->is_attachable = AttachListener::is_attach_supported();
-  info->is_kernel_jvm = 0; // false;
 }
 JVM_END
--- a/hotspot/src/share/vm/prims/jvm.h	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvm.h	Thu Feb 21 17:43:57 2013 -0800
@@ -1559,8 +1559,7 @@
      * the new bit is also added in the main/baseline.
      */
     unsigned int is_attachable : 1;
-    unsigned int is_kernel_jvm : 1;
-    unsigned int : 30;
+    unsigned int : 31;
     unsigned int : 32;
     unsigned int : 32;
 } jvm_version_info;
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -154,8 +154,15 @@
   // See jvmtiExport.hpp for detailed explanation.
   JvmtiExport::set_has_redefined_a_class();
 
-#ifdef ASSERT
-  SystemDictionary::classes_do(check_class, thread);
+// check_class() is optionally called for product bits, but is
+// always called for non-product bits.
+#ifdef PRODUCT
+  if (RC_TRACE_ENABLED(0x00004000)) {
+#endif
+    RC_TRACE_WITH_THREAD(0x00004000, thread, ("calling check_class"));
+    SystemDictionary::classes_do(check_class, thread);
+#ifdef PRODUCT
+  }
 #endif
 }
 
@@ -485,26 +492,6 @@
 } // end find_or_append_indirect_entry()
 
 
-void VM_RedefineClasses::swap_all_method_annotations(int i, int j, instanceKlassHandle scratch_class, TRAPS) {
-  AnnotationArray* save;
-
-  Annotations* sca = scratch_class->annotations();
-  if (sca == NULL) return;
-
-  save = sca->get_method_annotations_of(i);
-  sca->set_method_annotations_of(scratch_class, i, sca->get_method_annotations_of(j), CHECK);
-  sca->set_method_annotations_of(scratch_class, j, save, CHECK);
-
-  save = sca->get_method_parameter_annotations_of(i);
-  sca->set_method_parameter_annotations_of(scratch_class, i, sca->get_method_parameter_annotations_of(j), CHECK);
-  sca->set_method_parameter_annotations_of(scratch_class, j, save, CHECK);
-
-  save = sca->get_method_default_annotations_of(i);
-  sca->set_method_default_annotations_of(scratch_class, i, sca->get_method_default_annotations_of(j), CHECK);
-  sca->set_method_default_annotations_of(scratch_class, j, save, CHECK);
-}
-
-
 jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
              instanceKlassHandle the_class,
              instanceKlassHandle scratch_class) {
@@ -686,10 +673,9 @@
             idnum_owner->set_method_idnum(new_num);
           }
           k_new_method->set_method_idnum(old_num);
-          swap_all_method_annotations(old_num, new_num, scratch_class, thread);
-           if (thread->has_pending_exception()) {
-             return JVMTI_ERROR_OUT_OF_MEMORY;
-           }
+          if (thread->has_pending_exception()) {
+            return JVMTI_ERROR_OUT_OF_MEMORY;
+          }
         }
       }
       RC_TRACE(0x00008000, ("Method matched: new: %s [%d] == old: %s [%d]",
@@ -722,7 +708,6 @@
           idnum_owner->set_method_idnum(new_num);
         }
         k_new_method->set_method_idnum(num);
-        swap_all_method_annotations(new_num, num, scratch_class, thread);
         if (thread->has_pending_exception()) {
           return JVMTI_ERROR_OUT_OF_MEMORY;
         }
@@ -1564,9 +1549,9 @@
             bcp, cp_index, new_index));
           // Rewriter::rewrite_method() uses put_native_u2() in this
           // situation because it is reusing the constant pool index
-          // location for a native index into the constantPoolCache.
+          // location for a native index into the ConstantPoolCache.
           // Since we are updating the constant pool index prior to
-          // verification and constantPoolCache initialization, we
+          // verification and ConstantPoolCache initialization, we
           // need to keep the new index in Java byte order.
           Bytes::put_Java_u2(p, new_index);
         }
@@ -1888,10 +1873,7 @@
 bool VM_RedefineClasses::rewrite_cp_refs_in_fields_annotations(
        instanceKlassHandle scratch_class, TRAPS) {
 
-  Annotations* sca = scratch_class->annotations();
-  if (sca == NULL) return true;
-
-  Array<AnnotationArray*>* fields_annotations = sca->fields_annotations();
+  Array<AnnotationArray*>* fields_annotations = scratch_class->fields_annotations();
 
   if (fields_annotations == NULL || fields_annotations->length() == 0) {
     // no fields_annotations so nothing to do
@@ -1926,21 +1908,10 @@
 bool VM_RedefineClasses::rewrite_cp_refs_in_methods_annotations(
        instanceKlassHandle scratch_class, TRAPS) {
 
-  Annotations* sca = scratch_class->annotations();
-  if (sca == NULL) return true;
-
-  Array<AnnotationArray*>* methods_annotations = sca->methods_annotations();
-
-  if (methods_annotations == NULL || methods_annotations->length() == 0) {
-    // no methods_annotations so nothing to do
-    return true;
-  }
-
-  RC_TRACE_WITH_THREAD(0x02000000, THREAD,
-    ("methods_annotations length=%d", methods_annotations->length()));
-
-  for (int i = 0; i < methods_annotations->length(); i++) {
-    AnnotationArray* method_annotations = methods_annotations->at(i);
+  for (int i = 0; i < scratch_class->methods()->length(); i++) {
+    Method* m = scratch_class->methods()->at(i);
+    AnnotationArray* method_annotations = m->constMethod()->method_annotations();
+
     if (method_annotations == NULL || method_annotations->length() == 0) {
       // this method does not have any annotations so skip it
       continue;
@@ -1976,24 +1947,9 @@
 bool VM_RedefineClasses::rewrite_cp_refs_in_methods_parameter_annotations(
        instanceKlassHandle scratch_class, TRAPS) {
 
-  Annotations* sca = scratch_class->annotations();
-  if (sca == NULL) return true;
-
-  Array<AnnotationArray*>* methods_parameter_annotations =
-    sca->methods_parameter_annotations();
-
-  if (methods_parameter_annotations == NULL
-      || methods_parameter_annotations->length() == 0) {
-    // no methods_parameter_annotations so nothing to do
-    return true;
-  }
-
-  RC_TRACE_WITH_THREAD(0x02000000, THREAD,
-    ("methods_parameter_annotations length=%d",
-    methods_parameter_annotations->length()));
-
-  for (int i = 0; i < methods_parameter_annotations->length(); i++) {
-    AnnotationArray* method_parameter_annotations = methods_parameter_annotations->at(i);
+  for (int i = 0; i < scratch_class->methods()->length(); i++) {
+    Method* m = scratch_class->methods()->at(i);
+    AnnotationArray* method_parameter_annotations = m->constMethod()->parameter_annotations();
     if (method_parameter_annotations == NULL
         || method_parameter_annotations->length() == 0) {
       // this method does not have any parameter annotations so skip it
@@ -2043,24 +1999,9 @@
 bool VM_RedefineClasses::rewrite_cp_refs_in_methods_default_annotations(
        instanceKlassHandle scratch_class, TRAPS) {
 
-  Annotations* sca = scratch_class->annotations();
-  if (sca == NULL) return true;
-
-  Array<AnnotationArray*>* methods_default_annotations =
-    sca->methods_default_annotations();
-
-  if (methods_default_annotations == NULL
-      || methods_default_annotations->length() == 0) {
-    // no methods_default_annotations so nothing to do
-    return true;
-  }
-
-  RC_TRACE_WITH_THREAD(0x02000000, THREAD,
-    ("methods_default_annotations length=%d",
-    methods_default_annotations->length()));
-
-  for (int i = 0; i < methods_default_annotations->length(); i++) {
-    AnnotationArray* method_default_annotations = methods_default_annotations->at(i);
+  for (int i = 0; i < scratch_class->methods()->length(); i++) {
+    Method* m = scratch_class->methods()->at(i);
+    AnnotationArray* method_default_annotations = m->constMethod()->default_annotations();
     if (method_default_annotations == NULL
         || method_default_annotations->length() == 0) {
       // this method does not have any default annotations so skip it
@@ -3065,6 +3006,31 @@
 }
 
 
+void VM_RedefineClasses::swap_annotations(instanceKlassHandle the_class,
+                                          instanceKlassHandle scratch_class) {
+  // Since there is currently no rewriting of type annotations indexes
+  // into the CP, we null out type annotations on scratch_class before
+  // we swap annotations with the_class rather than facing the
+  // possibility of shipping annotations with broken indexes to
+  // Java-land.
+  ClassLoaderData* loader_data = scratch_class->class_loader_data();
+  AnnotationArray* new_class_type_annotations = scratch_class->class_type_annotations();
+  if (new_class_type_annotations != NULL) {
+    MetadataFactory::free_array<u1>(loader_data, new_class_type_annotations);
+    scratch_class->annotations()->set_class_type_annotations(NULL);
+  }
+  Array<AnnotationArray*>* new_field_type_annotations = scratch_class->fields_type_annotations();
+  if (new_field_type_annotations != NULL) {
+    Annotations::free_contents(loader_data, new_field_type_annotations);
+    scratch_class->annotations()->set_fields_type_annotations(NULL);
+  }
+
+  // Swap annotation fields values
+  Annotations* old_annotations = the_class->annotations();
+  the_class->set_annotations(scratch_class->annotations());
+  scratch_class->set_annotations(old_annotations);
+}
+
 
 // Install the redefinition of a class:
 //    - house keeping (flushing breakpoints and caches, deoptimizing
@@ -3275,23 +3241,7 @@
     the_class->set_access_flags(flags);
   }
 
-  // Since there is currently no rewriting of type annotations indexes
-  // into the CP, we null out type annotations on scratch_class before
-  // we swap annotations with the_class rather than facing the
-  // possibility of shipping annotations with broken indexes to
-  // Java-land.
-  Annotations* new_annotations = scratch_class->annotations();
-  if (new_annotations != NULL) {
-    Annotations* new_type_annotations = new_annotations->type_annotations();
-    if (new_type_annotations != NULL) {
-      MetadataFactory::free_metadata(scratch_class->class_loader_data(), new_type_annotations);
-      new_annotations->set_type_annotations(NULL);
-    }
-  }
-  // Swap annotation fields values
-  Annotations* old_annotations = the_class->annotations();
-  the_class->set_annotations(scratch_class->annotations());
-  scratch_class->set_annotations(old_annotations);
+  swap_annotations(the_class, scratch_class);
 
   // Replace minor version number of class file
   u2 old_minor_version = the_class->minor_version();
@@ -3371,7 +3321,6 @@
   }
 }
 
-#ifndef PRODUCT
 void VM_RedefineClasses::check_class(Klass* k_oop,
                                      ClassLoaderData* initiating_loader,
                                      TRAPS) {
@@ -3379,82 +3328,110 @@
   if (k->oop_is_instance()) {
     HandleMark hm(THREAD);
     InstanceKlass *ik = (InstanceKlass *) k;
-
-    if (ik->vtable_length() > 0) {
-      ResourceMark rm(THREAD);
-      if (!ik->vtable()->check_no_old_entries()) {
-        tty->print_cr("klassVtable::check_no_old_entries failure -- OLD method found -- class: %s", ik->signature_name());
+    bool no_old_methods = true;  // be optimistic
+    ResourceMark rm(THREAD);
+
+    // a vtable should never contain old or obsolete methods
+    if (ik->vtable_length() > 0 &&
+        !ik->vtable()->check_no_old_or_obsolete_entries()) {
+      if (RC_TRACE_ENABLED(0x00004000)) {
+        RC_TRACE_WITH_THREAD(0x00004000, THREAD,
+          ("klassVtable::check_no_old_or_obsolete_entries failure"
+           " -- OLD or OBSOLETE method found -- class: %s",
+           ik->signature_name()));
         ik->vtable()->dump_vtable();
-        assert(false, "OLD method found");
       }
+      no_old_methods = false;
     }
-    if (ik->itable_length() > 0) {
-      ResourceMark rm(THREAD);
-      if (!ik->itable()->check_no_old_entries()) {
-        tty->print_cr("klassItable::check_no_old_entries failure -- OLD method found -- class: %s", ik->signature_name());
-        assert(false, "OLD method found");
+
+    // an itable should never contain old or obsolete methods
+    if (ik->itable_length() > 0 &&
+        !ik->itable()->check_no_old_or_obsolete_entries()) {
+      if (RC_TRACE_ENABLED(0x00004000)) {
+        RC_TRACE_WITH_THREAD(0x00004000, THREAD,
+          ("klassItable::check_no_old_or_obsolete_entries failure"
+           " -- OLD or OBSOLETE method found -- class: %s",
+           ik->signature_name()));
+        ik->itable()->dump_itable();
       }
+      no_old_methods = false;
     }
-    // Check that the constant pool cache has no deleted entries.
+
+    // the constant pool cache should never contain old or obsolete methods
     if (ik->constants() != NULL &&
         ik->constants()->cache() != NULL &&
-       !ik->constants()->cache()->check_no_old_entries()) {
-      tty->print_cr("klassVtable::check_no_old_entries failure -- OLD method found -- class: %s", ik->signature_name());
-      assert(false, "OLD method found");
+        !ik->constants()->cache()->check_no_old_or_obsolete_entries()) {
+      if (RC_TRACE_ENABLED(0x00004000)) {
+        RC_TRACE_WITH_THREAD(0x00004000, THREAD,
+          ("cp-cache::check_no_old_or_obsolete_entries failure"
+           " -- OLD or OBSOLETE method found -- class: %s",
+           ik->signature_name()));
+        ik->constants()->cache()->dump_cache();
+      }
+      no_old_methods = false;
+    }
+
+    if (!no_old_methods) {
+      if (RC_TRACE_ENABLED(0x00004000)) {
+        dump_methods();
+      } else {
+        tty->print_cr("INFO: use the '-XX:TraceRedefineClasses=16384' option "
+          "to see more info about the following guarantee() failure.");
+      }
+      guarantee(false, "OLD and/or OBSOLETE method(s) found");
     }
   }
 }
 
 void VM_RedefineClasses::dump_methods() {
-        int j;
-        tty->print_cr("_old_methods --");
-        for (j = 0; j < _old_methods->length(); ++j) {
-          Method* m = _old_methods->at(j);
-          tty->print("%4d  (%5d)  ", j, m->vtable_index());
-          m->access_flags().print_on(tty);
-          tty->print(" --  ");
-          m->print_name(tty);
-          tty->cr();
-        }
-        tty->print_cr("_new_methods --");
-        for (j = 0; j < _new_methods->length(); ++j) {
-          Method* m = _new_methods->at(j);
-          tty->print("%4d  (%5d)  ", j, m->vtable_index());
-          m->access_flags().print_on(tty);
-          tty->print(" --  ");
-          m->print_name(tty);
-          tty->cr();
-        }
-        tty->print_cr("_matching_(old/new)_methods --");
-        for (j = 0; j < _matching_methods_length; ++j) {
-          Method* m = _matching_old_methods[j];
-          tty->print("%4d  (%5d)  ", j, m->vtable_index());
-          m->access_flags().print_on(tty);
-          tty->print(" --  ");
-          m->print_name(tty);
-          tty->cr();
-          m = _matching_new_methods[j];
-          tty->print("      (%5d)  ", m->vtable_index());
-          m->access_flags().print_on(tty);
-          tty->cr();
-        }
-        tty->print_cr("_deleted_methods --");
-        for (j = 0; j < _deleted_methods_length; ++j) {
-          Method* m = _deleted_methods[j];
-          tty->print("%4d  (%5d)  ", j, m->vtable_index());
-          m->access_flags().print_on(tty);
-          tty->print(" --  ");
-          m->print_name(tty);
-          tty->cr();
-        }
-        tty->print_cr("_added_methods --");
-        for (j = 0; j < _added_methods_length; ++j) {
-          Method* m = _added_methods[j];
-          tty->print("%4d  (%5d)  ", j, m->vtable_index());
-          m->access_flags().print_on(tty);
-          tty->print(" --  ");
-          m->print_name(tty);
-          tty->cr();
-        }
+  int j;
+  RC_TRACE(0x00004000, ("_old_methods --"));
+  for (j = 0; j < _old_methods->length(); ++j) {
+    Method* m = _old_methods->at(j);
+    RC_TRACE_NO_CR(0x00004000, ("%4d  (%5d)  ", j, m->vtable_index()));
+    m->access_flags().print_on(tty);
+    tty->print(" --  ");
+    m->print_name(tty);
+    tty->cr();
+  }
+  RC_TRACE(0x00004000, ("_new_methods --"));
+  for (j = 0; j < _new_methods->length(); ++j) {
+    Method* m = _new_methods->at(j);
+    RC_TRACE_NO_CR(0x00004000, ("%4d  (%5d)  ", j, m->vtable_index()));
+    m->access_flags().print_on(tty);
+    tty->print(" --  ");
+    m->print_name(tty);
+    tty->cr();
+  }
+  RC_TRACE(0x00004000, ("_matching_(old/new)_methods --"));
+  for (j = 0; j < _matching_methods_length; ++j) {
+    Method* m = _matching_old_methods[j];
+    RC_TRACE_NO_CR(0x00004000, ("%4d  (%5d)  ", j, m->vtable_index()));
+    m->access_flags().print_on(tty);
+    tty->print(" --  ");
+    m->print_name(tty);
+    tty->cr();
+    m = _matching_new_methods[j];
+    RC_TRACE_NO_CR(0x00004000, ("      (%5d)  ", m->vtable_index()));
+    m->access_flags().print_on(tty);
+    tty->cr();
+  }
+  RC_TRACE(0x00004000, ("_deleted_methods --"));
+  for (j = 0; j < _deleted_methods_length; ++j) {
+    Method* m = _deleted_methods[j];
+    RC_TRACE_NO_CR(0x00004000, ("%4d  (%5d)  ", j, m->vtable_index()));
+    m->access_flags().print_on(tty);
+    tty->print(" --  ");
+    m->print_name(tty);
+    tty->cr();
+  }
+  RC_TRACE(0x00004000, ("_added_methods --"));
+  for (j = 0; j < _added_methods_length; ++j) {
+    Method* m = _added_methods[j];
+    RC_TRACE_NO_CR(0x00004000, ("%4d  (%5d)  ", j, m->vtable_index()));
+    m->access_flags().print_on(tty);
+    tty->print(" --  ");
+    m->print_name(tty);
+    tty->cr();
+  }
 }
-#endif
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -384,11 +384,6 @@
   jvmtiError compare_and_normalize_class_versions(
     instanceKlassHandle the_class, instanceKlassHandle scratch_class);
 
-  // Swap annotations[i] with annotations[j]
-  // Used by compare_and_normalize_class_versions() when normalizing
-  // overloaded methods or changing idnum as when adding or deleting methods.
-  void swap_all_method_annotations(int i, int j, instanceKlassHandle scratch_class, TRAPS);
-
   // Figure out which new methods match old methods in name and signature,
   // which methods have been added, and which are no longer present
   void compute_added_deleted_matching_methods();
@@ -417,6 +412,9 @@
   void redefine_single_class(jclass the_jclass,
     Klass* scratch_class_oop, TRAPS);
 
+  void swap_annotations(instanceKlassHandle new_class,
+                        instanceKlassHandle scratch_class);
+
   // Increment the classRedefinedCount field in the specific InstanceKlass
   // and in all direct and indirect subclasses.
   void increment_class_counter(InstanceKlass *ik, TRAPS);
@@ -468,9 +466,9 @@
 
   void flush_dependent_code(instanceKlassHandle k_h, TRAPS);
 
-  static void check_class(Klass* k_oop, ClassLoaderData* initiating_loader, TRAPS) PRODUCT_RETURN;
-
-  static void dump_methods()   PRODUCT_RETURN;
+  static void check_class(Klass* k_oop, ClassLoaderData* initiating_loader,
+                TRAPS);
+  static void dump_methods();
 
  public:
   VM_RedefineClasses(jint class_count,
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -54,7 +54,7 @@
 //    0x00000800 |       2048 - previous class breakpoint mgmt
 //    0x00001000 |       4096 - detect calls to obsolete methods
 //    0x00002000 |       8192 - fail a guarantee() in addition to detection
-//    0x00004000 |      16384 - unused
+//    0x00004000 |      16384 - detect old/obsolete methods in metadata
 //    0x00008000 |      32768 - old/new method matching/add/delete
 //    0x00010000 |      65536 - impl details: CP size info
 //    0x00020000 |     131072 - impl details: CP merge pass info
@@ -82,6 +82,13 @@
     tty->print_cr args; \
   } while (0)
 
+#define RC_TRACE_NO_CR(level, args) \
+  if ((TraceRedefineClasses & level) != 0) { \
+    ResourceMark rm; \
+    tty->print("RedefineClasses-0x%x: ", level); \
+    tty->print args; \
+  } while (0)
+
 #define RC_TRACE_WITH_THREAD(level, thread, args) \
   if ((TraceRedefineClasses & level) != 0) { \
     ResourceMark rm(thread); \
--- a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -27,6 +27,6 @@
 #include "prims/jni.h"
 #include "prims/whitebox.hpp"
 
-WB_METHOD_DECLARE WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jobjectArray arguments);
+WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jobjectArray arguments);
 
 #endif //SHARE_VM_PRIMS_WBTESTMETHODS_PARSERTESTS_H
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -48,6 +48,8 @@
 #include "services/memTracker.hpp"
 #endif // INCLUDE_NMT
 
+#include "compiler/compileBroker.hpp"
+
 bool WhiteBox::_used = false;
 
 WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj))
@@ -169,6 +171,89 @@
 
 #endif // INCLUDE_NMT
 
+static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
+  assert(method != NULL, "method should not be null");
+  ThreadToNativeFromVM ttn(thread);
+  return env->FromReflectedMethod(method);
+}
+
+WB_ENTRY(void, WB_DeoptimizeAll(JNIEnv* env, jobject o))
+  MutexLockerEx mu(Compile_lock);
+  CodeCache::mark_all_nmethods_for_deoptimization();
+  VM_Deoptimize op;
+  VMThread::execute(&op);
+WB_END
+
+WB_ENTRY(jint, WB_DeoptimizeMethod(JNIEnv* env, jobject o, jobject method))
+  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
+  MutexLockerEx mu(Compile_lock);
+  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
+  int result = 0;
+  nmethod* code = mh->code();
+  if (code != NULL) {
+    code->mark_for_deoptimization();
+    ++result;
+  }
+  result += CodeCache::mark_for_deoptimization(mh());
+  if (result > 0) {
+    VM_Deoptimize op;
+    VMThread::execute(&op);
+  }
+  return result;
+WB_END
+
+WB_ENTRY(jboolean, WB_IsMethodCompiled(JNIEnv* env, jobject o, jobject method))
+  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
+  MutexLockerEx mu(Compile_lock);
+  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
+  nmethod* code = mh->code();
+  if (code == NULL) {
+    return JNI_FALSE;
+  }
+  return (code->is_alive() && !code->is_marked_for_deoptimization());
+WB_END
+
+WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method))
+  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
+  MutexLockerEx mu(Compile_lock);
+  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
+  return !mh->is_not_compilable();
+WB_END
+
+WB_ENTRY(jboolean, WB_IsMethodQueuedForCompilation(JNIEnv* env, jobject o, jobject method))
+  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
+  MutexLockerEx mu(Compile_lock);
+  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
+  return mh->queued_for_compilation();
+WB_END
+
+WB_ENTRY(jint, WB_GetMethodCompilationLevel(JNIEnv* env, jobject o, jobject method))
+  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
+  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
+  nmethod* code = mh->code();
+  return (code != NULL ? code->comp_level() : CompLevel_none);
+WB_END
+
+
+WB_ENTRY(void, WB_MakeMethodNotCompilable(JNIEnv* env, jobject o, jobject method))
+  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
+  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
+  mh->set_not_compilable();
+WB_END
+
+WB_ENTRY(jboolean, WB_SetDontInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value))
+  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
+  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
+  bool result = mh->dont_inline();
+  mh->set_dont_inline(value == JNI_TRUE);
+  return result;
+WB_END
+
+WB_ENTRY(jint, WB_GetCompileQueuesSize(JNIEnv* env, jobject o))
+  return CompileBroker::queue_size(CompLevel_full_optimization) /* C2 */ +
+         CompileBroker::queue_size(CompLevel_full_profile) /* C1 */;
+WB_END
+
 //Some convenience methods to deal with objects from java
 int WhiteBox::offset_for_field(const char* field_name, oop object,
     Symbol* signature_symbol) {
@@ -225,9 +310,9 @@
 static JNINativeMethod methods[] = {
   {CC"getObjectAddress",   CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress  },
   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
-  {CC"isClassAlive0",       CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
-  {CC "parseCommandLine",
-      CC "(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
+  {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
+  {CC"parseCommandLine",
+      CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
       (void*) &WB_ParseCommandLine
   },
 #if INCLUDE_ALL_GCS
@@ -241,6 +326,23 @@
   {CC"NMTFreeTestMemory",  CC"()Z",                   (void*)&WB_NMTFreeTestMemory },
   {CC"NMTWaitForDataMerge",CC"()Z",                   (void*)&WB_NMTWaitForDataMerge},
 #endif // INCLUDE_NMT
+  {CC"deoptimizeAll",      CC"()V",                   (void*)&WB_DeoptimizeAll     },
+  {CC"deoptimizeMethod",   CC"(Ljava/lang/reflect/Method;)I",
+                                                      (void*)&WB_DeoptimizeMethod  },
+  {CC"isMethodCompiled",   CC"(Ljava/lang/reflect/Method;)Z",
+                                                      (void*)&WB_IsMethodCompiled  },
+  {CC"isMethodCompilable", CC"(Ljava/lang/reflect/Method;)Z",
+                                                      (void*)&WB_IsMethodCompilable},
+  {CC"isMethodQueuedForCompilation",
+      CC"(Ljava/lang/reflect/Method;)Z",              (void*)&WB_IsMethodQueuedForCompilation},
+  {CC"makeMethodNotCompilable",
+      CC"(Ljava/lang/reflect/Method;)V",              (void*)&WB_MakeMethodNotCompilable},
+  {CC"setDontInlineMethod",
+      CC"(Ljava/lang/reflect/Method;Z)Z",             (void*)&WB_SetDontInlineMethod},
+  {CC"getMethodCompilationLevel",
+      CC"(Ljava/lang/reflect/Method;)I",              (void*)&WB_GetMethodCompilationLevel},
+  {CC"getCompileQueuesSize",
+      CC"()I",                                        (void*)&WB_GetCompileQueuesSize},
 };
 
 #undef CC
--- a/hotspot/src/share/vm/prims/whitebox.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/prims/whitebox.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -34,7 +34,7 @@
 
 #define WB_ENTRY(result_type, header) JNI_ENTRY(result_type, header)
 #define WB_END JNI_END
-#define WB_METHOD_DECLARE extern "C" jobjectArray JNICALL
+#define WB_METHOD_DECLARE(result_type) extern "C" result_type JNICALL
 
 class WhiteBox : public AllStatic {
  private:
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -1086,7 +1086,7 @@
   }
   // Increase the code cache size - tiered compiles a lot more.
   if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
-    FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2);
+    FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 5);
   }
 }
 
@@ -1257,7 +1257,7 @@
   // prefer minuscule survivor spaces so as not to waste
   // space for (non-existent) survivors
   if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) {
-    FLAG_SET_ERGO(intx, SurvivorRatio, MAX2((intx)1024, SurvivorRatio));
+    FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx)1024, SurvivorRatio));
   }
   // If OldPLABSize is set and CMSParPromoteBlocksToClaim is not,
   // set CMSParPromoteBlocksToClaim equal to OldPLABSize.
@@ -1897,6 +1897,24 @@
   // Keeping the heap 100% free is hard ;-) so limit it to 99%.
   MinHeapFreeRatio = MIN2(MinHeapFreeRatio, (uintx) 99);
 
+  // Min/MaxMetaspaceFreeRatio
+  status = status && verify_percentage(MinMetaspaceFreeRatio, "MinMetaspaceFreeRatio");
+  status = status && verify_percentage(MaxMetaspaceFreeRatio, "MaxMetaspaceFreeRatio");
+
+  if (MinMetaspaceFreeRatio > MaxMetaspaceFreeRatio) {
+    jio_fprintf(defaultStream::error_stream(),
+                "MinMetaspaceFreeRatio (%s" UINTX_FORMAT ") must be less than or "
+                "equal to MaxMetaspaceFreeRatio (%s" UINTX_FORMAT ")\n",
+                FLAG_IS_DEFAULT(MinMetaspaceFreeRatio) ? "Default: " : "",
+                MinMetaspaceFreeRatio,
+                FLAG_IS_DEFAULT(MaxMetaspaceFreeRatio) ? "Default: " : "",
+                MaxMetaspaceFreeRatio);
+    status = false;
+  }
+
+  // Trying to keep 100% free is not practical
+  MinMetaspaceFreeRatio = MIN2(MinMetaspaceFreeRatio, (uintx) 99);
+
   if (FullGCALot && FLAG_IS_DEFAULT(MarkSweepAlwaysCompactCount)) {
     MarkSweepAlwaysCompactCount = 1;  // Move objects every gc.
   }
@@ -1904,7 +1922,7 @@
   if (UseParallelOldGC && ParallelOldGCSplitALot) {
     // Settings to encourage splitting.
     if (!FLAG_IS_CMDLINE(NewRatio)) {
-      FLAG_SET_CMDLINE(intx, NewRatio, 2);
+      FLAG_SET_CMDLINE(uintx, NewRatio, 2);
     }
     if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) {
       FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false);
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -67,13 +67,10 @@
 
 AnnotationArray* fieldDescriptor::type_annotations() const {
   InstanceKlass* ik = field_holder();
-  Annotations* type_annos = ik->type_annotations();
+  Array<AnnotationArray*>* type_annos = ik->fields_type_annotations();
   if (type_annos == NULL)
     return NULL;
-  Array<AnnotationArray*>* md = type_annos->fields_annotations();
-  if (md == NULL)
-    return NULL;
-  return md->at(index());
+  return type_annos->at(index());
 }
 
 constantTag fieldDescriptor::initial_value_tag() const {
--- a/hotspot/src/share/vm/runtime/globals.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -69,7 +69,10 @@
 }
 
 bool Flag::is_unlocked() const {
-  if (strcmp(kind, "{diagnostic}") == 0) {
+  if (strcmp(kind, "{diagnostic}") == 0 ||
+      strcmp(kind, "{C2 diagnostic}") == 0 ||
+      strcmp(kind, "{ARCH diagnostic}") == 0 ||
+      strcmp(kind, "{Shark diagnostic}") == 0) {
     if (strcmp(name, "EnableInvokeDynamic") == 0 && UnlockExperimentalVMOptions && !UnlockDiagnosticVMOptions) {
       // transitional logic to allow tests to run until they are changed
       static int warned;
@@ -78,7 +81,9 @@
     }
     return UnlockDiagnosticVMOptions;
   } else if (strcmp(kind, "{experimental}") == 0 ||
-             strcmp(kind, "{C2 experimental}") == 0) {
+             strcmp(kind, "{C2 experimental}") == 0 ||
+             strcmp(kind, "{ARCH experimental}") == 0 ||
+             strcmp(kind, "{Shark experimental}") == 0) {
     return UnlockExperimentalVMOptions;
   } else {
     return is_unlocked_ext();
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -1802,7 +1802,7 @@
   product(bool, ParallelRefProcBalancingEnabled, true,                      \
           "Enable balancing of reference processing queues")                \
                                                                             \
-  product(intx, CMSTriggerRatio, 80,                                        \
+  product(uintx, CMSTriggerRatio, 80,                                       \
           "Percentage of MinHeapFreeRatio in CMS generation that is "       \
           "allocated before a CMS collection cycle commences")              \
                                                                             \
@@ -1816,7 +1816,7 @@
                                                                             \
   product(uintx, InitiatingHeapOccupancyPercent, 45,                        \
           "Percentage of the (entire) heap occupancy to start a "           \
-          "concurrent GC cycle. It us used by GCs that trigger a "          \
+          "concurrent GC cycle. It is used by GCs that trigger a "          \
           "concurrent GC cycle based on the occupancy of the entire heap, " \
           "not just one of the generations (e.g., G1). A value of 0 "       \
           "denotes 'do constant GC cycles'.")                               \
@@ -2977,10 +2977,10 @@
   product(uintx, TLABWasteIncrement,    4,                                  \
           "Increment allowed waste at slow allocation")                     \
                                                                             \
-  product(intx, SurvivorRatio, 8,                                           \
+  product(uintx, SurvivorRatio, 8,                                          \
           "Ratio of eden/survivor space size")                              \
                                                                             \
-  product(intx, NewRatio, 2,                                                \
+  product(uintx, NewRatio, 2,                                               \
           "Ratio of new/old generation sizes")                              \
                                                                             \
   product_pd(uintx, NewSizeThreadIncrease,                                  \
@@ -3010,10 +3010,16 @@
           "Min change in heap space due to GC (in bytes)")                  \
                                                                             \
   product(uintx, MinMetaspaceExpansion, ScaleForWordSize(256*K),            \
-          "Min expansion of permanent heap (in bytes)")                     \
+          "Min expansion of Metaspace (in bytes)")                          \
+                                                                            \
+  product(uintx, MinMetaspaceFreeRatio,    40,                              \
+          "Min percentage of Metaspace free after GC to avoid expansion")   \
+                                                                            \
+  product(uintx, MaxMetaspaceFreeRatio,    70,                              \
+          "Max percentage of Metaspace free after GC to avoid shrinking")   \
                                                                             \
   product(uintx, MaxMetaspaceExpansion, ScaleForWordSize(4*M),              \
-          "Max expansion of permanent heap without full GC (in bytes)")     \
+          "Max expansion of Metaspace without full GC (in bytes)")          \
                                                                             \
   product(intx, QueuedAllocationWarningCount, 0,                            \
           "Number of times an allocation that queues behind a GC "          \
@@ -3031,7 +3037,7 @@
   product(uintx, InitialTenuringThreshold,    7,                            \
           "Initial value for tenuring threshold")                           \
                                                                             \
-  product(intx, TargetSurvivorRatio,    50,                                 \
+  product(uintx, TargetSurvivorRatio,    50,                                \
           "Desired percentage of survivor space used after scavenge")       \
                                                                             \
   product(uintx, MarkSweepDeadRatio,     5,                                 \
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -366,11 +366,10 @@
   volatile_nonstatic_field(Method,      _from_compiled_entry,                          address)                               \
   volatile_nonstatic_field(Method,      _from_interpreted_entry,                       address)                               \
   volatile_nonstatic_field(ConstMethod, _fingerprint,                                  uint64_t)                              \
-  nonstatic_field(ConstMethod,          _constants,                                    ConstantPool*)                  \
+  nonstatic_field(ConstMethod,          _constants,                                    ConstantPool*)                         \
   nonstatic_field(ConstMethod,          _stackmap_data,                                Array<u1>*)                            \
   nonstatic_field(ConstMethod,          _constMethod_size,                             int)                                   \
-  nonstatic_field(ConstMethod,          _interpreter_kind,                             jbyte)                                 \
-  nonstatic_field(ConstMethod,          _flags,                                        jbyte)                                 \
+  nonstatic_field(ConstMethod,          _flags,                                        u2)                                    \
   nonstatic_field(ConstMethod,          _code_size,                                    u2)                                    \
   nonstatic_field(ConstMethod,          _name_index,                                   u2)                                    \
   nonstatic_field(ConstMethod,          _signature_index,                              u2)                                    \
@@ -2261,14 +2260,18 @@
   declare_constant(Klass::_lh_array_tag_obj_value)                        \
                                                                           \
   /********************************/                                      \
-  /* ConstMethod anon-enum */                                      \
+  /* ConstMethod anon-enum */                                             \
   /********************************/                                      \
                                                                           \
-  declare_constant(ConstMethod::_has_linenumber_table)             \
-  declare_constant(ConstMethod::_has_checked_exceptions)           \
-  declare_constant(ConstMethod::_has_localvariable_table)          \
-  declare_constant(ConstMethod::_has_exception_table)              \
-  declare_constant(ConstMethod::_has_generic_signature)            \
+  declare_constant(ConstMethod::_has_linenumber_table)                    \
+  declare_constant(ConstMethod::_has_checked_exceptions)                  \
+  declare_constant(ConstMethod::_has_localvariable_table)                 \
+  declare_constant(ConstMethod::_has_exception_table)                     \
+  declare_constant(ConstMethod::_has_generic_signature)                   \
+  declare_constant(ConstMethod::_has_method_annotations)                  \
+  declare_constant(ConstMethod::_has_parameter_annotations)               \
+  declare_constant(ConstMethod::_has_default_annotations)                 \
+  declare_constant(ConstMethod::_has_type_annotations)                    \
                                                                           \
   /*************************************/                                 \
   /* InstanceKlass enum                */                                 \
--- a/hotspot/src/share/vm/utilities/accessFlags.cpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/utilities/accessFlags.cpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -59,7 +59,7 @@
   } while(f != old_flags);
 }
 
-#ifndef PRODUCT
+#if !defined(PRODUCT) || INCLUDE_JVMTI
 
 void AccessFlags::print_on(outputStream* st) const {
   if (is_public      ()) st->print("public "      );
@@ -80,7 +80,7 @@
   if (on_stack       ()) st->print("{on_stack} "  );
 }
 
-#endif
+#endif // !PRODUCT || INCLUDE_JVMTI
 
 void accessFlags_init() {
   assert(sizeof(AccessFlags) == sizeof(jint), "just checking size of flags");
--- a/hotspot/src/share/vm/utilities/accessFlags.hpp	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/src/share/vm/utilities/accessFlags.hpp	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -239,7 +239,11 @@
   inline friend AccessFlags accessFlags_from(jint flags);
 
   // Printing/debugging
+#if INCLUDE_JVMTI
+  void print_on(outputStream* st) const;
+#else
   void print_on(outputStream* st) const PRODUCT_RETURN;
+#endif
 };
 
 inline AccessFlags accessFlags_from(jint flags) {
--- a/hotspot/test/compiler/7009359/Test7009359.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/hotspot/test/compiler/7009359/Test7009359.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -27,13 +27,13 @@
  * @bug 7009359
  * @summary HS with -XX:+AggressiveOpts optimize new StringBuffer(null) so it does not throw NPE as expected
  *
- * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat -XX:CompileCommand=exclude,Test7009359,main Test7009359
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeStringConcat -XX:CompileCommand=dontinline,Test7009359,stringmakerBUG Test7009359
  *
  */
 
 public class Test7009359 {
     public static void main (String[] args) {
-        for(int i = 0; i < 1000000; i++) {
+        for(int i = 0; i < 100000; i++) {
             if(!stringmakerBUG(null).equals("NPE")) {
                 System.out.println("StringBuffer(null) does not throw NPE");
                 System.exit(97);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,142 @@
+/*
+ * 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 sun.hotspot.WhiteBox;
+import sun.management.ManagementFactoryHelper;
+import com.sun.management.HotSpotDiagnosticMXBean;
+
+import java.lang.reflect.Method;
+
+/*
+ * @author igor.ignatyev@oracle.com
+ */
+public abstract class CompilerWhiteBoxTest {
+    protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    protected static final Method METHOD = getMethod("method");
+    protected static final int COMPILE_THRESHOLD
+            = Integer.parseInt(getVMOption("CompileThreshold", "10000"));
+
+    protected static Method getMethod(String name) {
+        try {
+            return CompilerWhiteBoxTest.class.getDeclaredMethod(name);
+        } catch (NoSuchMethodException | SecurityException e) {
+            throw new RuntimeException(
+                    "exception on getting method " + name, e);
+        }
+    }
+
+    protected static String getVMOption(String name, String defaultValue) {
+        String result;
+        HotSpotDiagnosticMXBean diagnostic
+                = ManagementFactoryHelper.getDiagnosticMXBean();
+        result = diagnostic.getVMOption(name).getValue();
+        return result == null ? defaultValue : result;
+    }
+
+    protected final void runTest() throws RuntimeException {
+        if (ManagementFactoryHelper.getCompilationMXBean() == null) {
+            System.err.println(
+                    "Warning: test is not applicable in interpreted mode");
+            return;
+        }
+        System.out.println("at test's start:");
+        printInfo(METHOD);
+        try {
+            test();
+        } catch (Exception e) {
+            System.out.printf("on exception '%s':", e.getMessage());
+            printInfo(METHOD);
+            throw new RuntimeException(e);
+        }
+        System.out.println("at test's end:");
+        printInfo(METHOD);
+    }
+
+    protected static void checkNotCompiled(Method method) {
+        if (WHITE_BOX.isMethodCompiled(method)) {
+            throw new RuntimeException(method + " must be not compiled");
+        }
+        if (WHITE_BOX.getMethodCompilationLevel(method) != 0) {
+            throw new RuntimeException(method + " comp_level must be == 0");
+        }
+    }
+
+    protected static void checkCompiled(Method method)
+            throws InterruptedException {
+        final long start = System.currentTimeMillis();
+        waitBackgroundCompilation(method);
+        if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
+            System.err.printf("Warning: %s is still in queue after %dms%n",
+                    method, System.currentTimeMillis() - start);
+            return;
+        }
+        if (!WHITE_BOX.isMethodCompiled(method)) {
+            throw new RuntimeException(method + " must be compiled");
+        }
+        if (WHITE_BOX.getMethodCompilationLevel(method) == 0) {
+            throw new RuntimeException(method + " comp_level must be != 0");
+        }
+    }
+
+    protected static void waitBackgroundCompilation(Method method)
+            throws InterruptedException {
+        final Object obj = new Object();
+        synchronized (obj) {
+            for (int i = 0; i < 10; ++i) {
+                if (!WHITE_BOX.isMethodQueuedForCompilation(method)) {
+                    break;
+                }
+                obj.wait(1000);
+            }
+        }
+    }
+
+    protected static void printInfo(Method method) {
+        System.out.printf("%n%s:%n", method);
+        System.out.printf("\tcompilable:\t%b%n",
+                WHITE_BOX.isMethodCompilable(method));
+        System.out.printf("\tcompiled:\t%b%n",
+                WHITE_BOX.isMethodCompiled(method));
+        System.out.printf("\tcomp_level:\t%d%n",
+                WHITE_BOX.getMethodCompilationLevel(method));
+        System.out.printf("\tin_queue:\t%b%n",
+                WHITE_BOX.isMethodQueuedForCompilation(method));
+        System.out.printf("compile_queues_size:\t%d%n%n",
+                WHITE_BOX.getCompileQueuesSize());
+    }
+
+    protected abstract void test() throws Exception;
+
+    protected final int compile() {
+        int result = 0;
+        for (int i = 0; i < COMPILE_THRESHOLD; ++i) {
+            result += method();
+        }
+        return result;
+    }
+
+
+    protected int method() {
+        return 42;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,45 @@
+/*
+ * 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 DeoptimizeAllTest
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI DeoptimizeAllTest.java
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeAllTest
+ * @author igor.ignatyev@oracle.com
+ */
+public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
+
+    public static void main(String[] args) throws Exception {
+        new DeoptimizeAllTest().runTest();
+    }
+
+    protected void test() throws Exception {
+        // to prevent inlining #method into #compile()
+        WHITE_BOX.setDontInlineMethod(METHOD, true);
+        compile();
+        checkCompiled(METHOD);
+        WHITE_BOX.deoptimizeAll();
+        checkNotCompiled(METHOD);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,45 @@
+/*
+ * 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 DeoptimizeMethodTest
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI DeoptimizeMethodTest.java
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DeoptimizeMethodTest
+ * @author igor.ignatyev@oracle.com
+ */
+public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
+
+    public static void main(String[] args) throws Exception {
+        new DeoptimizeMethodTest().runTest();
+    }
+
+    protected void test() throws Exception {
+        // to prevent inlining #method into #compile()
+        WHITE_BOX.setDontInlineMethod(METHOD, true);
+        compile();
+        checkCompiled(METHOD);
+        WHITE_BOX.deoptimizeMethod(METHOD);
+        checkNotCompiled(METHOD);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,84 @@
+/*
+ * 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 IsMethodCompilableTest
+ * @bug 8007270
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI IsMethodCompilableTest.java
+ * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IsMethodCompilableTest
+ * @author igor.ignatyev@oracle.com
+ */
+public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
+    protected static final long PER_METHOD_RECOMPILATION_CUTOFF;
+
+    static {
+        long tmp = Long.parseLong(
+                getVMOption("PerMethodRecompilationCutoff", "400"));
+        if (tmp == -1) {
+            PER_METHOD_RECOMPILATION_CUTOFF = -1 /* Inf */;
+        } else {
+            PER_METHOD_RECOMPILATION_CUTOFF = 1 + (0xFFFFFFFFL & tmp);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        new IsMethodCompilableTest().runTest();
+    }
+
+    protected void test() throws Exception {
+        if (!WHITE_BOX.isMethodCompilable(METHOD)) {
+            throw new RuntimeException(METHOD + " must be compilable");
+        }
+        System.out.println("PerMethodRecompilationCutoff = "
+                + PER_METHOD_RECOMPILATION_CUTOFF);
+        if (PER_METHOD_RECOMPILATION_CUTOFF == -1) {
+            System.err.println(
+                    "Warning: test is not applicable if PerMethodRecompilationCutoff == Inf");
+            return;
+        }
+        // to prevent inlining #method into #compile()
+        WHITE_BOX.setDontInlineMethod(METHOD, true);
+        boolean madeNotCompilable = false;
+
+        for (long i = 0; i < PER_METHOD_RECOMPILATION_CUTOFF; ++i) {
+            compile();
+            waitBackgroundCompilation(METHOD);
+            WHITE_BOX.deoptimizeMethod(METHOD);
+            if (!WHITE_BOX.isMethodCompilable(METHOD)) {
+                madeNotCompilable = true;
+                break;
+            }
+        }
+        if (!madeNotCompilable) {
+            throw new RuntimeException(METHOD + " is still compilable after "
+                    + PER_METHOD_RECOMPILATION_CUTOFF + " iterations");
+        }
+        compile();
+        if (WHITE_BOX.isMethodCompiled(METHOD)) {
+            printInfo(METHOD);
+            throw new RuntimeException(
+                    METHOD + " is not compilable but compiled");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,54 @@
+/*
+ * 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 MakeMethodNotCompilableTest
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI MakeMethodNotCompilableTest.java
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI MakeMethodNotCompilableTest
+ * @author igor.ignatyev@oracle.com
+ */
+public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
+
+    public static void main(String[] args) throws Exception {
+        new MakeMethodNotCompilableTest().runTest();
+    }
+
+    protected void test() throws Exception  {
+        if (!WHITE_BOX.isMethodCompilable(METHOD)) {
+            throw new RuntimeException(METHOD + " must be compilable");
+        }
+        WHITE_BOX.makeMethodNotCompilable(METHOD);
+        if (WHITE_BOX.isMethodCompilable(METHOD)) {
+            throw new RuntimeException(METHOD + " must be not compilable");
+        }
+        compile();
+        if (WHITE_BOX.isMethodQueuedForCompilation(METHOD)) {
+            throw new RuntimeException(METHOD + " must not be in queue");
+        }
+        checkNotCompiled(METHOD);
+        if (WHITE_BOX.isMethodCompilable(METHOD)) {
+            throw new RuntimeException(METHOD + " must be not compilable");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,59 @@
+/*
+ * 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 SetDontInlineMethodTest
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI CompilerWhiteBoxTest.java
+ * @compile -J-XX:+UnlockDiagnosticVMOptions -J-XX:+WhiteBoxAPI SetDontInlineMethodTest.java
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetDontInlineMethodTest
+ * @author igor.ignatyev@oracle.com
+ */
+public class SetDontInlineMethodTest extends CompilerWhiteBoxTest {
+
+    public static void main(String[] args) throws Exception {
+        new SetDontInlineMethodTest().runTest();
+    }
+
+    protected void test() throws Exception {
+        if (WHITE_BOX.setDontInlineMethod(METHOD, true)) {
+            throw new RuntimeException("on start " + METHOD
+                    + " must be inlineable");
+        }
+        if (!WHITE_BOX.setDontInlineMethod(METHOD, true)) {
+            throw new RuntimeException("after first change to true " + METHOD
+                    + " must be not inlineable");
+        }
+        if (!WHITE_BOX.setDontInlineMethod(METHOD, false)) {
+            throw new RuntimeException("after second change to true " + METHOD
+                    + " must be still not inlineable");
+        }
+        if (WHITE_BOX.setDontInlineMethod(METHOD, false)) {
+            throw new RuntimeException("after first change to false" + METHOD
+                    + " must be inlineable");
+        }
+        if (WHITE_BOX.setDontInlineMethod(METHOD, false)) {
+            throw new RuntimeException("after second change to false " + METHOD
+                    + " must be inlineable");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/8007320/ConstMethodTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,148 @@
+/*
+ * 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 8007320
+ * @summary Test all optional fields in ConstMethod
+ * @compile -g -parameters ConstMethodTest.java
+ * @run main ConstMethodTest
+ */
+
+import java.util.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.io.Serializable;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MyAnnotation {
+    public String name();
+    public String value();
+    public String date() default "today";
+}
+
+@Target(ElementType.TYPE_USE)
+@Retention(RetentionPolicy.RUNTIME)
+@interface TypeAnno {
+    String value();
+}
+
+@Target(ElementType.TYPE_USE)
+@Retention(RetentionPolicy.RUNTIME)
+@interface TypeAnno2 {
+    String value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+@interface Named {
+  String value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ScalarTypesWithDefault {
+    byte     b()    default 11;
+    short    s()    default 12;
+    int      i()    default 13;
+    long     l()    default 14;
+    char     c()    default 'V';
+}
+
+// Some exception class
+class OkException extends RuntimeException {};
+
+
+@MyAnnotation(name="someName", value = "Hello World")
+public class ConstMethodTest {
+
+    private static void check(boolean b) {
+        if (!b)
+            throw new RuntimeException();
+    }
+    private static void fail(String msg) {
+       System.err.println(msg);
+       throw new RuntimeException();
+    }
+    private static void equal(Object x, Object y) {
+        if (x == null ? y == null : x.equals(y)) {
+        } else {
+            fail(x + " not equal to " + y);
+        }
+    }
+    private static final String[] parameter_names = {
+        "parameter", "parameter2", "x"
+    };
+
+    // Declare a function with everything in it.
+    @MyAnnotation(name="someName", value="Hello World")
+    static <T> void kitchenSinkFunc(@Named(value="aName") String parameter,
+              @Named("bName") String parameter2,
+              @ScalarTypesWithDefault T x)
+            throws @TypeAnno("RE") @TypeAnno2("RE2") RuntimeException,
+                NullPointerException,
+                @TypeAnno("AIOOBE") ArrayIndexOutOfBoundsException {
+      int i, j, k;
+      try {
+        System.out.println("calling kitchenSinkFunc " + parameter);
+        throw new OkException();  // to see stack trace with line numbers
+      } catch (Exception e) {
+       e.printStackTrace();
+      }
+    }
+
+    private static void test1() throws Throwable {
+        for (Method m : ConstMethodTest.class.getDeclaredMethods()) {
+            if (m.getName().equals("kitchenSinkFunc")) {
+                Annotation[][] ann = m.getParameterAnnotations();
+                equal(ann.length, 3);
+                Annotation foo = ann[0][0];
+                Annotation bar = ann[1][0];
+                equal(foo.toString(), "@Named(value=aName)");
+                equal(bar.toString(), "@Named(value=bName)");
+                check(foo.equals(foo));
+                check(bar.equals(bar));
+                check(! foo.equals(bar));
+                // method annotations
+                Annotation[] ann2 = m.getAnnotations();
+                equal(ann2.length, 1);
+                Annotation mann = ann2[0];
+                equal(mann.toString(), "@MyAnnotation(date=today, name=someName, value=Hello World)");
+                // Test Method parameter names
+                Parameter[] parameters = m.getParameters();
+                if(parameters == null)
+                    throw new Exception("getParameters should never be null");
+                for(int i = 0; i < parameters.length; i++) {
+                    Parameter p = parameters[i];
+                    equal(parameters[i].getName(), parameter_names[i]);
+                }
+            }
+        }
+    }
+
+    public static void main(java.lang.String[] unused) throws Throwable {
+        // pass 5 so kitchenSinkFunc is instantiated with an int
+        kitchenSinkFunc("parameter", "param2", 5);
+        test1();
+    }
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8006298
+ * @summary Setting an invalid value for a bool argument should result in a useful error message
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class BooleanFlagWithInvalidValue {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:+UseLargePages=8", "-version");
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("Improperly specified VM option 'UseLargePages=8'");
+    output.shouldHaveExitValue(1);
+
+    pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:-UseLargePages=8", "-version");
+
+    output = new OutputAnalyzer(pb.start());
+    output.shouldContain("Improperly specified VM option 'UseLargePages=8'");
+    output.shouldHaveExitValue(1);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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 8006298
+ * @summary Setting a flag to an invalid value should print a useful error message
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class FlagWithInvalidValue {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:ObjectAlignmentInBytes=v", "-version");
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("Improperly specified VM option 'ObjectAlignmentInBytes=v'");
+    output.shouldHaveExitValue(1);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,50 @@
+/*
+ * 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 8006298
+ * @summary Using a bool (+/-) prefix on non-bool flag should result in a useful error message
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class NonBooleanFlagWithInvalidBooleanPrefix {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:-ObjectAlignmentInBytes=16", "-version");
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("Unexpected +/- setting in VM option 'ObjectAlignmentInBytes=16'");
+    output.shouldHaveExitValue(1);
+
+    pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:+ObjectAlignmentInBytes=16", "-version");
+
+    output = new OutputAnalyzer(pb.start());
+    output.shouldContain("Unexpected +/- setting in VM option 'ObjectAlignmentInBytes=16'");
+    output.shouldHaveExitValue(1);
+
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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 8006298
+ * @summary Using an unrecognized VM option should print the name of the option
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class UnrecognizedVMOption {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:bogus_option", "-version");
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("Unrecognized VM option 'bogus_option'");
+    output.shouldHaveExitValue(1);
+  }
+}
--- a/jaxp/.hgtags	Thu Feb 21 15:46:37 2013 -0800
+++ b/jaxp/.hgtags	Thu Feb 21 17:43:57 2013 -0800
@@ -198,3 +198,4 @@
 2087e24a4357eceb6432e94918e75fdc706a27d6 jdk8-b74
 ff0b73a6b3f6cea644d37d56d746a37743419fa7 jdk8-b75
 0c08593944d0cd30645f6e1e4946c51ff2b10c8c jdk8-b76
+573e789c187a69a3ae00bffd26eb35c0f4a60636 jdk8-b77
--- a/jaxws/.hgtags	Thu Feb 21 15:46:37 2013 -0800
+++ b/jaxws/.hgtags	Thu Feb 21 17:43:57 2013 -0800
@@ -198,3 +198,4 @@
 12db3c5a3393b03eeb09ff26f418c4420c21aaab jdk8-b74
 966bf9f3c41a59ff5d86ff4275291c52f329f984 jdk8-b75
 c4853f3f0e89ac60aa5b517f5f224f0f60e08577 jdk8-b76
+64dfba1bad16433f609f17a42c3c5990367c5c0b jdk8-b77
--- a/jdk/make/common/Defs-macosx.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/make/common/Defs-macosx.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -405,3 +405,11 @@
 endif
 
 LIB_LOCATION ?= $(LIBDIR)
+
+# Adding these macros will make it an error to link to mac APIs newer than OS version 10.7
+ifeq ($(MACOSX_REQUIRED_VERSION),)
+  MACOSX_REQUIRED_VERSION:=1070
+endif
+MACOSX_OS_VERSION_CFLAGS := -DMAC_OS_X_VERSION_MAX_ALLOWED=$(MACOSX_REQUIRED_VERSION) -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MACOSX_REQUIRED_VERSION)
+OTHER_CFLAGS += $(MACOSX_OS_VERSION_CFLAGS)
+OTHER_CXXFLAGS += $(MACOSX_OS_VERSION_CFLAGS)
--- a/jdk/make/common/Release.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/make/common/Release.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -1056,6 +1056,7 @@
 	    -processor com.sun.tools.javac.sym.CreateSymbols \
 	    -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
 	    -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
+	    -Acom.sun.tools.javac.sym.Profiles=$(JDK_TOPDIR)/makefiles/profile-rtjar-includes.txt \
 	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
 	$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(LIBDIR)/ct.sym \
 	    -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
--- a/jdk/make/docs/Makefile	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/make/docs/Makefile	Thu Feb 21 17:43:57 2013 -0800
@@ -1,4 +1,4 @@
-# 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
@@ -208,6 +208,7 @@
                 -use					\
                 -keywords				\
 		-Xdoclint:none				\
+                -Xprofilespath $(JDK_TOPDIR)/makefiles/profile-rtjar-includes.txt \
 		$(ADDITIONAL_JAVADOCFLAGS)
 
 ifdef OPENJDK
--- a/jdk/make/java/version/Makefile	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/make/java/version/Makefile	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
 	    -e 's/@@java_version@@/$(RELEASE)/g' \
 	    -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
 	    -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
+	    -e 's/@@java_profile_name@@//g' \
 	$< > $@.temp
 	@$(MV) $@.temp $@
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/src/build/tools/classfile/RemoveMethods.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.classfile;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Set;
+import java.util.HashSet;
+
+import com.sun.tools.classfile.AccessFlags;
+import com.sun.tools.classfile.Attributes;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ClassWriter;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.Field;
+import com.sun.tools.classfile.Method;
+
+public class RemoveMethods {
+
+    public static void main(String[] args) throws Exception {
+        if (args.length < 2) {
+            System.err.println("Usage: java RemoveMethods classfile output [method...]");
+            System.exit(-1);
+        }
+
+        // class file to read
+        Path input = Paths.get(args[0]);
+
+        // class file to write, if directory then use the name of the input
+        Path output = Paths.get(args[1]);
+        if (Files.isDirectory(output))
+            output = output.resolve(input.getFileName());
+
+        // the methods to remove
+        Set<String> methodsToRemove = new HashSet<>();
+        int i = 2;
+        while (i < args.length)
+            methodsToRemove.add(args[i++]);
+
+        // read class file
+        ClassFile cf;
+        try (InputStream in = Files.newInputStream(input)) {
+             cf = ClassFile.read(in);
+        }
+
+        final int magic = cf.magic;
+        final int major_version = cf.major_version;
+        final int minor_version = cf.minor_version;
+        final ConstantPool cp = cf.constant_pool;
+        final AccessFlags access_flags = cf.access_flags;
+        final int this_class = cf.this_class;
+        final int super_class = cf.super_class;
+        final int[] interfaces = cf.interfaces;
+        final Field[] fields = cf.fields;
+        final Attributes class_attrs = cf.attributes;
+
+        // remove the requested methods, no signature check at this time
+        Method[] methods = cf.methods;
+        i = 0;
+        while (i < methods.length) {
+            Method m = methods[i];
+            String name = m.getName(cp);
+            if (methodsToRemove.contains(name)) {
+                int len = methods.length;
+                Method[] newMethods = new Method[len-1];
+                if (i > 0)
+                    System.arraycopy(methods, 0, newMethods, 0, i);
+                int after = methods.length - i - 1;
+                if (after > 0)
+                    System.arraycopy(methods, i+1, newMethods, i, after);
+                methods = newMethods;
+                String paramTypes = m.descriptor.getParameterTypes(cp);
+                System.out.format("Removed method %s%s from %s%n",
+                    name, paramTypes, cf.getName());
+                continue;
+            }
+            i++;
+        }
+
+        // TBD, prune constant pool of entries that are no longer referenced
+
+        // re-write class file
+        cf = new ClassFile(magic, minor_version, major_version, cp, access_flags,
+                this_class, super_class, interfaces, fields, methods, class_attrs);
+        try (OutputStream out = Files.newOutputStream(output)) {
+             new ClassWriter().write(cf, out);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/src/build/tools/deps/CheckDeps.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,226 @@
+/*
+ * 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.
+ */
+
+package build.tools.deps;
+
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.charset.StandardCharsets;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Dependencies;
+import com.sun.tools.classfile.Dependency;
+
+/**
+ * A simple tool to check the JAR files in a JRE image to ensure that there
+ * aren't any references to types that do not exist. The tool is intended to
+ * be used in the JDK "profiles" build to help ensure that the profile
+ * definitions are kept up to date.
+ */
+
+public class CheckDeps {
+
+    // classfile API for finding dependencies
+    static final Dependency.Finder finder = Dependencies.getClassDependencyFinder();
+
+    // "known types", found in rt.jar or other JAR files
+    static final Set<String> knownTypes = new HashSet<>();
+
+    // References to unknown types. The map key is the unknown type, the
+    // map value is the set of classes that reference it.
+    static final Map<String,Set<String>> unknownRefs = new HashMap<>();
+
+    // The property name is the name of an unknown type that is allowed to be
+    // references. The property value is a comma separated list of the types
+    // that are allowed to reference it. The list also includes the names of
+    // the profiles that the reference is allowed.
+    static final Properties allowedBadRefs = new Properties();
+
+    /**
+     * Returns the class name for the given class file. In the case of inner
+     * classes then the enclosing class is returned in order to keep the
+     * rules simple.
+     */
+    static String toClassName(String s) {
+        int i = s.indexOf('$');
+        if (i > 0)
+            s = s.substring(0, i);
+        return s.replace("/", ".");
+    }
+
+    /**
+     * Analyze the dependencies of all classes in the given JAR file. The
+     * method updates knownTypes and unknownRefs as part of the analysis.
+     */
+    static void analyzeDependencies(Path jarpath) throws Exception {
+        System.out.format("Analyzing %s%n", jarpath);
+        try (JarFile jf = new JarFile(jarpath.toFile())) {
+            Enumeration<JarEntry> entries = jf.entries();
+            while (entries.hasMoreElements()) {
+                JarEntry e = entries.nextElement();
+                String name = e.getName();
+                if (name.endsWith(".class")) {
+                    ClassFile cf = ClassFile.read(jf.getInputStream(e));
+                    for (Dependency d : finder.findDependencies(cf)) {
+                        String origin = toClassName(d.getOrigin().getName());
+                        String target = toClassName(d.getTarget().getName());
+
+                        // origin is now known
+                        unknownRefs.remove(origin);
+                        knownTypes.add(origin);
+
+                        // if the target is not known then record the reference
+                        if (!knownTypes.contains(target)) {
+                            Set<String> refs = unknownRefs.get(target);
+                            if (refs == null) {
+                                // first time seeing this unknown type
+                                refs = new HashSet<>();
+                                unknownRefs.put(target, refs);
+                            }
+                            refs.add(origin);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * We have closure (no references to types that do not exist) if
+     * unknownRefs is empty. When unknownRefs is not empty then it should
+     * only contain references that are allowed to be present (these are
+     * loaded from the refs.allowed properties file).
+     *
+     * @param the profile that is being tested, this determines the exceptions
+     *   in {@code allowedBadRefs} that apply.
+     *
+     * @return {@code true} if there are no missing types or the only references
+     *   to missing types are described by {@code allowedBadRefs}.
+     */
+    static boolean checkClosure(String profile) {
+        // process the references to types that do not exist.
+        boolean fail = false;
+        for (Map.Entry<String,Set<String>> entry: unknownRefs.entrySet()) {
+            String target = entry.getKey();
+            for (String origin: entry.getValue()) {
+                // check if origin -> target allowed
+                String value = allowedBadRefs.getProperty(target);
+                if (value == null) {
+                    System.err.format("%s -> %s (unknown type)%n", origin, target);
+                    fail = true;
+                } else {
+                    // target is known, check if the origin is one that we
+                    // expect and that the exception applies to the profile.
+                    boolean found = false;
+                    boolean applicable = false;
+                    for (String s: value.split(",")) {
+                        s = s.trim();
+                        if (s.equals(origin))
+                            found = true;
+                        if (s.equals(profile))
+                            applicable = true;
+                    }
+                    if (!found || !applicable) {
+                        if (!found) {
+                            System.err.format("%s -> %s (not allowed)%n", origin, target);
+                        } else {
+                            System.err.format("%s -> %s (reference not applicable to %s)%n",
+                                origin, target, profile);
+                        }
+                        fail = true;
+                    }
+                }
+
+            }
+        }
+
+        return !fail;
+    }
+
+    static void fail(URL url) throws Exception {
+        System.err.println("One or more unexpected references encountered");
+        if (url != null)
+            System.err.format("Check %s is up to date%n", Paths.get(url.toURI()));
+        System.exit(-1);
+    }
+
+    public static void main(String[] args) throws Exception {
+        // load properties file so that we know what missing types that are
+        // allowed to be referenced.
+        URL url = CheckDeps.class.getResource("refs.allowed");
+        if (url != null) {
+            try (InputStream in = url.openStream()) {
+                allowedBadRefs.load(new InputStreamReader(in, StandardCharsets.UTF_8));
+            }
+        }
+
+        if (args.length != 2) {
+            System.err.println("Usage: java CheckDeps <image> <profile>");
+            System.exit(-1);
+        }
+
+        String image = args[0];
+        String profile = args[1];
+
+        // process JAR files on boot class path
+        Path lib = Paths.get(image, "lib");
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(lib, "*.jar")) {
+            for (Path jarpath: stream) {
+                analyzeDependencies(jarpath);
+            }
+        }
+
+        // classes on boot class path should not reference other types
+        boolean okay = checkClosure(profile);
+        if (!okay)
+            fail(url);
+
+        // process JAR files in the extensions directory
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(lib.resolve("ext"), "*.jar")) {
+            for (Path jarpath: stream) {
+                analyzeDependencies(jarpath);
+            }
+        }
+
+        // re-check to ensure that the extensions doesn't reference types that
+        // do not exist.
+        okay = checkClosure(profile);
+        if (!okay)
+            fail(url);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/src/build/tools/deps/refs.allowed	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,40 @@
+#
+# This properties-formatted file contains the names of the non-existent types
+# that are allowed to be referenced from classes in a profiles image.
+#
+# The property key is a type that does not exist. The property value is one or
+# more types that reference the missing type. The property value also encodes
+# the names of the profiles where this reference is allowed.
+
+# jsse.jar is not subsetted by the profiles build. For compact1 and compact2
+# then this means that there are references to Kerberos types that do not
+# exist. These references are harmless.
+#
+javax.security.auth.kerberos.KerberosKey=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+javax.security.auth.kerberos.KerberosPrincipal=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+javax.security.auth.kerberos.KerberosTicket=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+javax.security.auth.kerberos.ServicePermission=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.jgss.GSSCaller=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.jgss.krb5.Krb5Util=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.jgss.krb5.ServiceCreds=sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.krb5.EncryptedData= sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.EncryptionKey=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.internal.crypto.KeyUsage=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.internal.EncTicketPart=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.internal.Krb5=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.internal.Ticket=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.KrbException=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.PrincipalName=sun.security.ssl.krb5.Krb5ProxyImpl,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.Realm=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+
+# Residual references to java.beans.
+# The RemoveMethods tool does not yet purge the constant pool.
+# Rhino is due to be replaced so not worth addressing this dependency now.
+#
+java.beans.PropertyChangeListener=java.util.logging.LogManager,sun.org.mozilla.javascript.internal.Context,compact1,compact2,compact3
+java.beans.PropertyChangeEvent=sun.org.mozilla.javascript.internal.Context,compact3
+
+# JFR traces even in builds with JFR disabled
+com.oracle.jrockit.jfr.FlightRecorder: com.sun.management.MissionControl, compact3
+com.oracle.jrockit.jfr.management.FlightRecorderMBean: com.sun.management.MissionControl, compact3
+
--- a/jdk/make/tools/src/build/tools/jarreorder/JarReorder.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/make/tools/src/build/tools/jarreorder/JarReorder.java	Thu Feb 21 17:43:57 2013 -0800
@@ -162,8 +162,9 @@
         for (int i = orderList.size() - 1; i >= 0; --i) {
             String s = orderList.get(i);
             if (allFilesExcluded.contains(s)) {
-                System.err.println("Included order file " + s
-                    + " is also excluded, skipping.");
+                // Disable this warning until 8005688 is fixed
+                // System.err.println("Included order file " + s
+                //    + " is also excluded, skipping.");
             } else if (new File(s).exists()) {
                 allFiles.add(s);
             } else {
--- a/jdk/makefiles/BuildJdk.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/makefiles/BuildJdk.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -39,6 +39,12 @@
 # Setup the java compilers for the JDK build.
 include Setup.gmk
 
+# Include Profile information
+include ProfileNames.gmk
+
+# Include the corresponding custom file, if present.
+-include $(CUSTOM_MAKE_DIR)/BuildJdk.gmk
+
 import: import-only
 import-only:
 #       Import (corba jaxp jaxws langtools hotspot)
@@ -85,10 +91,11 @@
 	+$(MAKE) -f CopySamples.gmk
 
 # Create the final jdk and jre images, to be wrapped up
-# into packages, or installed.
+# into packages, or installed. Ensure PROFILE is not set
+# in these cases.
 images:
-	+$(MAKE) -f CreateJars.gmk
-	+$(MAKE) -f Images.gmk
+	+$(MAKE) PROFILE="" -f CreateJars.gmk
+	+$(MAKE) PROFILE="" -f Images.gmk
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 	+$(MAKE) -f Bundles.gmk
 endif
@@ -97,6 +104,13 @@
 	+$(MAKE) -f CompileLaunchers.gmk OVERLAY_IMAGES=true
 	+$(MAKE) -f Images.gmk overlay-images
 
+# Create Compact Profile images
+$(ALL_PROFILES):
+	+$(MAKE) PROFILE=$@ -f CreateJars.gmk
+	+$(MAKE) PROFILE=$@ JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/j2re-$(word $(call profile_number,$@),$(PROFILE_NAMES))-image -f Images.gmk profile-image
+
+profiles: $(ALL_PROFILES)
+
 sign-jars:
 	+$(MAKE) -f SignJars.gmk
 
@@ -121,3 +135,4 @@
 .PHONY: import gensrc gendata classes libs launchers genclasses
 .PHONY: import-only gensrc-only gendata-only classes-only libs-only launchers-only genclasses-only
 .PHONY: all jdk demos images overlay-images bundles install
+.PHONY: profiles $(ALL_PROFILES)
--- a/jdk/makefiles/CompileDemos.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/makefiles/CompileDemos.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -421,6 +421,7 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
                         -I$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB), \
+		LDFLAGS_SUFFIX_solaris:=-lc,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/demoobjs/jni/Poller,\
                 OUTPUT_DIR:=$(JDK_OUTPUTDIR)/demoobjs, \
 		LIBRARY:=Poller))
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -2188,6 +2188,7 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjfr/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS_SUFFIX_solaris:=-lc,\
 		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
 		RC_FLAGS:=$(RC_FLAGS)\
 			  -D "JDK_FNAME=jfr.dll" \
@@ -2236,6 +2237,7 @@
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_linux:=-lc -lpthread,\
+		LDFLAGS_SUFFIX_solaris:=-lc,\
 		LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
 		LDFLAGS_SUFFIX_posix:=-lm -ljava -ljvm,\
 		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
@@ -2939,6 +2941,7 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2ucrypto/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB),\
 		LDFLAGS_SUFFIX:=$(LIBDL),\
+		LDFLAGS_SUFFIX_solaris:=-lc,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto))
 
 $(BUILD_LIBJ2UCRYPTO) : $(BUILD_LIBJAVA)
--- a/jdk/makefiles/CreateJars.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/makefiles/CreateJars.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -35,16 +35,19 @@
 
 include Tools.gmk
 
+include Profiles.gmk
+
 #
 # This makefile...so that altering will trigger rebuilding include/exclude-lists => jars
 #
 MAKEFILE=$(JDK_TOPDIR)/makefiles/CreateJars.gmk
+#
+# And similarly for the Profiles
+PROFILE_MAKEFILES=$(JDK_TOPDIR)/makefiles/Profiles.gmk $(JDK_TOPDIR)/makefiles/profile-rtjar-includes.txt
 
 MAINMANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf
 BEANMANIFEST := $(JDK_TOPDIR)/make/javax/swing/beaninfo/manifest
 
-JARS:=
-
 $(eval $(call MakeDir,$(IMAGES_OUTPUTDIR)/lib))
 
 ##########################################################################################
@@ -57,7 +60,6 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/jconsole.jar,\
 		SKIP_METAINF:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/jconsole.jar
 
 ##########################################################################################
 
@@ -68,7 +70,6 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/dnsns.jar,\
 		SKIP_METAINF:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/ext/dnsns.jar
 
 ##########################################################################################
 
@@ -127,15 +128,20 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/localedata.jar,\
 		SKIP_METAINF:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/ext/localedata.jar
-
 ##########################################################################################
-# rt.jar and resources.jar are being built in the same way as in the old build. They require
-# the files to be in a certain order and converting that is not easy and will not be needed
-# in jigsaw anyway.
+#
+# Different variants of rt.jar are built based on the current profile. The output
+# directory is augmented with the profile name so that the final jar file and all the
+# intermediary list files will be in directory. This has the form lib$PROFILE rather than
+# lib/$PROFILE so that it won't get copied as part of the image generation process.
+# Each profile customizes the RT_JAR_EXCLUDES variable.
+#
+##########################################################################################
 
-# Exclude list for rt.jar and resources.jar
-RT_JAR_EXCLUDES := \
+# Full JRE exclude list for rt.jar and resources.jar
+# This value should exclude types destined for jars other than rt.jar and resources.jar. 
+# When building a Profile this value augments the profile specific exclusions
+RT_JAR_EXCLUDES += \
 	com/oracle/security \
 	com/sun/codemodel \
 	com/sun/crypto/provider \
@@ -258,24 +264,9 @@
 	sun/tools/util \
 	sun/util/cldr/CLDRLocaleDataMetaInfo.class \
 	sun/util/resources/cldr \
-	$(LOCALEDATA_INCLUDES)
-
-# These files should never be put into rt.jar
-# but due to a misstake...some are put there if embedded
-#
-ifneq ($(JAVASE_EMBEDDED), true)
-# normal (correct) case
-RT_JAR_EXCLUDES += \
+	$(LOCALEDATA_INCLUDES) \
 	com/oracle/jrockit/jfr \
 	oracle/jrockit/jfr
-else
-# embedded (broken) case
-RT_JAR_EXCLUDES += \
-  oracle/jrockit/jfr/parser \
-  oracle/jrockit/jfr/tools \
-  oracle/jrockit/jfr/NativeOptions.class \
-  oracle/jrockit/jfr/RepositoryChunkHandler.class
-endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
         RT_JAR_EXCLUDES += com/sun/nio/sctp \
@@ -286,8 +277,8 @@
 ALL_FILES_IN_CLASSES := $(call not-containing,_the.,$(filter-out %javac_state,\
                         $(call CacheFind,$(JDK_OUTPUTDIR)/classes)))
 
-RT_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib/_the.rt.jar_manifest
-RESOURCE_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib/_the.resources.jar_manifest
+RT_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar_manifest
+RESOURCE_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar_manifest
 
 $(RT_JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
 	$(MKDIR) -p $(@D)
@@ -307,7 +298,7 @@
 	       $(MAINMANIFEST) >> $@.tmp
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/_the.jars.exclude: $(MAKEFILE)
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude: $(MAKEFILE) $(PROFILE_MAKEFILES)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@.tmp)
@@ -320,55 +311,115 @@
 	$(TOOL_ADDJSUM) $< $@.tmp
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/_the.jars.contents: $(BUILD_TOOLS) $(IMAGES_OUTPUTDIR)/lib/_the.jars.exclude \
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents: $(BUILD_TOOLS) $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude \
 					 $(ALL_FILES_IN_CLASSES) $(IMAGES_OUTPUTDIR)/lib/classlist
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	($(CD) $(JDK_OUTPUTDIR)/classes && \
 	    $(TOOL_JARREORDER) \
-		-o  $@.tmp $(IMAGES_OUTPUTDIR)/lib/classlist $(IMAGES_OUTPUTDIR)/lib/_the.jars.exclude . )
+		-o  $@.tmp $(IMAGES_OUTPUTDIR)/lib/classlist $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude . )
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib/_the.jars.contents
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
-	$(GREP) -e '\.class$$' $(IMAGES_OUTPUTDIR)/lib/_the.jars.contents > $@.tmp
+	$(GREP) -e '\.class$$' $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
+ifneq ($(PROFILE),)
+#       # Add back classes from excluded packages (fixing the $ substitution in the process)
+	for type in  $(subst \$$,\, $(RT_JAR_INCLUDE_TYPES)) ; do \
+	  $(ECHO) $$type >> $@.tmp ; \
+	done
+endif
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/_the.resources.jar.contents: $(IMAGES_OUTPUTDIR)/lib/_the.jars.contents
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	$(GREP) -v -e '\.class$$' \
 	    -e '/_the\.*' -e '^_the\.*' -e '\\_the\.*' -e 'javac_state' \
-	    $(IMAGES_OUTPUTDIR)/lib/_the.jars.contents > $@.tmp
+	    $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
+ifneq ($(PROFILE),)
+#       # Strip out all META-INF/services/ entries
+	$(GREP) -v -e 'META-INF/services/' $@.tmp > $@.tmp2
+#       # Add back the required services
+#       # FIXME: On Solaris if PROFILE_INCLUDE_METAINF_SERVICES is not defined
+#       # we get a syntax error from sh. That doesn't happen on linux
+	for service in $(PROFILE_INCLUDE_METAINF_SERVICES) ; do \
+	  $(ECHO) $$service >> $@.tmp2; \
+	done
+	$(MV) $@.tmp2 $@.tmp
+endif
 	$(MV) $@.tmp $@
 
+# This is a hack but I don't know how to make this fit into the existing scheme
+$(PROFILE_VERSION_CLASS_TARGETS) : $(PROFILE_VERSION_JAVA_TARGETS)
+	@$(JAVAC) -d $(@D)/../../ $(@D)/$(VERSION_JAVA_FILE)
+
+
+# Support for removing the addPropertyChangeListener and removePropertyChangeListener
+# methods from classes that only go into the profile builds. For now the Pack200.Packer
+# and Packer200.Unpacker classes have special handling because of the $ in the file
+# name.
+BEANLESS_CLASSES = $(IMAGES_OUTPUTDIR)/beanless
+
+$(BEANLESS_CLASSES)/%: $(JDK_OUTPUTDIR)/classes/%
+	$(MKDIR) -p $(@D)
+	$(TOOL_REMOVEMETHODS) $< $@ addPropertyChangeListener removePropertyChangeListener
+
+CLASSES_TO_DEBEAN = \
+    java/util/logging/LogManager.class \
+    com/sun/java/util/jar/pack/PackerImpl.class \
+    com/sun/java/util/jar/pack/UnpackerImpl.class
+
+BEANLESS_CLASSES_TARGETS =
+ifneq ($(PROFILE),)
+    BEANLESS_CLASSES_TARGETS := $(foreach c, $(CLASSES_TO_DEBEAN), $(BEANLESS_CLASSES)/$c)
+endif
+
+
 RT_JAR_CREATE_OPTIONS := c0fm
+RT_JAR_UPDATE_OPTIONS := u0f
 ifeq ($(COMPRESS_JARS), true)
     RT_JAR_CREATE_OPTIONS := cfm
+    RT_JAR_UPDATE_OPTIONS := uf
 endif
 
-$(IMAGES_OUTPUTDIR)/lib/rt.jar: $(IMAGES_OUTPUTDIR)/lib/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE)
-	$(ECHO) Creating rt.jar
+# This defines a target-specific variables to make the shell logic easier to see.
+# We need to find the Version.class file for the profile currently being built
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: \
+  CLASS_FILE = $(if $(PROFILE),$(strip $(foreach class,$(PROFILE_VERSION_CLASS_TARGETS),$(if $(findstring $(PROFILE),$(class)),$(class)))), NO_SUCH_FILE)
+# This is the real target
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE) $(PROFILE_VERSION_CLASS_TARGETS) $(BEANLESS_CLASSES_TARGETS)
+	$(ECHO) Creating rt.jar $(PROFILE) Compressed=$(COMPRESS_JARS)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	$(CD) $(JDK_OUTPUTDIR)/classes && \
 	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RT_JAR_MANIFEST_FILE) \
-	        @$(IMAGES_OUTPUTDIR)/lib/_the.rt.jar.contents
+	        @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents && \
+	    if [ -f $(CLASS_FILE) ]; then \
+	      $(ECHO)  Updating rt.jar $(PROFILE) && \
+	      $(CD) $(patsubst %$(VERSION_CLASS_PATH),%,$(CLASS_FILE)) && \
+                $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(VERSION_CLASS_PATH); \
+	      $(MKDIR) -p $(BEANLESS_CLASSES)/java/util/jar; \
+	      $(TOOL_REMOVEMETHODS) $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200\$$Packer.class \
+		$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Packer.class addPropertyChangeListener removePropertyChangeListener; \
+	      $(TOOL_REMOVEMETHODS) $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200\$$Unpacker.class \
+		$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Unpacker.class addPropertyChangeListener removePropertyChangeListener; \
+	      $(CD) $(BEANLESS_CLASSES) && \
+		$(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(CLASSES_TO_DEBEAN) java/util/jar/* ; \
+            fi
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/resources.jar: $(IMAGES_OUTPUTDIR)/lib/_the.resources.jar.contents \
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/resources.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents \
 				    $(RESOURCE_JAR_MANIFEST_FILE)
 	$(ECHO) Creating resources.jar
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	$(CD) $(JDK_OUTPUTDIR)/classes && \
 	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RESOURCE_JAR_MANIFEST_FILE) \
-	        @$(IMAGES_OUTPUTDIR)/lib/_the.resources.jar.contents
+	        @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents
 	$(MV) $@.tmp $@
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/rt.jar $(IMAGES_OUTPUTDIR)/lib/resources.jar
-
 ##########################################################################################
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
@@ -393,8 +444,6 @@
 		SKIP_METAINF := true, \
                 CHECK_COMPRESS_JAR:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/charsets.jar
-
 ##########################################################################################
 
 ifndef OPENJDK
@@ -408,7 +457,6 @@
 		MANIFEST:=$(MAINMANIFEST), \
                 CHECK_COMPRESS_JAR:=true))
 
-    JARS+=$(IMAGES_OUTPUTDIR)/lib/jfr.jar
 endif
 endif
 
@@ -425,8 +473,6 @@
 		MANIFEST:=$(MAINMANIFEST), \
                 CHECK_COMPRESS_JAR:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/jsse.jar
-
 ##########################################################################################
 # Create manifest for security jars
 
@@ -446,7 +492,8 @@
 
 ##########################################################################################
 # For all security jars, always build the jar, but for closed, install the prebuilt signed
-# version instead of the newly built jar. For open, signing is not needed. See SignJars.gmk
+# version instead of the newly built jar. Unsigned jars are treated as intermediate targets
+# and explicitly added to the JARS list. For open, signing is not needed. See SignJars.gmk
 # for more information.
 
 SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar
@@ -472,7 +519,7 @@
 	$(install-file)
 endif
 
-JARS += $(SUNPKCS11_JAR_DST) $(SUNPKCS11_JAR_UNSIGNED)
+JARS += $(SUNPKCS11_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -499,7 +546,7 @@
 	$(install-file)
 endif
 
-JARS += $(SUNEC_JAR_DST) $(SUNEC_JAR_UNSIGNED)
+JARS += $(SUNEC_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -512,8 +559,6 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/dt.jar,\
 		SKIP_METAINF:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/dt.jar
-
 ##########################################################################################
 
 SUNJCE_PROVIDER_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunjce_provider.jar
@@ -539,7 +584,7 @@
 	$(install-file)
 endif
 
-JARS += $(SUNJCE_PROVIDER_JAR_DST) $(SUNJCE_PROVIDER_JAR_UNSIGNED)
+JARS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -566,7 +611,7 @@
 	$(install-file)
 endif
 
-JARS += $(JCE_JAR_DST) $(JCE_JAR_UNSIGNED)
+JARS +=  $(JCE_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -604,7 +649,7 @@
 	$(install-file)
 endif
 
-JARS += $(US_EXPORT_POLICY_JAR_DST) $(US_EXPORT_POLICY_JAR_UNSIGNED)
+JARS += $(US_EXPORT_POLICY_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -647,7 +692,7 @@
 	$(install-file)
 endif
 
-JARS += $(LOCAL_POLICY_JAR_DST) $(LOCAL_POLICY_JAR_UNSIGNED)
+JARS += $(LOCAL_POLICY_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -676,7 +721,7 @@
 	$(install-file)
 endif
 
-JARS += $(SUNMSCAPI_JAR_DST) $(SUNMSCAPI_JAR_UNSIGNED)
+JARS += $(SUNMSCAPI_JAR_UNSIGNED)
 
 endif
 
@@ -703,7 +748,7 @@
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
 	$(install-file)
 
-JARS += $(UCRYPTO_JAR_DST) $(UCRYPTO_JAR_UNSIGNED)
+JARS += $(UCRYPTO_JAR_UNSIGNED) 
 
 endif
 endif
@@ -726,8 +771,6 @@
 		EXTRA_MANIFEST_ATTR:=CLDR-Version: $(CLDRVERSION),\
 		SKIP_METAINF:=true))
 
-JARS += $(CLDRDATA_JAR_DST)
-
 ##########################################################################################
 
 TOOLS_JAR_INCLUDES := \
@@ -801,7 +844,6 @@
 		SKIP_METAINF:=true, \
                 CHECK_COMPRESS_JAR:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/tools.jar
 
 ##########################################################################################
 
@@ -842,6 +884,7 @@
 	    -processor com.sun.tools.javac.sym.CreateSymbols \
 	    -Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \
 	    -Acom.sun.tools.javac.sym.Dest=$(IMAGES_OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
+	    -Acom.sun.tools.javac.sym.Profiles=profile-rtjar-includes.txt \
 	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
 	$(TOUCH) $@
 
@@ -852,7 +895,6 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ct.sym, \
 		CHECK_COMPRESS_JAR:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/ct.sym
 
 ##########################################################################################
 
@@ -938,8 +980,6 @@
 		ZIP:=$(IMAGES_OUTPUTDIR)/src.zip,\
 		EXTRA_DEPS:=$(LAUNCHER_ZIP_SRC)))
 
-JARS+=$(IMAGES_OUTPUTDIR)/src.zip
-
 ##########################################################################################
 
 ifndef OPENJDK
@@ -990,15 +1030,11 @@
 $(IMAGES_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
 	$(JAR) cfm $@ $<
 
-JARS += $(IMAGES_OUTPUTDIR)/lib/management-agent.jar
-
 ##########################################################################################
 
 $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
 	$(install-file)
 
-JARS += $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar
-
 ##########################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS),macosx)
@@ -1006,8 +1042,6 @@
 		SRCS:=$(JDK_OUTPUTDIR)/jobjc_classes,\
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/JObjC.jar, \
 		JARINDEX:=true))
-
-    JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar
 endif
 
 ##########################################################################################
@@ -1017,7 +1051,6 @@
 		SRCS:=$(JDK_OUTPUTDIR)/altclasses_classes,\
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/alt-rt.jar))
 
-    JARS += $(IMAGES_OUTPUTDIR)/lib/alt-rt.jar
 endif
 
 ##########################################################################################
@@ -1028,8 +1061,6 @@
 $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(JDK_OUTPUTDIR)/lib/sa-jdi.jar
 	$(install-file)
 
-JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
-
 ##########################################################################################
 #
 # sec-bin.zip is used by builds where the corresponding sources are not available
--- a/jdk/makefiles/GensrcMisc.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/makefiles/GensrcMisc.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -23,24 +23,29 @@
 # questions.
 #
 
+include ProfileNames.gmk
+
 ##########################################################################################
 # Install the launcher name, release version string, full version
 # string and the runtime name into the Version.java file.
 # To be printed by java -version
 
-$(JDK_OUTPUTDIR)/gensrc/sun/misc/Version.java: \
-	$(JDK_TOPDIR)/src/share/classes/sun/misc/Version.java.template
+$(JDK_OUTPUTDIR)/gensrc/sun/misc/Version.java \
+$(PROFILE_VERSION_JAVA_TARGETS): \
+		$(JDK_TOPDIR)/src/share/classes/sun/misc/Version.java.template
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
-	$(ECHO) $(LOG_INFO) Generating sun/misc/Version.java
+	$(ECHO) Generating sun/misc/Version.java $(call profile_version_name, $@)
 	$(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \
 	       -e 's/@@java_version@@/$(RELEASE)/g' \
 	       -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
 	       -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
+	       -e 's/@@java_profile_name@@/$(call profile_version_name, $@)/g' \
             $< > $@.tmp
 	$(MV) $@.tmp $@
 
-GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/misc/Version.java
+GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/misc/Version.java \
+    $(PROFILE_VERSION_JAVA_TARGETS)
 
 ##########################################################################################
 # Version file for jconsole
--- a/jdk/makefiles/Images.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/makefiles/Images.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -41,6 +41,8 @@
 
 include Tools.gmk
 
+include Profiles.gmk
+
 # Note: This double-colon rule is intentional, to support
 # custom make file integration.
 images:: jre-image jdk-image
@@ -84,7 +86,7 @@
 ################################################################################
 #
 # Variable prefixes explained:
-# JRE_ refers to files in the j2re-image.
+# JRE_ refers to files in the j2re-*-image.
 # JDK_ refers to files in the j2sdk-image outside of the jre subdir.
 # JDKJRE_ refers to files in the j2sdk-image inside the jre subdir.
 #
@@ -92,7 +94,8 @@
 ################################################################################
 # /bin dir
 
-NOT_JRE_BIN_FILES := \
+ifeq ($(PROFILE),)
+    NOT_JRE_BIN_FILES := \
 	appletviewer$(EXE_SUFFIX) \
 	extcheck$(EXE_SUFFIX) \
 	idlj$(EXE_SUFFIX) \
@@ -125,6 +128,7 @@
         schemagen$(EXE_SUFFIX) \
 	jsadebugd$(EXE_SUFFIX) \
 	jhat$(EXE_SUFFIX)
+endif
 
 WINDOWS_JDK_BIN_FILES = \
 	$(EXE_SUFFIX) \
@@ -196,7 +200,8 @@
 	$(SALIB_NAME)
 endif
 
-NOT_JRE_LIB_FILES := \
+ifeq ($(PROFILE),)
+    NOT_JRE_LIB_FILES := \
 	tools.jar \
 	jconsole.jar \
 	sa-jdi.jar \
@@ -205,8 +210,9 @@
 	ir.idl \
 	ct.sym
 
-ifeq ($(OPENJDK_TARGET_OS), windows)
-    NOT_JRE_LIB_FILES += jawt.lib jvm.lib
+    ifeq ($(OPENJDK_TARGET_OS), windows)
+      NOT_JRE_LIB_FILES += jawt.lib jvm.lib
+    endif
 endif
 
 JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
@@ -607,6 +613,9 @@
 $(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
 	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(call create-info-file)
+ifneq ($(PROFILE),)
+	$(call info-file-item, "JAVA_PROFILE", "$(call profile_name, $(call profile_number, $(PROFILE)))")
+endif
 
 $(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
 	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
@@ -648,7 +657,7 @@
     EXEC_LIST_OVERLAY:=$(filter $(OVERLAY_FILTER),$(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
 
     # Filter out non JRE files and convert to unique touch files to depend on
-    JRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped,\
+    JRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped,\
 			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
 				 $(EXEC_LIST)))
 
@@ -688,7 +697,7 @@
     endef
 
     # Setup a rule for stripping files based on touch files
-    $(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped: $(JRE_IMAGE_DIR)/%
+    $(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped: $(JRE_IMAGE_DIR)/%
 	$(call strip-file)
 
     $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped: $(JDK_IMAGE_DIR)/%
@@ -728,6 +737,29 @@
 	$(JDK_OVERLAY_DEMO_TARGETS) $(JDK_OVERLAY_INFO_FILE) \
 	$(JDKJRE_OVERLAY_STRIP_LIST) $(JDK_OVERLAY_BIN_STRIP_LIST) 
 
+ifneq ($(PROFILE),)
+# Files in lib$(PROFILE) are excluded from the generic copying routines so
+# we have to add them back in here
+$(foreach f,$(CUSTOM_PROFILE_JARS),\
+    $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR)/lib$(PROFILE),$(JRE_IMAGE_DIR)/lib,$f,JRE_LIB_TARGETS)))
+
+PROFILE_IMAGE_JARS := $(filter %.jar, $(JRE_LIB_TARGETS))
+
+PROFILE_IMAGE_JARS_CHECKED := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_jars_checked
+
+$(PROFILE_IMAGE_JARS_CHECKED) : $(PROFILE_IMAGE_JARS)
+	$(TOOL_CHECKDEPS) $(JRE_IMAGE_DIR) \
+	    $(call profile_name, $(call profile_number, $(PROFILE)))
+	$(TOUCH) $@
+
+profile-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) \
+	$(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
+	$(JRE_INFO_FILE) $(JRE_STRIP_LIST) $(PROFILE_IMAGE_JARS_CHECKED)
+
+.PHONY: profile-image
+
+endif # Profile
+
 ################################################################################
 
 .PHONY: default images jre-image jdk-image
--- a/jdk/makefiles/Import.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/makefiles/Import.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -100,33 +100,13 @@
 
 #######
 
-ifeq ($(OPENJDK_TARGET_OS),solaris)
-define do-install-file
-	$(MKDIR) -p '$$(@D)'
-	$(RM) '$$@'
-	$(CP) -r -P '$$<' '$$(@D)'
-endef
-else ifeq ($(OPENJDK_TARGET_OS),macosx)
-define do-install-file
-	$(MKDIR) -p '$$(@D)'
-	$(RM) '$$@'
-	$(CP) -pRP '$$<' '$$@'
-endef
-else
-define do-install-file
-	$(MKDIR) -p '$$(@D)'
-	$(RM) '$$@'
-	$(CP) -P '$$<' '$$@'
-endef
-endif
-
 define CopyDir
         $1_SRC_FILES := $(shell $(FIND) $2 -type f -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE),$4) \))
         $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
         IMPORT_TARGET_FILES += $$($1_DST_FILES)
 $3/% : $2/%
 	$(ECHO) $(LOG_INFO) Copying $$(@F)
-	$(do-install-file)
+	$$(install-file)
 endef
 
 #######
@@ -155,6 +135,12 @@
             IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
         endif
     endif
+    ifeq ($(JVM_VARIANT_MINIMAL1), true)
+        IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+        ifneq (,$(JSIG_DEBUGINFO))
+            IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+        endif
+    endif
 endif
 
 $(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
@@ -195,27 +181,24 @@
 	$(RM) $(basename $@).debuginfo
 	$(MV) $@.tmp $@
 
-#######
+$(INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(LN) -s ../$(@F) $@
 
-ifeq ($(OPENJDK_TARGET_OS),solaris)
-define install-file
-	$(MKDIR) -p '$(@D)'
-	$(RM) '$@'
-	$(CP) -r -P '$<' '$(@D)'
-endef
-else ifeq ($(OPENJDK_TARGET_OS),macosx)
-define install-file
-	$(MKDIR) -p '$(@D)'
-	$(RM) '$@'
-	$(CP) -pRP '$<' '$@'
-endef
-else
-define install-file
-	$(MKDIR) -p '$(@D)'
-	$(RM) '$@'
-	$(CP) -P '$<' '$@'
-endef
-endif
+$(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(LN) -s ../$(@F) $@
+
+$(INSTALL_LIBRARIES_HERE)/minimal/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(RM) $@.tmp $(basename $@).debuginfo
+	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
+	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
+	$(RM) $(basename $@).debuginfo
+	$(MV) $@.tmp $@
 
 #######
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/ProfileNames.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,65 @@
+#
+# 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.  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 was split out from Profiles.gmk to allow GenSrcMisc.gmk to include it
+# without attempting to generate lists for output files that don't exist yet
+
+# These are the external names of each profile
+
+PROFILE_NAMES := compact1 compact2 compact3
+
+# The include files use 1,2,3,4 for simplicity and conciseness. Internally we
+# use profile_1, profile_2 and profile_3. Note that profile_4 is a full JRE so
+# we never have to use it directly.
+
+ALL_PROFILES := profile_1 profile_2 profile_3
+
+# This defines targets to generate per-profile Version.java/class files into
+# distinct locations
+
+VERSION_JAVA_DIR := sun/misc
+VERSION_JAVA_FILE := Version.java
+VERSION_JAVA_PATH := $(VERSION_JAVA_DIR)/$(VERSION_JAVA_FILE)
+VERSION_CLASS_PATH := $(VERSION_JAVA_PATH:.java=.class)
+
+PROFILE_VERSION_JAVA_TARGETS := $(foreach i, $(ALL_PROFILES), $(subst XXX,$i, $(JDK_OUTPUTDIR)/gen_XXX/$(VERSION_JAVA_PATH)))
+
+PROFILE_VERSION_CLASS_TARGETS := $(foreach i, $(PROFILE_VERSION_JAVA_TARGETS), $(i:.java=.class))
+
+# Function to map from profile designator, profile_1 etc, to its number
+profile_number = $(if $(patsubst profile_%,%, $(1)),$(patsubst profile_%,%, $(1)), $(words $(PROFILE_NAMES) extra))
+
+# Function to map from profile number, 1, 2 etc, to the corresponding name
+# An invalid number maps to an empty name
+profile_name = $(word $(1), $(PROFILE_NAMES))
+
+# Function to isolate a profile number from a Version.java target
+# Evaluates to the arg if the arg is not a profile version target
+profile_version_number = $(patsubst $(JDK_OUTPUTDIR)/gen_profile_%/$(VERSION_JAVA_PATH), %, $(1))
+
+# Function to go from a profile Version.java target to profile name. If not 
+# a profile version target then we need a number that maps to an empty name
+profile_version_name = $(word $(if $(filter-out $(call profile_version_number, $(1)), $(1)), $(call profile_version_number, $(1)), $(words $(PROFILE_NAMES) extra)), $(PROFILE_NAMES))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/Profiles.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,331 @@
+#
+# 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.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include ProfileNames.gmk
+
+# This defines the include lists for each profile, categorized as lib, bin
+# and other. We can use these to define the file lists for each profile
+# directly, rather than constructing a set of files to exclude from the
+# set of all files. But initially we will stick with generating exclude lists
+# as that is how the main build process already works.
+
+include profile-includes.txt
+
+###############################################################################
+# Per profile Jar lists
+#
+# These are the jar files to be built. In some builds these have to be
+# imported (signed jars) rather than built.
+#
+# The incoming lists, eg PROFILE_1_JRE_JARS_FILES, are the jars to be
+# included in this profile. They have the jar name relative to the lib 
+# directory. We have to turn these into targets by adding the 
+# $(IMAGES_OUTPUTDIR)/lib prefix
+#
+# Note that some jars may be optional depending on the type of build (jdk vs.
+# openjdk) and the platform.
+#
+# WARNING: incoming lists are currently validated for linux only!
+###############################################################################
+
+# These are jar files for which the contents vary depending on the profile
+CUSTOM_JARS := rt.jar resources.jar
+# This is used in Images.gmk
+CUSTOM_PROFILE_JARS := $(addprefix $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/, $(CUSTOM_JARS))
+
+# These are the common jar files built for and included with this profile
+# Filter out the custom jars and turn them into targets.
+
+PROFILE_1_JARS :=  \
+    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(filter-out $(CUSTOM_JARS), $(PROFILE_1_JRE_JAR_FILES)))
+
+PROFILE_2_JARS := \
+    $(if $(PROFILE_2_JRE_JAR_FILES), $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_2_JRE_JAR_FILES))) \
+    $(PROFILE_1_JARS)
+
+ifneq ($(ENABLE_JFR), true)
+  PROFILE_3_JRE_JAR_FILES :=  $(filter-out jfr.jar, $(PROFILE_3_JRE_JAR_FILES))
+endif
+
+PROFILE_3_JARS := \
+    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_3_JRE_JAR_FILES)) \
+    $(PROFILE_2_JARS)
+
+ifdef OPENJDK
+  PROFILE_4_JRE_JAR_FILES := $(filter-out alt-rt.jar, $(PROFILE_4_JRE_JAR_FILES))
+endif
+
+PROFILE_4_JARS := \
+    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_4_JRE_JAR_FILES)) \
+    $(PROFILE_3_JARS)
+
+# The full set of "jar" files needed for a complete JDK (ct.sym and src.zip
+# are also included.)
+# Note we need to add back the regular form of all the custom profile jars e.g.
+# rt.jar and resources.jar
+
+ALL_JARS := $(PROFILE_4_JARS) \
+        $(IMAGES_OUTPUTDIR)/lib/rt.jar \
+        $(IMAGES_OUTPUTDIR)/lib/resources.jar \
+        $(IMAGES_OUTPUTDIR)/lib/jconsole.jar \
+        $(IMAGES_OUTPUTDIR)/lib/dt.jar \
+        $(IMAGES_OUTPUTDIR)/lib/tools.jar \
+        $(IMAGES_OUTPUTDIR)/lib/ct.sym \
+        $(IMAGES_OUTPUTDIR)/src.zip \
+        $(IMAGES_OUTPUTDIR)/lib/ext/cldrdata.jar \
+        $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
+
+ifeq ($(OPENJDK_TARGET_OS),solaris)
+    ifndef OPENJDK
+        ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar
+    endif
+endif
+
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar
+endif 
+
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+    ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar
+endif
+
+ifeq ($(PROFILE), profile_1)
+    PROFILE_JARS := $(PROFILE_1_JARS)
+else ifeq ($(PROFILE), profile_2)
+    PROFILE_JARS := $(PROFILE_2_JARS)
+else ifeq ($(PROFILE), profile_3)
+    PROFILE_JARS := $(PROFILE_3_JARS)
+endif
+ifneq ($(PROFILE),)
+    JARS := $(CUSTOM_PROFILE_JARS) $(PROFILE_JARS)
+else
+    JARS := $(ALL_JARS)
+endif
+
+###############################################################################
+# JRE contents
+###############################################################################
+
+
+# we don't need to do anything if not building a profile
+ifneq ($(PROFILE),)
+
+
+# Need all files to generate the exclude lists
+NEW_ALL_BIN_LIST := $(patsubst $(JDK_OUTPUTDIR)/bin/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/bin \( -type f -o -type l \) ! -name "sjavac"))
+
+ALL_JRE_BIN_FILES := \
+   $(PROFILE_1_JRE_BIN_FILES) \
+   $(PROFILE_2_JRE_BIN_FILES) \
+   $(PROFILE_3_JRE_BIN_FILES) \
+   $(PROFILE_4_JRE_BIN_FILES) 
+
+NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST))
+
+# Additional exclusions for profile JRE
+ifeq ($(PROFILE), profile_1)
+    NOT_JRE_BIN_FILES += \
+        $(PROFILE_2_JRE_BIN_FILES) \
+        $(PROFILE_3_JRE_BIN_FILES) \
+        $(PROFILE_4_JRE_BIN_FILES) 
+endif
+
+ifeq ($(PROFILE), profile_2)
+    NOT_JRE_BIN_FILES += \
+        $(PROFILE_3_JRE_BIN_FILES) \
+        $(PROFILE_4_JRE_BIN_FILES) 
+endif
+
+ifeq ($(PROFILE), profile_3)
+    NOT_JRE_BIN_FILES += \
+        $(PROFILE_4_JRE_BIN_FILES) 
+endif
+
+NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES))
+
+# Need all files to generate the exclude lists
+NEW_ALL_LIB_LIST := $(patsubst $(JDK_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
+NEW_ALL_LIB_LIST += $(patsubst $(IMAGES_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
+
+ALL_JRE_LIB_FILES := \
+   $(PROFILE_1_JRE_LIB_FILES) \
+   $(PROFILE_2_JRE_LIB_FILES) \
+   $(PROFILE_3_JRE_LIB_FILES) \
+   $(PROFILE_4_JRE_LIB_FILES) 
+
+NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST))
+
+# Although these are NOT JRE lib files we have to filter them from the list
+# (ie cause them to be added them back in here) because the logic in
+# Images.gmk expects them to be there and handles them differently.
+# If we don't, they end up in the wrong place in the JDK image.
+# This needs fixing.
+NOT_JRE_LIB_FILES := $(filter-out $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(SALIB_NAME), $(NOT_JRE_LIB_FILES))
+
+# Additional exclusions for profile JREs
+ifeq ($(PROFILE), profile_1)
+    NOT_JRE_LIB_FILES += \
+        $(PROFILE_2_JRE_LIB_FILES) \
+        $(PROFILE_3_JRE_LIB_FILES) \
+        $(PROFILE_4_JRE_LIB_FILES) 
+endif
+
+ifeq ($(PROFILE), profile_2)
+    NOT_JRE_LIB_FILES += \
+        $(PROFILE_3_JRE_LIB_FILES) \
+        $(PROFILE_4_JRE_LIB_FILES) 
+endif
+
+ifeq ($(PROFILE), profile_3)
+    NOT_JRE_LIB_FILES += \
+        $(PROFILE_4_JRE_LIB_FILES) 
+endif
+
+# Exclude the custom jar files as these will be added back via a special rule
+NOT_JRE_LIB_FILES += $(CUSTOM_JARS)
+
+###############################################################################
+# Customization of rt.jar file contents
+# These are expressed as exclusions from everything found in the 
+# JDK_OUTPUTDIR/classes directory
+###############################################################################
+
+# The main set of excluded types/packages (ie everything not destined to be
+# part of rt.jar or resources.jar is captured in the CreateJars.gmk RT_JAR_EXCLUDES
+# variable. We add to that for the per-profile exclusion lists
+
+# For each profile we have four variables:
+#
+# - PROFILE_n_RTJAR_INCLUDE_PACKAGES
+#
+# This is a package prefix indicating that all classes in that package
+# and conditionally its subpackages are included in rt.jar for this profile.
+# The subpackages will be included as long as they do not appear in the
+# include list of a higher profile
+#
+# - PROFILE_n_RTJAR_INCLUDE_TYPES
+#
+# These are specific types that must be included within a package.
+# There are two cases:
+# - individual types in a package that is otherwise excluded at this 
+#   profile level. The only arises if there are split packages. 
+#
+# - A higher-level package is included in a high profile where a subpackage
+# is included in a lower profile. Including the package in the high profile
+# would exclude it and all subpackages from the lower profile, so instead
+# the classes in the package are listed for that higher profile (as *.class)
+#
+# These types are explicitly added back into the rt.jar content lists.
+#
+# - PROFILE_n_RTJAR_EXCLUDE_TYPES
+#
+# These are specific types that must be excluded even though most of the
+# containing package is include. Again this occurs with split packges.
+#
+# So the exclude list for each profile consists of the include lists
+# for all profiles above it, together with any explicitly excluded types. 
+# This is then combined with the overall RT_JAR_EXCLUDES list (which covers
+# things that go into other jar files).
+#
+# We also have to define the types to be explicitly included. This
+# accumulates up the profiles ie profile 3 has to include the types
+# that profiles 1 and 2 had to include. This is unnecessary if, for example,
+# profile 3 includes the entire package, but it is harmless to add them
+# explicitly, and complex to determine if we still need to include them.
+#
+# Need a way to express: 
+#  for (int i = profile+1; i < 4; i++)
+#     RT_JAR_EXCLUDES += PROFILE_$i_RTJAR_INCLUDE_PACKAGES
+#
+# Do it the long way for now
+#
+# - PROFILE_n_INCLUDE_METAINF_SERVICES
+#
+# These are META-INF/services/ entries found in resources.jar. Together
+# resources.jar and rt.jar hold the contents of the classes directory, (the
+# classes in rt.jar and everything else in resources.jar).Hence the 
+# include/exclude information for resources.jar is tied to that of rt.jar
+
+include profile-rtjar-includes.txt
+
+# Function to expand foo/*.class into the set of classes
+# NOTE: Classfiles with $ in their name are problematic as that is the
+# meta-character for both make and the shell! Hence the \$$$$ substitution.
+# But note that if you echo these values they will NOT display as expected.
+class_list =  $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\
+     $(foreach i,$(1), $(subst $$,\$$$$, $(wildcard $(JDK_OUTPUTDIR)/classes/$i))))
+
+ifeq ($(PROFILE), profile_1)
+  RT_JAR_EXCLUDES += \
+    $(PROFILE_1_RTJAR_EXCLUDE_TYPES) \
+    $(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
+    $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
+    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+  RT_JAR_INCLUDE_TYPES := \
+	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES))
+  PROFILE_INCLUDE_METAINF_SERVICES := \
+    $(PROFILE_1_INCLUDE_METAINF_SERVICES)
+endif
+ifeq ($(PROFILE), profile_2)
+  RT_JAR_EXCLUDES += \
+    $(PROFILE_2_RTJAR_EXCLUDE_TYPES) \
+    $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
+    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+  RT_JAR_INCLUDE_TYPES := \
+	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
+	$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES))
+  PROFILE_INCLUDE_METAINF_SERVICES := \
+    $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
+    $(PROFILE_2_INCLUDE_METAINF_SERVICES)
+endif
+ifeq ($(PROFILE), profile_3)
+  RT_JAR_EXCLUDES += \
+    $(PROFILE_3_RTJAR_EXCLUDE_TYPES) \
+    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+  RT_JAR_INCLUDE_TYPES := \
+	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
+	$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
+	$(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES))
+  PROFILE_INCLUDE_METAINF_SERVICES := \
+    $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
+    $(PROFILE_2_INCLUDE_METAINF_SERVICES) \
+    $(PROFILE_3_INCLUDE_METAINF_SERVICES)
+endif
+
+# Filter out non-OpenJDK services
+ifdef OPENJDK
+  EXCLUDED_SERVICES := META-INF/services/javax.script.ScriptEngineFactory 
+  PROFILE_INCLUDE_METAINF_SERVICES := $(filter-out $(EXCLUDED_SERVICES),$(PROFILE_INCLUDE_METAINF_SERVICES))
+endif
+
+
+endif # profile
+
--- a/jdk/makefiles/Tools.gmk	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/makefiles/Tools.gmk	Thu Feb 21 17:43:57 2013 -0800
@@ -53,6 +53,14 @@
 
 BUILD_TOOLS += $(foreach i,$(wildcard $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/nimbus/*.template),$(JDK_OUTPUTDIR)/btclasses/build/tools/generatenimbus/resources/$(notdir $i))
 
+# Resources used by CheckDeps tool
+$(JDK_OUTPUTDIR)/btclasses/build/tools/deps/% : \
+	$(JDK_TOPDIR)/make/tools/src/build/tools/deps/%
+	$(MKDIR) -p $(@D)
+	$(CP) $< $@
+
+BUILD_TOOLS += $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed
+
 # Add a checksum ("jsum") to the end of a text file. Prevents trivial tampering with class lists.
 TOOL_ADDJSUM=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
 	build.tools.addjsum.AddJsum
@@ -137,6 +145,14 @@
 TOOL_CLDRCONVERTER=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
 	build.tools.cldrconverter.CLDRConverter
 
+TOOL_REMOVEMETHODS=$(JAVA) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+    -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
+        build.tools.classfile.RemoveMethods
+
+TOOL_CHECKDEPS=$(JAVA) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+    -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
+        build.tools.deps.CheckDeps
+
 ##########################################################################################
 
 # Tools needed on solaris because OBJCOPY is broken.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/profile-includes.txt	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,258 @@
+#
+# 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.  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.
+#
+PROFILE_1_JRE_BIN_FILES := \
+    java$(EXE_SUFFIX) \
+    keytool$(EXE_SUFFIX)
+
+PROFILE_1_JRE_LIB_FILES := \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)net$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)nio$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)zip$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jsig.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jvm.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/Xusage.txt \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/jvm.cfg \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jsig.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jvm.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/Xusage.txt \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jsig.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jvm.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/Xusage.txt \
+    calendars.properties \
+    classlist \
+    content-types.properties \
+    currency.data \
+    ext/localedata.jar \
+    ext/meta-index \
+    ext/sunjce_provider.jar \
+    jce.jar \
+    jsse.jar \
+    logging.properties \
+    meta-index \
+    net.properties \
+    resources.jar \
+    rt.jar \
+    security/US_export_policy.jar \
+    security/blacklist \
+    security/cacerts \
+    security/java.policy \
+    security/java.security \
+    security/local_policy.jar \
+    security/trusted.libraries \
+    tzdb.jar
+
+PROFILE_1_JRE_OTHER_FILES := \
+    COPYRIGHT \
+    LICENSE \
+    README \
+    THIRDPARTYLICENSEREADME.txt \
+    Welcome.html \
+    release
+
+PROFILE_1_JRE_JAR_FILES := \
+    ext/localedata.jar \
+    ext/sunjce_provider.jar \
+    jce.jar \
+    jsse.jar \
+    resources.jar \
+    rt.jar \
+    security/US_export_policy.jar \
+    security/local_policy.jar \
+    tzdb.jar
+
+
+PROFILE_2_JRE_BIN_FILES := \
+    rmid$(EXE_SUFFIX) \
+    rmiregistry$(EXE_SUFFIX)
+
+PROFILE_2_JRE_LIB_FILES := 
+
+PROFILE_2_JRE_OTHER_FILES := 
+
+PROFILE_2_JRE_JAR_FILES := 
+
+
+PROFILE_3_JRE_BIN_FILES := 
+
+PROFILE_3_JRE_LIB_FILES := \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)hprof$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)hprof.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)instrument$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)instrument.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2gss$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pcsc$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jaas_unix$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
+    jfr.jar \
+    jvm.hprof.txt \
+    management-agent.jar \
+    management/jmxremote.access \
+    management/jmxremote.password.template \
+    management/management.properties \
+    management/snmp.acl.template
+
+PROFILE_3_JRE_OTHER_FILES := 
+
+PROFILE_3_JRE_JAR_FILES := \
+    jfr.jar \
+    management-agent.jar
+
+
+PROFILE_4_JRE_BIN_FILES := \
+    orbd$(EXE_SUFFIX) \
+    pack200$(EXE_SUFFIX) \
+    policytool$(EXE_SUFFIX) \
+    servertool$(EXE_SUFFIX) \
+    tnameserv$(EXE_SUFFIX) \
+    unpack200$(EXE_SUFFIX)
+
+PROFILE_4_JRE_LIB_FILES := \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_xawt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dcpr$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pkcs11$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsound$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsoundalsa$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)kcms$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)mlib_image$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)splashscreen$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sunec$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)t2k$(SHARED_LIBRARY_SUFFIX) \
+    alt-rt.jar \
+    charsets.jar \
+    cmm/CIEXYZ.pf \
+    cmm/GRAY.pf \
+    cmm/LINEAR_RGB.pf \
+    cmm/PYCC.pf \
+    cmm/sRGB.pf \
+    ext/cldrdata.jar \
+    ext/dnsns.jar \
+    ext/sunec.jar \
+    ext/sunpkcs11.jar \
+    ext/zipfs.jar \
+    flavormap.properties \
+    fontconfig.RedHat.5.bfc \
+    fontconfig.RedHat.5.properties.src \
+    fontconfig.RedHat.6.bfc \
+    fontconfig.RedHat.6.properties.src \
+    fontconfig.SuSE.10.bfc \
+    fontconfig.SuSE.10.properties.src \
+    fontconfig.SuSE.11.bfc \
+    fontconfig.SuSE.11.properties.src \
+    fontconfig.Turbo.bfc \
+    fontconfig.Turbo.properties.src \
+    fontconfig.bfc \
+    fontconfig.properties.src \
+    fonts/LucidaBrightDemiBold.ttf \
+    fonts/LucidaBrightDemiItalic.ttf \
+    fonts/LucidaBrightItalic.ttf \
+    fonts/LucidaBrightRegular.ttf \
+    fonts/LucidaSansDemiBold.ttf \
+    fonts/LucidaSansRegular.ttf \
+    fonts/LucidaTypewriterBold.ttf \
+    fonts/LucidaTypewriterRegular.ttf \
+    fonts/fonts.dir \
+    images/cursors/cursors.properties \
+    images/cursors/invalid32x32.gif \
+    images/cursors/motif_CopyDrop32x32.gif \
+    images/cursors/motif_CopyNoDrop32x32.gif \
+    images/cursors/motif_LinkDrop32x32.gif \
+    images/cursors/motif_LinkNoDrop32x32.gif \
+    images/cursors/motif_MoveDrop32x32.gif \
+    images/cursors/motif_MoveNoDrop32x32.gif \
+    jexec \
+    oblique-fonts/LucidaSansDemiOblique.ttf \
+    oblique-fonts/LucidaSansOblique.ttf \
+    oblique-fonts/LucidaTypewriterBoldOblique.ttf \
+    oblique-fonts/LucidaTypewriterOblique.ttf \
+    oblique-fonts/fonts.dir \
+    psfont.properties.ja \
+    psfontj2d.properties \
+    servicetag/jdk_header.png \
+    sound.properties
+
+PROFILE_4_JRE_OTHER_FILES := \
+    man/ja_JP.UTF-8/man1/java.1 \
+    man/ja_JP.UTF-8/man1/javaws.1 \
+    man/ja_JP.UTF-8/man1/keytool.1 \
+    man/ja_JP.UTF-8/man1/orbd.1 \
+    man/ja_JP.UTF-8/man1/pack200.1 \
+    man/ja_JP.UTF-8/man1/policytool.1 \
+    man/ja_JP.UTF-8/man1/rmid.1 \
+    man/ja_JP.UTF-8/man1/rmiregistry.1 \
+    man/ja_JP.UTF-8/man1/servertool.1 \
+    man/ja_JP.UTF-8/man1/tnameserv.1 \
+    man/ja_JP.UTF-8/man1/unpack200.1 \
+    man/man1/java.1 \
+    man/man1/javaws.1 \
+    man/man1/keytool.1 \
+    man/man1/orbd.1 \
+    man/man1/pack200.1 \
+    man/man1/policytool.1 \
+    man/man1/rmid.1 \
+    man/man1/rmiregistry.1 \
+    man/man1/servertool.1 \
+    man/man1/tnameserv.1 \
+    man/man1/unpack200.1
+
+PROFILE_4_JRE_JAR_FILES := \
+    alt-rt.jar \
+    charsets.jar \
+    ext/cldrdata.jar \
+    ext/dnsns.jar \
+    ext/sunec.jar \
+    ext/sunpkcs11.jar \
+    ext/zipfs.jar
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/profile-rtjar-includes.txt	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,926 @@
+#
+# 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.  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.
+#
+PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
+    com/sun/demo/jvmti/hprof \
+    com/sun/java/util/jar/pack \
+    com/sun/net/ssl \
+    com/sun/net/ssl/internal/www/protocol/https \
+    com/sun/nio/file \
+    com/sun/security/cert/internal/x509 \
+    java/io \
+    java/lang \
+    java/lang/annotation \
+    java/lang/invoke \
+    java/lang/ref \
+    java/lang/reflect \
+    java/math \
+    java/net \
+    java/nio \
+    java/nio/channels \
+    java/nio/channels/spi \
+    java/nio/charset \
+    java/nio/charset/spi \
+    java/nio/file \
+    java/nio/file/attribute \
+    java/nio/file/spi \
+    java/security \
+    java/security/cert \
+    java/security/interfaces \
+    java/security/spec \
+    java/text \
+    java/text/spi \
+    java/time \
+    java/util \
+    java/util/concurrent \
+    java/util/concurrent/atomic \
+    java/util/concurrent/locks \
+    java/util/function \
+    java/util/jar \
+    java/util/logging \
+    java/util/regex \
+    java/util/spi \
+    java/util/zip \
+    javax/net \
+    javax/net/ssl \
+    javax/security/auth \
+    javax/security/auth/callback \
+    javax/security/auth/login \
+    javax/security/auth/spi \
+    javax/security/auth/x500 \
+    javax/security/cert \
+    jdk/internal \
+    sun/invoke \
+    sun/invoke/anon \
+    sun/invoke/empty \
+    sun/invoke/util \
+    sun/launcher \
+    sun/launcher/resources \
+    sun/misc \
+    sun/misc/resources \
+    sun/net/ \
+    sun/net/idn \
+    sun/net/sdp \
+    sun/net/spi \
+    sun/net/spi/nameservice \
+    sun/net/util \
+    sun/net/www \
+    sun/net/www/http \
+    sun/net/www/protocol/file \
+    sun/net/www/protocol/http/ \
+    sun/net/www/protocol/http/logging \
+    sun/net/www/protocol/https \
+    sun/net/www/protocol/jar \
+    sun/nio \
+    sun/nio/ch \
+    sun/nio/cs \
+    sun/nio/fs \
+    sun/reflect \
+    sun/reflect/annotation \
+    sun/reflect/generics/factory \
+    sun/reflect/generics/parser \
+    sun/reflect/generics/reflectiveObjects \
+    sun/reflect/generics/repository \
+    sun/reflect/generics/scope \
+    sun/reflect/generics/tree \
+    sun/reflect/generics/visitor \
+    sun/reflect/misc \
+    sun/security/action \
+    sun/security/ec \
+    sun/security/jca \
+    sun/security/pkcs \
+    sun/security/pkcs10 \
+    sun/security/pkcs12 \
+    sun/security/provider \
+    sun/security/provider/certpath \
+    sun/security/provider/certpath/ssl \
+    sun/security/rsa \
+    sun/security/timestamp \
+    sun/security/tools \
+    sun/security/tools/keytool \
+    sun/security/util \
+    sun/security/validator \
+    sun/security/x509 \
+    sun/text \
+    sun/text/bidi \
+    sun/text/normalizer \
+    sun/text/resources \
+    sun/usagetracker \
+    sun/util \
+    sun/util/calendar \
+    sun/util/locale \
+    sun/util/logging \
+    sun/util/logging/resources \
+    sun/util/resources
+
+PROFILE_1_RTJAR_INCLUDE_TYPES :=
+
+PROFILE_1_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_1_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
+    com/sun/java_cup/internal/runtime \
+    com/sun/net/httpserver \
+    com/sun/net/httpserver/spi \
+    com/sun/org/apache/bcel/internal \
+    com/sun/org/apache/bcel/internal/classfile \
+    com/sun/org/apache/bcel/internal/generic \
+    com/sun/org/apache/bcel/internal/util \
+    com/sun/org/apache/regexp/internal \
+    com/sun/org/apache/xalan/internal \
+    com/sun/org/apache/xalan/internal/extensions \
+    com/sun/org/apache/xalan/internal/lib \
+    com/sun/org/apache/xalan/internal/res \
+    com/sun/org/apache/xalan/internal/templates \
+    com/sun/org/apache/xalan/internal/utils \
+    com/sun/org/apache/xalan/internal/xslt \
+    com/sun/org/apache/xalan/internal/xsltc \
+    com/sun/org/apache/xalan/internal/xsltc/cmdline \
+    com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt \
+    com/sun/org/apache/xalan/internal/xsltc/compiler \
+    com/sun/org/apache/xalan/internal/xsltc/compiler/util \
+    com/sun/org/apache/xalan/internal/xsltc/dom \
+    com/sun/org/apache/xalan/internal/xsltc/runtime \
+    com/sun/org/apache/xalan/internal/xsltc/runtime/output \
+    com/sun/org/apache/xalan/internal/xsltc/trax \
+    com/sun/org/apache/xalan/internal/xsltc/util \
+    com/sun/org/apache/xerces/internal/dom \
+    com/sun/org/apache/xerces/internal/dom/events \
+    com/sun/org/apache/xerces/internal/impl \
+    com/sun/org/apache/xerces/internal/impl/dtd \
+    com/sun/org/apache/xerces/internal/impl/dtd/models \
+    com/sun/org/apache/xerces/internal/impl/dv \
+    com/sun/org/apache/xerces/internal/impl/dv/dtd \
+    com/sun/org/apache/xerces/internal/impl/dv/util \
+    com/sun/org/apache/xerces/internal/impl/dv/xs \
+    com/sun/org/apache/xerces/internal/impl/io \
+    com/sun/org/apache/xerces/internal/impl/msg \
+    com/sun/org/apache/xerces/internal/impl/validation \
+    com/sun/org/apache/xerces/internal/impl/xpath \
+    com/sun/org/apache/xerces/internal/impl/xpath/regex \
+    com/sun/org/apache/xerces/internal/impl/xs \
+    com/sun/org/apache/xerces/internal/impl/xs/identity \
+    com/sun/org/apache/xerces/internal/impl/xs/models \
+    com/sun/org/apache/xerces/internal/impl/xs/opti \
+    com/sun/org/apache/xerces/internal/impl/xs/traversers \
+    com/sun/org/apache/xerces/internal/impl/xs/util \
+    com/sun/org/apache/xerces/internal/jaxp \
+    com/sun/org/apache/xerces/internal/jaxp/datatype \
+    com/sun/org/apache/xerces/internal/jaxp/validation \
+    com/sun/org/apache/xerces/internal/parsers \
+    com/sun/org/apache/xerces/internal/util \
+    com/sun/org/apache/xerces/internal/utils \
+    com/sun/org/apache/xerces/internal/xinclude \
+    com/sun/org/apache/xerces/internal/xni \
+    com/sun/org/apache/xerces/internal/xni/grammars \
+    com/sun/org/apache/xerces/internal/xni/parser \
+    com/sun/org/apache/xerces/internal/xpointer \
+    com/sun/org/apache/xerces/internal/xs \
+    com/sun/org/apache/xerces/internal/xs/datatypes \
+    com/sun/org/apache/xml/internal/dtm \
+    com/sun/org/apache/xml/internal/dtm/ref \
+    com/sun/org/apache/xml/internal/dtm/ref/dom2dtm \
+    com/sun/org/apache/xml/internal/dtm/ref/sax2dtm \
+    com/sun/org/apache/xml/internal/res \
+    com/sun/org/apache/xml/internal/resolver \
+    com/sun/org/apache/xml/internal/resolver/helpers \
+    com/sun/org/apache/xml/internal/resolver/readers \
+    com/sun/org/apache/xml/internal/resolver/tools \
+    com/sun/org/apache/xml/internal/serialize \
+    com/sun/org/apache/xml/internal/serializer \
+    com/sun/org/apache/xml/internal/serializer/utils \
+    com/sun/org/apache/xml/internal/utils \
+    com/sun/org/apache/xml/internal/utils/res \
+    com/sun/org/apache/xpath/internal \
+    com/sun/org/apache/xpath/internal/axes \
+    com/sun/org/apache/xpath/internal/compiler \
+    com/sun/org/apache/xpath/internal/domapi \
+    com/sun/org/apache/xpath/internal/functions \
+    com/sun/org/apache/xpath/internal/jaxp \
+    com/sun/org/apache/xpath/internal/objects \
+    com/sun/org/apache/xpath/internal/operations \
+    com/sun/org/apache/xpath/internal/patterns \
+    com/sun/org/apache/xpath/internal/res \
+    com/sun/rmi/rmid \
+    com/sun/xml/internal/stream/ \
+    com/sun/xml/internal/stream/dtd \
+    com/sun/xml/internal/stream/dtd/nonvalidating \
+    com/sun/xml/internal/stream/events \
+    com/sun/xml/internal/stream/util \
+    com/sun/xml/internal/stream/writers \
+    java/rmi \
+    java/rmi/activation \
+    java/rmi/dgc \
+    java/rmi/registry \
+    java/rmi/server \
+    java/sql \
+    javax/rmi/ssl \
+    javax/sql \
+    javax/transaction \
+    javax/transaction/xa \
+    javax/xml \
+    javax/xml/datatype \
+    javax/xml/namespace \
+    javax/xml/parsers \
+    javax/xml/stream \
+    javax/xml/stream/events \
+    javax/xml/stream/util \
+    javax/xml/transform \
+    javax/xml/transform/dom \
+    javax/xml/transform/sax \
+    javax/xml/transform/stax \
+    javax/xml/transform/stream \
+    javax/xml/validation \
+    javax/xml/xpath \
+    org/w3c/dom \
+    org/w3c/dom/bootstrap \
+    org/w3c/dom/css \
+    org/w3c/dom/events \
+    org/w3c/dom/html \
+    org/w3c/dom/ls \
+    org/w3c/dom/ranges \
+    org/w3c/dom/stylesheets \
+    org/w3c/dom/traversal \
+    org/w3c/dom/views \
+    org/w3c/dom/xpath \
+    org/xml/sax \
+    org/xml/sax/ext \
+    org/xml/sax/helpers \
+    sun/net/httpserver \
+    sun/rmi/log \
+    sun/rmi/registry \
+    sun/rmi/runtime \
+    sun/rmi/server \
+    sun/rmi/transport \
+    sun/rmi/transport/proxy \
+    sun/rmi/transport/tcp \
+    sun/util/xml
+
+PROFILE_2_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_2_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_2_INCLUDE_METAINF_SERVICES := \
+    META-INF/services/sun.util.spi.XmlPropertiesProvider
+
+
+PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
+    com/sun/jmx/defaults \
+    com/sun/jmx/interceptor \
+    com/sun/jmx/mbeanserver \
+    com/sun/jmx/remote/internal \
+    com/sun/jmx/remote/protocol/rmi \
+    com/sun/jmx/remote/security \
+    com/sun/jmx/remote/util \
+    com/sun/jmx/snmp \
+    com/sun/jmx/snmp/IPAcl \
+    com/sun/jmx/snmp/agent \
+    com/sun/jmx/snmp/daemon \
+    com/sun/jmx/snmp/defaults \
+    com/sun/jmx/snmp/internal \
+    com/sun/jmx/snmp/mpm \
+    com/sun/jmx/snmp/tasks \
+    com/sun/jmx/trace \
+    com/sun/jndi/dns \
+    com/sun/jndi/ldap \
+    com/sun/jndi/ldap/ext \
+    com/sun/jndi/ldap/pool \
+    com/sun/jndi/ldap/sasl \
+    com/sun/jndi/rmi/registry \
+    com/sun/jndi/toolkit/ctx \
+    com/sun/jndi/toolkit/dir \
+    com/sun/jndi/toolkit/url \
+    com/sun/jndi/url/dns \
+    com/sun/jndi/url/ldap \
+    com/sun/jndi/url/ldaps \
+    com/sun/jndi/url/rmi \
+    com/sun/management \
+    com/sun/management/jmx \
+    com/sun/naming/internal \
+    com/sun/nio/sctp \
+    com/sun/org/apache/xml/internal/security \
+    com/sun/org/apache/xml/internal/security/algorithms \
+    com/sun/org/apache/xml/internal/security/algorithms/implementations \
+    com/sun/org/apache/xml/internal/security/c14n \
+    com/sun/org/apache/xml/internal/security/c14n/helper \
+    com/sun/org/apache/xml/internal/security/c14n/implementations \
+    com/sun/org/apache/xml/internal/security/encryption \
+    com/sun/org/apache/xml/internal/security/exceptions \
+    com/sun/org/apache/xml/internal/security/keys \
+    com/sun/org/apache/xml/internal/security/keys/content \
+    com/sun/org/apache/xml/internal/security/keys/content/keyvalues \
+    com/sun/org/apache/xml/internal/security/keys/content/x509 \
+    com/sun/org/apache/xml/internal/security/keys/keyresolver \
+    com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations \
+    com/sun/org/apache/xml/internal/security/keys/storage \
+    com/sun/org/apache/xml/internal/security/keys/storage/implementations \
+    com/sun/org/apache/xml/internal/security/signature \
+    com/sun/org/apache/xml/internal/security/transforms \
+    com/sun/org/apache/xml/internal/security/transforms/implementations \
+    com/sun/org/apache/xml/internal/security/transforms/params \
+    com/sun/org/apache/xml/internal/security/utils \
+    com/sun/org/apache/xml/internal/security/utils/resolver \
+    com/sun/org/apache/xml/internal/security/utils/resolver/implementations \
+    com/sun/rowset \
+    com/sun/rowset/internal \
+    com/sun/rowset/providers \
+    com/sun/script/javascript \
+    com/sun/script/util \
+    com/sun/security/auth/callback \
+    com/sun/security/auth/login \
+    com/sun/security/auth/module \
+    com/sun/security/jgss \
+    com/sun/security/ntlm \
+    com/sun/security/sasl \
+    com/sun/security/sasl/digest \
+    com/sun/security/sasl/gsskerb \
+    com/sun/security/sasl/ntlm \
+    com/sun/security/sasl/util \
+    com/sun/tracing \
+    com/sun/tracing/dtrace \
+    java/lang/instrument \
+    java/lang/management \
+    java/security/acl \
+    java/util/prefs \
+    javax/annotation/processing \
+    javax/lang/model \
+    javax/lang/model/element \
+    javax/lang/model/type \
+    javax/lang/model/util \
+    javax/management \
+    javax/management/loading \
+    javax/management/modelmbean \
+    javax/management/monitor \
+    javax/management/openmbean \
+    javax/management/relation \
+    javax/management/remote \
+    javax/management/remote/rmi \
+    javax/management/timer \
+    javax/naming \
+    javax/naming/directory \
+    javax/naming/event \
+    javax/naming/ldap \
+    javax/naming/spi \
+    javax/script \
+    javax/security/auth/kerberos \
+    javax/security/sasl \
+    javax/smartcardio \
+    javax/sql/rowset \
+    javax/sql/rowset/serial \
+    javax/sql/rowset/spi \
+    javax/tools \
+    javax/tools/annotation \
+    javax/xml/crypto \
+    javax/xml/crypto/dom \
+    javax/xml/crypto/dsig \
+    javax/xml/crypto/dsig/dom \
+    javax/xml/crypto/dsig/keyinfo \
+    javax/xml/crypto/dsig/spec \
+    org/ietf/jgss \
+    org/jcp/xml/dsig/internal \
+    org/jcp/xml/dsig/internal/dom \
+    sun/instrument \
+    sun/management \
+    sun/management/counter \
+    sun/management/counter/perf \
+    sun/management/jmxremote \
+    sun/management/resources \
+    sun/management/snmp \
+    sun/management/snmp/jvminstr \
+    sun/management/snmp/jvmmib \
+    sun/management/snmp/util \
+    sun/net/dns \
+    sun/net/www/protocol/http/ntlm \
+    sun/net/www/protocol/http/spnego \
+    sun/nio/ch/sctp \
+    sun/org/mozilla/classfile/internal \
+    sun/org/mozilla/javascript/internal \
+    sun/org/mozilla/javascript/internal/annotations \
+    sun/org/mozilla/javascript/internal/ast \
+    sun/org/mozilla/javascript/internal/debug \
+    sun/org/mozilla/javascript/internal/jdk13 \
+    sun/org/mozilla/javascript/internal/jdk15 \
+    sun/org/mozilla/javascript/internal/json \
+    sun/org/mozilla/javascript/internal/optimizer \
+    sun/org/mozilla/javascript/internal/regexp \
+    sun/org/mozilla/javascript/internal/serialize \
+    sun/org/mozilla/javascript/internal/xml \
+    sun/org/mozilla/javascript/internal/xmlimpl \
+    sun/security/acl \
+    sun/security/jgss \
+    sun/security/jgss/krb5 \
+    sun/security/jgss/spi \
+    sun/security/jgss/spnego \
+    sun/security/jgss/wrapper \
+    sun/security/krb5 \
+    sun/security/krb5/internal \
+    sun/security/krb5/internal/ccache \
+    sun/security/krb5/internal/crypto \
+    sun/security/krb5/internal/crypto/dk \
+    sun/security/krb5/internal/ktab \
+    sun/security/krb5/internal/rcache \
+    sun/security/krb5/internal/util \
+    sun/security/provider/certpath/ldap \
+    sun/security/smartcardio \
+    sun/tracing \
+    sun/tracing/dtrace
+
+PROFILE_3_RTJAR_INCLUDE_TYPES := \
+    com/sun/security/auth/*.class
+
+PROFILE_3_RTJAR_EXCLUDE_TYPES := \
+    javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
+    javax/management/remote/rmi/_RMIConnection_Stub.class \
+    javax/management/remote/rmi/_RMIServerImpl_Tie.class \
+    javax/management/remote/rmi/_RMIServer_Stub.class \
+    com/sun/security/auth/callback/DialogCallbackHandler.class \
+    com/sun/security/auth/callback/DialogCallbackHandler\$$$$1.class \
+    com/sun/security/auth/callback/DialogCallbackHandler\$$$$2.class \
+    com/sun/security/auth/callback/DialogCallbackHandler\$$$$Action.class \
+    com/sun/security/auth/callback/DialogCallbackHandler\$$$$ConfirmationInfo.class
+
+PROFILE_3_INCLUDE_METAINF_SERVICES := \
+    META-INF/services/javax.script.ScriptEngineFactory 
+
+
+PROFILE_4_RTJAR_INCLUDE_PACKAGES := \
+    com/oracle/net \
+    com/oracle/nio \
+    com/oracle/util \
+    com/sun/accessibility/internal/resources \
+    com/sun/activation/registries \
+    com/sun/awt \
+    com/sun/beans \
+    com/sun/beans/decoder \
+    com/sun/beans/finder \
+    com/sun/corba/se/impl/activation \
+    com/sun/corba/se/impl/copyobject \
+    com/sun/corba/se/impl/corba \
+    com/sun/corba/se/impl/dynamicany \
+    com/sun/corba/se/impl/encoding \
+    com/sun/corba/se/impl/interceptors \
+    com/sun/corba/se/impl/io \
+    com/sun/corba/se/impl/ior \
+    com/sun/corba/se/impl/ior/iiop \
+    com/sun/corba/se/impl/javax/rmi \
+    com/sun/corba/se/impl/javax/rmi/CORBA \
+    com/sun/corba/se/impl/legacy/connection \
+    com/sun/corba/se/impl/logging \
+    com/sun/corba/se/impl/monitoring \
+    com/sun/corba/se/impl/naming/cosnaming \
+    com/sun/corba/se/impl/naming/namingutil \
+    com/sun/corba/se/impl/naming/pcosnaming \
+    com/sun/corba/se/impl/oa \
+    com/sun/corba/se/impl/oa/poa \
+    com/sun/corba/se/impl/oa/toa \
+    com/sun/corba/se/impl/orb \
+    com/sun/corba/se/impl/orbutil \
+    com/sun/corba/se/impl/orbutil/closure \
+    com/sun/corba/se/impl/orbutil/concurrent \
+    com/sun/corba/se/impl/orbutil/fsm \
+    com/sun/corba/se/impl/orbutil/graph \
+    com/sun/corba/se/impl/orbutil/threadpool \
+    com/sun/corba/se/impl/presentation/rmi \
+    com/sun/corba/se/impl/protocol \
+    com/sun/corba/se/impl/protocol/giopmsgheaders \
+    com/sun/corba/se/impl/resolver \
+    com/sun/corba/se/impl/transport \
+    com/sun/corba/se/impl/util \
+    com/sun/corba/se/internal/CosNaming \
+    com/sun/corba/se/internal/Interceptors \
+    com/sun/corba/se/internal/POA \
+    com/sun/corba/se/internal/corba \
+    com/sun/corba/se/internal/iiop \
+    com/sun/corba/se/org/omg/CORBA \
+    com/sun/corba/se/pept/broker \
+    com/sun/corba/se/pept/encoding \
+    com/sun/corba/se/pept/protocol \
+    com/sun/corba/se/pept/transport \
+    com/sun/corba/se/spi/activation \
+    com/sun/corba/se/spi/activation/InitialNameServicePackage \
+    com/sun/corba/se/spi/activation/LocatorPackage \
+    com/sun/corba/se/spi/activation/RepositoryPackage \
+    com/sun/corba/se/spi/copyobject \
+    com/sun/corba/se/spi/encoding \
+    com/sun/corba/se/spi/extension \
+    com/sun/corba/se/spi/ior \
+    com/sun/corba/se/spi/ior/iiop \
+    com/sun/corba/se/spi/legacy/connection \
+    com/sun/corba/se/spi/legacy/interceptor \
+    com/sun/corba/se/spi/logging \
+    com/sun/corba/se/spi/monitoring \
+    com/sun/corba/se/spi/oa \
+    com/sun/corba/se/spi/orb \
+    com/sun/corba/se/spi/orbutil/closure \
+    com/sun/corba/se/spi/orbutil/fsm \
+    com/sun/corba/se/spi/orbutil/proxy \
+    com/sun/corba/se/spi/orbutil/threadpool \
+    com/sun/corba/se/spi/presentation/rmi \
+    com/sun/corba/se/spi/protocol \
+    com/sun/corba/se/spi/resolver \
+    com/sun/corba/se/spi/servicecontext \
+    com/sun/corba/se/spi/transport \
+    com/sun/image/codec/jpeg \
+    com/sun/imageio/plugins/bmp \
+    com/sun/imageio/plugins/common \
+    com/sun/imageio/plugins/gif \
+    com/sun/imageio/plugins/jpeg \
+    com/sun/imageio/plugins/png \
+    com/sun/imageio/plugins/wbmp \
+    com/sun/imageio/spi \
+    com/sun/imageio/stream \
+    com/sun/istack/internal \
+    com/sun/istack/internal/localization \
+    com/sun/istack/internal/logging \
+    com/sun/java/browser/dom \
+    com/sun/java/browser/net \
+    com/sun/java/swing \
+    com/sun/java/swing/plaf/gtk \
+    com/sun/java/swing/plaf/gtk/resources \
+    com/sun/java/swing/plaf/motif \
+    com/sun/java/swing/plaf/motif/resources \
+    com/sun/java/swing/plaf/nimbus \
+    com/sun/java/swing/plaf/windows \
+    com/sun/java/swing/plaf/windows/resources \
+    com/sun/jmx/remote/protocol/iiop \
+    com/sun/jndi/cosnaming \
+    com/sun/jndi/toolkit/corba \
+    com/sun/jndi/url/corbaname \
+    com/sun/jndi/url/iiop \
+    com/sun/jndi/url/iiopname \
+    com/sun/media/sound \
+    com/sun/org/glassfish/external/amx \
+    com/sun/org/glassfish/external/arc \
+    com/sun/org/glassfish/external/probe/provider \
+    com/sun/org/glassfish/external/probe/provider/annotations \
+    com/sun/org/glassfish/external/statistics \
+    com/sun/org/glassfish/external/statistics/annotations \
+    com/sun/org/glassfish/external/statistics/impl \
+    com/sun/org/glassfish/gmbal \
+    com/sun/org/glassfish/gmbal/util \
+    com/sun/org/omg/CORBA \
+    com/sun/org/omg/CORBA/ValueDefPackage \
+    com/sun/org/omg/CORBA/portable \
+    com/sun/org/omg/SendingContext \
+    com/sun/org/omg/SendingContext/CodeBasePackage \
+    com/sun/servicetag \
+    com/sun/swing/internal/plaf/basic/resources \
+    com/sun/swing/internal/plaf/metal/resources \
+    com/sun/swing/internal/plaf/synth/resources \
+    com/sun/xml/internal/bind \
+    com/sun/xml/internal/bind/annotation \
+    com/sun/xml/internal/bind/api \
+    com/sun/xml/internal/bind/api/impl \
+    com/sun/xml/internal/bind/marshaller \
+    com/sun/xml/internal/bind/unmarshaller \
+    com/sun/xml/internal/bind/util \
+    com/sun/xml/internal/bind/v2 \
+    com/sun/xml/internal/bind/v2/bytecode \
+    com/sun/xml/internal/bind/v2/model/annotation \
+    com/sun/xml/internal/bind/v2/model/core \
+    com/sun/xml/internal/bind/v2/model/impl \
+    com/sun/xml/internal/bind/v2/model/nav \
+    com/sun/xml/internal/bind/v2/model/runtime \
+    com/sun/xml/internal/bind/v2/runtime \
+    com/sun/xml/internal/bind/v2/runtime/output \
+    com/sun/xml/internal/bind/v2/runtime/property \
+    com/sun/xml/internal/bind/v2/runtime/reflect \
+    com/sun/xml/internal/bind/v2/runtime/reflect/opt \
+    com/sun/xml/internal/bind/v2/runtime/unmarshaller \
+    com/sun/xml/internal/bind/v2/schemagen \
+    com/sun/xml/internal/bind/v2/schemagen/episode \
+    com/sun/xml/internal/bind/v2/schemagen/xmlschema \
+    com/sun/xml/internal/bind/v2/util \
+    com/sun/xml/internal/fastinfoset \
+    com/sun/xml/internal/fastinfoset/algorithm \
+    com/sun/xml/internal/fastinfoset/alphabet \
+    com/sun/xml/internal/fastinfoset/dom \
+    com/sun/xml/internal/fastinfoset/org/apache/xerces/util \
+    com/sun/xml/internal/fastinfoset/sax \
+    com/sun/xml/internal/fastinfoset/stax \
+    com/sun/xml/internal/fastinfoset/stax/events \
+    com/sun/xml/internal/fastinfoset/stax/factory \
+    com/sun/xml/internal/fastinfoset/stax/util \
+    com/sun/xml/internal/fastinfoset/tools \
+    com/sun/xml/internal/fastinfoset/util \
+    com/sun/xml/internal/fastinfoset/vocab \
+    com/sun/xml/internal/messaging/saaj \
+    com/sun/xml/internal/messaging/saaj/client/p2p \
+    com/sun/xml/internal/messaging/saaj/packaging/mime \
+    com/sun/xml/internal/messaging/saaj/packaging/mime/internet \
+    com/sun/xml/internal/messaging/saaj/packaging/mime/util \
+    com/sun/xml/internal/messaging/saaj/soap \
+    com/sun/xml/internal/messaging/saaj/soap/dynamic \
+    com/sun/xml/internal/messaging/saaj/soap/impl \
+    com/sun/xml/internal/messaging/saaj/soap/name \
+    com/sun/xml/internal/messaging/saaj/soap/ver1_1 \
+    com/sun/xml/internal/messaging/saaj/soap/ver1_2 \
+    com/sun/xml/internal/messaging/saaj/util \
+    com/sun/xml/internal/messaging/saaj/util/transform \
+    com/sun/xml/internal/org/jvnet/fastinfoset \
+    com/sun/xml/internal/org/jvnet/fastinfoset/sax \
+    com/sun/xml/internal/org/jvnet/fastinfoset/sax/helpers \
+    com/sun/xml/internal/org/jvnet/fastinfoset/stax \
+    com/sun/xml/internal/org/jvnet/mimepull \
+    com/sun/xml/internal/org/jvnet/staxex \
+    com/sun/xml/internal/org/jvnet/ws \
+    com/sun/xml/internal/org/jvnet/ws/databinding \
+    com/sun/xml/internal/org/jvnet/ws/message \
+    com/sun/xml/internal/stream/buffer \
+    com/sun/xml/internal/stream/buffer/sax \
+    com/sun/xml/internal/stream/buffer/stax \
+    com/sun/xml/internal/txw2 \
+    com/sun/xml/internal/txw2/annotation \
+    com/sun/xml/internal/txw2/output \
+    com/sun/xml/internal/ws/addressing \
+    com/sun/xml/internal/ws/addressing/model \
+    com/sun/xml/internal/ws/addressing/policy \
+    com/sun/xml/internal/ws/addressing/v200408 \
+    com/sun/xml/internal/ws/api \
+    com/sun/xml/internal/ws/api/addressing \
+    com/sun/xml/internal/ws/api/client \
+    com/sun/xml/internal/ws/api/config/management \
+    com/sun/xml/internal/ws/api/config/management/policy \
+    com/sun/xml/internal/ws/api/databinding \
+    com/sun/xml/internal/ws/api/fastinfoset \
+    com/sun/xml/internal/ws/api/ha \
+    com/sun/xml/internal/ws/api/handler \
+    com/sun/xml/internal/ws/api/message \
+    com/sun/xml/internal/ws/api/message/saaj \
+    com/sun/xml/internal/ws/api/message/stream \
+    com/sun/xml/internal/ws/api/model \
+    com/sun/xml/internal/ws/api/model/soap \
+    com/sun/xml/internal/ws/api/model/wsdl \
+    com/sun/xml/internal/ws/api/pipe \
+    com/sun/xml/internal/ws/api/pipe/helper \
+    com/sun/xml/internal/ws/api/policy \
+    com/sun/xml/internal/ws/api/policy/subject \
+    com/sun/xml/internal/ws/api/server \
+    com/sun/xml/internal/ws/api/streaming \
+    com/sun/xml/internal/ws/api/wsdl/parser \
+    com/sun/xml/internal/ws/api/wsdl/writer \
+    com/sun/xml/internal/ws/binding \
+    com/sun/xml/internal/ws/client \
+    com/sun/xml/internal/ws/client/dispatch \
+    com/sun/xml/internal/ws/client/sei \
+    com/sun/xml/internal/ws/config/management/policy \
+    com/sun/xml/internal/ws/db \
+    com/sun/xml/internal/ws/db/glassfish \
+    com/sun/xml/internal/ws/developer \
+    com/sun/xml/internal/ws/encoding \
+    com/sun/xml/internal/ws/encoding/fastinfoset \
+    com/sun/xml/internal/ws/encoding/policy \
+    com/sun/xml/internal/ws/encoding/soap \
+    com/sun/xml/internal/ws/encoding/soap/streaming \
+    com/sun/xml/internal/ws/encoding/xml \
+    com/sun/xml/internal/ws/fault \
+    com/sun/xml/internal/ws/handler \
+    com/sun/xml/internal/ws/message \
+    com/sun/xml/internal/ws/message/jaxb \
+    com/sun/xml/internal/ws/message/saaj \
+    com/sun/xml/internal/ws/message/source \
+    com/sun/xml/internal/ws/message/stream \
+    com/sun/xml/internal/ws/model \
+    com/sun/xml/internal/ws/model/soap \
+    com/sun/xml/internal/ws/model/wsdl \
+    com/sun/xml/internal/ws/org/objectweb/asm \
+    com/sun/xml/internal/ws/policy \
+    com/sun/xml/internal/ws/policy/jaxws \
+    com/sun/xml/internal/ws/policy/jaxws/spi \
+    com/sun/xml/internal/ws/policy/privateutil \
+    com/sun/xml/internal/ws/policy/sourcemodel \
+    com/sun/xml/internal/ws/policy/sourcemodel/attach \
+    com/sun/xml/internal/ws/policy/sourcemodel/wspolicy \
+    com/sun/xml/internal/ws/policy/spi \
+    com/sun/xml/internal/ws/policy/subject \
+    com/sun/xml/internal/ws/protocol/soap \
+    com/sun/xml/internal/ws/protocol/xml \
+    com/sun/xml/internal/ws/resources \
+    com/sun/xml/internal/ws/server \
+    com/sun/xml/internal/ws/server/provider \
+    com/sun/xml/internal/ws/server/sei \
+    com/sun/xml/internal/ws/spi \
+    com/sun/xml/internal/ws/spi/db \
+    com/sun/xml/internal/ws/streaming \
+    com/sun/xml/internal/ws/transport \
+    com/sun/xml/internal/ws/transport/http \
+    com/sun/xml/internal/ws/transport/http/client \
+    com/sun/xml/internal/ws/transport/http/server \
+    com/sun/xml/internal/ws/util \
+    com/sun/xml/internal/ws/util/exception \
+    com/sun/xml/internal/ws/util/localization \
+    com/sun/xml/internal/ws/util/pipe \
+    com/sun/xml/internal/ws/util/xml \
+    com/sun/xml/internal/ws/wsdl \
+    com/sun/xml/internal/ws/wsdl/parser \
+    com/sun/xml/internal/ws/wsdl/writer \
+    com/sun/xml/internal/ws/wsdl/writer/document \
+    com/sun/xml/internal/ws/wsdl/writer/document/http \
+    com/sun/xml/internal/ws/wsdl/writer/document/soap \
+    com/sun/xml/internal/ws/wsdl/writer/document/soap12 \
+    com/sun/xml/internal/ws/wsdl/writer/document/xsd \
+    java/applet \
+    java/awt \
+    java/awt/color \
+    java/awt/datatransfer \
+    java/awt/dnd \
+    java/awt/dnd/peer \
+    java/awt/event \
+    java/awt/font \
+    java/awt/geom \
+    java/awt/im \
+    java/awt/im/spi \
+    java/awt/image \
+    java/awt/image/renderable \
+    java/awt/peer \
+    java/awt/print \
+    java/beans \
+    javax/accessibility \
+    javax/activation \
+    javax/activity \
+    javax/imageio \
+    javax/imageio/event \
+    javax/imageio/metadata \
+    javax/imageio/plugins/bmp \
+    javax/imageio/plugins/jpeg \
+    javax/imageio/spi \
+    javax/imageio/stream \
+    javax/jws \
+    javax/jws/soap \
+    javax/print \
+    javax/print/attribute \
+    javax/print/attribute/standard \
+    javax/print/event \
+    javax/rmi/CORBA \
+    javax/sound/midi \
+    javax/sound/midi/spi \
+    javax/sound/sampled \
+    javax/sound/sampled/spi \
+    javax/swing \
+    javax/swing/border \
+    javax/swing/colorchooser \
+    javax/swing/event \
+    javax/swing/filechooser \
+    javax/swing/plaf \
+    javax/swing/plaf/basic \
+    javax/swing/plaf/metal \
+    javax/swing/plaf/multi \
+    javax/swing/plaf/nimbus \
+    javax/swing/plaf/synth \
+    javax/swing/table \
+    javax/swing/text \
+    javax/swing/text/html \
+    javax/swing/text/html/parser \
+    javax/swing/text/rtf \
+    javax/swing/tree \
+    javax/swing/undo \
+    javax/xml/bind \
+    javax/xml/bind/annotation \
+    javax/xml/bind/annotation/adapters \
+    javax/xml/bind/attachment \
+    javax/xml/bind/helpers \
+    javax/xml/bind/util \
+    javax/xml/soap \
+    javax/xml/ws \
+    javax/xml/ws/handler \
+    javax/xml/ws/handler/soap \
+    javax/xml/ws/http \
+    javax/xml/ws/soap \
+    javax/xml/ws/spi \
+    javax/xml/ws/spi/http \
+    javax/xml/ws/wsaddressing \
+    org/omg/CORBA \
+    org/omg/CORBA/DynAnyPackage \
+    org/omg/CORBA/ORBPackage \
+    org/omg/CORBA/TypeCodePackage \
+    org/omg/CORBA/portable \
+    org/omg/CORBA_2_3 \
+    org/omg/CORBA_2_3/portable \
+    org/omg/CosNaming \
+    org/omg/CosNaming/NamingContextExtPackage \
+    org/omg/CosNaming/NamingContextPackage \
+    org/omg/Dynamic \
+    org/omg/DynamicAny \
+    org/omg/DynamicAny/DynAnyFactoryPackage \
+    org/omg/DynamicAny/DynAnyPackage \
+    org/omg/IOP \
+    org/omg/IOP/CodecFactoryPackage \
+    org/omg/IOP/CodecPackage \
+    org/omg/Messaging \
+    org/omg/PortableInterceptor \
+    org/omg/PortableInterceptor/ORBInitInfoPackage \
+    org/omg/PortableServer \
+    org/omg/PortableServer/CurrentPackage \
+    org/omg/PortableServer/POAManagerPackage \
+    org/omg/PortableServer/POAPackage \
+    org/omg/PortableServer/ServantLocatorPackage \
+    org/omg/PortableServer/portable \
+    org/omg/SendingContext \
+    org/omg/stub/java/rmi \
+    org/omg/stub/javax/management/remote/rmi \
+    sun/applet \
+    sun/applet/resources \
+    sun/audio \
+    sun/awt \
+    sun/awt/X11 \
+    sun/awt/datatransfer \
+    sun/awt/dnd \
+    sun/awt/event \
+    sun/awt/geom \
+    sun/awt/im \
+    sun/awt/image \
+    sun/awt/image/codec \
+    sun/awt/motif \
+    sun/awt/resources \
+    sun/awt/shell \
+    sun/awt/util \
+    sun/awt/windows \
+    sun/beans/editors \
+    sun/beans/infos \
+    sun/corba \
+    sun/dc \
+    sun/dc/path \
+    sun/dc/pr \
+    sun/font \
+    sun/java2d \
+    sun/java2d/cmm \
+    sun/java2d/cmm/kcms \
+    sun/java2d/cmm/lcms \
+    sun/java2d/jules \
+    sun/java2d/loops \
+    sun/java2d/opengl \
+    sun/java2d/pipe \
+    sun/java2d/pipe/hw \
+    sun/java2d/pisces \
+    sun/java2d/x11 \
+    sun/java2d/xr \
+    sun/net/ftp \
+    sun/net/ftp/impl \
+    sun/net/smtp \
+    sun/net/www/content/audio \
+    sun/net/www/content/image \
+    sun/net/www/content/text \
+    sun/net/www/protocol/ftp \
+    sun/net/www/protocol/mailto \
+    sun/net/www/protocol/netdoc \
+    sun/print \
+    sun/print/resources \
+    sun/security/tools/policytool \
+    sun/swing \
+    sun/swing/icon \
+    sun/swing/plaf \
+    sun/swing/plaf/synth \
+    sun/swing/plaf/windows \
+    sun/swing/table \
+    sun/swing/text \
+    sun/swing/text/html \
+    sun/tools/jar \
+    sun/tools/jar/resources
+
+PROFILE_4_RTJAR_INCLUDE_TYPES := \
+    com/sun/xml/internal/ws/*.class \
+    javax/annotation/*.class \
+    javax/rmi/*.class
+
+PROFILE_4_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_4_INCLUDE_METAINF_SERVICES := \
+    META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin  \
+    META-INF/services/com.sun.tools.internal.xjc.Plugin  \
+    META-INF/services/javax.print.PrintServiceLookup  \
+    META-INF/services/javax.print.StreamPrintServiceFactory  \
+    META-INF/services/javax.sound.midi.spi.MidiDeviceProvider  \
+    META-INF/services/javax.sound.midi.spi.MidiFileReader  \
+    META-INF/services/javax.sound.midi.spi.MidiFileWriter  \
+    META-INF/services/javax.sound.midi.spi.SoundbankReader  \
+    META-INF/services/javax.sound.sampled.spi.AudioFileReader  \
+    META-INF/services/javax.sound.sampled.spi.AudioFileWriter  \
+    META-INF/services/javax.sound.sampled.spi.FormatConversionProvider  \
+    META-INF/services/javax.sound.sampled.spi.MixerProvider  \
+    META-INF/services/sun.java2d.cmm.PCMM  \
+    META-INF/services/sun.java2d.pipe.RenderingEngine 
+
+
--- a/jdk/src/share/classes/java/net/URLClassLoader.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/java/net/URLClassLoader.java	Thu Feb 21 17:43:57 2013 -0800
@@ -57,6 +57,12 @@
  * <p>
  * The classes that are loaded are by default granted permission only to
  * access the URLs specified when the URLClassLoader was created.
+ * <p>
+ * Where a JAR file contains the {@link Name#PROFILE Profile} attribute
+ * then its value is the name of the Java SE profile that the library
+ * minimally requires. If this runtime does not support the profile then
+ * it causes {@link java.util.jar.UnsupportedProfileException} to be
+ * thrown at some unspecified time.
  *
  * @author  David Connelly
  * @since   1.2
--- a/jdk/src/share/classes/java/util/jar/Attributes.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/java/util/jar/Attributes.java	Thu Feb 21 17:43:57 2013 -0800
@@ -565,6 +565,15 @@
         public static final Name MAIN_CLASS = new Name("Main-Class");
 
         /**
+         * {@code Name} object for {@code Profile} manifest attribute used by
+         * applications or libraries packaged as JAR files to indicate the
+         * minimum profile required to execute the application.
+         * @since 1.8
+         * @see UnsupportedProfileException
+         */
+        public static final Name PROFILE = new Name("Profile");
+
+        /**
          * <code>Name</code> object for <code>Sealed</code> manifest attribute
          * used for sealing.
          * @see <a href="../../../../technotes/guides/extensions/spec.html#sealing">
--- a/jdk/src/share/classes/java/util/jar/Pack200.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Thu Feb 21 17:43:57 2013 -0800
@@ -574,6 +574,13 @@
          * Registers a listener for PropertyChange events on the properties map.
          * This is typically used by applications to update a progress bar.
          *
+         * <p> The default implementation of this method does nothing and has
+         * no side-effects.</p>
+         *
+         * <p><b>WARNING:</b> This method is omitted from the interface
+         * declaration in all subset Profiles of Java SE that do not include
+         * the {@code java.beans} package. </p>
+
          * @see #properties
          * @see #PROGRESS
          * @param listener  An object to be invoked when a property is changed.
@@ -586,12 +593,20 @@
          *             property instead.
          */
         @Deprecated
-        void addPropertyChangeListener(PropertyChangeListener listener) ;
+        default void addPropertyChangeListener(PropertyChangeListener listener) {
+        }
 
         /**
          * Remove a listener for PropertyChange events, added by
          * the {@link #addPropertyChangeListener}.
          *
+         * <p> The default implementation of this method does nothing and has
+         * no side-effects.</p>
+         *
+         * <p><b>WARNING:</b> This method is omitted from the interface
+         * declaration in all subset Profiles of Java SE that do not include
+         * the {@code java.beans} package. </p>
+         *
          * @see #addPropertyChangeListener
          * @param listener  The PropertyChange listener to be removed.
          * @deprecated The dependency on {@code PropertyChangeListener} creates
@@ -600,8 +615,8 @@
          *             release.
          */
         @Deprecated
-        void removePropertyChangeListener(PropertyChangeListener listener);
-
+        default void removePropertyChangeListener(PropertyChangeListener listener) {
+        }
     }
 
     /**
@@ -718,6 +733,13 @@
          * Registers a listener for PropertyChange events on the properties map.
          * This is typically used by applications to update a progress bar.
          *
+         * <p> The default implementation of this method does nothing and has
+         * no side-effects.</p>
+         *
+         * <p><b>WARNING:</b> This method is omitted from the interface
+         * declaration in all subset Profiles of Java SE that do not include
+         * the {@code java.beans} package. </p>
+         *
          * @see #properties
          * @see #PROGRESS
          * @param listener  An object to be invoked when a property is changed.
@@ -730,12 +752,20 @@
          *             PROGRESS} property instead.
          */
         @Deprecated
-        void addPropertyChangeListener(PropertyChangeListener listener) ;
+        default void addPropertyChangeListener(PropertyChangeListener listener) {
+        }
 
         /**
          * Remove a listener for PropertyChange events, added by
          * the {@link #addPropertyChangeListener}.
          *
+         * <p> The default implementation of this method does nothing and has
+         * no side-effects.</p>
+         *
+         * <p><b>WARNING:</b> This method is omitted from the interface
+         * declaration in all subset Profiles of Java SE that do not include
+         * the {@code java.beans} package. </p>
+         *
          * @see #addPropertyChangeListener
          * @param listener  The PropertyChange listener to be removed.
          * @deprecated The dependency on {@code PropertyChangeListener} creates
@@ -744,7 +774,8 @@
          *             release.
          */
         @Deprecated
-        void removePropertyChangeListener(PropertyChangeListener listener);
+        default void removePropertyChangeListener(PropertyChangeListener listener) {
+        }
     }
 
     // Private stuff....
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/jar/UnsupportedProfileException.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.util.jar;
+
+/**
+ * Thrown to indicate an attempt to access a JAR file with a {@link
+ * Attributes.Name#PROFILE Profile} attribute that names a profile that
+ * is not supported by this runtime.
+ *
+ * @since   1.8
+ */
+public class UnsupportedProfileException extends RuntimeException {
+    private static final long serialVersionUID = -1834773870678792406L;
+
+    /**
+     * Constructs an {@code UnsupportedProfileException} with no detail
+     * message.
+     */
+    public UnsupportedProfileException() {
+    }
+
+    /**
+     * Constructs an {@code UnsupportedProfileException} with the
+     * specified detail message.
+     *
+     * @param message the detail message
+     */
+    public UnsupportedProfileException(String message) {
+        super(message);
+    }
+}
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Thu Feb 21 17:43:57 2013 -0800
@@ -302,6 +302,10 @@
      * the same event Listener results in multiple entries
      * in the property event listener table.
      *
+     * <p><b>WARNING:</b> This method is omitted from this class in all subset
+     * Profiles of Java SE that do not include the {@code java.beans} package.
+     * </p>
+     *
      * @param l  event listener
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have LoggingPermission("control").
@@ -335,6 +339,10 @@
      * <P>
      * Returns silently if the given listener is not found.
      *
+     * <p><b>WARNING:</b> This method is omitted from this class in all subset
+     * Profiles of Java SE that do not include the {@code java.beans} package.
+     * </p>
+     *
      * @param l  event listener (can be null)
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have LoggingPermission("control").
--- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Thu Feb 21 17:43:57 2013 -0800
@@ -65,10 +65,14 @@
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
+import sun.misc.Version;
+import sun.misc.URLClassPath;
 
 public enum LauncherHelper {
     INSTANCE;
     private static final String MAIN_CLASS = "Main-Class";
+    private static final String PROFILE    = "Profile";
+
     private static StringBuilder outBuf = new StringBuilder();
 
     private static final String INDENT = "    ";
@@ -409,6 +413,28 @@
             if (mainValue == null) {
                 abort(null, "java.launcher.jar.error3", jarname);
             }
+
+            /*
+             * If this is not a full JRE then the Profile attribute must be
+             * present with the Main-Class attribute so as to indicate the minimum
+             * profile required. Note that we need to suppress checking of the Profile
+             * attribute after we detect an error. This is because the abort may
+             * need to lookup resources and this may involve opening additional JAR
+             * files that would result in errors that suppress the main error.
+             */
+            String profile = mainAttrs.getValue(PROFILE);
+            if (profile == null) {
+                if (!Version.isFullJre()) {
+                    URLClassPath.suppressProfileCheckForLauncher();
+                    abort(null, "java.launcher.jar.error4", jarname);
+                }
+            } else {
+                if (!Version.supportsProfile(profile)) {
+                    URLClassPath.suppressProfileCheckForLauncher();
+                    abort(null, "java.launcher.jar.error5", profile, jarname);
+                }
+            }
+
             /*
              * Hand off to FXHelper if it detects a JavaFX application
              * This must be done after ensuring a Main-Class entry
@@ -418,6 +444,7 @@
                     new Attributes.Name(FXHelper.JAVAFX_APPLICATION_MARKER))) {
                 return FXHelper.class.getName();
             }
+
             return mainValue.trim();
         } catch (IOException ioe) {
             abort(ioe, "java.launcher.jar.error1", jarname);
--- a/jdk/src/share/classes/sun/launcher/resources/launcher.properties	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher.properties	Thu Feb 21 17:43:57 2013 -0800
@@ -139,6 +139,8 @@
     Error: An unexpected error occurred while trying to open file {0}
 java.launcher.jar.error2=manifest not found in {0}
 java.launcher.jar.error3=no main manifest attribute, in {0}
+java.launcher.jar.error4=no Profile manifest attribute in {0}
+java.launcher.jar.error5=Profile {0} required by {1} not supported by this runtime
 java.launcher.init.error=initialization error
 java.launcher.javafx.error1=\
     Error: The JavaFX launchApplication method has the wrong signature, it\n\
--- a/jdk/src/share/classes/sun/misc/URLClassPath.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/sun/misc/URLClassPath.java	Thu Feb 21 17:43:57 2013 -0800
@@ -35,6 +35,7 @@
 import java.util.jar.Manifest;
 import java.util.jar.Attributes;
 import java.util.jar.Attributes.Name;
+import java.util.jar.UnsupportedProfileException;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -64,6 +65,12 @@
     final static String JAVA_VERSION;
     private static final boolean DEBUG;
 
+    /**
+     * Used by launcher to indicate that checking of the JAR file "Profile"
+     * attribute has been suppressed.
+     */
+    private static boolean profileCheckSuppressedByLauncher;
+
     static {
         JAVA_VERSION = java.security.AccessController.doPrivileged(
             new sun.security.action.GetPropertyAction("java.version"));
@@ -582,6 +589,15 @@
         }
     }
 
+    /**
+     * Used by the launcher to suppress further checking of the JAR file Profile
+     * attribute (necessary when the launcher is aborting as the abort involves
+     * a resource lookup that may involve opening additional JAR files)
+     */
+    public static void suppressProfileCheckForLauncher() {
+        profileCheckSuppressedByLauncher = true;
+    }
+
     /*
      * Inner class used to represent a Loader of resources from a JAR URL.
      */
@@ -789,6 +805,28 @@
             return false;
         }
 
+        /**
+         * If the Profile attribute is present then this method checks that the runtime
+         * supports that profile.
+         *
+         * ## Add a fast path like Class-Path to avoid reading the manifest when the attribute
+         *    is not present.
+         */
+        void checkProfileAttribute() throws IOException {
+            Manifest man = jar.getManifest();
+            if (man != null) {
+                Attributes attr = man.getMainAttributes();
+                if (attr != null) {
+                    String value = attr.getValue(Name.PROFILE);
+                    if (value != null && !Version.supportsProfile(value)) {
+                        String prefix = Version.profileName().length() > 0 ?
+                            "This runtime implements " + Version.profileName() + ", " : "";
+                        throw new UnsupportedProfileException(prefix + csu + " requires " + value);
+                    }
+                }
+            }
+        }
+
         /*
          * Returns the URL for a resource with the specified name
          */
@@ -958,6 +996,12 @@
 
             ensureOpen();
             parseExtensionsDependencies();
+
+            // check Profile attribute if present
+            if (!profileCheckSuppressedByLauncher) {
+                checkProfileAttribute();
+            }
+
             if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only get manifest when necessary
                 Manifest man = jar.getManifest();
                 if (man != null) {
--- a/jdk/src/share/classes/sun/misc/Version.java.template	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/sun/misc/Version.java.template	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,11 @@
         "@@java_version@@";
 
     private static final String java_runtime_name =
-	"@@java_runtime_name@@";
- 
+        "@@java_runtime_name@@";
+
+    private static final String java_profile_name =
+        "@@java_profile_name@@";
+
     private static final String java_runtime_version =
         "@@java_runtime_version@@";
 
@@ -49,6 +52,8 @@
         System.setProperty("java.version", java_version);
         System.setProperty("java.runtime.version", java_runtime_version);
         System.setProperty("java.runtime.name", java_runtime_name);
+        if (java_profile_name.length() > 0)
+            System.setProperty("java.runtime.profile", java_profile_name);
     }
 
     private static boolean versionsInitialized = false;
@@ -90,23 +95,28 @@
         boolean isHeadless = false;
 
         /* Report that we're running headless if the property is true */
-	String headless = System.getProperty("java.awt.headless");
-	if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
+        String headless = System.getProperty("java.awt.headless");
+        if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
             isHeadless = true;
-	} 
+        }
 
         /* First line: platform version. */
         ps.println(launcher_name + " version \"" + java_version + "\"");
 
         /* Second line: runtime version (ie, libraries). */
 
-	ps.print(java_runtime_name + " (build " + java_runtime_version);
+        ps.print(java_runtime_name + " (build " + java_runtime_version);
 
-	if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
-	    // embedded builds report headless state
-	    ps.print(", headless");
-	}
-	ps.println(')');
+        if (java_profile_name.length() > 0) {
+            // profile name
+            ps.print(", profile " + java_profile_name);
+        }
+
+        if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
+            // embedded builds report headless state
+            ps.print(", headless");
+        }
+        ps.println(')');
 
         /* Third line: JVM information. */
         String java_vm_name    = System.getProperty("java.vm.name");
@@ -332,6 +342,67 @@
     private static native boolean getJvmVersionInfo();
     private static native void getJdkVersionInfo();
 
+    // Possible runtime profiles, ordered from small to large
+    private final static String[] PROFILES = { "compact1", "compact2", "compact3" };
+
+    /**
+     * Returns the name of the profile that this runtime implements. The empty
+     * string is returned for the full Java Runtime.
+     */
+    public static String profileName() {
+        return java_profile_name;
+    }
+
+    /**
+     * Indicates if this runtime implements the full Java Runtime.
+     */
+    public static boolean isFullJre() {
+        return java_profile_name.length() == 0;
+    }
+
+    // cached index of this profile's name in PROFILES (1-based)
+    private static int thisRuntimeIndex;
+
+    /**
+     * Indicates if this runtime supports the given profile. Profile names are
+     * case sensitive. 
+     *
+     * @return {@code true} if the given profile is supported
+     */
+    public static boolean supportsProfile(String requiredProfile) {
+        int x = thisRuntimeIndex - 1;
+        if (x < 0) {
+            String profile = profileName();
+            if (profile.length() > 0) {
+                x = 0;
+                while (x < PROFILES.length) {
+                    if (PROFILES[x].equals(profile))
+                        break;
+                    x++;
+                }
+                if (x >= PROFILES.length)
+                    throw new InternalError(profile + " not known to sun.misc.Version");
+
+                // okay if another thread has already set it
+                thisRuntimeIndex = x + 1;
+            }
+            // else we are a full JRE
+        }
+
+        int y = 0;
+        while (y < PROFILES.length) {
+            if (PROFILES[y].equals(requiredProfile))
+                break;
+            y++;
+        }
+        if (y >= PROFILES.length) {
+            // profile not found so caller has requested something that is not defined
+            return false;
+        }
+
+        return x < 0 || x >= y;
+    }
+
 }
 
 // Help Emacs a little because this file doesn't end in .java.
--- a/jdk/src/share/classes/sun/tools/jar/Main.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/Main.java	Thu Feb 21 17:43:57 2013 -0800
@@ -47,7 +47,7 @@
 class Main {
     String program;
     PrintStream out, err;
-    String fname, mname, ename;
+    String fname, mname, ename, pname;
     String zname = "";
     String[] files;
     String rootjar = null;
@@ -78,6 +78,9 @@
     static final String MANIFEST_DIR = "META-INF/";
     static final String VERSION = "1.0";
 
+    // valid values for Profile attribute
+    private static final String[] PROFILES = { "compact1", "compact2", "compact3" };
+
     private static ResourceBundle rsrc;
 
     /**
@@ -184,6 +187,14 @@
                     if (ename != null) {
                         addMainClass(manifest, ename);
                     }
+                    if (pname != null) {
+                        if (!addProfileName(manifest, pname)) {
+                            if (in != null) {
+                                in.close();
+                            }
+                            return false;
+                        }
+                    }
                 }
                 OutputStream out;
                 if (fname != null) {
@@ -230,7 +241,7 @@
                 if (manifest != null) {
                     manifest.close();
                 }
-                if (fname != null) {
+                if (ok && fname != null) {
                     // on Win32, we need this delete
                     inputFile.delete();
                     if (!tmpFile.renameTo(inputFile)) {
@@ -361,6 +372,9 @@
                 case 'e':
                      ename = args[count++];
                      break;
+                case 'p':
+                     pname = args[count++];
+                     break;
                 default:
                     error(formatMsg("error.illegal.option",
                                 String.valueOf(flags.charAt(i))));
@@ -410,7 +424,7 @@
             usageError();
             return false;
         } else if (uflag) {
-            if ((mname != null) || (ename != null)) {
+            if ((mname != null) || (ename != null) || (pname != null)) {
                 /* just want to update the manifest */
                 return true;
             } else {
@@ -544,7 +558,7 @@
                 || (Mflag && isManifestEntry)) {
                 continue;
             } else if (isManifestEntry && ((newManifest != null) ||
-                        (ename != null))) {
+                        (ename != null) || (pname != null))) {
                 foundManifest = true;
                 if (newManifest != null) {
                     // Don't read from the newManifest InputStream, as we
@@ -563,7 +577,9 @@
                 if (newManifest != null) {
                     old.read(newManifest);
                 }
-                updateManifest(old, zos);
+                if (!updateManifest(old, zos)) {
+                    return false;
+                }
             } else {
                 if (!entryMap.containsKey(name)) { // copy the old stuff
                     // do our own compression
@@ -596,10 +612,14 @@
                 Manifest m = new Manifest(newManifest);
                 updateOk = !isAmbiguousMainClass(m);
                 if (updateOk) {
-                    updateManifest(m, zos);
+                    if (!updateManifest(m, zos)) {
+                        updateOk = false;
+                    }
                 }
-            } else if (ename != null) {
-                updateManifest(new Manifest(), zos);
+            } else if (ename != null || pname != null) {
+                if (!updateManifest(new Manifest(), zos)) {
+                    updateOk = false;
+                }
             }
         }
         zis.close();
@@ -623,7 +643,7 @@
         zos.closeEntry();
     }
 
-    private void updateManifest(Manifest m, ZipOutputStream zos)
+    private boolean updateManifest(Manifest m, ZipOutputStream zos)
         throws IOException
     {
         addVersion(m);
@@ -631,6 +651,11 @@
         if (ename != null) {
             addMainClass(m, ename);
         }
+        if (pname != null) {
+            if (!addProfileName(m, pname)) {
+                return false;
+            }
+        }
         ZipEntry e = new ZipEntry(MANIFEST_NAME);
         e.setTime(System.currentTimeMillis());
         if (flag0) {
@@ -641,6 +666,7 @@
         if (vflag) {
             output(getMsg("out.update.manifest"));
         }
+        return true;
     }
 
 
@@ -687,6 +713,28 @@
         global.put(Attributes.Name.MAIN_CLASS, mainApp);
     }
 
+    private boolean addProfileName(Manifest m, String profile) {
+        // check profile name
+        boolean found = false;
+        int i = 0;
+        while (i < PROFILES.length) {
+            if (profile.equals(PROFILES[i])) {
+                found = true;
+                break;
+            }
+            i++;
+        }
+        if (!found) {
+            error(formatMsg("error.bad.pvalue", profile));
+            return false;
+        }
+
+        // overrides any existing Profile attribute
+        Attributes global = m.getMainAttributes();
+        global.put(Attributes.Name.PROFILE, profile);
+        return true;
+    }
+
     private boolean isAmbiguousMainClass(Manifest m) {
         if (ename != null) {
             Attributes global = m.getMainAttributes();
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar.properties	Thu Feb 21 15:46:37 2013 -0800
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar.properties	Thu Feb 21 17:43:57 2013 -0800
@@ -36,6 +36,8 @@
 error.bad.eflag=\
 	'e' flag and manifest with the 'Main-Class' attribute cannot be specified \n\
 	 together!
+error.bad.pvalue=\
+        bad value for 'Profile' attribute: {0}
 error.nosuch.fileordir=\
         {0} : no such file or directory
 error.write.file=\
@@ -77,6 +79,7 @@
 \ \   -m  include manifest information from specified manifest file\n\
 \ \   -e  specify application entry point for stand-alone application \n\
 \ \       bundled into an executable jar file\n\
+\ \   -p  specify profile name\n\
 \ \   -0  store only; use no ZIP compression\n\
 \ \   -M  do not create a manifest file for the entries\n\
 \ \   -i  generate index information for the specified jar files\n\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/SecurityManager/NoAWT.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,53 @@
+/*
+ * 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 8004502
+ * @summary Sanity check that SecurityManager methods that check AWTPermission
+ *   behave as expected when AWT is not present
+ */
+
+public class NoAWT {
+    public static void main(String[] args) {
+        SecurityManager sm = new SecurityManager();
+
+        try {
+            sm.checkAwtEventQueueAccess();
+            throw new RuntimeException("SecurityException expected");
+        } catch (SecurityException expected) { }
+
+        try {
+            sm.checkSystemClipboardAccess();
+            throw new RuntimeException("SecurityException expected");
+        } catch (SecurityException expected) { }
+
+        try {
+            sm.checkTopLevelWindow(null);
+            throw new RuntimeException("NullPointException expected");
+        } catch (NullPointerException expected) { }
+
+        if (sm.checkTopLevelWindow(new Object())) {
+            throw new RuntimeException("checkTopLevelWindow expected to return false");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/profiles/Basic.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.net.*;
+import java.io.File;
+import java.util.jar.*;
+
+/**
+ * Attempts to load classes or resources from a JAR file. The load should succeed
+ * if the runtime supports the profile indicated by the Profile attribute, fail
+ * with UnsupportedProfileException otherwise.
+ */
+
+public class Basic {
+
+    static int indexOf(String profile) {
+        if (profile == null || "compact1".equals(profile)) return 1;
+        if ("compact2".equals(profile)) return 2;
+        if ("compact3".equals(profile)) return 3;
+        if ("".equals(profile)) return 4;
+        return Integer.MAX_VALUE;  // unknown profile name
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (args.length < 2)
+            throw new RuntimeException("Usage: java <jarfile> <classname>");
+        String jar = args[0];
+        String cn = args[1];
+
+        File lib = new File(jar);
+        URL url = lib.toURI().toURL();
+        URL urls[] = { url };
+
+        // ## replace this if there is a standard way to determine the profile
+        String thisProfile = sun.misc.Version.profileName();
+
+        String jarProfile = null;
+        try (JarFile jf = new JarFile(lib)) {
+            Manifest manifest = jf.getManifest();
+            if (manifest != null) {
+                Attributes mainAttrs = manifest.getMainAttributes();
+                if (mainAttrs != null) {
+                    jarProfile = mainAttrs.getValue(Attributes.Name.PROFILE);
+                }
+            }
+        }
+
+        boolean shouldFail = indexOf(thisProfile) < indexOf(jarProfile);
+
+        try (URLClassLoader cl = new URLClassLoader(urls)) {
+            System.out.format("Loading %s from %s ...%n", cn, jar);
+            Class<?> c = Class.forName(cn, true, cl);
+            System.out.println(c);
+            if (shouldFail)
+                throw new RuntimeException("UnsupportedProfileException expected");
+        } catch (UnsupportedProfileException x) {
+            if (!shouldFail)
+                throw x;
+            System.out.println("UnsupportedProfileException thrown as expected");
+        }
+
+        try (URLClassLoader cl = new URLClassLoader(urls)) {
+            System.out.format("Loading resource from %s ...%n", jar);
+            URL r = cl.findResource("META-INF/MANIFEST.MF");
+            System.out.println(r);
+            if (shouldFail)
+                throw new RuntimeException("UnsupportedProfileException expected");
+        } catch (UnsupportedProfileException x) {
+            if (!shouldFail)
+                throw x;
+            System.out.println("UnsupportedProfileException thrown as expected");
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/profiles/Lib.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package lib;
+
+public class Lib {
+    private Lib() { }
+
+    public static void doSomething() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/profiles/basic.sh	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# @test
+# @bug 8003255
+# @compile -XDignore.symbol.file Basic.java Lib.java
+# @summary Test that UnsupportedProfileException thrown when attempting to
+#     load classes or resources from a JAR file with the Profile attribute
+# @run shell basic.sh
+
+if [ -z "$TESTJAVA" ]; then
+  if [ $# -lt 1 ]; then exit 1; fi
+  TESTJAVA=$1; shift
+  COMPILEJAVA=$TESTJAVA
+  TESTSRC=`pwd`
+  TESTCLASSES=`pwd`
+fi
+
+echo "Creating GoodLib.jar ..."
+echo "Profile: compact3" > good.mf
+$COMPILEJAVA/bin/jar cvfm GoodLib.jar good.mf -C $TESTCLASSES lib
+
+echo "Create BadLib.jar ..."
+echo "Profile: badname" > bad.mf
+$COMPILEJAVA/bin/jar cvfm BadLib.jar bad.mf -C $TESTCLASSES lib
+
+# remove classes so that they aren't on the classpath
+rm -rf $TESTCLASSES/lib
+
+echo "Test with GoodLib.jar ..."
+$TESTJAVA/bin/java -cp $TESTCLASSES Basic GoodLib.jar lib.Lib
+
+echo "Test with BadLib.jar ..."
+$TESTJAVA/bin/java -cp $TESTCLASSES Basic BadLib.jar lib.Lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/cert/CertStore/NoLDAP.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502
+ * @summary Sanity check that NoSuchAlgorithmException is thrown when requesting
+ *   a CertStore of type "LDAP" and LDAP is not available.
+ */
+
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertStore;
+import java.security.cert.LDAPCertStoreParameters;
+
+
+public class NoLDAP {
+    public static void main(String[] args) throws Exception {
+        try {
+            Class.forName("javax.naming.ldap.LdapName");
+            System.out.println("LDAP is present, test skipped");
+            return;
+        } catch (ClassNotFoundException ignore) { }
+
+        try {
+            CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
+            throw new RuntimeException("NoSuchAlgorithmException expected");
+        } catch (NoSuchAlgorithmException x) {
+            System.out.println("NoSuchAlgorithmException thrown as expected");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Reflect.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004931
+ * @summary Invoke getDeclaredMethods on LogManager to ensure that
+ *    all types referenced in the method signatures is present.
+ */
+
+import java.util.logging.LogManager;
+import java.lang.reflect.Method;
+
+public class Reflect {
+    static void printMethods(Class<?> c) {
+        System.out.println(c);
+        for (Method m: c.getDeclaredMethods()) {
+            System.out.println("    " + m);
+        }
+    }
+    public static void main(String[] args) {
+        printMethods(java.util.logging.LogManager.class);
+        printMethods(java.util.logging.LogManager.getLogManager().getClass());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/management/remote/mandatory/connection/NoIIOP.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,141 @@
+/*
+ * 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 8004502
+ * @summary Sanity check that attempts to use the IIOP transport or
+ *   RMIIIOPServerImpl when RMI/IIOP not present throws the expected exceptions
+ */
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.remote.*;
+import javax.management.remote.rmi.*;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import javax.security.auth.Subject;
+import java.rmi.NoSuchObjectException;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnectorServerFactory;
+
+public class NoIIOP {
+
+    /**
+     * RMIIIOPServerImpl implementation for testing purposes (methods are
+     * overridden to be public to allow for testing)
+     */
+    static class MyRMIIIOPServerImpl extends RMIIIOPServerImpl {
+        MyRMIIIOPServerImpl() throws IOException {
+            super(null);
+        }
+        @Override
+        public void export() throws IOException {
+            super.export();
+        }
+        @Override
+        public String getProtocol() {
+            return super.getProtocol();
+        }
+        @Override
+        public RMIConnection makeClient(String connectionId, Subject subject)
+            throws IOException
+        {
+            return super.makeClient(connectionId, subject);
+        }
+        @Override
+        public void closeClient(RMIConnection client) throws IOException {
+            super.closeClient(client);
+        }
+        @Override
+        public void closeServer() throws IOException {
+            super.closeServer();
+        }
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        try {
+            Class.forName("javax.management.remote.rmi._RMIConnectionImpl_Tie");
+            System.out.println("RMI/IIOP appears to be supported, test skipped");
+            return;
+        } catch (ClassNotFoundException okay) { }
+
+        JMXServiceURL url = new JMXServiceURL("service:jmx:iiop://");
+        MBeanServer mbs = MBeanServerFactory.createMBeanServer();
+
+
+        // test JMXConnectorFactory/JMXConnectorServerFactory
+
+        try {
+            JMXConnectorFactory.connect(url);
+            throw new RuntimeException("connect did not throw MalformedURLException");
+        } catch (MalformedURLException expected) { }
+
+        try {
+            JMXConnectorServerFactory.newJMXConnectorServer(url, null, null);
+            throw new RuntimeException("newJMXConnectorServer did not throw MalformedURLException");
+        } catch (MalformedURLException expected) { }
+
+
+        // test RMIConnector/RMIConnectorServer
+
+        RMIConnector connector = new RMIConnector(url, null);
+        try {
+            connector.connect();
+            throw new RuntimeException("connect did not throw IOException");
+        } catch (IOException expected) { }
+
+        RMIConnectorServer server = new RMIConnectorServer(url, null, mbs);
+        try {
+            server.start();
+            throw new RuntimeException("start did not throw IOException");
+        } catch (IOException expected) { }
+
+
+        // test RMIIIOPServerImpl
+
+        MyRMIIIOPServerImpl impl = new MyRMIIIOPServerImpl();
+        impl.setMBeanServer(mbs);
+        System.out.println(impl.getProtocol());
+
+        try {
+            impl.export();
+            throw new RuntimeException("export did not throw IOException");
+        } catch (IOException expected) { }
+
+        try {
+            impl.newClient(null);
+            throw new RuntimeException("newClient did not throw IOException");
+        } catch (IOException expected) { }
+
+        try {
+            impl.toStub();
+            throw new RuntimeException("toStub did not throw NoSuchObjectException");
+        } catch (NoSuchObjectException expected) { }
+
+        try {
+            impl.closeServer();
+            throw new RuntimeException("closeServer did not throw NoSuchObjectException");
+        } catch (NoSuchObjectException expected) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/naming/InitialContext/NoApplet.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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 8004502
+ * @summary Sanity check that specifying the APPLET property when creating an
+ *   InitialContext behaves as expected when java.awt.Applet is not present
+ */
+
+import javax.naming.*;
+import java.util.Hashtable;
+
+public class NoApplet {
+    public static void main(String[] args) throws NamingException {
+         Hashtable<Object,Object> env = new Hashtable<>();
+         env.put(Context.APPLET, new Object());
+         try {
+             Context ctxt = new InitialContext(env);
+             throw new RuntimeException("ClassCastException expected");
+         } catch (ClassCastException expected) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/protocol/http/NoNTLM.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,240 @@
+/*
+ * 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 8004502
+ * @summary Sanity check that NTLM will not be selected by the http protocol
+ *    handler when running on a profile that does not support NTLM
+ * @run main/othervm NoNTLM
+ */
+
+import java.net.*;
+import java.io.*;
+import sun.net.www.MessageHeader;
+
+public class NoNTLM {
+
+    static final String CRLF = "\r\n";
+
+    static final String OKAY =
+        "HTTP/1.1 200" + CRLF +
+        "Content-Length: 0" + CRLF +
+        "Connection: close" + CRLF +
+        CRLF;
+
+    static class Client implements Runnable {
+        private final URL url;
+        private volatile IOException ioe;
+        private volatile int respCode;
+
+        Client(int port) throws IOException {
+            this.url = new URL("http://127.0.0.1:" + port + "/foo.html");
+        }
+
+        public void run() {
+            try {
+                HttpURLConnection uc =
+                    (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
+                try {
+                    uc.getInputStream();
+                } catch (IOException x) {
+                    respCode = uc.getResponseCode();
+                    throw x;
+                }
+                uc.disconnect();
+            } catch (IOException x) {
+                if (respCode == 0)
+                    respCode = -1;
+                ioe = x;
+            }
+        }
+
+        IOException ioException() {
+            return ioe;
+        }
+
+        int respCode() {
+            return respCode;
+        }
+
+        static void start(int port) throws IOException {
+            Client client = new Client(port);
+            new Thread(client).start();
+        }
+    }
+
+    /**
+     * Return the http response with WWW-Authenticate headers for the given
+     * authentication schemes.
+     */
+    static String authReplyFor(String... schemes) {
+        // construct the server reply
+        String reply = "HTTP/1.1 401 Unauthorized" + CRLF +
+                       "Content-Length: 0"+ CRLF +
+                       "Connection: close" + CRLF;
+        for (String s: schemes) {
+            switch (s) {
+                case "Basic" :
+                    reply += "WWW-Authenticate: Basic realm=\"wallyworld\"" + CRLF;
+                    break;
+                case "Digest" :
+                    reply += "WWW-Authenticate: Digest" +
+                             " realm=\"wallyworld\"" +
+                             " domain=/" +
+                             " nonce=\"abcdefghijklmnopqrstuvwxyz\"" +
+                             " qop=\"auth\"" + CRLF;
+                    break;
+                case "NTLM" :
+                    reply += "WWW-Authenticate: NTLM" + CRLF;
+                    break;
+                default :
+                    throw new RuntimeException("Should not get here");
+            }
+        }
+        reply += CRLF;
+        return reply;
+    }
+
+    /**
+     * Test the http protocol handler with the given authentication schemes
+     * in the WWW-Authenticate header.
+     */
+    static void test(String... schemes) throws IOException {
+
+        // the authentication scheme that the client is expected to choose
+        String expected = null;
+        for (String s: schemes) {
+            if (expected == null) {
+                expected = s;
+            } else if (s.equals("Digest")) {
+                expected = s;
+            }
+        }
+
+        // server reply
+        String reply = authReplyFor(schemes);
+
+        System.out.println("====================================");
+        System.out.println("Expect client to choose: " + expected);
+        System.out.println(reply);
+
+        try (ServerSocket ss = new ServerSocket(0)) {
+            Client.start(ss.getLocalPort());
+
+            // client ---- GET ---> server
+            // client <--- 401 ---- server
+            try (Socket s = ss.accept()) {
+                new MessageHeader().parseHeader(s.getInputStream());
+                s.getOutputStream().write(reply.getBytes("US-ASCII"));
+            }
+
+            // client ---- GET ---> server
+            // client <--- 200 ---- server
+            String auth;
+            try (Socket s = ss.accept()) {
+                MessageHeader mh = new MessageHeader();
+                mh.parseHeader(s.getInputStream());
+                s.getOutputStream().write(OKAY.getBytes("US-ASCII"));
+                auth = mh.findValue("Authorization");
+            }
+
+            // check Authorization header
+            if (auth == null)
+                throw new RuntimeException("Authorization header not found");
+            System.out.println("Server received Authorization header: " + auth);
+            String[] values = auth.split(" ");
+            if (!values[0].equals(expected))
+                throw new RuntimeException("Unexpected value");
+        }
+    }
+
+    /**
+     * Test the http protocol handler with one WWW-Authenticate header with
+     * the value "NTLM".
+     */
+    static void testNTLM() throws Exception {
+        // server reply
+        String reply = authReplyFor("NTLM");
+
+        System.out.println("====================================");
+        System.out.println("Expect client to fail with 401 Unauthorized");
+        System.out.println(reply);
+
+        try (ServerSocket ss = new ServerSocket(0)) {
+            Client client = new Client(ss.getLocalPort());
+            Thread thr = new Thread(client);
+            thr.start();
+
+            // client ---- GET ---> server
+            // client <--- 401 ---- client
+            try (Socket s = ss.accept()) {
+                new MessageHeader().parseHeader(s.getInputStream());
+                s.getOutputStream().write(reply.getBytes("US-ASCII"));
+            }
+
+            // the client should fail with 401
+            System.out.println("Waiting for client to terminate");
+            thr.join();
+            IOException ioe = client.ioException();
+            if (ioe != null)
+                System.out.println("Client failed: " + ioe);
+            int respCode = client.respCode();
+            if (respCode != 0 && respCode != -1)
+                System.out.println("Client received HTTP response code: " + respCode);
+            if (respCode != HttpURLConnection.HTTP_UNAUTHORIZED)
+                throw new RuntimeException("Unexpected response code");
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        // assume NTLM is not supported when Kerberos is not available
+        try {
+            Class.forName("javax.security.auth.kerberos.KerberosPrincipal");
+            System.out.println("Kerberos is present, assuming NTLM is supported too");
+            return;
+        } catch (ClassNotFoundException okay) { }
+
+        // setup Authenticator
+        Authenticator.setDefault(new Authenticator() {
+            @Override
+            protected PasswordAuthentication getPasswordAuthentication() {
+                return new PasswordAuthentication("user", "pass".toCharArray());
+            }
+        });
+
+        // test combinations of authentication schemes
+        test("Basic");
+        test("Digest");
+        test("Basic", "Digest");
+        test("Basic", "NTLM");
+        test("Digest", "NTLM");
+        test("Basic", "Digest", "NTLM");
+
+        // test NTLM only, this should fail with "401 Unauthorized"
+        testNTLM();
+
+        System.out.println();
+        System.out.println("TEST PASSED");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/sanity/ciphersuites/NoKerberos.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502
+ * @summary Sanity check to ensure that Kerberos cipher suites cannot be
+ *   negotiated when running on a compact profile that does not include Kerberos
+ */
+
+import java.net.*;
+import java.util.*;
+import javax.net.ssl.*;
+
+public class NoKerberos {
+
+    static final List<String> KERBEROS_CIPHER_SUITES = Arrays.asList(
+        "TLS_KRB5_WITH_RC4_128_SHA",
+        "TLS_KRB5_WITH_RC4_128_MD5",
+        "TLS_KRB5_WITH_3DES_EDE_CBC_SHA",
+        "TLS_KRB5_WITH_3DES_EDE_CBC_MD5",
+        "TLS_KRB5_WITH_DES_CBC_SHA",
+        "TLS_KRB5_WITH_DES_CBC_MD5",
+        "TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
+        "TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
+        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",
+        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5"
+    );
+
+    /**
+     * Checks that the given array of supported cipher suites does not include
+     * any Kerberos cipher suites.
+     */
+    static void checkNotSupported(String[] supportedSuites) {
+        for (String suites: supportedSuites) {
+            if (KERBEROS_CIPHER_SUITES.contains(suites)) {
+                throw new RuntimeException("Supported list of cipher suites " +
+                    " should not include Kerberos cipher suites");
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            Class.forName("javax.security.auth.kerberos.KerberosPrincipal");
+            System.out.println("Kerberos is present, nothing to test");
+            return;
+        } catch (ClassNotFoundException okay) { }
+
+        // test SSLSocket
+        try (Socket s = SSLSocketFactory.getDefault().createSocket()) {
+            SSLSocket sslSocket = (SSLSocket)s;
+
+            checkNotSupported(sslSocket.getSupportedCipherSuites());
+
+            // attempt to enable each of the Kerberos cipher suites
+            for (String kcs: KERBEROS_CIPHER_SUITES) {
+                String[] suites = { kcs };
+                try {
+                    sslSocket.setEnabledCipherSuites(suites);
+                    throw new RuntimeException("SSLSocket.setEnabledCipherSuitessuites allowed " +
+                        kcs + " but Kerberos not supported");
+                } catch (IllegalArgumentException expected) { }
+            }
+        }
+
+        // test SSLServerSocket
+        try (ServerSocket ss = SSLServerSocketFactory.getDefault().createServerSocket()) {
+            SSLServerSocket sslSocket = (SSLServerSocket)ss;
+
+            checkNotSupported(sslSocket.getSupportedCipherSuites());
+
+            // attempt to enable each of the Kerberos cipher suites
+            for (String kcs: KERBEROS_CIPHER_SUITES) {
+                String[] suites = { kcs };
+                try {
+                    sslSocket.setEnabledCipherSuites(suites);
+                    throw new RuntimeException("SSLSocket.setEnabledCipherSuitessuites allowed " +
+                        kcs + " but Kerberos not supported");
+                } catch (IllegalArgumentException expected) { }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/AddAndUpdateProfile.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8003255
+ * @compile -XDignore.symbol.file AddAndUpdateProfile.java
+ * @run main AddAndUpdateProfile
+ * @summary Basic test of jar tool "p" option to add or update the Profile
+ *    attribute in the main manifest of a JAR file
+ */
+
+import java.util.jar.*;
+import static java.util.jar.Attributes.Name.*;
+import java.nio.file.*;
+import java.io.IOException;
+
+import sun.tools.jar.Main;
+
+public class AddAndUpdateProfile {
+    static boolean doJar(String... args) {
+        System.out.print("jar");
+        for (String arg: args)
+            System.out.print(" " + arg);
+        System.out.println("");
+
+        Main jartool = new Main(System.out, System.err, "jar");
+        return jartool.run(args);
+    }
+
+    static void jar(String... args) {
+        if (!doJar(args))
+            throw new RuntimeException("jar command failed");
+    }
+
+    static void jarExpectingFail(String... args) {
+        if (doJar(args))
+            throw new RuntimeException("jar command not expected to succeed");
+    }
+
+    static void checkMainAttribute(String jarfile, Attributes.Name name,
+                                   String expectedValue)
+        throws IOException
+    {
+        try (JarFile jf = new JarFile(jarfile)) {
+            Manifest mf = jf.getManifest();
+            if (mf == null && expectedValue != null)
+                throw new RuntimeException("Manifest not found");
+            if (mf != null) {
+                String actual = mf.getMainAttributes().getValue(name);
+                if (actual != null) {
+                    if (!actual.equals(expectedValue))
+                        throw new RuntimeException("Profile attribute has unexpected value");
+                } else {
+                    if (expectedValue != null)
+                        throw new RuntimeException("Profile attribute should not be present");
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Path entry = Files.createFile(Paths.get("xfoo"));
+        String jarfile = "xFoo.jar";
+        try {
+
+            // create JAR file with Profile attribute
+            jar("cfp", jarfile, "compact1", entry.toString());
+            checkMainAttribute(jarfile, PROFILE, "compact1");
+
+            // attempt to create JAR file with Profile attribute and bad value
+            jarExpectingFail("cfp", jarfile, "garbage", entry.toString());
+            jarExpectingFail("cfp", jarfile, "Compact1", entry.toString());
+            jarExpectingFail("cfp", jarfile, "COMPACT1", entry.toString());
+
+            // update value of Profile attribute
+            jar("ufp", jarfile, "compact2");
+            checkMainAttribute(jarfile, PROFILE, "compact2");
+
+            // attempt to update value of Profile attribute to bad value
+            // (update should not change the JAR file)
+            jarExpectingFail("ufp", jarfile, "garbage");
+            checkMainAttribute(jarfile, PROFILE, "compact2");
+            jarExpectingFail("ufp", jarfile, "COMPACT1");
+            checkMainAttribute(jarfile, PROFILE, "compact2");
+
+            // create JAR file with both a Main-Class and Profile attribute
+            jar("cfep", jarfile, "Foo", "compact1", entry.toString());
+            checkMainAttribute(jarfile, MAIN_CLASS, "Foo");
+            checkMainAttribute(jarfile, PROFILE, "compact1");
+
+            // update value of Profile attribute
+            jar("ufp", jarfile, "compact2");
+            checkMainAttribute(jarfile, PROFILE, "compact2");
+
+            // create JAR file without Profile attribute
+            jar("cf", jarfile, entry.toString());
+            checkMainAttribute(jarfile, PROFILE, null);
+
+            // update value of Profile attribute
+            jar("ufp", jarfile, "compact3");
+            checkMainAttribute(jarfile, PROFILE, "compact3");
+
+        } finally {
+            Files.deleteIfExists(Paths.get(jarfile));
+            Files.delete(entry);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/profiles/Basic.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8003255
+ * @compile -XDignore.symbol.file Basic.java Main.java Logging.java
+ * @run main Basic
+ * @summary Test the launcher checks the Profile attribute of executable JAR
+ *     files. Also checks that libraries that specify the Profile attribute
+ *     are not loaded if the runtime does not support the required profile.
+ */
+
+import java.io.*;
+import java.util.jar.*;
+import static java.util.jar.JarFile.MANIFEST_NAME;
+import java.util.zip.*;
+import java.nio.file.*;
+import java.nio.file.attribute.BasicFileAttributes;
+
+public class Basic {
+
+    static final String MANIFEST_DIR = "META-INF/";
+
+    static final String JAVA_HOME = System.getProperty("java.home");
+    static final String OS_NAME = System.getProperty("os.name");
+    static final String OS_ARCH = System.getProperty("os.arch");
+
+    static final String JAVA_CMD =
+            OS_NAME.startsWith("Windows") ? "java.exe" : "java";
+
+    static final boolean NEED_D64 =
+            OS_NAME.equals("SunOS") &&
+            (OS_ARCH.equals("sparcv9") || OS_ARCH.equals("amd64"));
+
+    /**
+     * Creates a JAR file with the given attributes and the given entries.
+     * Class files are assumed to be in ${test.classes}. Note that this this
+     * method cannot use the "jar" tool as it may not be present in the image.
+     */
+    static void createJarFile(String jarfile,
+                              String mainAttributes,
+                              String... entries)
+        throws IOException
+    {
+        // create Manifest
+        Manifest manifest = new Manifest();
+        Attributes jarAttrs = manifest.getMainAttributes();
+        jarAttrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
+        if (mainAttributes.length() > 0) {
+            for (String attr: mainAttributes.split(",")) {
+                String[] s = attr.split("=");
+                jarAttrs.put(new Attributes.Name(s[0]), s[1]);
+            }
+        }
+
+        try (OutputStream out = Files.newOutputStream(Paths.get(jarfile));
+             ZipOutputStream zos = new JarOutputStream(out))
+        {
+            // add manifest directory and manifest file
+            ZipEntry e = new JarEntry(MANIFEST_DIR);
+            e.setTime(System.currentTimeMillis());
+            e.setSize(0);
+            e.setCrc(0);
+            zos.putNextEntry(e);
+            e = new ZipEntry(MANIFEST_NAME);
+            e.setTime(System.currentTimeMillis());
+            zos.putNextEntry(e);
+            manifest.write(zos);
+            zos.closeEntry();
+
+            // entries in JAR file
+            for (String entry: entries) {
+                e = new JarEntry(entry);
+                Path path;
+                if (entry.endsWith(".class")) {
+                    path = Paths.get(System.getProperty("test.classes"), entry);
+                } else {
+                    path = Paths.get(entry);
+                }
+                BasicFileAttributes attrs =
+                    Files.readAttributes(path, BasicFileAttributes.class);
+                e.setTime(attrs.lastModifiedTime().toMillis());
+                if (attrs.size() == 0) {
+                    e.setMethod(ZipEntry.STORED);
+                    e.setSize(0);
+                    e.setCrc(0);
+                }
+                zos.putNextEntry(e);
+                if (attrs.isRegularFile())
+                    Files.copy(path, zos);
+                zos.closeEntry();
+            }
+        }
+    }
+
+    /**
+     * Execute the given executable JAR file with the given arguments. This
+     * method blocks until the launched VM terminates. Any output or error
+     * message from the launched VM are printed to System.out. Returns the
+     * exit value.
+     */
+    static int exec(String jf, String... args) throws IOException {
+        StringBuilder sb = new StringBuilder();
+        sb.append(Paths.get(JAVA_HOME, "bin", JAVA_CMD).toString());
+        if (NEED_D64)
+            sb.append(" -d64");
+        sb.append(" -jar ");
+        sb.append(Paths.get(jf).toAbsolutePath());
+        for (String arg: args) {
+            sb.append(' ');
+            sb.append(arg);
+        }
+        String[] cmd = sb.toString().split(" ");
+        ProcessBuilder pb = new ProcessBuilder(cmd);
+        pb.redirectErrorStream(true);
+        Process p = pb.start();
+        BufferedReader reader =
+            new BufferedReader(new InputStreamReader(p.getInputStream()));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            System.out.println(line);
+        }
+        try {
+            return p.waitFor();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Should not happen");
+        }
+    }
+
+    static void checkRun(String jf, String... args) throws IOException {
+        if (exec(jf) != 0)
+            throw new RuntimeException(jf + " failed!!!");
+    }
+
+    static void checkRunFail(String jf, String... args) throws IOException {
+        if (exec(jf) == 0)
+            throw new RuntimeException(jf + " did not fail!!!");
+        System.out.println("Failed as expected");
+    }
+
+    public static void main(String[] args) throws IOException {
+        // ## replace this if there is a standard way to determine the profile
+        String profile = sun.misc.Version.profileName();
+
+        int thisProfile = 4;
+        if ("compact1".equals(profile)) thisProfile = 1;
+        if ("compact2".equals(profile)) thisProfile = 2;
+        if ("compact3".equals(profile)) thisProfile = 3;
+
+        // "library" JAR file used by the test
+        createJarFile("Logging.jar", "", "Logging.class");
+
+        // Executable JAR file without the Profile attribute
+        if (thisProfile <= 3) {
+            createJarFile("Main.jar",
+                          "Main-Class=Main,Class-Path=Logging.jar",
+                          "Main.class");
+            checkRunFail("Main.jar");
+        }
+
+        // Executable JAR file with Profile attribute, Library JAR file without
+        for (int p=1; p<=3; p++) {
+            String attrs = "Main-Class=Main,Class-Path=Logging.jar" +
+                 ",Profile=compact" + p;
+            createJarFile("Main.jar", attrs,  "Main.class");
+            if (p <= thisProfile) {
+                checkRun("Main.jar");
+            } else {
+                checkRunFail("Main.jar");
+            }
+        }
+
+        // Executable JAR file with Profile attribute that has invalid profile
+        // name, including incorrect case.
+        createJarFile("Main.jar",
+                      "Main-Class=Main,Class-Path=Logging.jar,Profile=BadName",
+                      "Main.class");
+        checkRunFail("Main.jar");
+
+        createJarFile("Main.jar",
+                      "Main-Class=Main,Class-Path=Logging.jar,Profile=Compact1",
+                      "Main.class");
+        checkRunFail("Main.jar");
+
+        // Executable JAR file and Librrary JAR file with Profile attribute
+        createJarFile("Main.jar",
+                      "Main-Class=Main,Class-Path=Logging.jar,Profile=compact1",
+                      "Main.class");
+        for (int p=1; p<=3; p++) {
+            String attrs = "Profile=compact" + p;
+            createJarFile("Logging.jar", attrs, "Logging.class");
+            if (p <= thisProfile) {
+                checkRun("Main.jar");
+            } else {
+                checkRunFail("Main.jar");
+            }
+        }
+
+        // Executable JAR file and Library JAR with Profile attribute, value
+        // of Profile not recognized
+        createJarFile("Logging.jar", "Profile=BadName", "Logging.class");
+        createJarFile("Main.jar",
+                      "Main-Class=Main,Class-Path=Logging.jar,Profile=compact1",
+                      "Main.class");
+        checkRunFail("Main.jar");
+
+        System.out.println("TEST PASSED.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/profiles/Logging.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class Logging {
+    private Logging() { }
+
+    public static void log(String msg) {
+        System.out.println(msg);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/profiles/Main.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class Main {
+    private Main() { }
+
+    public static void main(String[] args) {
+        Logging.log("main running");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/profiles/VersionCheck.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8003256
+ * @compile -XDignore.symbol.file VersionCheck.java
+ * @run main VersionCheck
+ * @summary Tests that "java -version" includes the name of the profile and that
+ *     it matches the name in the release file
+ */
+
+import java.nio.file.*;
+import java.io.*;
+import java.util.Properties;
+
+public class VersionCheck {
+
+    static final String JAVA_HOME = System.getProperty("java.home");
+    static final String OS_NAME = System.getProperty("os.name");
+    static final String OS_ARCH = System.getProperty("os.arch");
+
+    static final String JAVA_CMD =
+            OS_NAME.startsWith("Windows") ? "java.exe" : "java";
+
+    static final boolean NEED_D64 =
+            OS_NAME.equals("SunOS") &&
+            (OS_ARCH.equals("sparcv9") || OS_ARCH.equals("amd64"));
+
+    /**
+     * Returns {@code true} if the given class is present.
+     */
+    static boolean isPresent(String cn) {
+        try {
+            Class.forName(cn);
+            return true;
+        } catch (ClassNotFoundException ignore) {
+            return false;
+        }
+    }
+
+    /**
+     * Determines the profile by checking whether specific classes are present.
+     * Returns the empty string if this runtime does not appear to be a profile
+     * of Java SE.
+     */
+    static String probeProfile() {
+        if (isPresent("java.awt.Window"))
+            return "";
+        if (isPresent("java.lang.management.ManagementFactory"))
+            return "compact3";
+        if (isPresent("java.sql.DriverManager"))
+            return "compact2";
+        return "compact1";
+    }
+
+    /**
+     * Execs java with the given parameters. The method blocks until the
+     * process terminates. Returns a {@code ByteArrayOutputStream} with any
+     * stdout or stderr from the process.
+     */
+    static ByteArrayOutputStream execJava(String... args)
+        throws IOException
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append(Paths.get(JAVA_HOME, "bin", JAVA_CMD).toString());
+        if (NEED_D64)
+            sb.append(" -d64");
+        for (String arg: args) {
+            sb.append(' ');
+            sb.append(arg);
+        }
+        String[] cmd = sb.toString().split(" ");
+        ProcessBuilder pb = new ProcessBuilder(cmd);
+        pb.redirectErrorStream(true);
+        Process p = pb.start();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        byte[] buf = new byte[1024];
+        int n;
+        do {
+            n = p.getInputStream().read(buf);
+            if (n > 0)
+               baos.write(buf, 0, n);
+        } while (n > 0);
+        try {
+            int exitCode = p.waitFor();
+            if (exitCode != 0)
+                throw new RuntimeException("Exit code: " + exitCode);
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Should not happen");
+        }
+        return baos;
+    }
+
+    public static void main(String[] args) throws IOException {
+        String reported = sun.misc.Version.profileName();
+        String probed = probeProfile();
+        if (!reported.equals(probed)) {
+            throw new RuntimeException("sun.misc.Version reports: " + reported
+               + ", but probing reports: " + probed);
+        }
+
+        String profile = probed;
+        boolean isFullJre = (profile.length() == 0);
+
+        // check that java -version includes "profile compactN"
+        String expected = "profile " + profile;
+        System.out.println("Checking java -version ...");
+        ByteArrayOutputStream baos = execJava("-version");
+        ByteArrayInputStream bain = new ByteArrayInputStream(baos.toByteArray());
+        BufferedReader reader = new BufferedReader(new InputStreamReader(bain));
+        boolean found = false;
+        String line;
+        while ((line = reader.readLine()) != null) {
+            if (line.contains(expected)) {
+                found = true;
+                break;
+            }
+        }
+        if (found && isFullJre)
+           throw new RuntimeException(expected + " found in java -version output");
+        if (!found && !isFullJre)
+            throw new RuntimeException("java -version did not include " + expected);
+
+        // check that the profile name matches the release file
+        System.out.println("Checking release file ...");
+        Properties props = new Properties();
+
+        Path home = Paths.get(JAVA_HOME);
+        if (home.getFileName().toString().equals("jre"))
+            home = home.getParent();
+        Path release = home.resolve("release");
+        try (InputStream in = Files.newInputStream(release)) {
+            props.load(in);
+        }
+        String value = props.getProperty("JAVA_PROFILE");
+        if (isFullJre) {
+            if (value != null)
+                throw new RuntimeException("JAVA_PROFILE should not be present");
+        } else {
+            if (value == null)
+                throw new RuntimeException("JAVA_PROFILE not present in release file");
+            if (!value.equals("\"" + profile + "\""))
+                throw new RuntimeException("Unexpected value of JAVA_PROFILE: " + value);
+        }
+
+        System.out.println("Test passed.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/pack200/NoBeans.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004931
+ * @compile NoBeans.java
+ * @summary A compile-only test to ensure that implementations of Packer
+ *   and Unpacker can be compiled without implementating the
+ *   addPropertyChangeListener and removePropertyChangeListener methods.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+
+public class NoBeans {
+
+    static class MyPacker implements Pack200.Packer {
+        public SortedMap<String,String> properties() { return null; }
+        public void pack(JarFile in, OutputStream out) { }
+        public void pack(JarInputStream in, OutputStream out) { }
+    }
+
+    static class MyUnpacker implements Pack200.Unpacker {
+        public SortedMap<String,String> properties() { return null; }
+        public void unpack(InputStream in, JarOutputStream out) { }
+        public void unpack(File in, JarOutputStream out) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/pack200/Reflect.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary Invoke getDeclaredMethods on Packer and Unpacker to ensure
+ *    that all types referenced in the method signatures is present.
+ */
+
+import java.util.jar.Pack200;
+import java.util.jar.Pack200.Packer;
+import java.util.jar.Pack200.Unpacker;
+import java.lang.reflect.Method;
+
+public class Reflect {
+    static void printMethods(Class<?> c) {
+        System.out.println(c);
+        for (Method m: c.getDeclaredMethods()) {
+            System.out.println("    " + m);
+        }
+    }
+    public static void main(String[] args) {
+        printMethods(Pack200.Packer.class);
+        printMethods(Pack200.Unpacker.class);
+        printMethods(Pack200.newPacker().getClass());
+        printMethods(Pack200.newUnpacker().getClass());
+    }
+}
--- a/langtools/.hgtags	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/.hgtags	Thu Feb 21 17:43:57 2013 -0800
@@ -198,3 +198,4 @@
 56c97aff46bb577b8668874154c24115a7e8a3e8 jdk8-b74
 c2e11e2ec4a3682513e566849e5562f31ded8c65 jdk8-b75
 e81839b3233792415daaab051698edc6067f1a16 jdk8-b76
+89c66415168925dffe492356ff893ff248bb5603 jdk8-b77
--- a/langtools/src/share/classes/com/sun/tools/classfile/AccessFlags.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/AccessFlags.java	Thu Feb 21 17:43:57 2013 -0800
@@ -56,7 +56,7 @@
     public static final int ACC_SYNTHETIC     = 0x1000; // class, inner, field, method
     public static final int ACC_ANNOTATION    = 0x2000; // class, inner
     public static final int ACC_ENUM          = 0x4000; // class, inner, field
-    public static final int ACC_MODULE        = 0x8000; // class, inner, field, method
+    public static final int ACC_MANDATED      = 0x8000; // class, inner, field, method
 
     public static enum Kind { Class, InnerClass, Field, Method};
 
@@ -81,12 +81,12 @@
     }
 
     private static final int[] classModifiers = {
-        ACC_PUBLIC, ACC_FINAL, ACC_ABSTRACT, ACC_MODULE
+        ACC_PUBLIC, ACC_FINAL, ACC_ABSTRACT
     };
 
     private static final int[] classFlags = {
         ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_INTERFACE, ACC_ABSTRACT,
-        ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM, ACC_MODULE
+        ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
     };
 
     public Set<String> getClassModifiers() {
@@ -100,12 +100,12 @@
 
     private static final int[] innerClassModifiers = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
-        ACC_ABSTRACT, ACC_MODULE
+        ACC_ABSTRACT
     };
 
     private static final int[] innerClassFlags = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_SUPER,
-        ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM, ACC_MODULE
+        ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
     };
 
     public Set<String> getInnerClassModifiers() {
@@ -119,12 +119,12 @@
 
     private static final int[] fieldModifiers = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
-        ACC_VOLATILE, ACC_TRANSIENT, ACC_MODULE
+        ACC_VOLATILE, ACC_TRANSIENT
     };
 
     private static final int[] fieldFlags = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
-        ACC_VOLATILE, ACC_TRANSIENT, ACC_SYNTHETIC, ACC_ENUM, ACC_MODULE
+        ACC_VOLATILE, ACC_TRANSIENT, ACC_SYNTHETIC, ACC_ENUM
     };
 
     public Set<String> getFieldModifiers() {
@@ -137,13 +137,13 @@
 
     private static final int[] methodModifiers = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
-        ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT, ACC_MODULE
+        ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT
     };
 
     private static final int[] methodFlags = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
         ACC_SYNCHRONIZED, ACC_BRIDGE, ACC_VARARGS, ACC_NATIVE, ACC_ABSTRACT,
-        ACC_STRICT, ACC_SYNTHETIC, ACC_MODULE
+        ACC_STRICT, ACC_SYNTHETIC
     };
 
     public Set<String> getMethodModifiers() {
@@ -208,8 +208,8 @@
                 return "abstract";
             case ACC_STRICT:
                 return "strictfp";
-            case ACC_MODULE:
-                return "module";
+            case ACC_MANDATED:
+                return "mandated";
             default:
                 return null;
         }
@@ -247,8 +247,8 @@
             return "ACC_ANNOTATION";
         case ACC_ENUM:
             return "ACC_ENUM";
-        case ACC_MODULE:
-            return "ACC_MODULE";
+        case ACC_MANDATED:
+            return "ACC_MANDATED";
         default:
             return null;
         }
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -727,12 +727,13 @@
         private void write(TypeAnnotation.Position p, ClassOutputStream out) {
             out.writeByte(p.type.targetTypeValue());
             switch (p.type) {
-            // type cast
-            case CAST:
             // instanceof
             case INSTANCEOF:
             // new expression
             case NEW:
+            // constructor/method reference receiver
+            case CONSTRUCTOR_REFERENCE:
+            case METHOD_REFERENCE:
                 out.writeShort(p.offset);
                 break;
             // local variable
@@ -779,9 +780,12 @@
             case METHOD_FORMAL_PARAMETER:
                 out.writeByte(p.parameter_index);
                 break;
+            // type cast
+            case CAST:
             // method/constructor/reference type argument
             case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
             case METHOD_INVOCATION_TYPE_ARGUMENT:
+            case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
             case METHOD_REFERENCE_TYPE_ARGUMENT:
                 out.writeShort(p.offset);
                 out.writeByte(p.type_index);
@@ -790,10 +794,6 @@
             case METHOD_RETURN:
             case FIELD:
                 break;
-            // lambda formal parameter
-            case LAMBDA_FORMAL_PARAMETER:
-                out.writeByte(p.parameter_index);
-                break;
             case UNKNOWN:
                 throw new AssertionError("ClassWriter: UNKNOWN target type should never occur!");
             default:
--- a/langtools/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Thu Feb 21 17:43:57 2013 -0800
@@ -86,12 +86,13 @@
         position.type = type;
 
         switch (type) {
-        // type cast
-        case CAST:
         // instanceof
         case INSTANCEOF:
         // new expression
         case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
             position.offset = cr.readUnsignedShort();
             break;
         // local variable
@@ -142,9 +143,12 @@
         case METHOD_FORMAL_PARAMETER:
             position.parameter_index = cr.readUnsignedByte();
             break;
+        // type cast
+        case CAST:
         // method/constructor/reference type argument
         case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
         case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
         case METHOD_REFERENCE_TYPE_ARGUMENT:
             position.offset = cr.readUnsignedShort();
             position.type_index = cr.readUnsignedByte();
@@ -153,10 +157,6 @@
         case METHOD_RETURN:
         case FIELD:
             break;
-        // lambda formal parameter
-        case LAMBDA_FORMAL_PARAMETER:
-            position.parameter_index = cr.readUnsignedByte();
-            break;
         case UNKNOWN:
             throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
         default:
@@ -177,13 +177,14 @@
         int n = 0;
         n += 1; // TargetType tag is a byte
         switch (pos.type) {
-        // type cast
-        case CAST:
         // instanceof
         case INSTANCEOF:
         // new expression
         case NEW:
-            n += 2;
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
+            n += 2; // offset
             break;
         // local variable
         case LOCAL_VARIABLE:
@@ -192,7 +193,7 @@
             n += 2; // table_length;
             int table_length = pos.lvarOffset.length;
             n += 2 * table_length; // offset
-            n += 2 * table_length; // length;
+            n += 2 * table_length; // length
             n += 2 * table_length; // index
             break;
         // exception parameter
@@ -206,7 +207,7 @@
         // type parameter
         case CLASS_TYPE_PARAMETER:
         case METHOD_TYPE_PARAMETER:
-            n += 1; // parameter_index;
+            n += 1; // parameter_index
             break;
         // type parameter bound
         case CLASS_TYPE_PARAMETER_BOUND:
@@ -226,9 +227,12 @@
         case METHOD_FORMAL_PARAMETER:
             n += 1; // parameter_index
             break;
+        // type cast
+        case CAST:
         // method/constructor/reference type argument
         case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
         case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
         case METHOD_REFERENCE_TYPE_ARGUMENT:
             n += 2; // offset
             n += 1; // type index
@@ -237,10 +241,6 @@
         case METHOD_RETURN:
         case FIELD:
             break;
-        // lambda formal parameter
-        case LAMBDA_FORMAL_PARAMETER:
-            n += 1; // parameter_index
-            break;
         case UNKNOWN:
             throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
         default:
@@ -377,12 +377,13 @@
             sb.append(type);
 
             switch (type) {
-            // type cast
-            case CAST:
             // instanceof
             case INSTANCEOF:
             // new expression
             case NEW:
+            // constructor/method reference receiver
+            case CONSTRUCTOR_REFERENCE:
+            case METHOD_REFERENCE:
                 sb.append(", offset = ");
                 sb.append(offset);
                 break;
@@ -444,9 +445,12 @@
                 sb.append(", param_index = ");
                 sb.append(parameter_index);
                 break;
+            // type cast
+            case CAST:
             // method/constructor/reference type argument
             case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
             case METHOD_INVOCATION_TYPE_ARGUMENT:
+            case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
             case METHOD_REFERENCE_TYPE_ARGUMENT:
                 sb.append(", offset = ");
                 sb.append(offset);
@@ -457,12 +461,6 @@
             case METHOD_RETURN:
             case FIELD:
                 break;
-            // lambda formal parameter
-            case LAMBDA_FORMAL_PARAMETER:
-                // TODO: also needs an offset?
-                sb.append(", param_index = ");
-                sb.append(parameter_index);
-                break;
             case UNKNOWN:
                 sb.append(", position UNKNOWN!");
                 break;
@@ -564,34 +562,37 @@
         /** For annotations on an exception parameter. */
         EXCEPTION_PARAMETER(0x42, true),
 
-        /** For annotations on a typecast. */
-        CAST(0x43, true),
-
         /** For annotations on a type test. */
-        INSTANCEOF(0x44, true),
+        INSTANCEOF(0x43, true),
 
         /** For annotations on an object creation expression. */
-        NEW(0x45, true),
+        NEW(0x44, true),
+
+        /** For annotations on a constructor reference receiver. */
+        CONSTRUCTOR_REFERENCE(0x45, true),
+
+        /** For annotations on a method reference receiver. */
+        METHOD_REFERENCE(0x46, true),
+
+        /** For annotations on a typecast. */
+        CAST(0x47, true),
 
         /** For annotations on a type argument of an object creation expression. */
-        CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x46, true),
+        CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x48, true),
 
         /** For annotations on a type argument of a method call. */
-        METHOD_INVOCATION_TYPE_ARGUMENT(0x47, true),
+        METHOD_INVOCATION_TYPE_ARGUMENT(0x49, true),
 
-        /** For annotations on a lambda parameter type. */
-        LAMBDA_FORMAL_PARAMETER(0x48, true),
-
-        /** For annotations on a method reference. */
-        METHOD_REFERENCE(0x49, true),
+        /** For annotations on a type argument of a constructor reference. */
+        CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(0x4A, true),
 
         /** For annotations on a type argument of a method reference. */
-        METHOD_REFERENCE_TYPE_ARGUMENT(0x50, true),
+        METHOD_REFERENCE_TYPE_ARGUMENT(0x4B, true),
 
         /** For annotations with an unknown target. */
         UNKNOWN(0xFF);
 
-        private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x50;
+        private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x4B;
 
         private final int targetTypeValue;
         private final boolean isLocal;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, 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
@@ -150,7 +150,20 @@
             String tableSummary, Content body) {
         if (packages.length > 0) {
             Arrays.sort(packages);
-            addAllClassesLink(body);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexHeader);
+            addAllClassesLink(div);
+            if (configuration.showProfiles) {
+                addAllProfilesLink(div);
+            }
+            body.addContent(div);
+            if (configuration.showProfiles) {
+                String profileSummary = configuration.getText("doclet.Profiles");
+                String profilesTableSummary = configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles"));
+                addProfilesList(profileSummary, profilesTableSummary, body);
+            }
             addPackagesList(packages, text, tableSummary, body);
         }
     }
@@ -182,10 +195,29 @@
     }
 
     /**
-     * Do nothing. This will be overridden in PackageIndexFrameWriter.
+     * Do nothing. This will be overridden.
+     *
+     * @param div the document tree to which the all classes link will be added
+     */
+    protected void addAllClassesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden.
      *
-     * @param body the document tree to which the all classes link will be added
+     * @param div the document tree to which the all profiles link will be added
      */
-    protected void addAllClassesLink(Content body) {
+    protected void addAllProfilesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden.
+     *
+     * @param profileSummary the profile summary heading
+     * @param profilesTableSummary the profiles table summary information
+     * @param body the content tree to which the profiles list will be added
+     */
+    protected void addProfilesList(String profileSummary, String profilesTableSummary,
+            Content body) {
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,276 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.DocPath;
+
+/**
+ * Abstract class to generate the profile overview files in
+ * Frame and Non-Frame format. This will be sub-classed to
+ * generate profile-overview-frame.html as well as profile-overview-summary.html.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
+
+    /**
+     * Profiles to be documented.
+     */
+    protected Profiles profiles;
+
+    /**
+     * Constructor. Also initializes the profiles variable.
+     *
+     * @param configuration  The current configuration
+     * @param filename Name of the profile index file to be generated.
+     */
+    public AbstractProfileIndexWriter(ConfigurationImpl configuration,
+                                      DocPath filename) throws IOException {
+        super(configuration, filename);
+        profiles = configuration.profiles;
+    }
+
+    /**
+     * Adds the navigation bar header to the documentation tree.
+     *
+     * @param body the document tree to which the navigation bar header will be added
+     */
+    protected abstract void addNavigationBarHeader(Content body);
+
+    /**
+     * Adds the navigation bar footer to the documentation tree.
+     *
+     * @param body the document tree to which the navigation bar footer will be added
+     */
+    protected abstract void addNavigationBarFooter(Content body);
+
+    /**
+     * Adds the overview header to the documentation tree.
+     *
+     * @param body the document tree to which the overview header will be added
+     */
+    protected abstract void addOverviewHeader(Content body);
+
+    /**
+     * Adds the profiles list to the documentation tree.
+     *
+     * @param profiles profiles object
+     * @param text caption for the table
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the profiles list will be added
+     */
+    protected abstract void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body);
+
+    /**
+     * Adds the profile packages list to the documentation tree.
+     *
+     * @param profiles profiles object
+     * @param text caption for the table
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the profiles list will be added
+     * @param profileName the name for the profile being documented
+     */
+    protected abstract void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName);
+
+    /**
+     * Generate and prints the contents in the profile index file. Call appropriate
+     * methods from the sub-class in order to generate Frame or Non
+     * Frame format.
+     *
+     * @param title the title of the window.
+     * @param includeScript boolean set true if windowtitle script is to be included
+     */
+    protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException {
+        String windowOverview = configuration.getText(title);
+        Content body = getBody(includeScript, getWindowTitle(windowOverview));
+        addNavigationBarHeader(body);
+        addOverviewHeader(body);
+        addIndex(body);
+        addOverview(body);
+        addNavigationBarFooter(body);
+        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
+                configuration.doctitle), includeScript, body);
+    }
+
+    /**
+     * Generate and prints the contents in the profile packages index file. Call appropriate
+     * methods from the sub-class in order to generate Frame or Non
+     * Frame format.
+     *
+     * @param title the title of the window.
+     * @param includeScript boolean set true if windowtitle script is to be included
+     * @param profileName the name of the profile being documented
+     */
+    protected void buildProfilePackagesIndexFile(String title,
+            boolean includeScript, String profileName) throws IOException {
+        String windowOverview = configuration.getText(title);
+        Content body = getBody(includeScript, getWindowTitle(windowOverview));
+        addNavigationBarHeader(body);
+        addOverviewHeader(body);
+        addProfilePackagesIndex(body, profileName);
+        addOverview(body);
+        addNavigationBarFooter(body);
+        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
+                configuration.doctitle), includeScript, body);
+    }
+
+    /**
+     * Default to no overview, override to add overview.
+     *
+     * @param body the document tree to which the overview will be added
+     */
+    protected void addOverview(Content body) throws IOException {
+    }
+
+    /**
+     * Adds the frame or non-frame profile index to the documentation tree.
+     *
+     * @param body the document tree to which the index will be added
+     */
+    protected void addIndex(Content body) {
+        addIndexContents(profiles, "doclet.Profile_Summary",
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles")), body);
+    }
+
+    /**
+     * Adds the frame or non-frame profile packages index to the documentation tree.
+     *
+     * @param body the document tree to which the index will be added
+     * @param profileName  the name of the profile being documented
+     */
+    protected void addProfilePackagesIndex(Content body, String profileName) {
+        addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles")), body, profileName);
+    }
+
+    /**
+     * Adds profile index contents. Call appropriate methods from
+     * the sub-classes. Adds it to the body HtmlTree
+     *
+     * @param profiles profiles to be documented
+     * @param text string which will be used as the heading
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the index contents will be added
+     */
+    protected void addIndexContents(Profiles profiles, String text,
+            String tableSummary, Content body) {
+        if (profiles.getProfileCount() > 0) {
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexHeader);
+            addAllClassesLink(div);
+            addAllPackagesLink(div);
+            body.addContent(div);
+            addProfilesList(profiles, text, tableSummary, body);
+        }
+    }
+
+    /**
+     * Adds profile packages index contents. Call appropriate methods from
+     * the sub-classes. Adds it to the body HtmlTree
+     *
+     * @param profiles profiles to be documented
+     * @param text string which will be used as the heading
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the index contents will be added
+     * @param profileName the name of the profile being documented
+     */
+    protected void addProfilePackagesIndexContents(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.indexHeader);
+        addAllClassesLink(div);
+        addAllPackagesLink(div);
+        addAllProfilesLink(div);
+        body.addContent(div);
+        addProfilePackagesList(profiles, text, tableSummary, body, profileName);
+    }
+
+    /**
+     * Adds the doctitle to the documentation tree, if it is specified on the command line.
+     *
+     * @param body the document tree to which the title will be added
+     */
+    protected void addConfigurationTitle(Content body) {
+        if (configuration.doctitle.length() > 0) {
+            Content title = new RawHtml(configuration.doctitle);
+            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
+                    HtmlStyle.title, title);
+            Content div = HtmlTree.DIV(HtmlStyle.header, heading);
+            body.addContent(div);
+        }
+    }
+
+    /**
+     * Returns highlighted "Overview", in the navigation bar as this is the
+     * overview page.
+     *
+     * @return a Content object to be added to the documentation tree
+     */
+    protected Content getNavLinkContents() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
+        return li;
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfileIndexFrameWriter.
+     *
+     * @param div the document tree to which the all classes link will be added
+     */
+    protected void addAllClassesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfileIndexFrameWriter.
+     *
+     * @param div the document tree to which the all packages link will be added
+     */
+    protected void addAllPackagesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfilePackageIndexFrameWriter.
+     *
+     * @param div the document tree to which the all profiles link will be added
+     */
+    protected void addAllProfilesLink(Content div) {
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -25,10 +25,10 @@
 
 package com.sun.tools.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
@@ -165,6 +165,20 @@
         bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
+        if (configuration.showProfiles) {
+            String sep = "";
+            int profile = configuration.profiles.getProfile(getTypeNameForProfile(classDoc));
+            if (profile > 0) {
+                Content profNameContent = new StringContent();
+                for (int i = profile; i < configuration.profiles.getProfileCount(); i++) {
+                    profNameContent.addContent(sep);
+                    profNameContent.addContent(Profile.lookup(i).name);
+                    sep = ", ";
+                }
+                Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profNameContent);
+                div.addContent(profileNameDiv);
+            }
+        }
         if (pkgname.length() > 0) {
             Content pkgNameContent = new StringContent(pkgname);
             Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -65,7 +65,7 @@
     public FrameOutputWriter(ConfigurationImpl configuration,
                              DocPath filename) throws IOException {
         super(configuration, filename);
-    noOfPackages = configuration.packages.length;
+        noOfPackages = configuration.packages.length;
     }
 
     /**
@@ -135,7 +135,13 @@
     protected Content getFrameDetails() {
         HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
                 "top.loadFrames()");
-        if (noOfPackages <= 1) {
+        if (configuration.showProfiles) {
+            HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
+                "top.loadFrames()");
+            addAllProfilesFrameTag(leftFrameset);
+            addAllClassesFrameTag(leftFrameset);
+            frameset.addContent(leftFrameset);
+        } else if (noOfPackages <= 1) {
             addAllClassesFrameTag(frameset);
         } else if (noOfPackages > 1) {
             HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
@@ -150,6 +156,17 @@
     }
 
     /**
+     * Add the FRAME tag for the frame that lists all profiles.
+     *
+     * @param contentTree the content tree to which the information will be added
+     */
+    private void addAllProfilesFrameTag(Content contentTree) {
+        HtmlTree frame = HtmlTree.FRAME(DocPaths.PROFILE_OVERVIEW_FRAME.getPath(),
+                "profileListFrame", configuration.getText("doclet.All_Profiles"));
+        contentTree.addContent(frame);
+    }
+
+    /**
      * Add the FRAME tag for the frame that lists all packages.
      *
      * @param contentTree the content tree to which the information will be added
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -28,6 +28,8 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -202,6 +204,44 @@
     /**
      * {@inheritDoc}
      */
+    protected void generateProfileFiles() throws Exception {
+        if (configuration.showProfiles) {
+            ProfileIndexFrameWriter.generate(configuration);
+            Profile prevProfile = null, nextProfile;
+            for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
+                ProfilePackageIndexFrameWriter.generate(configuration, Profile.lookup(i).name);
+                PackageDoc[] packages = configuration.profilePackages.get(
+                        Profile.lookup(i).name);
+                PackageDoc prev = null, next;
+                for (int j = 0; j < packages.length; j++) {
+                    // if -nodeprecated option is set and the package is marked as
+                    // deprecated, do not generate the profilename-package-summary.html
+                    // and profilename-package-frame.html pages for that package.
+                    if (!(configuration.nodeprecated && Util.isDeprecated(packages[j]))) {
+                        ProfilePackageFrameWriter.generate(configuration, packages[j], i);
+                        next = (j + 1 < packages.length
+                                && packages[j + 1].name().length() > 0) ? packages[j + 1] : null;
+                        AbstractBuilder profilePackageSummaryBuilder =
+                                configuration.getBuilderFactory().getProfilePackageSummaryBuilder(
+                                packages[j], prev, next, Profile.lookup(i));
+                        profilePackageSummaryBuilder.build();
+                        prev = packages[j];
+                    }
+                }
+                nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ?
+                        Profile.lookup(i + 1) : null;
+                AbstractBuilder profileSummaryBuilder =
+                        configuration.getBuilderFactory().getProfileSummaryBuilder(
+                        Profile.lookup(i), prevProfile, nextProfile);
+                profileSummaryBuilder.build();
+                prevProfile = Profile.lookup(i);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     protected void generatePackageFiles(ClassTree classtree) throws Exception {
         PackageDoc[] packages = configuration.packages;
         if (packages.length > 1) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -301,6 +301,107 @@
     }
 
     /**
+     * Get Profile Package link, with target frame.
+     *
+     * @param pd the packageDoc object
+     * @param target name of the target frame
+     * @param label tag for the link
+     * @param profileName the name of the profile being documented
+     * @return a content for the target profile packages link
+     */
+    public Content getTargetProfilePackageLink(PackageDoc pd, String target,
+            Content label, String profileName) {
+        return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)),
+                label, "", target);
+    }
+
+    /**
+     * Get Profile link, with target frame.
+     *
+     * @param target name of the target frame
+     * @param label tag for the link
+     * @param profileName the name of the profile being documented
+     * @return a content for the target profile link
+     */
+    public Content getTargetProfileLink(String target, Content label,
+            String profileName) {
+        return getHyperLink(pathToRoot.resolve(
+                DocPaths.profileSummary(profileName)), label, "", target);
+    }
+
+    /**
+     * Get the type name for profile search.
+     *
+     * @param cd the classDoc object for which the type name conversion is needed
+     * @return a type name string for the type
+     */
+    public String getTypeNameForProfile(ClassDoc cd) {
+        StringBuilder typeName =
+                new StringBuilder((cd.containingPackage()).name().replace(".", "/"));
+        typeName.append("/")
+                .append(cd.name().replace(".", "$"));
+        return typeName.toString();
+    }
+
+    /**
+     * Check if a type belongs to a profile.
+     *
+     * @param cd the classDoc object that needs to be checked
+     * @param profileValue the profile in which the type needs to be checked
+     * @return true if the type is in the profile
+     */
+    public boolean isTypeInProfile(ClassDoc cd, int profileValue) {
+        return (configuration.profiles.getProfile(getTypeNameForProfile(cd)) <= profileValue);
+    }
+
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content summaryContentTree,
+            int profileValue) {
+        if(classes.length > 0) {
+            Arrays.sort(classes);
+            Content caption = getTableCaption(label);
+            Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
+                    tableSummary, caption);
+            table.addContent(getSummaryTableHeader(tableHeader, "col"));
+            Content tbody = new HtmlTree(HtmlTag.TBODY);
+            for (int i = 0; i < classes.length; i++) {
+                if (!isTypeInProfile(classes[i], profileValue)) {
+                    continue;
+                }
+                if (!Util.isCoreClass(classes[i]) ||
+                    !configuration.isGeneratedDoc(classes[i])) {
+                    continue;
+                }
+                Content classContent = new RawHtml(getLink(new LinkInfoImpl(
+                        configuration, LinkInfoImpl.CONTEXT_PACKAGE, classes[i],
+                        false)));
+                Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
+                HtmlTree tr = HtmlTree.TR(tdClass);
+                if (i%2 == 0)
+                    tr.addStyle(HtmlStyle.altColor);
+                else
+                    tr.addStyle(HtmlStyle.rowColor);
+                HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
+                tdClassDescription.addStyle(HtmlStyle.colLast);
+                if (Util.isDeprecated(classes[i])) {
+                    tdClassDescription.addContent(deprecatedLabel);
+                    if (classes[i].tags("deprecated").length > 0) {
+                        addSummaryDeprecatedComment(classes[i],
+                            classes[i].tags("deprecated")[0], tdClassDescription);
+                    }
+                }
+                else
+                    addSummaryComment(classes[i], tdClassDescription);
+                tr.addContent(tdClassDescription);
+                tbody.addContent(tr);
+            }
+            table.addContent(tbody);
+            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
+            summaryContentTree.addContent(li);
+        }
+    }
+
+    /**
      * Generates the HTML document tree and prints it out.
      *
      * @param metakeywords Array of String keywords for META tag. Each element
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, 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
@@ -145,13 +145,26 @@
      * Adds "All Classes" link for the top of the left-hand frame page to the
      * documentation tree.
      *
-     * @param body the Content object to which the all classes link should be added
+     * @param div the Content object to which the all classes link should be added
      */
-    protected void addAllClassesLink(Content body) {
+    protected void addAllClassesLink(Content div) {
         Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
                 allclassesLabel, "", "packageFrame");
-        Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent);
-        body.addContent(div);
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Profiles" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all profiles link should be added
+     */
+    protected void addAllProfilesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
+                allprofilesLabel, "", "profileListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -29,6 +29,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -122,6 +123,21 @@
     /**
      * {@inheritDoc}
      */
+    protected void addProfilesList(String profileSummary, String profilesTableSummary,
+            Content body) {
+        Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary,
+                getTableCaption(profileSummary));
+        table.addContent(getSummaryTableHeader(profileTableHeader, "col"));
+        Content tbody = new HtmlTree(HtmlTag.TBODY);
+        addProfilesList(tbody);
+        table.addContent(tbody);
+        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
+        body.addContent(div);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     protected void addPackagesList(PackageDoc[] packages, String text,
             String tableSummary, Content body) {
         Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
@@ -135,6 +151,31 @@
     }
 
     /**
+     * Adds list of profiles in the index table. Generate link to each profile.
+     *
+     * @param tbody the documentation tree to which the list will be added
+     */
+    protected void addProfilesList(Content tbody) {
+        for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
+            String profileName = Profile.lookup(i).name;
+            Content profileLinkContent = getTargetProfileLink("classFrame",
+                    new StringContent(profileName), profileName);
+            Content tdProfile = HtmlTree.TD(HtmlStyle.colFirst, profileLinkContent);
+            HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+            tdSummary.addStyle(HtmlStyle.colLast);
+            tdSummary.addContent(getSpace());
+            HtmlTree tr = HtmlTree.TR(tdProfile);
+            tr.addContent(tdSummary);
+            if (i % 2 == 0) {
+                tr.addStyle(HtmlStyle.altColor);
+            } else {
+                tr.addStyle(HtmlStyle.rowColor);
+            }
+            tbody.addContent(tr);
+        }
+    }
+
+    /**
      * Adds list of packages in the index table. Generate link to each package.
      *
      * @param packages Packages to which link is to be generated
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,173 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.javac.jvm.Profile;
+
+/**
+ * Generate the profile index for the left-hand frame in the generated output.
+ * A click on the profile name in this frame will update the page in the top
+ * left hand frame with the listing of packages of the clicked profile.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
+
+    /**
+     * Construct the ProfileIndexFrameWriter object.
+     *
+     * @param configuration the configuration object
+     * @param filename Name of the profile index file to be generated.
+     */
+    public ProfileIndexFrameWriter(ConfigurationImpl configuration,
+                                   DocPath filename) throws IOException {
+        super(configuration, filename);
+    }
+
+    /**
+     * Generate the profile index file named "profile-overview-frame.html".
+     * @throws DocletAbortException
+     * @param configuration the configuration object
+     */
+    public static void generate(ConfigurationImpl configuration) {
+        ProfileIndexFrameWriter profilegen;
+        DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME;
+        try {
+            profilegen = new ProfileIndexFrameWriter(configuration, filename);
+            profilegen.buildProfileIndexFile("doclet.Window_Overview", false);
+            profilegen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                        "doclet.exception_encountered",
+                        exc.toString(), filename);
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body) {
+        Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
+                profilesLabel);
+        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addAttr(HtmlAttr.TITLE, profilesLabel.toString());
+        for (int i = 1; i < profiles.getProfileCount(); i++) {
+            ul.addContent(getProfile(i));
+        }
+        div.addContent(ul);
+        body.addContent(div);
+    }
+
+    /**
+     * Gets each profile name as a separate link.
+     *
+     * @param profile the profile being documented
+     * @return content for the profile link
+     */
+    protected Content getProfile(int profile) {
+        Content profileLinkContent;
+        Content profileLabel;
+        String profileName = (Profile.lookup(profile)).name;
+        profileLabel = new StringContent(profileName);
+        profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "",
+                    "profileListFrame");
+        Content li = HtmlTree.LI(profileLinkContent);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarHeader(Content body) {
+        Content headerContent;
+        if (configuration.packagesheader.length() > 0) {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
+        } else {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
+        }
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.bar, headerContent);
+        body.addContent(heading);
+    }
+
+    /**
+     * Do nothing as there is no overview information in this page.
+     */
+    protected void addOverviewHeader(Content body) {
+    }
+
+    /**
+     * Adds "All Classes" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all classes link should be added
+     */
+    protected void addAllClassesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
+                allclassesLabel, "", "packageFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Packages" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all packages link should be added
+     */
+    protected void addAllPackagesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
+                allpackagesLabel, "", "profileListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarFooter(Content body) {
+        Content p = HtmlTree.P(getSpace());
+        body.addContent(p);
+    }
+
+    protected void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,186 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each package contents of a profile in the left-hand bottom
+ * frame. This will list all the Class Kinds in the package for a profile. A click on any
+ * class-kind will update the right-hand frame with the clicked class-kind page.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageFrameWriter extends HtmlDocletWriter {
+
+    /**
+     * The package being documented.
+     */
+    private PackageDoc packageDoc;
+
+    /**
+     * Constructor to construct ProfilePackageFrameWriter object and to generate
+     * "profilename-package-frame.html" file in the respective package directory.
+     * For example for profile compact1 and package "java.lang" this will generate file
+     * "compact1-package-frame.html" file in the "java/lang" directory. It will also
+     * create "java/lang" directory in the current or the destination directory
+     * if it doesn't exist.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param packageDoc PackageDoc under consideration.
+     * @param profileName the name of the profile being documented
+     */
+    public ProfilePackageFrameWriter(ConfigurationImpl configuration,
+            PackageDoc packageDoc, String profileName)
+            throws IOException {
+        super(configuration, DocPath.forPackage(packageDoc).resolve(
+                DocPaths.profilePackageFrame(profileName)));
+        this.packageDoc = packageDoc;
+    }
+
+    /**
+     * Generate a profile package summary page for the left-hand bottom frame. Construct
+     * the ProfilePackageFrameWriter object and then uses it generate the file.
+     *
+     * @param configuration the current configuration of the doclet.
+     * @param packageDoc The package for which "profilename-package-frame.html" is to be generated.
+     * @param profileValue the value of the profile being documented
+     */
+    public static void generate(ConfigurationImpl configuration,
+            PackageDoc packageDoc, int profileValue) {
+        ProfilePackageFrameWriter profpackgen;
+        try {
+            String profileName = Profile.lookup(profileValue).name;
+            profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc,
+                    profileName);
+            StringBuilder winTitle = new StringBuilder(profileName);
+            String sep = " - ";
+            winTitle.append(sep);
+            String pkgName = Util.getPackageName(packageDoc);
+            winTitle.append(pkgName);
+            Content body = profpackgen.getBody(false,
+                    profpackgen.getWindowTitle(winTitle.toString()));
+            Content profName = new StringContent(profileName);
+            Content sepContent = new StringContent(sep);
+            Content pkgNameContent = new RawHtml(pkgName);
+            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
+                    profpackgen.getTargetProfileLink("classFrame", profName, profileName));
+            heading.addContent(sepContent);
+            heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc,
+                    "classFrame", pkgNameContent, profileName));
+            body.addContent(heading);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexContainer);
+            profpackgen.addClassListing(div, profileValue);
+            body.addContent(div);
+            profpackgen.printHtmlDocument(
+                    configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
+            profpackgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                    "doclet.exception_encountered",
+                    exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * Add class listing for all the classes in this package. Divide class
+     * listing as per the class kind and generate separate listing for
+     * Classes, Interfaces, Exceptions and Errors.
+     *
+     * @param contentTree the content tree to which the listing will be added
+     * @param profileValue the value of the profile being documented
+     */
+    protected void addClassListing(Content contentTree, int profileValue) {
+        if (packageDoc.isIncluded()) {
+            addClassKindListing(packageDoc.interfaces(),
+                getResource("doclet.Interfaces"), contentTree, profileValue);
+            addClassKindListing(packageDoc.ordinaryClasses(),
+                getResource("doclet.Classes"), contentTree, profileValue);
+            addClassKindListing(packageDoc.enums(),
+                getResource("doclet.Enums"), contentTree, profileValue);
+            addClassKindListing(packageDoc.exceptions(),
+                getResource("doclet.Exceptions"), contentTree, profileValue);
+            addClassKindListing(packageDoc.errors(),
+                getResource("doclet.Errors"), contentTree, profileValue);
+            addClassKindListing(packageDoc.annotationTypes(),
+                getResource("doclet.AnnotationTypes"), contentTree, profileValue);
+        }
+    }
+
+    /**
+     * Add specific class kind listing. Also add label to the listing.
+     *
+     * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error
+     * @param labelContent content tree of the label to be added
+     * @param contentTree the content tree to which the class kind listing will be added
+     * @param profileValue the value of the profile being documented
+     */
+    protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
+            Content contentTree, int profileValue) {
+        if(arr.length > 0) {
+            Arrays.sort(arr);
+            boolean printedHeader = false;
+            HtmlTree ul = new HtmlTree(HtmlTag.UL);
+            ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
+            for (int i = 0; i < arr.length; i++) {
+                if (!isTypeInProfile(arr[i], profileValue)) {
+                    continue;
+                }
+                if (!Util.isCoreClass(arr[i]) || !
+                        configuration.isGeneratedDoc(arr[i])) {
+                    continue;
+                }
+                if (!printedHeader) {
+                    Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
+                            true, labelContent);
+                    contentTree.addContent(heading);
+                    printedHeader = true;
+                }
+                Content link = new RawHtml (getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.PACKAGE_FRAME, arr[i],
+                        (arr[i].isInterface() ? italicsText(arr[i].name()) :
+                            arr[i].name()),"classFrame")));
+                Content li = HtmlTree.LI(link);
+                ul.addContent(li);
+            }
+            contentTree.addContent(ul);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,200 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Generate the profile package index for the left-hand frame in the generated output.
+ * A click on the package name in this frame will update the page in the bottom
+ * left hand frame with the listing of contents of the clicked profile package.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
+
+    /**
+     * Construct the ProfilePackageIndexFrameWriter object.
+     *
+     * @param configuration the configuration object
+     * @param filename Name of the package index file to be generated.
+     */
+    public ProfilePackageIndexFrameWriter(ConfigurationImpl configuration,
+                                   DocPath filename) throws IOException {
+        super(configuration, filename);
+    }
+
+    /**
+     * Generate the profile package index file.
+     * @throws DocletAbortException
+     * @param configuration the configuration object
+     * @param profileName the name of the profile being documented
+     */
+    public static void generate(ConfigurationImpl configuration, String profileName) {
+        ProfilePackageIndexFrameWriter profpackgen;
+        DocPath filename = DocPaths.profileFrame(profileName);
+        try {
+            profpackgen = new ProfilePackageIndexFrameWriter(configuration, filename);
+            profpackgen.buildProfilePackagesIndexFile("doclet.Window_Overview", false, profileName);
+            profpackgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                        "doclet.exception_encountered",
+                        exc.toString(), filename);
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+        Content profNameContent = new StringContent(profileName);
+        Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
+                getTargetProfileLink("classFrame", profNameContent, profileName));
+        heading.addContent(getSpace());
+        heading.addContent(packagesLabel);
+        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
+        PackageDoc[] packages = configuration.profilePackages.get(profileName);
+        for (int i = 0; i < packages.length; i++) {
+            if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
+                ul.addContent(getPackage(packages[i], profileName));
+            }
+        }
+        div.addContent(ul);
+        body.addContent(div);
+    }
+
+    /**
+     * Gets each package name as a separate link.
+     *
+     * @param pd PackageDoc
+     * @param profileName the name of the profile being documented
+     * @return content for the package link
+     */
+    protected Content getPackage(PackageDoc pd, String profileName) {
+        Content packageLinkContent;
+        Content pkgLabel;
+        if (pd.name().length() > 0) {
+            pkgLabel = getPackageLabel(pd.name());
+            packageLinkContent = getHyperLink(pathString(pd,
+                     DocPaths.profilePackageFrame(profileName)), pkgLabel, "",
+                    "packageFrame");
+        } else {
+            pkgLabel = new RawHtml("&lt;unnamed package&gt;");
+            packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
+                    pkgLabel, "", "packageFrame");
+        }
+        Content li = HtmlTree.LI(packageLinkContent);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarHeader(Content body) {
+        Content headerContent;
+        if (configuration.packagesheader.length() > 0) {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
+        } else {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
+        }
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.bar, headerContent);
+        body.addContent(heading);
+    }
+
+    /**
+     * Do nothing as there is no overview information in this page.
+     */
+    protected void addOverviewHeader(Content body) {
+    }
+
+    protected void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body) {
+    }
+
+    /**
+     * Adds "All Classes" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all classes link should be added
+     */
+    protected void addAllClassesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
+                allclassesLabel, "", "packageFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Packages" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all packages link should be added
+     */
+    protected void addAllPackagesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
+                allpackagesLabel, "", "profileListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Profiles" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all profiles link should be added
+     */
+    protected void addAllProfilesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
+                allprofilesLabel, "", "profileListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarFooter(Content body) {
+        Content p = HtmlTree.P(getSpace());
+        body.addContent(p);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,296 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each profile package contents in the right-hand
+ * frame. This will list all the Class Kinds in the package. A click on any
+ * class-kind will update the frame with the clicked class-kind page.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageWriterImpl extends HtmlDocletWriter
+    implements ProfilePackageSummaryWriter {
+
+    /**
+     * The prev package name in the alpha-order list.
+     */
+    protected PackageDoc prev;
+
+    /**
+     * The next package name in the alpha-order list.
+     */
+    protected PackageDoc next;
+
+    /**
+     * The profile package being documented.
+     */
+    protected PackageDoc packageDoc;
+
+    /**
+     * The name of the profile being documented.
+     */
+    protected String profileName;
+
+    /**
+     * The value of the profile being documented.
+     */
+    protected int profileValue;
+
+    /**
+     * Constructor to construct ProfilePackageWriter object and to generate
+     * "profilename-package-summary.html" file in the respective package directory.
+     * For example for profile compact1 and package "java.lang" this will generate file
+     * "compact1-package-summary.html" file in the "java/lang" directory. It will also
+     * create "java/lang" directory in the current or the destination directory
+     * if it doesn't exist.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param packageDoc    PackageDoc under consideration.
+     * @param prev          Previous package in the sorted array.
+     * @param next          Next package in the sorted array.
+     * @param profile       The profile being documented.
+     */
+    public ProfilePackageWriterImpl(ConfigurationImpl configuration,
+            PackageDoc packageDoc, PackageDoc prev, PackageDoc next,
+            Profile profile) throws IOException {
+        super(configuration, DocPath.forPackage(packageDoc).resolve(
+                DocPaths.profilePackageSummary(profile.name)));
+        this.prev = prev;
+        this.next = next;
+        this.packageDoc = packageDoc;
+        this.profileName = profile.name;
+        this.profileValue = profile.value;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageHeader(String heading) {
+        String pkgName = packageDoc.name();
+        Content bodyTree = getBody(true, getWindowTitle(pkgName));
+        addTop(bodyTree);
+        addNavLinks(true, bodyTree);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.header);
+        Content profileContent = new StringContent(profileName);
+        Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profileContent);
+        div.addContent(profileNameDiv);
+        Content annotationContent = new HtmlTree(HtmlTag.P);
+        addAnnotationInfo(packageDoc, annotationContent);
+        div.addContent(annotationContent);
+        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.title, packageLabel);
+        tHeading.addContent(getSpace());
+        Content packageHead = new RawHtml(heading);
+        tHeading.addContent(packageHead);
+        div.addContent(tHeading);
+        addDeprecationInfo(div);
+        if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
+            HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
+            docSummaryDiv.addStyle(HtmlStyle.docSummary);
+            addSummaryComment(packageDoc, docSummaryDiv);
+            div.addContent(docSummaryDiv);
+            Content space = getSpace();
+            Content descLink = getHyperLink(DocLink.fragment("package_description"),
+                    descriptionLabel, "", "");
+            Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
+            div.addContent(descPara);
+        }
+        bodyTree.addContent(div);
+        return bodyTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getContentHeader() {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.contentContainer);
+        return div;
+    }
+
+    /**
+     * Add the package deprecation information to the documentation tree.
+     *
+     * @param div the content tree to which the deprecation information will be added
+     */
+    public void addDeprecationInfo(Content div) {
+        Tag[] deprs = packageDoc.tags("deprecated");
+        if (Util.isDeprecated(packageDoc)) {
+            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
+            deprDiv.addStyle(HtmlStyle.deprecatedContent);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
+            deprDiv.addContent(deprPhrase);
+            if (deprs.length > 0) {
+                Tag[] commentTags = deprs[0].inlineTags();
+                if (commentTags.length > 0) {
+                    addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv);
+                }
+            }
+            div.addContent(deprDiv);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
+        addClassesSummary(classes, label, tableSummary, tableHeader,
+                packageSummaryContentTree, profileValue);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryHeader() {
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addStyle(HtmlStyle.blockList);
+        return ul;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageDescription(Content packageContentTree) {
+        if (packageDoc.inlineTags().length > 0) {
+            packageContentTree.addContent(getMarkerAnchor("package_description"));
+            Content h2Content = new StringContent(
+                    configuration.getText("doclet.Package_Description",
+                    packageDoc.name()));
+            packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
+                    true, h2Content));
+            addInlineComment(packageDoc, packageContentTree);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageTags(Content packageContentTree) {
+        addTagsInfo(packageDoc, packageContentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageFooter(Content contentTree) {
+        addNavLinks(false, contentTree);
+        addBottom(contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void printDocument(Content contentTree) throws IOException {
+        printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
+                true, contentTree);
+    }
+
+    /**
+     * Get "Use" link for this package in the navigation bar.
+     *
+     * @return a content tree for the class use link
+     */
+    protected Content getNavLinkClassUse() {
+        Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
+                useLabel, "", "");
+        Content li = HtmlTree.LI(useLink);
+        return li;
+    }
+
+    /**
+     * Get "PREV PACKAGE" link in the navigation bar.
+     *
+     * @return a content tree for the previous link
+     */
+    public Content getNavLinkPrevious() {
+        Content li;
+        if (prev == null) {
+            li = HtmlTree.LI(prevpackageLabel);
+        } else {
+            DocPath path = DocPath.relativePath(packageDoc, prev);
+            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
+                prevpackageLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "NEXT PACKAGE" link in the navigation bar.
+     *
+     * @return a content tree for the next link
+     */
+    public Content getNavLinkNext() {
+        Content li;
+        if (next == null) {
+            li = HtmlTree.LI(nextpackageLabel);
+        } else {
+            DocPath path = DocPath.relativePath(packageDoc, next);
+            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
+                nextpackageLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "Tree" link in the navigation bar. This will be link to the package
+     * tree file.
+     *
+     * @return a content tree for the tree link
+     */
+    protected Content getNavLinkTree() {
+        Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
+                treeLabel, "", "");
+        Content li = HtmlTree.LI(useLink);
+        return li;
+    }
+
+    /**
+     * Highlight "Package" in the navigation bar, as this is the package page.
+     *
+     * @return a content tree for the package link
+     */
+    protected Content getNavLinkPackage() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
+        return li;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,208 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each profile contents in the right-hand
+ * frame. This will list all the packages and Class Kinds in the profile. A click on any
+ * class-kind will update the frame with the clicked class-kind page. A click on any
+ * package will update the frame with the clicked profile package page.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfileWriterImpl extends HtmlDocletWriter
+    implements ProfileSummaryWriter {
+
+    /**
+     * The prev profile name in the alpha-order list.
+     */
+    protected Profile prevProfile;
+
+    /**
+     * The next profile name in the alpha-order list.
+     */
+    protected Profile nextProfile;
+
+    /**
+     * The profile being documented.
+     */
+    protected Profile profile;
+
+    /**
+     * Constructor to construct ProfileWriter object and to generate
+     * "profileName-summary.html" file.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param profile       Profile under consideration.
+     * @param prevProfile   Previous profile in the sorted array.
+     * @param nextProfile   Next profile in the sorted array.
+     */
+    public ProfileWriterImpl(ConfigurationImpl configuration,
+            Profile profile, Profile prevProfile, Profile nextProfile)
+            throws IOException {
+        super(configuration, DocPaths.profileSummary(profile.name));
+        this.prevProfile = prevProfile;
+        this.nextProfile = nextProfile;
+        this.profile = profile;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getProfileHeader(String heading) {
+        String profileName = profile.name;
+        Content bodyTree = getBody(true, getWindowTitle(profileName));
+        addTop(bodyTree);
+        addNavLinks(true, bodyTree);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.header);
+        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.title, profileLabel);
+        tHeading.addContent(getSpace());
+        Content profileHead = new RawHtml(heading);
+        tHeading.addContent(profileHead);
+        div.addContent(tHeading);
+        bodyTree.addContent(div);
+        return bodyTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getContentHeader() {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.contentContainer);
+        return div;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryHeader() {
+        HtmlTree li = new HtmlTree(HtmlTag.LI);
+        li.addStyle(HtmlStyle.blockList);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryTree(Content summaryContentTree) {
+        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
+        HtmlTree div = HtmlTree.DIV(HtmlStyle.summary, ul);
+        return div;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageSummaryHeader(PackageDoc pkg) {
+        Content pkgName = getTargetProfilePackageLink(pkg,
+                    "classFrame", new StringContent(pkg.name()), profile.name);
+        Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
+        HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageSummaryTree(Content packageSummaryContentTree) {
+        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
+        return ul;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
+        addClassesSummary(classes, label, tableSummary, tableHeader,
+                packageSummaryContentTree, profile.value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addProfileFooter(Content contentTree) {
+        addNavLinks(false, contentTree);
+        addBottom(contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void printDocument(Content contentTree) throws IOException {
+        printHtmlDocument(configuration.metakeywords.getMetaKeywords(profile),
+                true, contentTree);
+    }
+
+    /**
+     * Get "PREV PROFILE" link in the navigation bar.
+     *
+     * @return a content tree for the previous link
+     */
+    public Content getNavLinkPrevious() {
+        Content li;
+        if (prevProfile == null) {
+            li = HtmlTree.LI(prevprofileLabel);
+        } else {
+            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
+                    prevProfile.name)), prevprofileLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "NEXT PROFILE" link in the navigation bar.
+     *
+     * @return a content tree for the next link
+     */
+    public Content getNavLinkNext() {
+        Content li;
+        if (nextProfile == null) {
+            li = HtmlTree.LI(nextprofileLabel);
+        } else {
+            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
+                    nextProfile.name)), nextprofileLabel, "", ""));
+        }
+        return li;
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -28,6 +28,7 @@
 import java.io.IOException;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -69,6 +70,24 @@
     /**
      * {@inheritDoc}
      */
+    public ProfileSummaryWriter getProfileSummaryWriter(Profile profile,
+        Profile prevProfile, Profile nextProfile) throws Exception {
+        return new ProfileWriterImpl(configuration, profile,
+            prevProfile, nextProfile);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(PackageDoc packageDoc,
+        PackageDoc prevPkg, PackageDoc nextPkg, Profile profile) throws Exception {
+        return new ProfilePackageWriterImpl(configuration, packageDoc,
+            prevPkg, nextPkg, profile);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
             ClassDoc nextClass, ClassTree classTree) throws IOException {
         return new ClassWriterImpl(configuration, classDoc,
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, 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
@@ -168,6 +168,11 @@
     public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
 
     /**
+     * Html tag for the profile name heading.
+     */
+    public static final HtmlTag PROFILE_HEADING = HtmlTag.H2;
+
+    /**
      * Html tag for the member summary heading.
      */
     public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -63,6 +63,11 @@
     protected boolean memberDetailsListPrinted;
 
     /**
+     * Header for table displaying profiles and description..
+     */
+    protected final String[] profileTableHeader;
+
+    /**
      * Header for tables displaying packages and description..
      */
     protected final String[] packageTableHeader;
@@ -83,6 +88,8 @@
 
     public final Content packageLabel;
 
+    public final Content profileLabel;
+
     public final Content useLabel;
 
     public final Content prevLabel;
@@ -111,6 +118,10 @@
 
     public final Content allclassesLabel;
 
+    public final Content allpackagesLabel;
+
+    public final Content allprofilesLabel;
+
     public final Content indexLabel;
 
     public final Content helpLabel;
@@ -123,8 +134,14 @@
 
     public final Content nextpackageLabel;
 
+    public final Content prevprofileLabel;
+
+    public final Content nextprofileLabel;
+
     public final Content packagesLabel;
 
+    public final Content profilesLabel;
+
     public final Content methodDetailsLabel;
 
     public final Content annotationTypeDetailsLabel;
@@ -162,6 +179,10 @@
         writer = DocFile.createFileForOutput(configuration, path).openWriter();
         this.configuration = configuration;
         this.memberDetailsListPrinted = false;
+        profileTableHeader = new String[] {
+            configuration.getText("doclet.Profile"),
+            configuration.getText("doclet.Description")
+        };
         packageTableHeader = new String[] {
             configuration.getText("doclet.Package"),
             configuration.getText("doclet.Description")
@@ -175,6 +196,7 @@
         defaultPackageLabel = new RawHtml(
                 DocletConstants.DEFAULT_PACKAGE_NAME);
         packageLabel = getResource("doclet.Package");
+        profileLabel = getResource("doclet.Profile");
         useLabel = getResource("doclet.navClassUse");
         prevLabel = getResource("doclet.Prev");
         nextLabel = getResource("doclet.Next");
@@ -189,13 +211,18 @@
         deprecatedLabel = getResource("doclet.navDeprecated");
         deprecatedPhrase = getResource("doclet.Deprecated");
         allclassesLabel = getResource("doclet.All_Classes");
+        allpackagesLabel = getResource("doclet.All_Packages");
+        allprofilesLabel = getResource("doclet.All_Profiles");
         indexLabel = getResource("doclet.Index");
         helpLabel = getResource("doclet.Help");
         seeLabel = getResource("doclet.See");
         descriptionLabel = getResource("doclet.Description");
         prevpackageLabel = getResource("doclet.Prev_Package");
         nextpackageLabel = getResource("doclet.Next_Package");
+        prevprofileLabel = getResource("doclet.Prev_Profile");
+        nextprofileLabel = getResource("doclet.Next_Profile");
         packagesLabel = getResource("doclet.Packages");
+        profilesLabel = getResource("doclet.Profiles");
         methodDetailsLabel = getResource("doclet.Method_Detail");
         annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
         fieldDetailsLabel = getResource("doclet.Field_Detail");
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Feb 21 17:43:57 2013 -0800
@@ -4,7 +4,9 @@
 doclet.Window_Overview=Overview List
 doclet.Window_Overview_Summary=Overview
 doclet.Package=Package
+doclet.Profile=Profile
 doclet.All_Packages=All Packages
+doclet.All_Profiles=All Profiles
 doclet.Tree=Tree
 doclet.Class_Hierarchy=Class Hierarchy
 doclet.Window_Class_Hierarchy=Class Hierarchy
@@ -17,6 +19,8 @@
 doclet.Next_Class=Next Class
 doclet.Prev_Package=Prev Package
 doclet.Next_Package=Next Package
+doclet.Prev_Profile=Prev Profile
+doclet.Next_Profile=Next Profile
 doclet.Prev_Letter=Prev Letter
 doclet.Next_Letter=Next Letter
 doclet.Href_Class_Title=class in {0}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -28,8 +28,6 @@
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
-import java.io.File;
-import java.util.StringTokenizer;
 
 /**
  * An abstract implementation of a Doclet.
@@ -128,6 +126,7 @@
 
         PackageListWriter.generate(configuration);
         generatePackageFiles(classtree);
+        generateProfileFiles();
 
         generateOtherFiles(root, classtree);
         configuration.tagletManager.printReport();
@@ -148,6 +147,12 @@
     }
 
     /**
+     * Generate the profile documentation.
+     *
+     */
+    protected abstract void generateProfileFiles() throws Exception;
+
+    /**
      * Generate the package documentation.
      *
      * @param classtree the data structure representing the class tree.
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Feb 21 17:43:57 2013 -0800
@@ -29,6 +29,8 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -188,6 +190,17 @@
     public String sourcepath = "";
 
     /**
+     * Argument for command line option "-Xprofilespath".
+     */
+    public String profilespath = "";
+
+    /**
+     * Generate profiles documentation if profilespath is set and valid profiles
+     * are present.
+     */
+    public boolean showProfiles = false;
+
+    /**
      * Don't generate deprecated API information at all, if -nodeprecated
      * option is used. <code>nodepracted</code> is set to true if
      * -nodeprecated option is used. Default is generate deprected API
@@ -247,6 +260,16 @@
     public abstract MessageRetriever getDocletSpecificMsg();
 
     /**
+     * A profiles object used to access profiles across various pages.
+     */
+    public Profiles profiles;
+
+    /**
+     * An map of the profiles to packages.
+     */
+    public Map<String,PackageDoc[]> profilePackages;
+
+    /**
      * An array of the packages specified on the command-line merged
      * with the array of packages that contain the classes specified on the
      * command-line.  The array is sorted.
@@ -315,7 +338,8 @@
                    option.equals("-sourcepath") ||
                    option.equals("-tag") ||
                    option.equals("-taglet") ||
-                   option.equals("-tagletpath")) {
+                   option.equals("-tagletpath") ||
+                   option.equals("-xprofilespath")) {
             return 2;
         } else if (option.equals("-group") ||
                    option.equals("-linkoffline")) {
@@ -334,6 +358,38 @@
     public abstract boolean validOptions(String options[][],
         DocErrorReporter reporter);
 
+    private void initProfiles() throws IOException {
+        profiles = Profiles.read(new File(profilespath));
+        // Generate profiles documentation only is profilespath is set and if
+        // profiles is not null and profiles count is 1 or more.
+        showProfiles = (!profilespath.isEmpty() && profiles != null &&
+                profiles.getProfileCount() > 0);
+    }
+
+    private void initProfilePackages() throws IOException {
+        profilePackages = new HashMap<String,PackageDoc[]>();
+        ArrayList<PackageDoc> results;
+        Map<String,PackageDoc> packageIndex = new HashMap<String,PackageDoc>();
+        for (int i = 0; i < packages.length; i++) {
+            PackageDoc pkg = packages[i];
+            packageIndex.put(pkg.name(), pkg);
+        }
+        for (int i = 1; i < profiles.getProfileCount(); i++) {
+            Set<String> profPkgs = profiles.getPackages(i);
+            results = new ArrayList<PackageDoc>();
+            for (String packageName : profPkgs) {
+                packageName = packageName.replace("/", ".");
+                PackageDoc profPkg = packageIndex.get(packageName);
+                if (profPkg != null) {
+                    results.add(profPkg);
+                }
+            }
+            Collections.sort(results);
+            PackageDoc[] profilePkgs = results.toArray(new PackageDoc[]{});
+            profilePackages.put(Profile.lookup(i).name, profilePkgs);
+        }
+    }
+
     private void initPackageArray() {
         Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
         ClassDoc[] classes = root.specifiedClasses();
@@ -404,6 +460,8 @@
                 customTagStrs.add(os);
             } else if (opt.equals("-tagletpath")) {
                 tagletpath = os[1];
+            }  else if (opt.equals("-xprofilespath")) {
+                profilespath = os[1];
             } else if (opt.equals("-keywords")) {
                 keywords = true;
             } else if (opt.equals("-serialwarn")) {
@@ -439,6 +497,14 @@
     public void setOptions() {
         initPackageArray();
         setOptions(root.options());
+        if (!profilespath.isEmpty()) {
+            try {
+                initProfiles();
+                initProfilePackages();
+            } catch (Exception e) {
+                throw new DocletAbortException();
+            }
+        }
         setSpecificDocletOptions(root.options());
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfilePackageSummaryWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.internal.toolkit;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+
+/**
+ * The interface for writing profile package summary output.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+
+public interface ProfilePackageSummaryWriter {
+
+    /**
+     * Get the header for the summary.
+     *
+     * @param heading Package name.
+     * @return the header to be added to the content tree
+     */
+    public abstract Content getPackageHeader(String heading);
+
+    /**
+     * Get the header for the content.
+     *
+     * @return a content tree for the content header
+     */
+    public abstract Content getContentHeader();
+
+    /**
+     * Get the header for the package summary.
+     *
+     * @return a content tree with the package summary header
+     */
+    public abstract Content getSummaryHeader();
+
+    /**
+     * Adds the table of classes to the documentation tree.
+     *
+     * @param classes the array of classes to document.
+     * @param label the label for this table.
+     * @param tableSummary the summary string for the table
+     * @param tableHeader array of table headers
+     * @param summaryContentTree the content tree to which the summaries will be added
+     */
+    public abstract void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content summaryContentTree);
+
+    /**
+     * Adds the package description from the "packages.html" file to the documentation
+     * tree.
+     *
+     * @param packageContentTree the content tree to which the package description
+     *                           will be added
+     */
+    public abstract void addPackageDescription(Content packageContentTree);
+
+    /**
+     * Adds the tag information from the "packages.html" file to the documentation
+     * tree.
+     *
+     * @param packageContentTree the content tree to which the package tags will
+     *                           be added
+     */
+    public abstract void addPackageTags(Content packageContentTree);
+
+    /**
+     * Adds the footer to the documentation tree.
+     *
+     * @param contentTree the tree to which the footer will be added
+     */
+    public abstract void addPackageFooter(Content contentTree);
+
+    /**
+     * Print the package summary document.
+     *
+     * @param contentTree the content tree that will be printed
+     */
+    public abstract void printDocument(Content contentTree) throws IOException;
+
+    /**
+     * Close the writer.
+     */
+    public abstract void close() throws IOException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfileSummaryWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.internal.toolkit;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+
+/**
+ * The interface for writing profile summary output.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+
+public interface ProfileSummaryWriter {
+
+    /**
+     * Get the header for the summary.
+     *
+     * @param heading profile name.
+     * @return the header to be added to the content tree
+     */
+    public abstract Content getProfileHeader(String heading);
+
+    /**
+     * Get the header for the profile content.
+     *
+     * @return a content tree for the profile content header
+     */
+    public abstract Content getContentHeader();
+
+    /**
+     * Get the header for the summary header.
+     *
+     * @return a content tree with the summary header
+     */
+    public abstract Content getSummaryHeader();
+
+    /**
+     * Get the header for the summary tree.
+     *
+     * @param summaryContentTree the content tree.
+     * @return a content tree with the summary tree
+     */
+    public abstract Content getSummaryTree(Content summaryContentTree);
+
+    /**
+     * Get the header for the package summary header.
+     *
+     * @return a content tree with the package summary header
+     */
+    public abstract Content getPackageSummaryHeader(PackageDoc pkg);
+
+    /**
+     * Get the header for the package summary tree.
+     *
+     * @return a content tree with the package summary
+     */
+    public abstract Content getPackageSummaryTree(Content packageSummaryContentTree);
+
+    /**
+     * Adds the table of classes to the documentation tree.
+     *
+     * @param classes the array of classes to document.
+     * @param label the label for this table.
+     * @param tableSummary the summary string for the table
+     * @param tableHeader array of table headers
+     * @param packageSummaryContentTree the content tree to which the summaries will be added
+     */
+    public abstract void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree);
+
+    /**
+     * Adds the footer to the documentation tree.
+     *
+     * @param contentTree the tree to which the footer will be added
+     */
+    public abstract void addProfileFooter(Content contentTree);
+
+    /**
+     * Print the profile summary document.
+     *
+     * @param contentTree the content tree that will be printed
+     */
+    public abstract void printDocument(Content contentTree) throws IOException;
+
+    /**
+     * Close the writer.
+     */
+    public abstract void close() throws IOException;
+
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -26,6 +26,7 @@
 package com.sun.tools.doclets.internal.toolkit;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
@@ -65,6 +66,33 @@
     throws Exception;
 
     /**
+     * Return the writer for the profile summary.
+     *
+     * @param profile the profile being documented.
+     * @param prevProfile the previous profile that was documented.
+     * @param nextProfile the next profile being documented.
+     * @return the writer for the profile summary.  Return null if this
+     * writer is not supported by the doclet.
+     */
+    public abstract ProfileSummaryWriter getProfileSummaryWriter(Profile
+        profile, Profile prevProfile, Profile nextProfile)
+    throws Exception;
+
+    /**
+     * Return the writer for the profile package summary.
+     *
+     * @param packageDoc the profile package being documented.
+     * @param prevPkg the previous profile package that was documented.
+     * @param nextPkg the next profile package being documented.
+     * @param profile the profile being documented.
+     * @return the writer for the profile package summary.  Return null if this
+     * writer is not supported by the doclet.
+     */
+    public abstract ProfilePackageSummaryWriter getProfilePackageSummaryWriter(
+            PackageDoc packageDoc, PackageDoc prevPkg, PackageDoc nextPkg,
+            Profile profile) throws Exception;
+
+    /**
      * Return the writer for a class.
      *
      * @param classDoc the class being documented.
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -29,6 +29,7 @@
 import java.util.Set;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -96,6 +97,36 @@
     }
 
     /**
+     * Return the builder that builds the profile summary.
+     *
+     * @param profile the profile being documented.
+     * @param prevProfile the previous profile being documented.
+     * @param nextProfile the next profile being documented.
+     * @return the builder that builds the profile summary.
+     */
+    public AbstractBuilder getProfileSummaryBuilder(Profile profile, Profile prevProfile,
+            Profile nextProfile) throws Exception {
+        return ProfileSummaryBuilder.getInstance(context, profile,
+            writerFactory.getProfileSummaryWriter(profile, prevProfile, nextProfile));
+    }
+
+    /**
+     * Return the builder that builds the profile package summary.
+     *
+     * @param pkg the profile package being documented.
+     * @param prevPkg the previous profile package being documented.
+     * @param nextPkg the next profile package being documented.
+     * @param profile the profile being documented.
+     * @return the builder that builds the profile package summary.
+     */
+    public AbstractBuilder getProfilePackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
+            PackageDoc nextPkg, Profile profile) throws Exception {
+        return ProfilePackageSummaryBuilder.getInstance(context, pkg,
+            writerFactory.getProfilePackageSummaryWriter(pkg, prevPkg, nextPkg,
+                profile), profile);
+    }
+
+    /**
      * Return the builder for the class.
      *
      * @param classDoc the class being documented.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,374 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.internal.toolkit.builders;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds the summary for a given profile package.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfilePackageSummaryBuilder extends AbstractBuilder {
+    /**
+     * The root element of the profile package summary XML is {@value}.
+     */
+    public static final String ROOT = "PackageDoc";
+
+    /**
+     * The profile package being documented.
+     */
+    private final PackageDoc packageDoc;
+
+    /**
+     * The name of the profile being documented.
+     */
+    private final String profileName;
+
+    /**
+     * The value of the profile being documented.
+     */
+    private final int profileValue;
+
+    /**
+     * The doclet specific writer that will output the result.
+     */
+    private final ProfilePackageSummaryWriter profilePackageWriter;
+
+    /**
+     * The content that will be added to the profile package summary documentation tree.
+     */
+    private Content contentTree;
+
+    /**
+     * Construct a new ProfilePackageSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param pkg the profile package being documented.
+     * @param profilePackageWriter the doclet specific writer that will output the
+     *        result.
+     * @param profile the profile being documented.
+     */
+    private ProfilePackageSummaryBuilder(Context context,
+            PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
+            Profile profile) {
+        super(context);
+        this.packageDoc = pkg;
+        this.profilePackageWriter = profilePackageWriter;
+        this.profileName = profile.name;
+        this.profileValue = profile.value;
+    }
+
+    /**
+     * Construct a new ProfilePackageSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param pkg the profile package being documented.
+     * @param profilePackageWriter the doclet specific writer that will output the
+     *        result.
+     * @param profile the profile being documented.
+     *
+     * @return an instance of a ProfilePackageSummaryBuilder.
+     */
+    public static ProfilePackageSummaryBuilder getInstance(Context context,
+            PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
+            Profile profile) {
+        return new ProfilePackageSummaryBuilder(context, pkg, profilePackageWriter,
+                profile);
+    }
+
+    /**
+     * Build the profile package summary.
+     */
+    public void build() throws IOException {
+        if (profilePackageWriter == null) {
+            //Doclet does not support this output.
+            return;
+        }
+        build(layoutParser.parseXML(ROOT), contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return ROOT;
+    }
+
+    /**
+     * Build the profile package documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the documentation will be added
+     */
+    public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
+        contentTree = profilePackageWriter.getPackageHeader(
+                Util.getPackageName(packageDoc));
+        buildChildren(node, contentTree);
+        profilePackageWriter.addPackageFooter(contentTree);
+        profilePackageWriter.printDocument(contentTree);
+        profilePackageWriter.close();
+        Util.copyDocFiles(configuration, packageDoc);
+    }
+
+    /**
+     * Build the content for the profile package doc.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the package contents
+     *                    will be added
+     */
+    public void buildContent(XMLNode node, Content contentTree) {
+        Content packageContentTree = profilePackageWriter.getContentHeader();
+        buildChildren(node, packageContentTree);
+        contentTree.addContent(packageContentTree);
+    }
+
+    /**
+     * Build the profile package summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the package content tree to which the summaries will
+     *                           be added
+     */
+    public void buildSummary(XMLNode node, Content packageContentTree) {
+        Content summaryContentTree = profilePackageWriter.getSummaryHeader();
+        buildChildren(node, summaryContentTree);
+        packageContentTree.addContent(summaryContentTree);
+    }
+
+    /**
+     * Build the summary for the interfaces in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the interface summary
+     *                           will be added
+     */
+    public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
+        String interfaceTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Interface_Summary"),
+                configuration.getText("doclet.interfaces"));
+        String[] interfaceTableHeader = new String[] {
+            configuration.getText("doclet.Interface"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] interfaces =
+                packageDoc.isIncluded()
+                        ? packageDoc.interfaces()
+                        : configuration.classDocCatalog.interfaces(
+                                Util.getPackageName(packageDoc));
+        if (interfaces.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    interfaces,
+                    configuration.getText("doclet.Interface_Summary"),
+                    interfaceTableSummary, interfaceTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the classes in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the class summary will
+     *                           be added
+     */
+    public void buildClassSummary(XMLNode node, Content summaryContentTree) {
+        String classTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Class_Summary"),
+                configuration.getText("doclet.classes"));
+        String[] classTableHeader = new String[] {
+            configuration.getText("doclet.Class"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] classes =
+                packageDoc.isIncluded()
+                        ? packageDoc.ordinaryClasses()
+                        : configuration.classDocCatalog.ordinaryClasses(
+                                Util.getPackageName(packageDoc));
+        if (classes.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    classes,
+                    configuration.getText("doclet.Class_Summary"),
+                    classTableSummary, classTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the enums in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the enum summary will
+     *                           be added
+     */
+    public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
+        String enumTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Enum_Summary"),
+                configuration.getText("doclet.enums"));
+        String[] enumTableHeader = new String[] {
+            configuration.getText("doclet.Enum"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] enums =
+                packageDoc.isIncluded()
+                        ? packageDoc.enums()
+                        : configuration.classDocCatalog.enums(
+                                Util.getPackageName(packageDoc));
+        if (enums.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    enums,
+                    configuration.getText("doclet.Enum_Summary"),
+                    enumTableSummary, enumTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the exceptions in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the exception summary will
+     *                           be added
+     */
+    public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
+        String exceptionTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Exception_Summary"),
+                configuration.getText("doclet.exceptions"));
+        String[] exceptionTableHeader = new String[] {
+            configuration.getText("doclet.Exception"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] exceptions =
+                packageDoc.isIncluded()
+                        ? packageDoc.exceptions()
+                        : configuration.classDocCatalog.exceptions(
+                                Util.getPackageName(packageDoc));
+        if (exceptions.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    exceptions,
+                    configuration.getText("doclet.Exception_Summary"),
+                    exceptionTableSummary, exceptionTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the errors in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the error summary will
+     *                           be added
+     */
+    public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
+        String errorTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Error_Summary"),
+                configuration.getText("doclet.errors"));
+        String[] errorTableHeader = new String[] {
+            configuration.getText("doclet.Error"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] errors =
+                packageDoc.isIncluded()
+                        ? packageDoc.errors()
+                        : configuration.classDocCatalog.errors(
+                                Util.getPackageName(packageDoc));
+        if (errors.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    errors,
+                    configuration.getText("doclet.Error_Summary"),
+                    errorTableSummary, errorTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the annotation type in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the annotation type
+     *                           summary will be added
+     */
+    public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
+        String annotationtypeTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Types_Summary"),
+                configuration.getText("doclet.annotationtypes"));
+        String[] annotationtypeTableHeader = new String[] {
+            configuration.getText("doclet.AnnotationType"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] annotationTypes =
+                packageDoc.isIncluded()
+                        ? packageDoc.annotationTypes()
+                        : configuration.classDocCatalog.annotationTypes(
+                                Util.getPackageName(packageDoc));
+        if (annotationTypes.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    annotationTypes,
+                    configuration.getText("doclet.Annotation_Types_Summary"),
+                    annotationtypeTableSummary, annotationtypeTableHeader,
+                    summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the description of the summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the tree to which the package description will
+     *                           be added
+     */
+    public void buildPackageDescription(XMLNode node, Content packageContentTree) {
+        if (configuration.nocomment) {
+            return;
+        }
+        profilePackageWriter.addPackageDescription(packageContentTree);
+    }
+
+    /**
+     * Build the tags of the summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the tree to which the package tags will be added
+     */
+    public void buildPackageTags(XMLNode node, Content packageContentTree) {
+        if (configuration.nocomment) {
+            return;
+        }
+        profilePackageWriter.addPackageTags(packageContentTree);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,328 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.internal.toolkit.builders;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds the summary for a given profile.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public class ProfileSummaryBuilder extends AbstractBuilder {
+    /**
+     * The root element of the profile summary XML is {@value}.
+     */
+    public static final String ROOT = "ProfileDoc";
+
+    /**
+     * The profile being documented.
+     */
+    private final Profile profile;
+
+    /**
+     * The doclet specific writer that will output the result.
+     */
+    private final ProfileSummaryWriter profileWriter;
+
+    /**
+     * The content that will be added to the profile summary documentation tree.
+     */
+    private Content contentTree;
+
+    /**
+     * The profile package being documented.
+     */
+    private PackageDoc pkg;
+
+    /**
+     * Construct a new ProfileSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param profile the profile being documented.
+     * @param profileWriter the doclet specific writer that will output the
+     *        result.
+     */
+    private ProfileSummaryBuilder(Context context,
+            Profile profile, ProfileSummaryWriter profileWriter) {
+        super(context);
+        this.profile = profile;
+        this.profileWriter = profileWriter;
+    }
+
+    /**
+     * Construct a new ProfileSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param profile the profile being documented.
+     * @param profileWriter the doclet specific writer that will output the
+     *        result.
+     *
+     * @return an instance of a ProfileSummaryBuilder.
+     */
+    public static ProfileSummaryBuilder getInstance(Context context,
+            Profile profile, ProfileSummaryWriter profileWriter) {
+        return new ProfileSummaryBuilder(context, profile, profileWriter);
+    }
+
+    /**
+     * Build the profile summary.
+     */
+    public void build() throws IOException {
+        if (profileWriter == null) {
+            //Doclet does not support this output.
+            return;
+        }
+        build(layoutParser.parseXML(ROOT), contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return ROOT;
+    }
+
+    /**
+     * Build the profile documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the documentation will be added
+     */
+    public void buildProfileDoc(XMLNode node, Content contentTree) throws Exception {
+        contentTree = profileWriter.getProfileHeader(profile.name);
+        buildChildren(node, contentTree);
+        profileWriter.addProfileFooter(contentTree);
+        profileWriter.printDocument(contentTree);
+        profileWriter.close();
+        Util.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
+    }
+
+    /**
+     * Build the content for the profile doc.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the profile contents
+     *                    will be added
+     */
+    public void buildContent(XMLNode node, Content contentTree) {
+        Content profileContentTree = profileWriter.getContentHeader();
+        buildChildren(node, profileContentTree);
+        contentTree.addContent(profileContentTree);
+    }
+
+    /**
+     * Build the profile summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param profileContentTree the profile content tree to which the summaries will
+     *                           be added
+     */
+    public void buildSummary(XMLNode node, Content profileContentTree) {
+        Content summaryContentTree = profileWriter.getSummaryHeader();
+        buildChildren(node, summaryContentTree);
+        profileContentTree.addContent(profileWriter.getSummaryTree(summaryContentTree));
+    }
+
+    /**
+     * Build the profile package summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the content tree to which the summaries will
+     *                           be added
+     */
+    public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
+        PackageDoc[] packages = configuration.profilePackages.get(profile.name);
+        for (int i = 0; i < packages.length; i++) {
+            this.pkg = packages[i];
+            Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
+            buildChildren(node, packageSummaryContentTree);
+            summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
+                    packageSummaryContentTree));
+        }
+    }
+
+    /**
+     * Build the summary for the interfaces in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the interface summary
+     *                           will be added
+     */
+    public void buildInterfaceSummary(XMLNode node, Content packageSummaryContentTree) {
+        String interfaceTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Interface_Summary"),
+                configuration.getText("doclet.interfaces"));
+        String[] interfaceTableHeader = new String[] {
+            configuration.getText("doclet.Interface"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] interfaces = pkg.interfaces();
+        if (interfaces.length > 0) {
+            profileWriter.addClassesSummary(
+                    interfaces,
+                    configuration.getText("doclet.Interface_Summary"),
+                    interfaceTableSummary, interfaceTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the classes in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the class summary will
+     *                           be added
+     */
+    public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) {
+        String classTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Class_Summary"),
+                configuration.getText("doclet.classes"));
+        String[] classTableHeader = new String[] {
+            configuration.getText("doclet.Class"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] classes = pkg.ordinaryClasses();
+        if (classes.length > 0) {
+            profileWriter.addClassesSummary(
+                    classes,
+                    configuration.getText("doclet.Class_Summary"),
+                    classTableSummary, classTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the enums in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the enum summary will
+     *                           be added
+     */
+    public void buildEnumSummary(XMLNode node, Content packageSummaryContentTree) {
+        String enumTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Enum_Summary"),
+                configuration.getText("doclet.enums"));
+        String[] enumTableHeader = new String[] {
+            configuration.getText("doclet.Enum"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] enums = pkg.enums();
+        if (enums.length > 0) {
+            profileWriter.addClassesSummary(
+                    enums,
+                    configuration.getText("doclet.Enum_Summary"),
+                    enumTableSummary, enumTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the exceptions in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the exception summary will
+     *                           be added
+     */
+    public void buildExceptionSummary(XMLNode node, Content packageSummaryContentTree) {
+        String exceptionTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Exception_Summary"),
+                configuration.getText("doclet.exceptions"));
+        String[] exceptionTableHeader = new String[] {
+            configuration.getText("doclet.Exception"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] exceptions = pkg.exceptions();
+        if (exceptions.length > 0) {
+            profileWriter.addClassesSummary(
+                    exceptions,
+                    configuration.getText("doclet.Exception_Summary"),
+                    exceptionTableSummary, exceptionTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the errors in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the error summary will
+     *                           be added
+     */
+    public void buildErrorSummary(XMLNode node, Content packageSummaryContentTree) {
+        String errorTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Error_Summary"),
+                configuration.getText("doclet.errors"));
+        String[] errorTableHeader = new String[] {
+            configuration.getText("doclet.Error"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] errors = pkg.errors();
+        if (errors.length > 0) {
+            profileWriter.addClassesSummary(
+                    errors,
+                    configuration.getText("doclet.Error_Summary"),
+                    errorTableSummary, errorTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the annotation type in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the annotation type
+     *                           summary will be added
+     */
+    public void buildAnnotationTypeSummary(XMLNode node, Content packageSummaryContentTree) {
+        String annotationtypeTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Types_Summary"),
+                configuration.getText("doclet.annotationtypes"));
+        String[] annotationtypeTableHeader = new String[] {
+            configuration.getText("doclet.AnnotationType"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] annotationTypes = pkg.annotationTypes();
+        if (annotationTypes.length > 0) {
+            profileWriter.addClassesSummary(
+                    annotationTypes,
+                    configuration.getText("doclet.Annotation_Types_Summary"),
+                    annotationtypeTableSummary, annotationtypeTableHeader,
+                    packageSummaryContentTree);
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Thu Feb 21 17:43:57 2013 -0800
@@ -28,6 +28,21 @@
 
 <Doclet>
 
+    <ProfileDoc>
+        <Content>
+            <Summary>
+                <PackageSummary>
+                    <InterfaceSummary/>
+                    <ClassSummary/>
+                    <EnumSummary/>
+                    <ExceptionSummary/>
+                    <ErrorSummary/>
+                    <AnnotationTypeSummary/>
+                </PackageSummary>
+            </Summary>
+        </Content>
+    </ProfileDoc>
+
     <PackageDoc>
         <Content>
             <Summary>
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Thu Feb 21 17:43:57 2013 -0800
@@ -31,6 +31,7 @@
 doclet.Building_Index_For_All_Classes=Building index for all classes...
 doclet.sourcetab_warning=The argument for -sourcetab must be an integer greater than 0.
 doclet.Packages=Packages
+doclet.Profiles=Profiles
 doclet.Other_Packages=Other Packages
 doclet.Notice_taglet_registered=Registered Taglet {0} ...
 doclet.Notice_taglet_unseen=Note: Custom tags that were not seen: {0}
@@ -61,6 +62,7 @@
 doclet.malformed_html_link_tag=<a> tag is malformed:\n"{0}"
 doclet.tag_misuse=Tag {0} cannot be used in {1} documentation.  It can only be used in the following types of documentation: {2}.
 doclet.Package_Summary=Package Summary
+doclet.Profile_Summary=Profile Summary
 doclet.Interface_Summary=Interface Summary
 doclet.Annotation_Types_Summary=Annotation Types Summary
 doclet.Enum_Summary=Enum Summary
@@ -82,6 +84,7 @@
 doclet.Classes=Classes
 doclet.Packages=Packages
 doclet.packages=packages
+doclet.profiles=profiles
 doclet.All_Classes=All Classes
 doclet.All_Superinterfaces=All Superinterfaces:
 doclet.All_Implemented_Interfaces=All Implemented Interfaces:
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Thu Feb 21 17:43:57 2013 -0800
@@ -191,6 +191,9 @@
     margin:10px;
     position:relative;
 }
+.indexHeader span{
+    margin-right:15px;
+}
 .indexHeader h1 {
     font-size:1.3em;
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, 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
@@ -87,6 +87,26 @@
     /** The name of the file for the package frame. */
     public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html");
 
+    /** The name of the file for the profile frame. */
+     public static final DocPath profileFrame(String profileName) {
+        return DocPath.create(profileName + "-frame.html");
+    }
+
+    /** The name of the file for the profile package frame. */
+     public static final DocPath profilePackageFrame(String profileName) {
+        return DocPath.create(profileName + "-package-frame.html");
+    }
+
+    /** The name of the file for the profile package summary. */
+     public static final DocPath profilePackageSummary(String profileName) {
+        return DocPath.create(profileName + "-package-summary.html");
+    }
+
+    /** The name of the file for the profile summary. */
+     public static final DocPath profileSummary(String profileName) {
+        return DocPath.create(profileName + "-summary.html");
+    }
+
     /** The name of the file for the package list. */
     public static final DocPath PACKAGE_LIST = DocPath.create("package-list");
 
@@ -99,6 +119,9 @@
     /** The name of the file for the package usage info. */
     public static final DocPath PACKAGE_USE = DocPath.create("package-use.html");
 
+    /** The name of the file for the overview frame. */
+    public static final DocPath PROFILE_OVERVIEW_FRAME = DocPath.create("profile-overview-frame.html");
+
     /** The name of the directory in which resources are generated.
      *  Also the name of the sub-package from which resources are read.
      */
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, 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
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 
 /**
@@ -105,6 +106,20 @@
     }
 
     /**
+     * Get the profile keywords.
+     *
+     * @param profile the profile being documented
+     */
+    public String[] getMetaKeywords(Profile profile) {
+        if( configuration.keywords ) {
+            String profileName = profile.name;
+            return new String[] { profileName + " " + "profile" };
+        } else {
+            return new String[] {};
+        }
+    }
+
+    /**
      * Get the overview keywords.
      */
     public String[] getOverviewMetaKeywords(String title, String docTitle) {
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Thu Feb 21 17:43:57 2013 -0800
@@ -245,12 +245,19 @@
         if (t == null) {
             env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
         } else {
+            boolean done = false;
             for (TagStackItem tsi: tagStack) {
                 if (tsi.tag.accepts(t)) {
                     while (tagStack.peek() != tsi) tagStack.pop();
+                    done = true;
                     break;
-                } else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL)
+                } else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL) {
+                    done = true;
                     break;
+                }
+            }
+            if (!done && HtmlTag.BODY.accepts(t)) {
+                tagStack.clear();
             }
 
             checkStructure(tree, t);
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Feb 21 17:43:57 2013 -0800
@@ -154,10 +154,11 @@
                 throw new IllegalStateException();
         } else {
             initContext();
+            compilerMain.log = Log.instance(context);
             compilerMain.setOptions(Options.instance(context));
             compilerMain.filenames = new LinkedHashSet<File>();
             Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
-            if (!filenames.isEmpty())
+            if (filenames != null && !filenames.isEmpty())
                 throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
             compiler = JavaCompiler.instance(context);
             compiler.keepComments = true;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Feb 21 17:43:57 2013 -0800
@@ -74,6 +74,7 @@
         if ((mask&DEPRECATED) != 0) flags.add(Flag.DEPRECATED);
         if ((mask&HASINIT) != 0) flags.add(Flag.HASINIT);
         if ((mask&ENUM) != 0) flags.add(Flag.ENUM);
+        if ((mask&MANDATED) != 0) flags.add(Flag.MANDATED);
         if ((mask&IPROXY) != 0) flags.add(Flag.IPROXY);
         if ((mask&NOOUTERTHIS) != 0) flags.add(Flag.NOOUTERTHIS);
         if ((mask&EXISTS) != 0) flags.add(Flag.EXISTS);
@@ -114,6 +115,9 @@
      *  classfile v49.0. */
     public static final int ENUM         = 1<<14;
 
+    /** Added in SE8, represents constructs implicitly declared in source. */
+    public static final int MANDATED     = 1<<15;
+
     public static final int StandardFlags = 0x0fff;
     public static final int ModifierFlags = StandardFlags & ~INTERFACE;
 
@@ -264,6 +268,11 @@
      */
     public static final long AUXILIARY = 1L<<44;
 
+    /**
+     * Flag that marks that a symbol is not available in the current profile
+     */
+    public static final long NOT_IN_PROFILE = 1L<<45;
+
     /** Modifier masks.
      */
     public static final int
@@ -342,6 +351,7 @@
         DEPRECATED("deprecated"),
         HASINIT("hasinit"),
         ENUM("enum"),
+        MANDATED("mandated"),
         IPROXY("iproxy"),
         NOOUTERTHIS("noouterthis"),
         EXISTS("exists"),
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Feb 21 17:43:57 2013 -0800
@@ -221,7 +221,7 @@
     public boolean allowIntersectionTypesInCast() {
         return compareTo(JDK1_8) >= 0;
     }
-    public boolean allowEarlyReturnConstraints() {
+    public boolean allowGraphInference() {
         return compareTo(JDK1_8) >= 0;
     }
     public boolean allowStructuralMostSpecific() {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Feb 21 17:43:57 2013 -0800
@@ -217,6 +217,14 @@
         return (flags() & INTERFACE) != 0;
     }
 
+    public boolean isPrivate() {
+        return (flags_field & Flags.AccessFlags) == PRIVATE;
+    }
+
+    public boolean isEnum() {
+        return (flags() & ENUM) != 0;
+    }
+
     /** Is this symbol declared (directly or indirectly) local
      *  to a method or variable initializer?
      *  Also includes fields of inner classes which are in
@@ -479,7 +487,7 @@
     }
 
     // This method is part of the javax.lang.model API, do not use this in javac code.
-    public <A extends java.lang.annotation.Annotation> A[] getAnnotations(Class<A> annoType) {
+    public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(Class<A> annoType) {
         return JavacElements.getAnnotations(this, annoType);
     }
 
@@ -1082,6 +1090,9 @@
         /** The code of the method. */
         public Code code = null;
 
+        /** The extra (synthetic/mandated) parameters of the method. */
+        public List<VarSymbol> extraParams = List.nil();
+
         /** The parameters of the method. */
         public List<VarSymbol> params = null;
 
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Feb 21 17:43:57 2013 -0800
@@ -156,6 +156,7 @@
     public final Type deprecatedType;
     public final Type suppressWarningsType;
     public final Type inheritedType;
+    public final Type profileType;
     public final Type proprietaryType;
     public final Type systemType;
     public final Type autoCloseableType;
@@ -360,6 +361,22 @@
 
     }
 
+    // Enter a synthetic class that is used to mark classes in ct.sym.
+    // This class does not have a class file.
+    private Type enterSyntheticAnnotation(String name) {
+        ClassType type = (ClassType)enterClass(name);
+        ClassSymbol sym = (ClassSymbol)type.tsym;
+        sym.completer = null;
+        sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
+        sym.erasure_field = type;
+        sym.members_field = new Scope(sym);
+        type.typarams_field = List.nil();
+        type.allparams_field = List.nil();
+        type.supertype_field = annotationType;
+        type.interfaces_field = List.nil();
+        return type;
+    }
+
     /** Constructor; enters all predefined identifiers and operators
      *  into symbol table.
      */
@@ -521,17 +538,13 @@
         // Enter a synthetic class that is used to mark internal
         // proprietary classes in ct.sym.  This class does not have a
         // class file.
-        ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
-        this.proprietaryType = proprietaryType;
-        ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
-        proprietarySymbol.completer = null;
-        proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
-        proprietarySymbol.erasure_field = proprietaryType;
-        proprietarySymbol.members_field = new Scope(proprietarySymbol);
-        proprietaryType.typarams_field = List.nil();
-        proprietaryType.allparams_field = List.nil();
-        proprietaryType.supertype_field = annotationType;
-        proprietaryType.interfaces_field = List.nil();
+        proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
+
+        // Enter a synthetic class that is used to provide profile info for
+        // classes in ct.sym.  This class does not have a class file.
+        profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
+        MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
+        profileType.tsym.members().enter(m);
 
         // Enter a class for arrays.
         // The class implements java.lang.Cloneable and java.io.Serializable.
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TargetType.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TargetType.java	Thu Feb 21 17:43:57 2013 -0800
@@ -82,34 +82,37 @@
     /** For annotations on an exception parameter. */
     EXCEPTION_PARAMETER(0x42, true),
 
-    /** For annotations on a typecast. */
-    CAST(0x43, true),
-
     /** For annotations on a type test. */
-    INSTANCEOF(0x44, true),
+    INSTANCEOF(0x43, true),
 
     /** For annotations on an object creation expression. */
-    NEW(0x45, true),
+    NEW(0x44, true),
+
+    /** For annotations on a constructor reference receiver. */
+    CONSTRUCTOR_REFERENCE(0x45, true),
+
+    /** For annotations on a method reference receiver. */
+    METHOD_REFERENCE(0x46, true),
+
+    /** For annotations on a typecast. */
+    CAST(0x47, true),
 
     /** For annotations on a type argument of an object creation expression. */
-    CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x46, true),
+    CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x48, true),
 
     /** For annotations on a type argument of a method call. */
-    METHOD_INVOCATION_TYPE_ARGUMENT(0x47, true),
+    METHOD_INVOCATION_TYPE_ARGUMENT(0x49, true),
 
-    /** For annotations on a lambda parameter type. */
-    LAMBDA_FORMAL_PARAMETER(0x48, true),
-
-    /** For annotations on a method reference. */
-    METHOD_REFERENCE(0x49, true),
+    /** For annotations on a type argument of a constructor reference. */
+    CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(0x4A, true),
 
     /** For annotations on a type argument of a method reference. */
-    METHOD_REFERENCE_TYPE_ARGUMENT(0x50, true),
+    METHOD_REFERENCE_TYPE_ARGUMENT(0x4B, true),
 
     /** For annotations with an unknown target. */
     UNKNOWN(0xFF);
 
-    private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x92;
+    private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x4B;
 
     private final int targetTypeValue;
     private final boolean isLocal;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1309,6 +1309,9 @@
         /** inference variable's inferred type (set from Infer.java) */
         public Type inst = null;
 
+        /** number of declared (upper) bounds */
+        public int declaredCount;
+
         /** inference variable's change listener */
         public UndetVarListener listener = null;
 
@@ -1318,13 +1321,11 @@
         }
 
         public UndetVar(TypeVar origin, Types types) {
-            this(origin, types, true);
-        }
-
-        public UndetVar(TypeVar origin, Types types, boolean includeBounds) {
             super(UNDETVAR, origin);
             bounds = new EnumMap<InferenceBound, List<Type>>(InferenceBound.class);
-            bounds.put(InferenceBound.UPPER, includeBounds ? types.getBounds(origin) : List.<Type>nil());
+            List<Type> declaredBounds = types.getBounds(origin);
+            declaredCount = declaredBounds.length();
+            bounds.put(InferenceBound.UPPER, declaredBounds);
             bounds.put(InferenceBound.LOWER, List.<Type>nil());
             bounds.put(InferenceBound.EQ, List.<Type>nil());
         }
@@ -1340,38 +1341,89 @@
         }
 
         /** get all bounds of a given kind */
-        public List<Type> getBounds(InferenceBound ib) {
-            return bounds.get(ib);
+        public List<Type> getBounds(InferenceBound... ibs) {
+            ListBuffer<Type> buf = ListBuffer.lb();
+            for (InferenceBound ib : ibs) {
+                buf.appendList(bounds.get(ib));
+            }
+            return buf.toList();
+        }
+
+        /** get the list of declared (upper) bounds */
+        public List<Type> getDeclaredBounds() {
+            ListBuffer<Type> buf = ListBuffer.lb();
+            int count = 0;
+            for (Type b : getBounds(InferenceBound.UPPER)) {
+                if (count++ == declaredCount) break;
+                buf.append(b);
+            }
+            return buf.toList();
         }
 
         /** add a bound of a given kind - this might trigger listener notification */
         public void addBound(InferenceBound ib, Type bound, Types types) {
+            Type bound2 = toTypeVarMap.apply(bound);
             List<Type> prevBounds = bounds.get(ib);
             for (Type b : prevBounds) {
-                if (types.isSameType(b, bound)) {
-                    return;
-                }
+                //check for redundancy - use strict version of isSameType on tvars
+                //(as the standard version will lead to false positives w.r.t. clones ivars)
+                if (types.isSameType(b, bound2, true)) return;
             }
-            bounds.put(ib, prevBounds.prepend(bound));
+            bounds.put(ib, prevBounds.prepend(bound2));
             notifyChange(EnumSet.of(ib));
         }
+        //where
+            Type.Mapping toTypeVarMap = new Mapping("toTypeVarMap") {
+                @Override
+                public Type apply(Type t) {
+                    if (t.hasTag(UNDETVAR)) {
+                        UndetVar uv = (UndetVar)t;
+                        return uv.qtype;
+                    } else {
+                        return t.map(this);
+                    }
+                }
+            };
 
         /** replace types in all bounds - this might trigger listener notification */
         public void substBounds(List<Type> from, List<Type> to, Types types) {
-            EnumSet<InferenceBound> changed = EnumSet.noneOf(InferenceBound.class);
-            Map<InferenceBound, List<Type>> bounds2 = new EnumMap<InferenceBound, List<Type>>(InferenceBound.class);
-            for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
-                InferenceBound ib = _entry.getKey();
-                List<Type> prevBounds = _entry.getValue();
-                List<Type> newBounds = types.subst(prevBounds, from, to);
-                bounds2.put(ib, newBounds);
-                if (prevBounds != newBounds) {
-                    changed.add(ib);
+            List<Type> instVars = from.diff(to);
+            //if set of instantiated ivars is empty, there's nothing to do!
+            if (instVars.isEmpty()) return;
+            final EnumSet<InferenceBound> boundsChanged = EnumSet.noneOf(InferenceBound.class);
+            UndetVarListener prevListener = listener;
+            try {
+                //setup new listener for keeping track of changed bounds
+                listener = new UndetVarListener() {
+                    public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
+                        boundsChanged.addAll(ibs);
+                    }
+                };
+                for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
+                    InferenceBound ib = _entry.getKey();
+                    List<Type> prevBounds = _entry.getValue();
+                    ListBuffer<Type> newBounds = ListBuffer.lb();
+                    ListBuffer<Type> deps = ListBuffer.lb();
+                    //step 1 - re-add bounds that are not dependent on ivars
+                    for (Type t : prevBounds) {
+                        if (!t.containsAny(instVars)) {
+                            newBounds.append(t);
+                        } else {
+                            deps.append(t);
+                        }
+                    }
+                    //step 2 - replace bounds
+                    bounds.put(ib, newBounds.toList());
+                    //step 3 - for each dependency, add new replaced bound
+                    for (Type dep : deps) {
+                        addBound(ib, types.subst(dep, from, to), types);
+                    }
                 }
-            }
-            if (!changed.isEmpty()) {
-                bounds = bounds2;
-                notifyChange(changed);
+            } finally {
+                listener = prevListener;
+                if (!boundsChanged.isEmpty()) {
+                    notifyChange(boundsChanged);
+                }
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Thu Feb 21 17:43:57 2013 -0800
@@ -126,7 +126,8 @@
     // Tree position.
     public int pos = -1;
 
-    // For typecasts, type tests, new (and locals, as start_pc).
+    // For type casts, type tests, new, locals (as start_pc),
+    // and method and constructor reference type arguments.
     public boolean isValidOffset = false;
     public int offset = -1;
 
@@ -156,12 +157,13 @@
         sb.append(type);
 
         switch (type) {
-        // type cast
-        case CAST:
         // instanceof
         case INSTANCEOF:
         // new expression
         case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
             sb.append(", offset = ");
             sb.append(offset);
             break;
@@ -223,9 +225,12 @@
             sb.append(", param_index = ");
             sb.append(parameter_index);
             break;
+        // type cast
+        case CAST:
         // method/constructor/reference type argument
         case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
         case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
         case METHOD_REFERENCE_TYPE_ARGUMENT:
             sb.append(", offset = ");
             sb.append(offset);
@@ -236,12 +241,6 @@
         case METHOD_RETURN:
         case FIELD:
             break;
-        // lambda formal parameter
-        case LAMBDA_FORMAL_PARAMETER:
-            // TODO: also needs an offset?
-            sb.append(", param_index = ");
-            sb.append(parameter_index);
-            break;
         case UNKNOWN:
             sb.append(", position UNKNOWN!");
             break;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Feb 21 17:43:57 2013 -0800
@@ -217,6 +217,9 @@
         // Such an annotation is _not_ part of an JCAnnotatedType tree and we therefore
         // need to set its position explicitly.
         // The method returns a copy of type that contains these annotations.
+        //
+        // As a side effect the method sets the type annotation position of "annotations".
+        // Note that it is assumed that all annotations share the same position.
         private static Type typeWithAnnotations(final JCTree typetree, final Type type,
                 final List<Attribute.TypeCompound> annotations, Log log) {
             // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s)%n",
@@ -267,7 +270,9 @@
                 }
                 Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, log);
                 tomodify.elemtype = arelemType;
-                for (Attribute.TypeCompound a : annotations) {
+                {
+                    // All annotations share the same position; modify the first one.
+                    Attribute.TypeCompound a = annotations.get(0);
                     TypeAnnotationPosition p = a.position;
                     p.location = p.location.prependList(depth.toList());
                 }
@@ -345,10 +350,10 @@
                 if (depth.nonEmpty()) {
                     // Only need to change the annotation positions
                     // if they are on an enclosed type.
-                    for (Attribute.TypeCompound a : annotations) {
-                        TypeAnnotationPosition p = a.position;
-                        p.location = p.location.appendList(depth.toList());
-                    }
+                    // All annotations share the same position; modify the first one.
+                    Attribute.TypeCompound a = annotations.get(0);
+                    TypeAnnotationPosition p = a.position;
+                    p.location = p.location.appendList(depth.toList());
                 }
 
                 Type ret = typeWithAnnotations(type, enclTy, annotations);
@@ -463,8 +468,7 @@
 
                 @Override
                 public Type visitType(Type t, List<TypeCompound> s) {
-                    // Error?
-                    return t;
+                    return new AnnotatedType(s, t);
                 }
             };
 
@@ -575,6 +579,10 @@
             System.out.println("Resolving tree: " + tree + " kind: " + tree.getKind());
             System.out.println("    Framing tree: " + frame + " kind: " + frame.getKind());
             */
+
+            // Note that p.offset is set in
+            // com.sun.tools.javac.jvm.Gen.setTypeAnnotationPositions(int)
+
             switch (frame.getKind()) {
                 case TYPE_CAST:
                     p.type = TargetType.CAST;
@@ -659,6 +667,45 @@
                     return;
                 }
 
+                case MEMBER_REFERENCE: {
+                    JCMemberReference mrframe = (JCMemberReference) frame;
+
+                    if (mrframe.expr == tree) {
+                        switch (mrframe.mode) {
+                        case INVOKE:
+                            p.type = TargetType.METHOD_REFERENCE;
+                            break;
+                        case NEW:
+                            p.type = TargetType.CONSTRUCTOR_REFERENCE;
+                            break;
+                        default:
+                            Assert.error("Unknown method reference mode " + mrframe.mode +
+                                    " for tree " + tree + " within frame " + frame);
+                        }
+                        p.pos = frame.pos;
+                    } else if (mrframe.typeargs != null &&
+                            mrframe.typeargs.contains(tree)) {
+                        int arg = mrframe.typeargs.indexOf(tree);
+                        p.type_index = arg;
+                        switch (mrframe.mode) {
+                        case INVOKE:
+                            p.type = TargetType.METHOD_REFERENCE_TYPE_ARGUMENT;
+                            break;
+                        case NEW:
+                            p.type = TargetType.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT;
+                            break;
+                        default:
+                            Assert.error("Unknown method reference mode " + mrframe.mode +
+                                    " for tree " + tree + " within frame " + frame);
+                        }
+                        p.pos = frame.pos;
+                    } else {
+                        Assert.error("Could not determine type argument position of tree " + tree +
+                                " within frame " + frame);
+                    }
+                    return;
+                }
+
                 case ARRAY_TYPE: {
                     ListBuffer<TypePathEntry> index = ListBuffer.lb();
                     index = index.append(TypePathEntry.ARRAY);
@@ -766,6 +813,14 @@
                     return;
                 }
 
+                case INTERSECTION_TYPE: {
+                    JCTypeIntersection isect = (JCTypeIntersection)frame;
+                    p.type_index = isect.bounds.indexOf(tree);
+                    List<JCTree> newPath = path.tail;
+                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
+                    return;
+                }
+
                 case METHOD_INVOCATION: {
                     JCMethodInvocation invocation = (JCMethodInvocation)frame;
                     if (!invocation.typeargs.contains(tree)) {
@@ -911,6 +966,8 @@
         public void visitVarDef(final JCVariableDecl tree) {
             if (tree.sym == null) {
                 // Something is wrong already. Quietly ignore.
+            } else if (tree.sym.getKind() == ElementKind.PARAMETER) {
+                // Parameters are handled in visitMethodDef above.
             } else if (tree.sym.getKind() == ElementKind.FIELD) {
                 if (sigOnly) {
                     TypeAnnotationPosition pos = new TypeAnnotationPosition();
@@ -924,7 +981,6 @@
                 pos.pos = tree.pos;
                 separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
             } else if (tree.sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
-                // System.out.println("Found exception param: " + tree);
                 TypeAnnotationPosition pos = new TypeAnnotationPosition();
                 pos.type = TargetType.EXCEPTION_PARAMETER;
                 pos.pos = tree.pos;
@@ -934,9 +990,11 @@
                 pos.type = TargetType.RESOURCE_VARIABLE;
                 pos.pos = tree.pos;
                 separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+            } else if (tree.sym.getKind() == ElementKind.ENUM_CONSTANT) {
+                // No type annotations can occur here.
             } else {
                 // There is nothing else in a variable declaration that needs separation.
-                // System.out.println("We found a: " + tree);
+                Assert.error("Unhandled variable kind: " + tree + " of kind: " + tree.sym.getKind());
             }
 
             push(tree);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 21 17:43:57 2013 -0800
@@ -976,9 +976,12 @@
      * lists are of different length, return false.
      */
     public boolean isSameTypes(List<Type> ts, List<Type> ss) {
+        return isSameTypes(ts, ss, false);
+    }
+    public boolean isSameTypes(List<Type> ts, List<Type> ss, boolean strict) {
         while (ts.tail != null && ss.tail != null
                /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ &&
-               isSameType(ts.head, ss.head)) {
+               isSameType(ts.head, ss.head, strict)) {
             ts = ts.tail;
             ss = ss.tail;
         }
@@ -990,10 +993,15 @@
      * Is t the same type as s?
      */
     public boolean isSameType(Type t, Type s) {
-        return isSameType.visit(t, s);
+        return isSameType(t, s, false);
+    }
+    public boolean isSameType(Type t, Type s, boolean strict) {
+        return strict ?
+                isSameTypeStrict.visit(t, s) :
+                isSameTypeLoose.visit(t, s);
     }
     // where
-        private TypeRelation isSameType = new TypeRelation() {
+        abstract class SameTypeVisitor extends TypeRelation {
 
             public Boolean visitType(Type t, Type s) {
                 if (t == s)
@@ -1010,8 +1018,7 @@
                     if (s.tag == TYPEVAR) {
                         //type-substitution does not preserve type-var types
                         //check that type var symbols and bounds are indeed the same
-                        return t.tsym == s.tsym &&
-                                visit(t.getUpperBound(), s.getUpperBound());
+                        return sameTypeVars((TypeVar)t, (TypeVar)s);
                     }
                     else {
                         //special case for s == ? super X, where upper(s) = u
@@ -1026,6 +1033,8 @@
                 }
             }
 
+            abstract boolean sameTypeVars(TypeVar tv1, TypeVar tv2);
+
             @Override
             public Boolean visitWildcardType(WildcardType t, Type s) {
                 if (s.isPartial())
@@ -1060,9 +1069,11 @@
                 }
                 return t.tsym == s.tsym
                     && visit(t.getEnclosingType(), s.getEnclosingType())
-                    && containsTypeEquivalent(t.getTypeArguments(), s.getTypeArguments());
+                    && containsTypes(t.getTypeArguments(), s.getTypeArguments());
             }
 
+            abstract protected boolean containsTypes(List<Type> ts1, List<Type> ts2);
+
             @Override
             public Boolean visitArrayType(ArrayType t, Type s) {
                 if (t == s)
@@ -1115,6 +1126,36 @@
             public Boolean visitErrorType(ErrorType t, Type s) {
                 return true;
             }
+        }
+
+        /**
+         * Standard type-equality relation - type variables are considered
+         * equals if they share the same type symbol.
+         */
+        TypeRelation isSameTypeLoose = new SameTypeVisitor() {
+            @Override
+            boolean sameTypeVars(TypeVar tv1, TypeVar tv2) {
+                return tv1.tsym == tv2.tsym && visit(tv1.getUpperBound(), tv2.getUpperBound());
+            }
+            @Override
+            protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
+                return containsTypeEquivalent(ts1, ts2);
+            }
+        };
+
+        /**
+         * Strict type-equality relation - type variables are considered
+         * equals if they share the same object identity.
+         */
+        TypeRelation isSameTypeStrict = new SameTypeVisitor() {
+            @Override
+            boolean sameTypeVars(TypeVar tv1, TypeVar tv2) {
+                return tv1 == tv2;
+            }
+            @Override
+            protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
+                return isSameTypes(ts1, ts2, true);
+            }
         };
     // </editor-fold>
 
@@ -2027,7 +2068,15 @@
 
             @Override
             public Type visitAnnotatedType(AnnotatedType t, Boolean recurse) {
-                return new AnnotatedType(t.typeAnnotations, erasure(t.underlyingType, recurse));
+                Type erased = erasure(t.underlyingType, recurse);
+                if (erased.getKind() == TypeKind.ANNOTATED) {
+                    // This can only happen when the underlying type is a
+                    // type variable and the upper bound of it is annotated.
+                    // The annotation on the type variable overrides the one
+                    // on the bound.
+                    erased = ((AnnotatedType)erased).underlyingType;
+                }
+                return new AnnotatedType(t.typeAnnotations, erased);
             }
         };
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 21 17:43:57 2013 -0800
@@ -43,7 +43,7 @@
 import com.sun.tools.javac.comp.Check.CheckContext;
 import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
 import com.sun.tools.javac.comp.Infer.InferenceContext;
-import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
+import com.sun.tools.javac.comp.Infer.FreeTypeListener;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
@@ -244,8 +244,8 @@
                     @Override
                     public void typesInferred(InferenceContext inferenceContext) {
                         ResultInfo pendingResult =
-                                    resultInfo.dup(inferenceContext.asInstType(resultInfo.pt, types));
-                        check(tree, inferenceContext.asInstType(found, types), ownkind, pendingResult);
+                                    resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
+                        check(tree, inferenceContext.asInstType(found), ownkind, pendingResult);
                     }
                 });
                 return tree.type = resultInfo.pt;
@@ -766,6 +766,8 @@
         JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
 
         try {
+            memberEnter.typeAnnotate(initializer, env, env.info.enclVar);
+            annotate.flush();
             Type itype = attribExpr(initializer, env, type);
             if (itype.constValue() != null)
                 return coerce(itype, type).constValue();
@@ -1099,8 +1101,9 @@
             Env<AttrContext> localEnv =
                 env.dup(tree, env.info.dup(env.info.scope.dupUnshared()));
             localEnv.info.scope.owner =
-                new MethodSymbol(tree.flags | BLOCK, names.empty, null,
-                                 env.info.scope.owner);
+                new MethodSymbol(tree.flags | BLOCK |
+                    env.info.scope.owner.flags() & STRICTFP, names.empty, null,
+                    env.info.scope.owner);
             if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++;
 
             // Attribute all type annotations in the block
@@ -2415,7 +2418,7 @@
                 inferenceContext.addFreeTypeListener(ts, new FreeTypeListener() {
                     @Override
                     public void typesInferred(InferenceContext inferenceContext) {
-                        checkAccessibleTypes(pos, env, inferenceContext, inferenceContext.asInstTypes(ts, types));
+                        checkAccessibleTypes(pos, env, inferenceContext, inferenceContext.asInstTypes(ts));
                     }
                 });
             } else {
@@ -2440,7 +2443,7 @@
             @Override
             public boolean compatible(Type found, Type req, Warner warn) {
                 //return type must be compatible in both current context and assignment context
-                return chk.basicHandler.compatible(found, inferenceContext().asFree(req, types), warn);
+                return chk.basicHandler.compatible(found, inferenceContext().asFree(req), warn);
             }
 
             @Override
@@ -2475,7 +2478,7 @@
         * descriptor.
         */
         private void checkLambdaCompatible(JCLambda tree, Type descriptor, CheckContext checkContext, boolean speculativeAttr) {
-            Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType(), types);
+            Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
 
             //return values have already been checked - but if lambda has no return
             //values, we must ensure that void/value compatibility is correct;
@@ -2487,13 +2490,13 @@
                         diags.fragment("missing.ret.val", returnType)));
             }
 
-            List<Type> argTypes = checkContext.inferenceContext().asFree(descriptor.getParameterTypes(), types);
+            List<Type> argTypes = checkContext.inferenceContext().asFree(descriptor.getParameterTypes());
             if (!types.isSameTypes(argTypes, TreeInfo.types(tree.params))) {
                 checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
             }
 
             if (!speculativeAttr) {
-                List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes(), types);
+                List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes());
                 if (chk.unhandled(tree.inferredThrownTypes == null ? List.<Type>nil() : tree.inferredThrownTypes, thrownTypes).nonEmpty()) {
                     log.error(tree, "incompatible.thrown.types.in.lambda", tree.inferredThrownTypes);
                 }
@@ -2538,7 +2541,7 @@
 
             if (exprType.isErroneous()) {
                 //if the qualifier expression contains problems,
-                //give up atttribution of method reference
+                //give up attribution of method reference
                 result = that.type = exprType;
                 return;
             }
@@ -2680,7 +2683,7 @@
 
     @SuppressWarnings("fallthrough")
     void checkReferenceCompatible(JCMemberReference tree, Type descriptor, Type refType, CheckContext checkContext, boolean speculativeAttr) {
-        Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType(), types);
+        Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
 
         Type resType;
         switch (tree.getMode()) {
@@ -2712,7 +2715,7 @@
         }
 
         if (!speculativeAttr) {
-            List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes(), types);
+            List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes());
             if (chk.unhandled(refType.getThrownTypes(), thrownTypes).nonEmpty()) {
                 log.error(tree, "incompatible.thrown.types.in.mref", refType.getThrownTypes());
             }
@@ -2728,7 +2731,7 @@
         if (inferenceContext.free(descriptorType)) {
             inferenceContext.addFreeTypeListener(List.of(pt, descriptorType), new FreeTypeListener() {
                 public void typesInferred(InferenceContext inferenceContext) {
-                    setFunctionalInfo(fExpr, pt, inferenceContext.asInstType(descriptorType, types), inferenceContext);
+                    setFunctionalInfo(fExpr, pt, inferenceContext.asInstType(descriptorType), inferenceContext);
                 }
             });
         } else {
@@ -3396,6 +3399,7 @@
             if (sym.name != names.init) {
                 chk.checkDeprecated(tree.pos(), env.info.scope.owner, sym);
                 chk.checkSunAPI(tree.pos(), sym);
+                chk.checkProfile(tree.pos(), sym);
             }
 
             // Test (3): if symbol is a variable, check that its type and
@@ -4151,7 +4155,9 @@
         }
 
     private Type capture(Type type) {
-        return types.capture(type);
+        //do not capture free types
+        return resultInfo.checkContext.inferenceContext().free(type) ?
+                type : types.capture(type);
     }
 
     private void validateTypeAnnotations(JCTree tree) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Feb 21 17:43:57 2013 -0800
@@ -42,7 +42,7 @@
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
 import com.sun.tools.javac.comp.Infer.InferenceContext;
-import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
+import com.sun.tools.javac.comp.Infer.FreeTypeListener;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
 
@@ -80,6 +80,7 @@
     private boolean enableSunApiLintControl;
     private final TreeInfo treeinfo;
     private final JavaFileManager fileManager;
+    private final Profile profile;
 
     // The set of lint options currently in effect. It is initialized
     // from the context, and then is set/reset as needed by Attr as it
@@ -110,7 +111,7 @@
         enter = Enter.instance(context);
         deferredAttr = DeferredAttr.instance(context);
         infer = Infer.instance(context);
-        this.types = Types.instance(context);
+        types = Types.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         Options options = Options.instance(context);
         lint = Lint.instance(context);
@@ -133,6 +134,8 @@
         Target target = Target.instance(context);
         syntheticNameChar = target.syntheticNameChar();
 
+        profile = Profile.instance(context);
+
         boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
         boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
         boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
@@ -530,7 +533,7 @@
             inferenceContext.addFreeTypeListener(List.of(req), new FreeTypeListener() {
                 @Override
                 public void typesInferred(InferenceContext inferenceContext) {
-                    checkType(pos, found, inferenceContext.asInstType(req, types), checkContext);
+                    checkType(pos, found, inferenceContext.asInstType(req), checkContext);
                 }
             });
         }
@@ -1023,7 +1026,7 @@
         };
 
     /** Check that given modifiers are legal for given symbol and
-     *  return modifiers together with any implicit modififiers for that symbol.
+     *  return modifiers together with any implicit modifiers for that symbol.
      *  Warning: we can't use flags() here since this method
      *  is called during class enter, when flags() would cause a premature
      *  completion.
@@ -1069,7 +1072,7 @@
             }
             // Imply STRICTFP if owner has STRICTFP set.
             if (((flags|implicit) & Flags.ABSTRACT) == 0)
-              implicit |= sym.owner.flags_field & STRICTFP;
+                implicit |= sym.owner.flags_field & STRICTFP;
             break;
         case TYP:
             if (sym.isLocal()) {
@@ -3033,6 +3036,12 @@
         }
     }
 
+    void checkProfile(final DiagnosticPosition pos, final Symbol s) {
+        if (profile != Profile.DEFAULT && (s.flags() & NOT_IN_PROFILE) != 0) {
+            log.error(pos, "not.in.profile", s, profile);
+        }
+    }
+
 /* *************************************************************************
  * Check for recursive annotation elements.
  **************************************************************************/
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Thu Feb 21 17:43:57 2013 -0800
@@ -234,7 +234,7 @@
                     dt.speculativeCache.put(deferredAttrContext.msym, speculativeTree, deferredAttrContext.phase);
                     return speculativeTree.type;
                 case CHECK:
-                    Assert.check(dt.mode == AttrMode.SPECULATIVE);
+                    Assert.check(dt.mode != null);
                     return attr.attribTree(dt.tree, dt.env, resultInfo);
             }
             Assert.error();
@@ -242,6 +242,13 @@
         }
     };
 
+    DeferredTypeCompleter dummyCompleter = new DeferredTypeCompleter() {
+        public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+            Assert.check(deferredAttrContext.mode == AttrMode.CHECK);
+            return dt.tree.type = Type.noType;
+        }
+    };
+
     /**
      * The 'mode' in which the deferred type is to be type-checked
      */
@@ -332,13 +339,22 @@
         /** inference context */
         final InferenceContext inferenceContext;
 
+        /** parent deferred context */
+        final DeferredAttrContext parent;
+
+        /** Warner object to report warnings */
+        final Warner warn;
+
         /** list of deferred attribution nodes to be processed */
         ArrayList<DeferredAttrNode> deferredAttrNodes = new ArrayList<DeferredAttrNode>();
 
-        DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase, InferenceContext inferenceContext) {
+        DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase,
+                InferenceContext inferenceContext, DeferredAttrContext parent, Warner warn) {
             this.mode = mode;
             this.msym = msym;
             this.phase = phase;
+            this.parent = parent;
+            this.warn = warn;
             this.inferenceContext = inferenceContext;
         }
 
@@ -363,7 +379,7 @@
                 //scan a defensive copy of the node list - this is because a deferred
                 //attribution round can add new nodes to the list
                 for (DeferredAttrNode deferredAttrNode : List.from(deferredAttrNodes)) {
-                    if (!deferredAttrNode.process()) {
+                    if (!deferredAttrNode.process(this)) {
                         stuckVars.addAll(deferredAttrNode.stuckVars);
                     } else {
                         deferredAttrNodes.remove(deferredAttrNode);
@@ -373,123 +389,133 @@
                 if (!progress) {
                     //remove all variables that have already been instantiated
                     //from the list of stuck variables
-                    inferenceContext.solveAny(inferenceContext.freeVarsIn(List.from(stuckVars)), types, infer);
-                    inferenceContext.notifyChange(types);
+                    inferenceContext.solveAny(List.from(stuckVars), warn);
+                    inferenceContext.notifyChange();
                 }
             }
         }
+    }
+
+    /**
+     * Class representing a deferred attribution node. It keeps track of
+     * a deferred type, along with the expected target type information.
+     */
+    class DeferredAttrNode implements Infer.FreeTypeListener {
+
+        /** underlying deferred type */
+        DeferredType dt;
+
+        /** underlying target type information */
+        ResultInfo resultInfo;
+
+        /** list of uninferred inference variables causing this node to be stuck */
+        List<Type> stuckVars;
+
+        DeferredAttrNode(DeferredType dt, ResultInfo resultInfo, List<Type> stuckVars) {
+            this.dt = dt;
+            this.resultInfo = resultInfo;
+            this.stuckVars = stuckVars;
+            if (!stuckVars.isEmpty()) {
+                resultInfo.checkContext.inferenceContext().addFreeTypeListener(stuckVars, this);
+            }
+        }
+
+        @Override
+        public void typesInferred(InferenceContext inferenceContext) {
+            stuckVars = List.nil();
+            resultInfo = resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
+        }
+
+        /**
+         * Process a deferred attribution node.
+         * Invariant: a stuck node cannot be processed.
+         */
+        @SuppressWarnings("fallthrough")
+        boolean process(DeferredAttrContext deferredAttrContext) {
+            switch (deferredAttrContext.mode) {
+                case SPECULATIVE:
+                    dt.check(resultInfo, List.<Type>nil(), new StructuralStuckChecker());
+                    return true;
+                case CHECK:
+                    if (stuckVars.nonEmpty()) {
+                        //stuck expression - see if we can propagate
+                        if (deferredAttrContext.parent != emptyDeferredAttrContext &&
+                                Type.containsAny(deferredAttrContext.parent.inferenceContext.inferencevars, List.from(stuckVars))) {
+                            deferredAttrContext.parent.deferredAttrNodes.add(this);
+                            dt.check(resultInfo, List.<Type>nil(), dummyCompleter);
+                            return true;
+                        } else {
+                            return false;
+                        }
+                    } else {
+                        dt.check(resultInfo, stuckVars, basicCompleter);
+                        return true;
+                    }
+                default:
+                    throw new AssertionError("Bad mode");
+            }
+        }
 
         /**
-         * Class representing a deferred attribution node. It keeps track of
-         * a deferred type, along with the expected target type information.
+         * Structural checker for stuck expressions
          */
-        class DeferredAttrNode implements Infer.InferenceContext.FreeTypeListener {
+        class StructuralStuckChecker extends TreeScanner implements DeferredTypeCompleter {
 
-            /** underlying deferred type */
-            DeferredType dt;
-
-            /** underlying target type information */
             ResultInfo resultInfo;
+            InferenceContext inferenceContext;
 
-            /** list of uninferred inference variables causing this node to be stuck */
-            List<Type> stuckVars;
+            public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+                this.resultInfo = resultInfo;
+                this.inferenceContext = deferredAttrContext.inferenceContext;
+                dt.tree.accept(this);
+                dt.speculativeCache.put(deferredAttrContext.msym, stuckTree, deferredAttrContext.phase);
+                return Type.noType;
+            }
 
-            DeferredAttrNode(DeferredType dt, ResultInfo resultInfo, List<Type> stuckVars) {
-                this.dt = dt;
-                this.resultInfo = resultInfo;
-                this.stuckVars = stuckVars;
-                if (!stuckVars.isEmpty()) {
-                    resultInfo.checkContext.inferenceContext().addFreeTypeListener(stuckVars, this);
+            @Override
+            public void visitLambda(JCLambda tree) {
+                Check.CheckContext checkContext = resultInfo.checkContext;
+                Type pt = resultInfo.pt;
+                if (inferenceContext.inferencevars.contains(pt)) {
+                    //ok
+                    return;
+                } else {
+                    //must be a functional descriptor
+                    try {
+                        Type desc = types.findDescriptorType(pt);
+                        if (desc.getParameterTypes().length() != tree.params.length()) {
+                            checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
+                        }
+                    } catch (Types.FunctionDescriptorLookupError ex) {
+                        checkContext.report(null, ex.getDiagnostic());
+                    }
                 }
             }
 
             @Override
-            public void typesInferred(InferenceContext inferenceContext) {
-                stuckVars = List.nil();
-                resultInfo = resultInfo.dup(inferenceContext.asInstType(resultInfo.pt, types));
+            public void visitNewClass(JCNewClass tree) {
+                //do nothing
             }
 
-            /**
-             * Process a deferred attribution node.
-             * Invariant: a stuck node cannot be processed.
-             */
-            @SuppressWarnings("fallthrough")
-            boolean process() {
-                switch (mode) {
-                    case SPECULATIVE:
-                        dt.check(resultInfo, List.<Type>nil(), new StructuralStuckChecker());
-                        return true;
-                    case CHECK:
-                        if (stuckVars.nonEmpty()) {
-                            return false;
-                        } else {
-                            dt.check(resultInfo, stuckVars, basicCompleter);
-                            return true;
-                        }
-                    default:
-                        throw new AssertionError("Bad mode");
-                }
+            @Override
+            public void visitApply(JCMethodInvocation tree) {
+                //do nothing
             }
 
-            /**
-             * Structural checker for stuck expressions
-             */
-            class StructuralStuckChecker extends TreeScanner implements DeferredTypeCompleter {
-
-                ResultInfo resultInfo;
-
-                public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
-                    this.resultInfo = resultInfo;
-                    dt.tree.accept(this);
-                    dt.speculativeCache.put(msym, stuckTree, phase);
-                    return Type.noType;
-                }
-
-                @Override
-                public void visitLambda(JCLambda tree) {
-                    Check.CheckContext checkContext = resultInfo.checkContext;
-                    Type pt = resultInfo.pt;
-                    if (inferenceContext.inferencevars.contains(pt)) {
-                        //ok
-                        return;
-                    } else {
-                        //must be a functional descriptor
-                        try {
-                            Type desc = types.findDescriptorType(pt);
-                            if (desc.getParameterTypes().length() != tree.params.length()) {
-                                checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
-                            }
-                        } catch (Types.FunctionDescriptorLookupError ex) {
-                            checkContext.report(null, ex.getDiagnostic());
-                        }
-                    }
-                }
-
-                @Override
-                public void visitNewClass(JCNewClass tree) {
-                    //do nothing
-                }
-
-                @Override
-                public void visitApply(JCMethodInvocation tree) {
-                    //do nothing
-                }
-
-                @Override
-                public void visitReference(JCMemberReference tree) {
-                    Check.CheckContext checkContext = resultInfo.checkContext;
-                    Type pt = resultInfo.pt;
-                    if (inferenceContext.inferencevars.contains(pt)) {
-                        //ok
-                        return;
-                    } else {
-                        try {
-                            //TODO: we should speculative determine if there's a match
-                            //based on arity - if yes, method is applicable.
-                            types.findDescriptorType(pt);
-                        } catch (Types.FunctionDescriptorLookupError ex) {
-                            checkContext.report(null, ex.getDiagnostic());
-                        }
+            @Override
+            public void visitReference(JCMemberReference tree) {
+                Check.CheckContext checkContext = resultInfo.checkContext;
+                Type pt = resultInfo.pt;
+                if (inferenceContext.inferencevars.contains(pt)) {
+                    //ok
+                    return;
+                } else {
+                    try {
+                        //TODO: we should speculative determine if there's a match
+                        //based on arity - if yes, method is applicable.
+                        types.findDescriptorType(pt);
+                    } catch (Types.FunctionDescriptorLookupError ex) {
+                        checkContext.report(null, ex.getDiagnostic());
                     }
                 }
             }
@@ -498,7 +524,7 @@
 
     /** an empty deferred attribution context - all methods throw exceptions */
     final DeferredAttrContext emptyDeferredAttrContext =
-            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, null) {
+            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, null, null, null) {
                 @Override
                 void addDeferredAttrNode(DeferredType dt, ResultInfo ri, List<Type> stuckVars) {
                     Assert.error("Empty deferred context!");
@@ -521,7 +547,8 @@
 
         protected DeferredTypeMap(AttrMode mode, Symbol msym, MethodResolutionPhase phase) {
             super(String.format("deferredTypeMap[%s]", mode));
-            this.deferredAttrContext = new DeferredAttrContext(mode, msym, phase, infer.emptyContext);
+            this.deferredAttrContext = new DeferredAttrContext(mode, msym, phase,
+                    infer.emptyContext, emptyDeferredAttrContext, types.noWarnings);
         }
 
         protected boolean validState(DeferredType dt) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -25,22 +25,30 @@
 
 package com.sun.tools.javac.comp;
 
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type.*;
-import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
-import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
-import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
-import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCTypeCast;
 import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
+import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph;
+import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph.Node;
+import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
+import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
 
 import static com.sun.tools.javac.code.TypeTag.*;
 
@@ -55,19 +63,15 @@
     protected static final Context.Key<Infer> inferKey =
         new Context.Key<Infer>();
 
-    /** A value for prototypes that admit any type, including polymorphic ones. */
-    public static final Type anyPoly = new Type(NONE, null);
-
+    Resolve rs;
+    Check chk;
     Symtab syms;
     Types types;
-    Check chk;
-    Resolve rs;
-    DeferredAttr deferredAttr;
+    JCDiagnostic.Factory diags;
     Log log;
-    JCDiagnostic.Factory diags;
 
-    /** Should we inject return-type constraints earlier? */
-    boolean allowEarlyReturnConstraints;
+    /** should the graph solver be used? */
+    boolean allowGraphInference;
 
     public static Infer instance(Context context) {
         Infer instance = context.get(inferKey);
@@ -78,17 +82,22 @@
 
     protected Infer(Context context) {
         context.put(inferKey, this);
+
+        rs = Resolve.instance(context);
+        chk = Check.instance(context);
         syms = Symtab.instance(context);
         types = Types.instance(context);
-        rs = Resolve.instance(context);
-        deferredAttr = DeferredAttr.instance(context);
+        diags = JCDiagnostic.Factory.instance(context);
         log = Log.instance(context);
-        chk = Check.instance(context);
-        diags = JCDiagnostic.Factory.instance(context);
         inferenceException = new InferenceException(diags);
-        allowEarlyReturnConstraints = Source.instance(context).allowEarlyReturnConstraints();
+        Options options = Options.instance(context);
+        allowGraphInference = Source.instance(context).allowGraphInference()
+                && options.isUnset("useLegacyInference");
     }
 
+    /** A value for prototypes that admit any type, including polymorphic ones. */
+    public static final Type anyPoly = new Type(NONE, null);
+
    /**
     * This exception class is design to store a list of diagnostics corresponding
     * to inference errors that can arise during a method applicability check.
@@ -118,140 +127,12 @@
         }
     }
 
-    final InferenceException inferenceException;
-
-/***************************************************************************
- * Mini/Maximization of UndetVars
- ***************************************************************************/
-
-    /** Instantiate undetermined type variable to its minimal upper bound.
-     *  Throw a NoInstanceException if this not possible.
-     */
-   void maximizeInst(UndetVar that, Warner warn) throws InferenceException {
-        List<Type> hibounds = Type.filter(that.getBounds(InferenceBound.UPPER), boundFilter);
-        if (that.getBounds(InferenceBound.EQ).isEmpty()) {
-            if (hibounds.isEmpty())
-                that.inst = syms.objectType;
-            else if (hibounds.tail.isEmpty())
-                that.inst = hibounds.head;
-            else
-                that.inst = types.glb(hibounds);
-        } else {
-            that.inst = that.getBounds(InferenceBound.EQ).head;
-        }
-        if (that.inst == null ||
-            that.inst.isErroneous())
-            throw inferenceException
-                .setMessage("no.unique.maximal.instance.exists",
-                            that.qtype, hibounds);
-    }
+    protected final InferenceException inferenceException;
 
-    private Filter<Type> boundFilter = new Filter<Type>() {
-        @Override
-        public boolean accepts(Type t) {
-            return !t.isErroneous() && !t.hasTag(BOT);
-        }
-    };
-
-    /** Instantiate undetermined type variable to the lub of all its lower bounds.
-     *  Throw a NoInstanceException if this not possible.
-     */
-    void minimizeInst(UndetVar that, Warner warn) throws InferenceException {
-        List<Type> lobounds = Type.filter(that.getBounds(InferenceBound.LOWER), boundFilter);
-        if (that.getBounds(InferenceBound.EQ).isEmpty()) {
-            if (lobounds.isEmpty()) {
-                //do nothing - the inference variable is under-constrained
-                return;
-            } else if (lobounds.tail.isEmpty())
-                that.inst = lobounds.head.isPrimitive() ? syms.errType : lobounds.head;
-            else {
-                that.inst = types.lub(lobounds);
-            }
-            if (that.inst == null || that.inst.hasTag(ERROR))
-                    throw inferenceException
-                        .setMessage("no.unique.minimal.instance.exists",
-                                    that.qtype, lobounds);
-        } else {
-            that.inst = that.getBounds(InferenceBound.EQ).head;
-        }
-    }
-
-/***************************************************************************
- * Exported Methods
- ***************************************************************************/
-
+    // <editor-fold defaultstate="collapsed" desc="Inference routines">
     /**
-     * Instantiate uninferred inference variables (JLS 15.12.2.8). First
-     * if the method return type is non-void, we derive constraints from the
-     * expected type - then we use declared bound well-formedness to derive additional
-     * constraints. If no instantiation exists, or if several incomparable
-     * best instantiations exist throw a NoInstanceException.
-     */
-    public void instantiateUninferred(DiagnosticPosition pos,
-            InferenceContext inferenceContext,
-            MethodType mtype,
-            Attr.ResultInfo resultInfo,
-            Warner warn) throws InferenceException {
-        while (true) {
-            boolean stuck = true;
-            for (Type t : inferenceContext.undetvars) {
-                UndetVar uv = (UndetVar)t;
-                if (uv.inst == null && (uv.getBounds(InferenceBound.EQ).nonEmpty() ||
-                        !inferenceContext.free(uv.getBounds(InferenceBound.UPPER)))) {
-                    maximizeInst((UndetVar)t, warn);
-                    stuck = false;
-                }
-            }
-            if (inferenceContext.restvars().isEmpty()) {
-                //all variables have been instantiated - exit
-                break;
-            } else if (stuck) {
-                //some variables could not be instantiated because of cycles in
-                //upper bounds - provide a (possibly recursive) default instantiation
-                instantiateAsUninferredVars(inferenceContext);
-                break;
-            } else {
-                //some variables have been instantiated - replace newly instantiated
-                //variables in remaining upper bounds and continue
-                for (Type t : inferenceContext.undetvars) {
-                    UndetVar uv = (UndetVar)t;
-                    uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), types);
-                }
-            }
-        }
-    }
-
-    /**
-     * Infer cyclic inference variables as described in 15.12.2.8.
-     */
-    private void instantiateAsUninferredVars(InferenceContext inferenceContext) {
-        ListBuffer<Type> todo = ListBuffer.lb();
-        //step 1 - create fresh tvars
-        for (Type t : inferenceContext.undetvars) {
-            UndetVar uv = (UndetVar)t;
-            if (uv.inst == null) {
-                TypeSymbol fresh_tvar = new TypeSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
-                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null);
-                todo.append(uv);
-                uv.inst = fresh_tvar.type;
-            }
-        }
-        //step 2 - replace fresh tvars in their bounds
-        List<Type> formals = inferenceContext.inferenceVars();
-        for (Type t : todo) {
-            UndetVar uv = (UndetVar)t;
-            TypeVar ct = (TypeVar)uv.inst;
-            ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct), types));
-            if (ct.bound.isErroneous()) {
-                //report inference error if glb fails
-                reportBoundError(uv, BoundErrorKind.BAD_UPPER);
-            }
-            formals = formals.tail;
-        }
-    }
-
-    /** Instantiate a generic method type by finding instantiations for all its
-     * inference variables so that it can be applied to a given argument type list.
+     * Main inference entry point - instantiate a generic method type
+     * using given argument types and (possibly) an expected target-type.
      */
     public Type instantiateMethod(Env<AttrContext> env,
                                   List<Type> tvars,
@@ -265,259 +146,146 @@
                                   Resolve.MethodCheck methodCheck,
                                   Warner warn) throws InferenceException {
         //-System.err.println("instantiateMethod(" + tvars + ", " + mt + ", " + argtypes + ")"); //DEBUG
-        final InferenceContext inferenceContext = new InferenceContext(tvars, this, true);
+        final InferenceContext inferenceContext = new InferenceContext(tvars);
         inferenceException.clear();
+        try {
+            DeferredAttr.DeferredAttrContext deferredAttrContext =
+                    resolveContext.deferredAttrContext(msym, inferenceContext, resultInfo, warn);
 
-        DeferredAttr.DeferredAttrContext deferredAttrContext =
-                resolveContext.deferredAttrContext(msym, inferenceContext);
+            methodCheck.argumentsAcceptable(env, deferredAttrContext,
+                    argtypes, mt.getParameterTypes(), warn);
 
-        try {
-            methodCheck.argumentsAcceptable(env, deferredAttrContext, argtypes, mt.getParameterTypes(), warn);
-
-            if (resultInfo != null && allowEarlyReturnConstraints &&
+            if (allowGraphInference &&
+                    resultInfo != null &&
                     !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
-                generateReturnConstraints(mt, inferenceContext, resultInfo);
+                //inject return constraints earlier
+                checkWithinBounds(inferenceContext, warn); //propagation
+                generateReturnConstraints(resultInfo, mt, inferenceContext);
+                //propagate outwards if needed
+                if (resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
+                    //propagate inference context outwards and exit
+                    inferenceContext.dupTo(resultInfo.checkContext.inferenceContext());
+                    deferredAttrContext.complete();
+                    return mt;
+                }
             }
 
             deferredAttrContext.complete();
 
             // minimize as yet undetermined type variables
-            for (Type t : inferenceContext.undetvars) {
-                minimizeInst((UndetVar)t, warn);
+            if (allowGraphInference) {
+                inferenceContext.solve(warn);
+            } else {
+                inferenceContext.solveLegacy(true, warn, LegacyInferenceSteps.EQ_LOWER.steps); //minimizeInst
             }
 
-            checkWithinBounds(inferenceContext, warn);
-
-            mt = (MethodType)inferenceContext.asInstType(mt, types);
-
-            List<Type> restvars = inferenceContext.restvars();
+            mt = (MethodType)inferenceContext.asInstType(mt);
 
-            if (!restvars.isEmpty()) {
-                if (resultInfo != null && !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
-                    if (!allowEarlyReturnConstraints) {
-                        generateReturnConstraints(mt, inferenceContext, resultInfo);
-                    }
-                    instantiateUninferred(env.tree.pos(), inferenceContext, mt, resultInfo, warn);
-                    checkWithinBounds(inferenceContext, warn);
-                    mt = (MethodType)inferenceContext.asInstType(mt, types);
-                    if (rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
-                        log.note(env.tree.pos, "deferred.method.inst", msym, mt, resultInfo.pt);
-                    }
-                }
+            if (!allowGraphInference &&
+                    inferenceContext.restvars().nonEmpty() &&
+                    resultInfo != null &&
+                    !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
+                generateReturnConstraints(resultInfo, mt, inferenceContext);
+                inferenceContext.solveLegacy(false, warn, LegacyInferenceSteps.EQ_UPPER.steps); //maximizeInst
+                mt = (MethodType)inferenceContext.asInstType(mt);
+            }
+
+            if (resultInfo != null && rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
+                log.note(env.tree.pos, "deferred.method.inst", msym, mt, resultInfo.pt);
             }
 
             // return instantiated version of method type
             return mt;
         } finally {
-            inferenceContext.notifyChange(types);
-        }
-    }
-    //where
-        void generateReturnConstraints(Type mt, InferenceContext inferenceContext, Attr.ResultInfo resultInfo) {
-            if (resultInfo != null) {
-                Type to = resultInfo.pt;
-                if (to.hasTag(NONE) || resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
-                    to = mt.getReturnType().isPrimitiveOrVoid() ?
-                            mt.getReturnType() : syms.objectType;
-                }
-                Type qtype1 = inferenceContext.asFree(mt.getReturnType(), types);
-                Warner retWarn = new Warner();
-                if (!resultInfo.checkContext.compatible(qtype1, qtype1.hasTag(UNDETVAR) ? types.boxedTypeOrType(to) : to, retWarn) ||
-                        //unchecked conversion is not allowed
-                        retWarn.hasLint(Lint.LintCategory.UNCHECKED)) {
-                    throw inferenceException
-                            .setMessage("infer.no.conforming.instance.exists",
-                            inferenceContext.restvars(), mt.getReturnType(), to);
-                }
-            }
-        }
-
-    /** check that type parameters are within their bounds.
-     */
-    void checkWithinBounds(InferenceContext inferenceContext,
-                           Warner warn) throws InferenceException {
-        //step 1 - check compatibility of instantiated type w.r.t. initial bounds
-        for (Type t : inferenceContext.undetvars) {
-            UndetVar uv = (UndetVar)t;
-            uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), types);
-            checkCompatibleUpperBounds(uv, inferenceContext.inferenceVars());
-            if (!inferenceContext.restvars().contains(uv.qtype)) {
-                Type inst = inferenceContext.asInstType(t, types);
-                for (Type u : uv.getBounds(InferenceBound.UPPER)) {
-                    if (!types.isSubtypeUnchecked(inst, inferenceContext.asFree(u, types), warn)) {
-                        reportBoundError(uv, BoundErrorKind.UPPER);
-                    }
-                }
-                for (Type l : uv.getBounds(InferenceBound.LOWER)) {
-                    Assert.check(!inferenceContext.free(l));
-                    if (!types.isSubtypeUnchecked(l, inst, warn)) {
-                        reportBoundError(uv, BoundErrorKind.LOWER);
-                    }
-                }
-                for (Type e : uv.getBounds(InferenceBound.EQ)) {
-                    Assert.check(!inferenceContext.free(e));
-                    if (!types.isSameType(inst, e)) {
-                        reportBoundError(uv, BoundErrorKind.EQ);
-                    }
-                }
-            }
-        }
-
-        //step 2 - check that eq bounds are consistent w.r.t. eq/lower bounds
-        for (Type t : inferenceContext.undetvars) {
-            UndetVar uv = (UndetVar)t;
-            //check eq bounds consistency
-            Type eq = null;
-            for (Type e : uv.getBounds(InferenceBound.EQ)) {
-                Assert.check(!inferenceContext.free(e));
-                if (eq != null && !types.isSameType(e, eq)) {
-                    reportBoundError(uv, BoundErrorKind.EQ);
-                }
-                eq = e;
-                for (Type l : uv.getBounds(InferenceBound.LOWER)) {
-                    Assert.check(!inferenceContext.free(l));
-                    if (!types.isSubtypeUnchecked(l, e, warn)) {
-                        reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
-                    }
-                }
-                for (Type u : uv.getBounds(InferenceBound.UPPER)) {
-                    if (inferenceContext.free(u)) continue;
-                    if (!types.isSubtypeUnchecked(e, u, warn)) {
-                        reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
-                    }
-                }
+            if (resultInfo != null || !allowGraphInference) {
+                inferenceContext.notifyChange();
+            } else {
+                inferenceContext.notifyChange(inferenceContext.boundedVars());
             }
         }
     }
 
-    void checkCompatibleUpperBounds(UndetVar uv, List<Type> tvars) {
-        // VGJ: sort of inlined maximizeInst() below.  Adding
-        // bounds can cause lobounds that are above hibounds.
-        ListBuffer<Type> hiboundsNoVars = ListBuffer.lb();
-        for (Type t : Type.filter(uv.getBounds(InferenceBound.UPPER), boundFilter)) {
-            if (!t.containsAny(tvars)) {
-                hiboundsNoVars.append(t);
+    /**
+     * Generate constraints from the generic method's return type. If the method
+     * call occurs in a context where a type T is expected, use the expected
+     * type to derive more constraints on the generic method inference variables.
+     */
+    void generateReturnConstraints(Attr.ResultInfo resultInfo,
+            MethodType mt, InferenceContext inferenceContext) {
+        Type qtype1 = inferenceContext.asFree(mt.getReturnType());
+        Type to = returnConstraintTarget(qtype1, resultInfo.pt);
+        Assert.check(allowGraphInference || !resultInfo.checkContext.inferenceContext().free(to),
+                "legacy inference engine cannot handle constraints on both sides of a subtyping assertion");
+        //we need to skip capture?
+        Warner retWarn = new Warner();
+        if (!resultInfo.checkContext.compatible(qtype1, resultInfo.checkContext.inferenceContext().asFree(to), retWarn) ||
+                //unchecked conversion is not allowed
+                retWarn.hasLint(Lint.LintCategory.UNCHECKED)) {
+            throw inferenceException
+                    .setMessage("infer.no.conforming.instance.exists",
+                    inferenceContext.restvars(), mt.getReturnType(), to);
+        }
+    }
+    //where
+        private Type returnConstraintTarget(Type from, Type to) {
+            if (from.hasTag(VOID)) {
+                return syms.voidType;
+            } else if (to.hasTag(NONE)) {
+                return from.isPrimitive() ? from : syms.objectType;
+            } else if (from.hasTag(UNDETVAR) && to.isPrimitive()) {
+                if (!allowGraphInference) {
+                    //if legacy, just return boxed type
+                    return types.boxedClass(to).type;
+                }
+                //if graph inference we need to skip conflicting boxed bounds...
+                UndetVar uv = (UndetVar)from;
+                for (Type t : uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) {
+                    Type boundAsPrimitive = types.unboxedType(t);
+                    if (boundAsPrimitive == null) continue;
+                    if (types.isConvertible(boundAsPrimitive, to)) {
+                        //effectively skip return-type constraint generation (compatibility)
+                        return syms.objectType;
+                    }
+                }
+                return types.boxedClass(to).type;
+            } else {
+                return to;
             }
         }
-        List<Type> hibounds = hiboundsNoVars.toList();
-        Type hb = null;
-        if (hibounds.isEmpty())
-            hb = syms.objectType;
-        else if (hibounds.tail.isEmpty())
-            hb = hibounds.head;
-        else
-            hb = types.glb(hibounds);
-        if (hb == null || hb.isErroneous())
-            reportBoundError(uv, BoundErrorKind.BAD_UPPER);
-    }
 
-    enum BoundErrorKind {
-        BAD_UPPER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("incompatible.upper.bounds", uv.qtype,
-                        uv.getBounds(InferenceBound.UPPER));
-            }
-        },
-        BAD_EQ_UPPER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("incompatible.eq.upper.bounds", uv.qtype,
-                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.UPPER));
-            }
-        },
-        BAD_EQ_LOWER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("incompatible.eq.lower.bounds", uv.qtype,
-                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.LOWER));
-            }
-        },
-        UPPER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("inferred.do.not.conform.to.upper.bounds", uv.inst,
-                        uv.getBounds(InferenceBound.UPPER));
-            }
-        },
-        LOWER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("inferred.do.not.conform.to.lower.bounds", uv.inst,
-                        uv.getBounds(InferenceBound.LOWER));
-            }
-        },
-        EQ() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("inferred.do.not.conform.to.eq.bounds", uv.inst,
-                        uv.getBounds(InferenceBound.EQ));
+    /**
+      * Infer cyclic inference variables as described in 15.12.2.8.
+      */
+    private void instantiateAsUninferredVars(List<Type> vars, InferenceContext inferenceContext) {
+        ListBuffer<Type> todo = ListBuffer.lb();
+        //step 1 - create fresh tvars
+        for (Type t : vars) {
+            UndetVar uv = (UndetVar)inferenceContext.asFree(t);
+            List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER);
+            if (Type.containsAny(upperBounds, vars)) {
+                TypeSymbol fresh_tvar = new TypeSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
+                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null);
+                todo.append(uv);
+                uv.inst = fresh_tvar.type;
+            } else if (upperBounds.nonEmpty()) {
+                uv.inst = types.glb(upperBounds);
+            } else {
+                uv.inst = syms.objectType;
             }
-        };
-
-        abstract InapplicableMethodException setMessage(InferenceException ex, UndetVar uv);
-    }
-    //where
-    void reportBoundError(UndetVar uv, BoundErrorKind bk) {
-        throw bk.setMessage(inferenceException, uv);
-    }
-
-    // <editor-fold desc="functional interface instantiation">
-    /**
-     * This method is used to infer a suitable target functional interface in case
-     * the original parameterized interface contains wildcards. An inference process
-     * is applied so that wildcard bounds, as well as explicit lambda/method ref parameters
-     * (where applicable) are used to constraint the solution.
-     */
-    public Type instantiateFunctionalInterface(DiagnosticPosition pos, Type funcInterface,
-            List<Type> paramTypes, Check.CheckContext checkContext) {
-        if (types.capture(funcInterface) == funcInterface) {
-            //if capture doesn't change the type then return the target unchanged
-            //(this means the target contains no wildcards!)
-            return funcInterface;
-        } else {
-            Type formalInterface = funcInterface.tsym.type;
-            InferenceContext funcInterfaceContext =
-                    new InferenceContext(funcInterface.tsym.type.getTypeArguments(), this, false);
-            Assert.check(paramTypes != null);
-            //get constraints from explicit params (this is done by
-            //checking that explicit param types are equal to the ones
-            //in the functional interface descriptors)
-            List<Type> descParameterTypes = types.findDescriptorType(formalInterface).getParameterTypes();
-            if (descParameterTypes.size() != paramTypes.size()) {
-                checkContext.report(pos, diags.fragment("incompatible.arg.types.in.lambda"));
-                return types.createErrorType(funcInterface);
+        }
+        //step 2 - replace fresh tvars in their bounds
+        List<Type> formals = vars;
+        for (Type t : todo) {
+            UndetVar uv = (UndetVar)t;
+            TypeVar ct = (TypeVar)uv.inst;
+            ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct)));
+            if (ct.bound.isErroneous()) {
+                //report inference error if glb fails
+                reportBoundError(uv, BoundErrorKind.BAD_UPPER);
             }
-            for (Type p : descParameterTypes) {
-                if (!types.isSameType(funcInterfaceContext.asFree(p, types), paramTypes.head)) {
-                    checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
-                    return types.createErrorType(funcInterface);
-                }
-                paramTypes = paramTypes.tail;
-            }
-            List<Type> actualTypeargs = funcInterface.getTypeArguments();
-            for (Type t : funcInterfaceContext.undetvars) {
-                UndetVar uv = (UndetVar)t;
-                minimizeInst(uv, types.noWarnings);
-                if (uv.inst == null &&
-                        Type.filter(uv.getBounds(InferenceBound.UPPER), boundFilter).nonEmpty()) {
-                    maximizeInst(uv, types.noWarnings);
-                }
-                if (uv.inst == null) {
-                    uv.inst = actualTypeargs.head;
-                }
-                actualTypeargs = actualTypeargs.tail;
-            }
-            Type owntype = funcInterfaceContext.asInstType(formalInterface, types);
-            if (!chk.checkValidGenericType(owntype)) {
-                //if the inferred functional interface type is not well-formed,
-                //or if it's not a subtype of the original target, issue an error
-                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
-            }
-            return owntype;
+            formals = formals.tail;
         }
     }
-    // </editor-fold>
 
     /**
      * Compute a synthetic method type corresponding to the requested polymorphic
@@ -571,7 +339,7 @@
         class ImplicitArgType extends DeferredAttr.DeferredTypeMap {
 
             public ImplicitArgType(Symbol msym, Resolve.MethodResolutionPhase phase) {
-                deferredAttr.super(AttrMode.SPECULATIVE, msym, phase);
+                rs.deferredAttr.super(AttrMode.SPECULATIVE, msym, phase);
             }
 
             public Type apply(Type t) {
@@ -585,23 +353,927 @@
         }
 
     /**
-     * Mapping that turns inference variables into undet vars
-     * (used by inference context)
+      * This method is used to infer a suitable target SAM in case the original
+      * SAM type contains one or more wildcards. An inference process is applied
+      * so that wildcard bounds, as well as explicit lambda/method ref parameters
+      * (where applicable) are used to constraint the solution.
+      */
+    public Type instantiateFunctionalInterface(DiagnosticPosition pos, Type funcInterface,
+            List<Type> paramTypes, Check.CheckContext checkContext) {
+        if (types.capture(funcInterface) == funcInterface) {
+            //if capture doesn't change the type then return the target unchanged
+            //(this means the target contains no wildcards!)
+            return funcInterface;
+        } else {
+            Type formalInterface = funcInterface.tsym.type;
+            InferenceContext funcInterfaceContext =
+                    new InferenceContext(funcInterface.tsym.type.getTypeArguments());
+
+            Assert.check(paramTypes != null);
+            //get constraints from explicit params (this is done by
+            //checking that explicit param types are equal to the ones
+            //in the functional interface descriptors)
+            List<Type> descParameterTypes = types.findDescriptorType(formalInterface).getParameterTypes();
+            if (descParameterTypes.size() != paramTypes.size()) {
+                checkContext.report(pos, diags.fragment("incompatible.arg.types.in.lambda"));
+                return types.createErrorType(funcInterface);
+            }
+            for (Type p : descParameterTypes) {
+                if (!types.isSameType(funcInterfaceContext.asFree(p), paramTypes.head)) {
+                    checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
+                    return types.createErrorType(funcInterface);
+                }
+                paramTypes = paramTypes.tail;
+            }
+
+            try {
+                funcInterfaceContext.solve(funcInterfaceContext.boundedVars(), types.noWarnings);
+            } catch (InferenceException ex) {
+                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
+            }
+
+            List<Type> actualTypeargs = funcInterface.getTypeArguments();
+            for (Type t : funcInterfaceContext.undetvars) {
+                UndetVar uv = (UndetVar)t;
+                if (uv.inst == null) {
+                    uv.inst = actualTypeargs.head;
+                }
+                actualTypeargs = actualTypeargs.tail;
+            }
+
+            Type owntype = funcInterfaceContext.asInstType(formalInterface);
+            if (!chk.checkValidGenericType(owntype)) {
+                //if the inferred functional interface type is not well-formed,
+                //or if it's not a subtype of the original target, issue an error
+                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
+            }
+            return owntype;
+        }
+    }
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Bound checking">
+    /**
+     * Check bounds and perform incorporation
      */
-    class FromTypeVarFun extends Mapping {
+    void checkWithinBounds(InferenceContext inferenceContext,
+                             Warner warn) throws InferenceException {
+        MultiUndetVarListener mlistener = new MultiUndetVarListener(inferenceContext.undetvars);
+        try {
+            while (true) {
+                mlistener.reset();
+                if (!allowGraphInference) {
+                    //in legacy mode we lack of transitivity, so bound check
+                    //cannot be run in parallel with other incoprporation rounds
+                    for (Type t : inferenceContext.undetvars) {
+                        UndetVar uv = (UndetVar)t;
+                        IncorporationStep.CHECK_BOUNDS.apply(uv, inferenceContext, warn);
+                    }
+                }
+                for (Type t : inferenceContext.undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    //bound incorporation
+                    EnumSet<IncorporationStep> incorporationSteps = allowGraphInference ?
+                            incorporationStepsGraph : incorporationStepsLegacy;
+                    for (IncorporationStep is : incorporationSteps) {
+                        is.apply(uv, inferenceContext, warn);
+                    }
+                }
+                if (!mlistener.changed || !allowGraphInference) break;
+            }
+        }
+        finally {
+            mlistener.detach();
+        }
+    }
+    //where
+        /**
+         * This listener keeps track of changes on a group of inference variable
+         * bounds. Note: the listener must be detached (calling corresponding
+         * method) to make sure that the underlying inference variable is
+         * left in a clean state.
+         */
+        class MultiUndetVarListener implements UndetVar.UndetVarListener {
+
+            int rounds;
+            boolean changed;
+            List<Type> undetvars;
+
+            public MultiUndetVarListener(List<Type> undetvars) {
+                this.undetvars = undetvars;
+                for (Type t : undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    uv.listener = this;
+                }
+            }
+
+            public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
+                //avoid non-termination
+                if (rounds < MAX_INCORPORATION_STEPS) {
+                    changed = true;
+                }
+            }
+
+            void reset() {
+                rounds++;
+                changed = false;
+            }
+
+            void detach() {
+                for (Type t : undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    uv.listener = null;
+                }
+            }
+        };
+
+        /** max number of incorporation rounds */
+        static final int MAX_INCORPORATION_STEPS = 100;
 
-        boolean includeBounds;
+    /**
+     * This enumeration defines an entry point for doing inference variable
+     * bound incorporation - it can be used to inject custom incorporation
+     * logic into the basic bound checking routine
+     */
+    enum IncorporationStep {
+        /**
+         * Performs basic bound checking - i.e. is the instantiated type for a given
+         * inference variable compatible with its bounds?
+         */
+        CHECK_BOUNDS() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), infer.types);
+                infer.checkCompatibleUpperBounds(uv, inferenceContext);
+                if (uv.inst != null) {
+                    Type inst = uv.inst;
+                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
+                        if (!infer.types.isSubtypeUnchecked(inst, inferenceContext.asFree(u), warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.UPPER);
+                        }
+                    }
+                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
+                        if (!infer.types.isSubtypeUnchecked(inferenceContext.asFree(l), inst, warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.LOWER);
+                        }
+                    }
+                    for (Type e : uv.getBounds(InferenceBound.EQ)) {
+                        if (!infer.types.isSameType(inst, inferenceContext.asFree(e))) {
+                            infer.reportBoundError(uv, BoundErrorKind.EQ);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Check consistency of equality constraints. This is a slightly more aggressive
+         * inference routine that is designed as to maximize compatibility with JDK 7.
+         * Note: this is not used in graph mode.
+         */
+        EQ_CHECK_LEGACY() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                Type eq = null;
+                for (Type e : uv.getBounds(InferenceBound.EQ)) {
+                    Assert.check(!inferenceContext.free(e));
+                    if (eq != null && !infer.types.isSameType(e, eq)) {
+                        infer.reportBoundError(uv, BoundErrorKind.EQ);
+                    }
+                    eq = e;
+                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
+                        Assert.check(!inferenceContext.free(l));
+                        if (!infer.types.isSubtypeUnchecked(l, e, warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
+                        }
+                    }
+                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
+                        if (inferenceContext.free(u)) continue;
+                        if (!infer.types.isSubtypeUnchecked(e, u, warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Check consistency of equality constraints.
+         */
+        EQ_CHECK() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type e : uv.getBounds(InferenceBound.EQ)) {
+                    if (e.containsAny(inferenceContext.inferenceVars())) continue;
+                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
+                        if (!infer.types.isSubtypeUnchecked(e, inferenceContext.asFree(u), warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
+                        }
+                    }
+                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
+                        if (!infer.types.isSubtypeUnchecked(inferenceContext.asFree(l), e, warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha <: T} and {@code alpha :> S}
+         * perform {@code S <: T} (which could lead to new bounds).
+         */
+        CROSS_UPPER_LOWER() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
+                    for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
+                        if (!inferenceContext.inferenceVars().contains(b1) &&
+                                !inferenceContext.inferenceVars().contains(b2) &&
+                                infer.types.asSuper(b2, b1.tsym) != null) {
+                            infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha <: T} and {@code alpha == S}
+         * perform {@code S <: T} (which could lead to new bounds).
+         */
+        CROSS_UPPER_EQ() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
+                    for (Type b2 : uv.getBounds(InferenceBound.EQ)) {
+                        if (!inferenceContext.inferenceVars().contains(b1) &&
+                                !inferenceContext.inferenceVars().contains(b2) &&
+                                infer.types.asSuper(b2, b1.tsym) != null) {
+                            infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha :> S} and {@code alpha == T}
+         * perform {@code S <: T} (which could lead to new bounds).
+         */
+        CROSS_EQ_LOWER() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b1 : uv.getBounds(InferenceBound.EQ)) {
+                    for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
+                        if (!inferenceContext.inferenceVars().contains(b1) &&
+                                !inferenceContext.inferenceVars().contains(b2) &&
+                                infer.types.asSuper(b2, b1.tsym) != null) {
+                            infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha <: beta} propagate lower bounds
+         * from alpha to beta; also propagate upper bounds from beta to alpha.
+         */
+        PROP_UPPER() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b : uv.getBounds(InferenceBound.UPPER)) {
+                    if (inferenceContext.inferenceVars().contains(b)) {
+                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
+                        //alpha <: beta
+                        //1. copy alpha's lower to beta's
+                        for (Type l : uv.getBounds(InferenceBound.LOWER)) {
+                            uv2.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
+                        }
+                        //2. copy beta's upper to alpha's
+                        for (Type u : uv2.getBounds(InferenceBound.UPPER)) {
+                            uv.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha :> beta} propagate lower bounds
+         * from beta to alpha; also propagate upper bounds from alpha to beta.
+         */
+        PROP_LOWER() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b : uv.getBounds(InferenceBound.LOWER)) {
+                    if (inferenceContext.inferenceVars().contains(b)) {
+                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
+                        //alpha :> beta
+                        //1. copy alpha's upper to beta's
+                        for (Type u : uv.getBounds(InferenceBound.UPPER)) {
+                            uv2.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
+                        }
+                        //2. copy beta's lower to alpha's
+                        for (Type l : uv2.getBounds(InferenceBound.LOWER)) {
+                            uv.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha == beta} propagate lower/upper
+         * bounds from alpha to beta and back.
+         */
+        PROP_EQ() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b : uv.getBounds(InferenceBound.EQ)) {
+                    if (inferenceContext.inferenceVars().contains(b)) {
+                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
+                        //alpha == beta
+                        //1. copy all alpha's bounds to beta's
+                        for (InferenceBound ib : InferenceBound.values()) {
+                            for (Type b2 : uv.getBounds(ib)) {
+                                if (b2 != uv2) {
+                                    uv2.addBound(ib, inferenceContext.asInstType(b2), infer.types);
+                                }
+                            }
+                        }
+                        //2. copy all beta's bounds to alpha's
+                        for (InferenceBound ib : InferenceBound.values()) {
+                            for (Type b2 : uv2.getBounds(ib)) {
+                                if (b2 != uv) {
+                                    uv.addBound(ib, inferenceContext.asInstType(b2), infer.types);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        };
 
-        FromTypeVarFun(boolean includeBounds) {
-            super("fromTypeVarFunWithBounds");
-            this.includeBounds = includeBounds;
+        abstract void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn);
+    }
+
+    /** incorporation steps to be executed when running in legacy mode */
+    EnumSet<IncorporationStep> incorporationStepsLegacy = EnumSet.of(IncorporationStep.EQ_CHECK_LEGACY);
+
+    /** incorporation steps to be executed when running in graph mode */
+    EnumSet<IncorporationStep> incorporationStepsGraph =
+            EnumSet.complementOf(EnumSet.of(IncorporationStep.EQ_CHECK_LEGACY));
+
+    /**
+     * Make sure that the upper bounds we got so far lead to a solvable inference
+     * variable by making sure that a glb exists.
+     */
+    void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) {
+        List<Type> hibounds =
+                Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext));
+        Type hb = null;
+        if (hibounds.isEmpty())
+            hb = syms.objectType;
+        else if (hibounds.tail.isEmpty())
+            hb = hibounds.head;
+        else
+            hb = types.glb(hibounds);
+        if (hb == null || hb.isErroneous())
+            reportBoundError(uv, BoundErrorKind.BAD_UPPER);
+    }
+    //where
+        protected static class BoundFilter implements Filter<Type> {
+
+            InferenceContext inferenceContext;
+
+            public BoundFilter(InferenceContext inferenceContext) {
+                this.inferenceContext = inferenceContext;
+            }
+
+            @Override
+            public boolean accepts(Type t) {
+                return !t.isErroneous() && !inferenceContext.free(t) &&
+                        !t.hasTag(BOT);
+            }
+        };
+
+    /**
+     * This enumeration defines all possible bound-checking related errors.
+     */
+    enum BoundErrorKind {
+        /**
+         * The (uninstantiated) inference variable has incompatible upper bounds.
+         */
+        BAD_UPPER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("incompatible.upper.bounds", uv.qtype,
+                        uv.getBounds(InferenceBound.UPPER));
+            }
+        },
+        /**
+         * An equality constraint is not compatible with an upper bound.
+         */
+        BAD_EQ_UPPER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("incompatible.eq.upper.bounds", uv.qtype,
+                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.UPPER));
+            }
+        },
+        /**
+         * An equality constraint is not compatible with a lower bound.
+         */
+        BAD_EQ_LOWER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("incompatible.eq.lower.bounds", uv.qtype,
+                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.LOWER));
+            }
+        },
+        /**
+         * Instantiated inference variable is not compatible with an upper bound.
+         */
+        UPPER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.upper.bounds", uv.inst,
+                        uv.getBounds(InferenceBound.UPPER));
+            }
+        },
+        /**
+         * Instantiated inference variable is not compatible with a lower bound.
+         */
+        LOWER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.lower.bounds", uv.inst,
+                        uv.getBounds(InferenceBound.LOWER));
+            }
+        },
+        /**
+         * Instantiated inference variable is not compatible with an equality constraint.
+         */
+        EQ() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.eq.bounds", uv.inst,
+                        uv.getBounds(InferenceBound.EQ));
+            }
+        };
+
+        abstract InapplicableMethodException setMessage(InferenceException ex, UndetVar uv);
+    }
+
+    /**
+     * Report a bound-checking error of given kind
+     */
+    void reportBoundError(UndetVar uv, BoundErrorKind bk) {
+        throw bk.setMessage(inferenceException, uv);
+    }
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Inference engine">
+    /**
+     * Graph inference strategy - act as an input to the inference solver; a strategy is
+     * composed of two ingredients: (i) find a node to solve in the inference graph,
+     * and (ii) tell th engine when we are done fixing inference variables
+     */
+    interface GraphStrategy {
+        /**
+         * Pick the next node (leaf) to solve in the graph
+         */
+        Node pickNode(InferenceGraph g);
+        /**
+         * Is this the last step?
+         */
+        boolean done();
+    }
+
+    /**
+     * Simple solver strategy class that locates all leaves inside a graph
+     * and picks the first leaf as the next node to solve
+     */
+    abstract class LeafSolver implements GraphStrategy {
+        public Node pickNode(InferenceGraph g) {
+                        Assert.check(!g.nodes.isEmpty(), "No nodes to solve!");
+            return g.nodes.get(0);
+        }
+    }
+
+    /**
+     * This solver uses an heuristic to pick the best leaf - the heuristic
+     * tries to select the node that has maximal probability to contain one
+     * or more inference variables in a given list
+     */
+    abstract class BestLeafSolver extends LeafSolver {
+
+        List<Type> varsToSolve;
+
+        BestLeafSolver(List<Type> varsToSolve) {
+            this.varsToSolve = varsToSolve;
         }
 
-        public Type apply(Type t) {
-            if (t.hasTag(TYPEVAR)) return new UndetVar((TypeVar)t, types, includeBounds);
-            else return t.map(this);
+        /**
+         * Computes the cost associated with a given node; the cost is computed
+         * as the total number of type-variables that should be eagerly instantiated
+         * in order to get to some of the variables in {@code varsToSolve} from
+         * a given node
+         */
+        void computeCostIfNeeded(Node n, Map<Node, Integer> costMap) {
+            if (costMap.containsKey(n)) {
+                return;
+            } else if (!Collections.disjoint(n.data, varsToSolve)) {
+                costMap.put(n, n.data.size());
+            } else {
+                int subcost = Integer.MAX_VALUE;
+                costMap.put(n, subcost); //avoid loops
+                for (Node n2 : n.getDependencies()) {
+                    computeCostIfNeeded(n2, costMap);
+                    subcost = Math.min(costMap.get(n2), subcost);
+                }
+                //update cost map to reflect real cost
+                costMap.put(n, subcost == Integer.MAX_VALUE ?
+                        Integer.MAX_VALUE :
+                        n.data.size() + subcost);
+            }
+        }
+
+        /**
+         * Pick the leaf that minimize cost
+         */
+        @Override
+        public Node pickNode(final InferenceGraph g) {
+            final Map<Node, Integer> costMap = new HashMap<Node, Integer>();
+            ArrayList<Node> leaves = new ArrayList<Node>();
+            for (Node n : g.nodes) {
+                computeCostIfNeeded(n, costMap);
+                if (n.isLeaf(n)) {
+                    leaves.add(n);
+                }
+            }
+            Assert.check(!leaves.isEmpty(), "No nodes to solve!");
+            Collections.sort(leaves, new java.util.Comparator<Node>() {
+                public int compare(Node n1, Node n2) {
+                    return costMap.get(n1) - costMap.get(n2);
+                }
+            });
+            return leaves.get(0);
+        }
+    }
+
+    /**
+     * The inference process can be thought of as a sequence of steps. Each step
+     * instantiates an inference variable using a subset of the inference variable
+     * bounds, if certain condition are met. Decisions such as the sequence in which
+     * steps are applied, or which steps are to be applied are left to the inference engine.
+     */
+    enum InferenceStep {
+
+        /**
+         * Instantiate an inference variables using one of its (ground) equality
+         * constraints
+         */
+        EQ(InferenceBound.EQ) {
+            @Override
+            Type solve(UndetVar uv, InferenceContext inferenceContext) {
+                return filterBounds(uv, inferenceContext).head;
+            }
+        },
+        /**
+         * Instantiate an inference variables using its (ground) lower bounds. Such
+         * bounds are merged together using lub().
+         */
+        LOWER(InferenceBound.LOWER) {
+            @Override
+            Type solve(UndetVar uv, InferenceContext inferenceContext) {
+                Infer infer = inferenceContext.infer();
+                List<Type> lobounds = filterBounds(uv, inferenceContext);
+                Type owntype = infer.types.lub(lobounds);
+                if (owntype.hasTag(ERROR)) {
+                    throw infer.inferenceException
+                        .setMessage("no.unique.minimal.instance.exists",
+                                    uv.qtype, lobounds);
+                } else {
+                    return owntype;
+                }
+            }
+        },
+        /**
+         * Instantiate an inference variables using its (ground) upper bounds. Such
+         * bounds are merged together using glb().
+         */
+        UPPER(InferenceBound.UPPER) {
+            @Override
+            Type solve(UndetVar uv, InferenceContext inferenceContext) {
+                Infer infer = inferenceContext.infer();
+                List<Type> hibounds = filterBounds(uv, inferenceContext);
+                Type owntype = infer.types.glb(hibounds);
+                if (owntype.isErroneous()) {
+                    throw infer.inferenceException
+                        .setMessage("no.unique.maximal.instance.exists",
+                                    uv.qtype, hibounds);
+                } else {
+                    return owntype;
+                }
+            }
+        },
+        /**
+         * Like the former; the only difference is that this step can only be applied
+         * if all upper bounds are ground.
+         */
+        UPPER_LEGACY(InferenceBound.UPPER) {
+            @Override
+            public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
+                return !inferenceContext.free(t.getBounds(ib));
+            }
+
+            @Override
+            Type solve(UndetVar uv, InferenceContext inferenceContext) {
+                return UPPER.solve(uv, inferenceContext);
+            }
+        };
+
+        final InferenceBound ib;
+
+        InferenceStep(InferenceBound ib) {
+            this.ib = ib;
+        }
+
+        /**
+         * Find an instantiated type for a given inference variable within
+         * a given inference context
+         */
+        abstract Type solve(UndetVar uv, InferenceContext inferenceContext);
+
+        /**
+         * Can the inference variable be instantiated using this step?
+         */
+        public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
+            return filterBounds(t, inferenceContext).nonEmpty();
+        }
+
+        /**
+         * Return the subset of ground bounds in a given bound set (i.e. eq/lower/upper)
+         */
+        List<Type> filterBounds(UndetVar uv, InferenceContext inferenceContext) {
+            return Type.filter(uv.getBounds(ib), new BoundFilter(inferenceContext));
+        }
+    }
+
+    /**
+     * This enumeration defines the sequence of steps to be applied when the
+     * solver works in legacy mode. The steps in this enumeration reflect
+     * the behavior of old inference routine (see JLS SE 7 15.12.2.7/15.12.2.8).
+     */
+    enum LegacyInferenceSteps {
+
+        EQ_LOWER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER)),
+        EQ_UPPER(EnumSet.of(InferenceStep.EQ, InferenceStep.UPPER_LEGACY));
+
+        final EnumSet<InferenceStep> steps;
+
+        LegacyInferenceSteps(EnumSet<InferenceStep> steps) {
+            this.steps = steps;
+        }
+    }
+
+    /**
+     * This enumeration defines the sequence of steps to be applied when the
+     * graph solver is used. This order is defined so as to maximize compatibility
+     * w.r.t. old inference routine (see JLS SE 7 15.12.2.7/15.12.2.8).
+     */
+    enum GraphInferenceSteps {
+
+        EQ(EnumSet.of(InferenceStep.EQ)),
+        EQ_LOWER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER)),
+        EQ_LOWER_UPPER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER, InferenceStep.UPPER));
+
+        final EnumSet<InferenceStep> steps;
+
+        GraphInferenceSteps(EnumSet<InferenceStep> steps) {
+            this.steps = steps;
+        }
+    }
+
+    /**
+     * This is the graph inference solver - the solver organizes all inference variables in
+     * a given inference context by bound dependencies - in the general case, such dependencies
+     * would lead to a cyclic directed graph (hence the name); the dependency info is used to build
+     * an acyclic graph, where all cyclic variables are bundled together. An inference
+     * step corresponds to solving a node in the acyclic graph - this is done by
+     * relying on a given strategy (see GraphStrategy).
+     */
+    class GraphSolver {
+
+        InferenceContext inferenceContext;
+        Warner warn;
+
+        GraphSolver(InferenceContext inferenceContext, Warner warn) {
+            this.inferenceContext = inferenceContext;
+            this.warn = warn;
         }
-    };
+
+        /**
+         * Solve variables in a given inference context. The amount of variables
+         * to be solved, and the way in which the underlying acyclic graph is explored
+         * depends on the selected solver strategy.
+         */
+        void solve(GraphStrategy sstrategy) {
+            checkWithinBounds(inferenceContext, warn); //initial propagation of bounds
+            InferenceGraph inferenceGraph = new InferenceGraph();
+            while (!sstrategy.done()) {
+                InferenceGraph.Node nodeToSolve = sstrategy.pickNode(inferenceGraph);
+                List<Type> varsToSolve = List.from(nodeToSolve.data);
+                inferenceContext.save();
+                try {
+                    //repeat until all variables are solved
+                    outer: while (Type.containsAny(inferenceContext.restvars(), varsToSolve)) {
+                        //for each inference phase
+                        for (GraphInferenceSteps step : GraphInferenceSteps.values()) {
+                            if (inferenceContext.solveBasic(varsToSolve, step.steps)) {
+                                checkWithinBounds(inferenceContext, warn);
+                                continue outer;
+                            }
+                        }
+                        //no progress
+                        throw inferenceException;
+                    }
+                }
+                catch (InferenceException ex) {
+                    inferenceContext.rollback();
+                    instantiateAsUninferredVars(varsToSolve, inferenceContext);
+                    checkWithinBounds(inferenceContext, warn);
+                }
+                inferenceGraph.deleteNode(nodeToSolve);
+            }
+        }
+
+        /**
+         * The dependencies between the inference variables that need to be solved
+         * form a (possibly cyclic) graph. This class reduces the original dependency graph
+         * to an acyclic version, where cyclic nodes are folded into a single 'super node'.
+         */
+        class InferenceGraph {
+
+            /**
+             * This class represents a node in the graph. Each node corresponds
+             * to an inference variable and has edges (dependencies) on other
+             * nodes. The node defines an entry point that can be used to receive
+             * updates on the structure of the graph this node belongs to (used to
+             * keep dependencies in sync).
+             */
+            class Node extends GraphUtils.TarjanNode<ListBuffer<Type>> {
+
+                Set<Node> deps;
+
+                Node(Type ivar) {
+                    super(ListBuffer.of(ivar));
+                    this.deps = new HashSet<Node>();
+                }
+
+                @Override
+                public Iterable<? extends Node> getDependencies() {
+                    return deps;
+                }
+
+                @Override
+                public String printDependency(GraphUtils.Node<ListBuffer<Type>> to) {
+                    StringBuilder buf = new StringBuilder();
+                    String sep = "";
+                    for (Type from : data) {
+                        UndetVar uv = (UndetVar)inferenceContext.asFree(from);
+                        for (Type bound : uv.getBounds(InferenceBound.values())) {
+                            if (bound.containsAny(List.from(to.data))) {
+                                buf.append(sep);
+                                buf.append(bound);
+                                sep = ",";
+                            }
+                        }
+                    }
+                    return buf.toString();
+                }
+
+                boolean isLeaf(Node n) {
+                    //no deps, or only one self dep
+                    return (n.deps.isEmpty() ||
+                            n.deps.size() == 1 && n.deps.contains(n));
+                }
+
+                void mergeWith(List<? extends Node> nodes) {
+                    for (Node n : nodes) {
+                        Assert.check(n.data.length() == 1, "Attempt to merge a compound node!");
+                        data.appendList(n.data);
+                        deps.addAll(n.deps);
+                    }
+                    //update deps
+                    Set<Node> deps2 = new HashSet<Node>();
+                    for (Node d : deps) {
+                        if (data.contains(d.data.first())) {
+                            deps2.add(this);
+                        } else {
+                            deps2.add(d);
+                        }
+                    }
+                    deps = deps2;
+                }
+
+                void graphChanged(Node from, Node to) {
+                    if (deps.contains(from)) {
+                        deps.remove(from);
+                        if (to != null) {
+                            deps.add(to);
+                        }
+                    }
+                }
+            }
+
+            /** the nodes in the inference graph */
+            ArrayList<Node> nodes;
+
+            InferenceGraph() {
+                initNodes();
+            }
+
+            /**
+             * Delete a node from the graph. This update the underlying structure
+             * of the graph (including dependencies) via listeners updates.
+             */
+            public void deleteNode(Node n) {
+                Assert.check(nodes.contains(n));
+                nodes.remove(n);
+                notifyUpdate(n, null);
+            }
+
+            /**
+             * Notify all nodes of a change in the graph. If the target node is
+             * {@code null} the source node is assumed to be removed.
+             */
+            void notifyUpdate(Node from, Node to) {
+                for (Node n : nodes) {
+                    n.graphChanged(from, to);
+                }
+            }
+
+            /**
+             * Create the graph nodes. First a simple node is created for every inference
+             * variables to be solved. Then Tarjan is used to found all connected components
+             * in the graph. For each component containing more than one node, a super node is
+                 * created, effectively replacing the original cyclic nodes.
+             */
+            void initNodes() {
+                ArrayList<Node> nodes = new ArrayList<Node>();
+                for (Type t : inferenceContext.restvars()) {
+                    nodes.add(new Node(t));
+                }
+                for (Node n_i : nodes) {
+                    Type i = n_i.data.first();
+                    for (Node n_j : nodes) {
+                        Type j = n_j.data.first();
+                        UndetVar uv_i = (UndetVar)inferenceContext.asFree(i);
+                        if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) {
+                            //update i's deps
+                            n_i.deps.add(n_j);
+                            //update j's deps - only if i's bounds contain _exactly_ j
+                            if (uv_i.getBounds(InferenceBound.values()).contains(j)) {
+                                n_j.deps.add(n_i);
+                            }
+                        }
+                    }
+                }
+                this.nodes = new ArrayList<Node>();
+                for (List<? extends Node> conSubGraph : GraphUtils.tarjan(nodes)) {
+                    if (conSubGraph.length() > 1) {
+                        Node root = conSubGraph.head;
+                        root.mergeWith(conSubGraph.tail);
+                        for (Node n : conSubGraph) {
+                            notifyUpdate(n, root);
+                        }
+                    }
+                    this.nodes.add(conSubGraph.head);
+                }
+            }
+
+            /**
+             * Debugging: dot representation of this graph
+             */
+            String toDot() {
+                StringBuilder buf = new StringBuilder();
+                for (Type t : inferenceContext.undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    buf.append(String.format("var %s - upper bounds = %s, lower bounds = %s, eq bounds = %s\\n",
+                            uv.qtype, uv.getBounds(InferenceBound.UPPER), uv.getBounds(InferenceBound.LOWER),
+                            uv.getBounds(InferenceBound.EQ)));
+                }
+                return GraphUtils.toDot(nodes, "inferenceGraph" + hashCode(), buf.toString());
+            }
+        }
+    }
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Inference context">
+    /**
+     * Functional interface for defining inference callbacks. Certain actions
+     * (i.e. subtyping checks) might need to be redone after all inference variables
+     * have been fixed.
+     */
+    interface FreeTypeListener {
+        void typesInferred(InferenceContext inferenceContext);
+    }
 
     /**
      * An inference context keeps track of the set of variables that are free
@@ -611,16 +1283,7 @@
      * it can be used as an entry point for performing upper/lower bound inference
      * (see InferenceKind).
      */
-    static class InferenceContext {
-
-        /**
-        * Single-method-interface for defining inference callbacks. Certain actions
-        * (i.e. subtyping checks) might need to be redone after all inference variables
-        * have been fixed.
-        */
-        interface FreeTypeListener {
-            void typesInferred(InferenceContext inferenceContext);
-        }
+     class InferenceContext {
 
         /** list of inference vars as undet vars */
         List<Type> undetvars;
@@ -628,15 +1291,26 @@
         /** list of inference vars in this context */
         List<Type> inferencevars;
 
+        /** backed up inference variables */
+        List<Type> saved_undet;
+
         java.util.Map<FreeTypeListener, List<Type>> freeTypeListeners =
                 new java.util.HashMap<FreeTypeListener, List<Type>>();
 
         List<FreeTypeListener> freetypeListeners = List.nil();
 
-        public InferenceContext(List<Type> inferencevars, Infer infer, boolean includeBounds) {
-            this.undetvars = Type.map(inferencevars, infer.new FromTypeVarFun(includeBounds));
+        public InferenceContext(List<Type> inferencevars) {
+            this.undetvars = Type.map(inferencevars, fromTypeVarFun);
             this.inferencevars = inferencevars;
         }
+        //where
+            Mapping fromTypeVarFun = new Mapping("fromTypeVarFunWithBounds") {
+                // mapping that turns inference variables into undet vars
+                public Type apply(Type t) {
+                    if (t.hasTag(TYPEVAR)) return new UndetVar((TypeVar)t, types);
+                    else return t.map(this);
+                }
+            };
 
         /**
          * returns the list of free variables (as type-variables) in this
@@ -648,19 +1322,51 @@
 
         /**
          * returns the list of uninstantiated variables (as type-variables) in this
-         * inference context (usually called after instantiate())
+         * inference context
          */
         List<Type> restvars() {
-            List<Type> undetvars = this.undetvars;
-            ListBuffer<Type> restvars = ListBuffer.lb();
-            for (Type t : instTypes()) {
-                UndetVar uv = (UndetVar)undetvars.head;
-                if (uv.qtype == t) {
-                    restvars.append(t);
+            return filterVars(new Filter<UndetVar>() {
+                public boolean accepts(UndetVar uv) {
+                    return uv.inst == null;
+                }
+            });
+        }
+
+        /**
+         * returns the list of instantiated variables (as type-variables) in this
+         * inference context
+         */
+        List<Type> instvars() {
+            return filterVars(new Filter<UndetVar>() {
+                public boolean accepts(UndetVar uv) {
+                    return uv.inst != null;
                 }
-                undetvars = undetvars.tail;
+            });
+        }
+
+        /**
+         * Get list of bounded inference variables (where bound is other than
+         * declared bounds).
+         */
+        final List<Type> boundedVars() {
+            return filterVars(new Filter<UndetVar>() {
+                public boolean accepts(UndetVar uv) {
+                    return uv.getBounds(InferenceBound.UPPER)
+                            .diff(uv.getDeclaredBounds())
+                            .appendList(uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)).nonEmpty();
+                }
+            });
+        }
+
+        private List<Type> filterVars(Filter<UndetVar> fu) {
+            ListBuffer<Type> res = ListBuffer.lb();
+            for (Type t : undetvars) {
+                UndetVar uv = (UndetVar)t;
+                if (fu.accepts(uv)) {
+                    res.append(uv.qtype);
+                }
             }
-            return restvars.toList();
+            return res.toList();
         }
 
         /**
@@ -709,14 +1415,14 @@
          * undet vars (used ahead of subtyping/compatibility checks to allow propagation
          * of inference constraints).
          */
-        final Type asFree(Type t, Types types) {
+        final Type asFree(Type t) {
             return types.subst(t, inferencevars, undetvars);
         }
 
-        final List<Type> asFree(List<Type> ts, Types types) {
+        final List<Type> asFree(List<Type> ts) {
             ListBuffer<Type> buf = ListBuffer.lb();
             for (Type t : ts) {
-                buf.append(asFree(t, types));
+                buf.append(asFree(t));
             }
             return buf.toList();
         }
@@ -735,14 +1441,14 @@
          * instantiated types - if one or more free variable has not been
          * fully instantiated, it will still be available in the resulting type.
          */
-        Type asInstType(Type t, Types types) {
+        Type asInstType(Type t) {
             return types.subst(t, inferencevars, instTypes());
         }
 
-        List<Type> asInstTypes(List<Type> ts, Types types) {
+        List<Type> asInstTypes(List<Type> ts) {
             ListBuffer<Type> buf = ListBuffer.lb();
             for (Type t : ts) {
-                buf.append(asInstType(t, types));
+                buf.append(asInstType(t));
             }
             return buf.toList();
         }
@@ -758,11 +1464,15 @@
          * Mark the inference context as complete and trigger evaluation
          * of all deferred checks.
          */
-        void notifyChange(Types types) {
+        void notifyChange() {
+            notifyChange(inferencevars.diff(restvars()));
+        }
+
+        void notifyChange(List<Type> inferredVars) {
             InferenceException thrownEx = null;
             for (Map.Entry<FreeTypeListener, List<Type>> entry :
                     new HashMap<FreeTypeListener, List<Type>>(freeTypeListeners).entrySet()) {
-                if (!Type.containsAny(entry.getValue(), restvars())) {
+                if (!Type.containsAny(entry.getValue(), inferencevars.diff(inferredVars))) {
                     try {
                         entry.getKey().typesInferred(this);
                         freeTypeListeners.remove(entry.getKey());
@@ -780,22 +1490,156 @@
             }
         }
 
-        void solveAny(List<Type> varsToSolve, Types types, Infer infer) {
-            boolean progress = false;
-            for (Type t : varsToSolve) {
-                UndetVar uv = (UndetVar)asFree(t, types);
-                if (uv.inst == null) {
-                    infer.minimizeInst(uv, types.noWarnings);
-                    if (uv.inst != null) {
-                        progress = true;
+        /**
+         * Save the state of this inference context
+         */
+        void save() {
+            ListBuffer<Type> buf = ListBuffer.lb();
+            for (Type t : undetvars) {
+                UndetVar uv = (UndetVar)t;
+                UndetVar uv2 = new UndetVar((TypeVar)uv.qtype, types);
+                for (InferenceBound ib : InferenceBound.values()) {
+                    for (Type b : uv.getBounds(ib)) {
+                        uv2.addBound(ib, b, types);
+                    }
+                }
+                uv2.inst = uv.inst;
+                buf.add(uv2);
+            }
+            saved_undet = buf.toList();
+        }
+
+        /**
+         * Restore the state of this inference context to the previous known checkpoint
+         */
+        void rollback() {
+            Assert.check(saved_undet != null && saved_undet.length() == undetvars.length());
+            undetvars = saved_undet;
+            saved_undet = null;
+        }
+
+        /**
+         * Copy variable in this inference context to the given context
+         */
+        void dupTo(final InferenceContext that) {
+            that.inferencevars = that.inferencevars.appendList(inferencevars);
+            that.undetvars = that.undetvars.appendList(undetvars);
+            //set up listeners to notify original inference contexts as
+            //propagated vars are inferred in new context
+            for (Type t : inferencevars) {
+                that.freeTypeListeners.put(new FreeTypeListener() {
+                    public void typesInferred(InferenceContext inferenceContext) {
+                        InferenceContext.this.notifyChange();
+                    }
+                }, List.of(t));
+            }
+        }
+
+        /**
+         * Solve with given graph strategy.
+         */
+        private void solve(GraphStrategy ss, Warner warn) {
+            GraphSolver s = new GraphSolver(this, warn);
+            s.solve(ss);
+        }
+
+        /**
+         * Solve all variables in this context.
+         */
+        public void solve(Warner warn) {
+            solve(new LeafSolver() {
+                public boolean done() {
+                    return restvars().isEmpty();
+                }
+            }, warn);
+        }
+
+        /**
+         * Solve all variables in the given list.
+         */
+        public void solve(final List<Type> vars, Warner warn) {
+            solve(new BestLeafSolver(vars) {
+                public boolean done() {
+                    return !free(asInstTypes(vars));
+                }
+            }, warn);
+        }
+
+        /**
+         * Solve at least one variable in given list.
+         */
+        public void solveAny(List<Type> varsToSolve, Warner warn) {
+            checkWithinBounds(this, warn); //propagate bounds
+            List<Type> boundedVars = boundedVars().intersect(restvars()).intersect(varsToSolve);
+            if (boundedVars.isEmpty()) {
+                throw inferenceException.setMessage("cyclic.inference",
+                                freeVarsIn(varsToSolve));
+            }
+            solve(new BestLeafSolver(boundedVars) {
+                public boolean done() {
+                    return instvars().intersect(varsToSolve).nonEmpty();
+                }
+            }, warn);
+        }
+
+        /**
+         * Apply a set of inference steps
+         */
+        private boolean solveBasic(EnumSet<InferenceStep> steps) {
+            return solveBasic(inferencevars, steps);
+        }
+
+        private boolean solveBasic(List<Type> varsToSolve, EnumSet<InferenceStep> steps) {
+            boolean changed = false;
+            for (Type t : varsToSolve.intersect(restvars())) {
+                UndetVar uv = (UndetVar)asFree(t);
+                for (InferenceStep step : steps) {
+                    if (step.accepts(uv, this)) {
+                        uv.inst = step.solve(uv, this);
+                        changed = true;
+                        break;
                     }
                 }
             }
-            if (!progress) {
-                throw infer.inferenceException.setMessage("cyclic.inference", varsToSolve);
+            return changed;
+        }
+
+        /**
+         * Instantiate inference variables in legacy mode (JLS 15.12.2.7, 15.12.2.8).
+         * During overload resolution, instantiation is done by doing a partial
+         * inference process using eq/lower bound instantiation. During check,
+         * we also instantiate any remaining vars by repeatedly using eq/upper
+         * instantiation, until all variables are solved.
+         */
+        public void solveLegacy(boolean partial, Warner warn, EnumSet<InferenceStep> steps) {
+            while (true) {
+                boolean stuck = !solveBasic(steps);
+                if (restvars().isEmpty() || partial) {
+                    //all variables have been instantiated - exit
+                    break;
+                } else if (stuck) {
+                    //some variables could not be instantiated because of cycles in
+                    //upper bounds - provide a (possibly recursive) default instantiation
+                    instantiateAsUninferredVars(restvars(), this);
+                    break;
+                } else {
+                    //some variables have been instantiated - replace newly instantiated
+                    //variables in remaining upper bounds and continue
+                    for (Type t : undetvars) {
+                        UndetVar uv = (UndetVar)t;
+                        uv.substBounds(inferenceVars(), instTypes(), types);
+                    }
+                }
             }
+            checkWithinBounds(this, warn);
+        }
+
+        private Infer infer() {
+            //back-door to infer
+            return Infer.this;
         }
     }
 
-    final InferenceContext emptyContext = new InferenceContext(List.<Type>nil(), this, false);
+    final InferenceContext emptyContext = new InferenceContext(List.<Type>nil());
+    // </editor-fold>
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1445,22 +1445,49 @@
         return result;
     }
 
+    private VarSymbol makeOuterThisVarSymbol(Symbol owner, long flags) {
+        if (owner.kind == TYP &&
+            target.usePrivateSyntheticFields())
+            flags |= PRIVATE;
+        Type target = types.erasure(owner.enclClass().type.getEnclosingType());
+        VarSymbol outerThis =
+            new VarSymbol(flags, outerThisName(target, owner), target, owner);
+        outerThisStack = outerThisStack.prepend(outerThis);
+        return outerThis;
+    }
+
+    private JCVariableDecl makeOuterThisVarDecl(int pos, VarSymbol sym) {
+        JCVariableDecl vd = make.at(pos).VarDef(sym, null);
+        vd.vartype = access(vd.vartype);
+        return vd;
+    }
+
+    /** Definition for this$n field.
+     *  @param pos        The source code position of the definition.
+     *  @param owner      The method in which the definition goes.
+     */
+    JCVariableDecl outerThisDef(int pos, MethodSymbol owner) {
+        ClassSymbol c = owner.enclClass();
+        boolean isMandated =
+            // Anonymous constructors
+            (owner.isConstructor() && owner.isAnonymous()) ||
+            // Constructors of non-private inner member classes
+            (owner.isConstructor() && c.isInner() &&
+             !c.isPrivate() && !c.isStatic());
+        long flags =
+            FINAL | (isMandated ? MANDATED : SYNTHETIC);
+        VarSymbol outerThis = makeOuterThisVarSymbol(owner, flags);
+        owner.extraParams = owner.extraParams.prepend(outerThis);
+        return makeOuterThisVarDecl(pos, outerThis);
+    }
+
     /** Definition for this$n field.
      *  @param pos        The source code position of the definition.
      *  @param owner      The class in which the definition goes.
      */
-    JCVariableDecl outerThisDef(int pos, Symbol owner) {
-        long flags = FINAL | SYNTHETIC;
-        if (owner.kind == TYP &&
-            target.usePrivateSyntheticFields())
-            flags |= PRIVATE;
-        Type target = types.erasure(owner.enclClass().type.getEnclosingType());
-        VarSymbol outerThis = new VarSymbol(
-            flags, outerThisName(target, owner), target, owner);
-        outerThisStack = outerThisStack.prepend(outerThis);
-        JCVariableDecl vd = make.at(pos).VarDef(outerThis, null);
-        vd.vartype = access(vd.vartype);
-        return vd;
+    JCVariableDecl outerThisDef(int pos, ClassSymbol owner) {
+        VarSymbol outerThis = makeOuterThisVarSymbol(owner, FINAL | SYNTHETIC);
+        return makeOuterThisVarDecl(pos, outerThis);
     }
 
     /** Return a list of trees that load the free variables in given list,
@@ -2568,7 +2595,6 @@
                                        "enum" + target.syntheticNameChar() + "name"),
                       syms.stringType, tree.sym);
             nameParam.mods.flags |= SYNTHETIC; nameParam.sym.flags_field |= SYNTHETIC;
-
             JCVariableDecl ordParam = make.
                 Param(names.fromString(target.syntheticNameChar() +
                                        "enum" + target.syntheticNameChar() +
@@ -2579,6 +2605,8 @@
             tree.params = tree.params.prepend(ordParam).prepend(nameParam);
 
             MethodSymbol m = tree.sym;
+            m.extraParams = m.extraParams.prepend(ordParam.sym);
+            m.extraParams = m.extraParams.prepend(nameParam.sym);
             Type olderasure = m.erasure(types);
             m.erasure_field = new MethodType(
                 olderasure.getParameterTypes().prepend(syms.intType).prepend(syms.stringType),
@@ -3066,55 +3094,38 @@
     }
 
     public void visitAssignop(final JCAssignOp tree) {
-        if (!tree.lhs.type.isPrimitive() &&
-            tree.operator.type.getReturnType().isPrimitive()) {
-            // boxing required; need to rewrite as x = (unbox typeof x)(x op y);
-            // or if x == (typeof x)z then z = (unbox typeof x)((typeof x)z op y)
-            // (but without recomputing x)
-            JCTree newTree = abstractLval(tree.lhs, new TreeBuilder() {
-                    public JCTree build(final JCTree lhs) {
-                        JCTree.Tag newTag = tree.getTag().noAssignOp();
-                        // Erasure (TransTypes) can change the type of
-                        // tree.lhs.  However, we can still get the
-                        // unerased type of tree.lhs as it is stored
-                        // in tree.type in Attr.
-                        Symbol newOperator = rs.resolveBinaryOperator(tree.pos(),
-                                                                      newTag,
-                                                                      attrEnv,
-                                                                      tree.type,
-                                                                      tree.rhs.type);
-                        JCExpression expr = (JCExpression)lhs;
-                        if (expr.type != tree.type)
-                            expr = make.TypeCast(tree.type, expr);
-                        JCBinary opResult = make.Binary(newTag, expr, tree.rhs);
-                        opResult.operator = newOperator;
-                        opResult.type = newOperator.type.getReturnType();
-                        JCTypeCast newRhs = make.TypeCast(types.unboxedType(tree.type),
-                                                          opResult);
-                        return make.Assign((JCExpression)lhs, newRhs).setType(tree.type);
-                    }
-                });
-            result = translate(newTree);
-            return;
-        }
-        tree.lhs = translate(tree.lhs, tree);
-        tree.rhs = translate(tree.rhs, tree.operator.type.getParameterTypes().tail.head);
-
-        // If translated left hand side is an Apply, we are
-        // seeing an access method invocation. In this case, append
-        // right hand side as last argument of the access method.
-        if (tree.lhs.hasTag(APPLY)) {
-            JCMethodInvocation app = (JCMethodInvocation)tree.lhs;
-            // if operation is a += on strings,
-            // make sure to convert argument to string
-            JCExpression rhs = (((OperatorSymbol)tree.operator).opcode == string_add)
-              ? makeString(tree.rhs)
-              : tree.rhs;
-            app.args = List.of(rhs).prependList(app.args);
-            result = app;
-        } else {
-            result = tree;
-        }
+        final boolean boxingReq = !tree.lhs.type.isPrimitive() &&
+            tree.operator.type.getReturnType().isPrimitive();
+
+        // boxing required; need to rewrite as x = (unbox typeof x)(x op y);
+        // or if x == (typeof x)z then z = (unbox typeof x)((typeof x)z op y)
+        // (but without recomputing x)
+        JCTree newTree = abstractLval(tree.lhs, new TreeBuilder() {
+                public JCTree build(final JCTree lhs) {
+                    JCTree.Tag newTag = tree.getTag().noAssignOp();
+                    // Erasure (TransTypes) can change the type of
+                    // tree.lhs.  However, we can still get the
+                    // unerased type of tree.lhs as it is stored
+                    // in tree.type in Attr.
+                    Symbol newOperator = rs.resolveBinaryOperator(tree.pos(),
+                                                                  newTag,
+                                                                  attrEnv,
+                                                                  tree.type,
+                                                                  tree.rhs.type);
+                    JCExpression expr = (JCExpression)lhs;
+                    if (expr.type != tree.type)
+                        expr = make.TypeCast(tree.type, expr);
+                    JCBinary opResult = make.Binary(newTag, expr, tree.rhs);
+                    opResult.operator = newOperator;
+                    opResult.type = newOperator.type.getReturnType();
+                    JCExpression newRhs = boxingReq ?
+                            make.TypeCast(types.unboxedType(tree.type),
+                                                      opResult) :
+                            opResult;
+                    return make.Assign((JCExpression)lhs, newRhs).setType(tree.type);
+                }
+            });
+        result = translate(newTree);
     }
 
     /** Lower a tree of the form e++ or e-- where e is an object type */
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -465,7 +465,8 @@
                       names.valueOf,
                       make.Type(tree.sym.type),
                       List.<JCTypeParameter>nil(),
-                      List.of(make.VarDef(make.Modifiers(Flags.PARAMETER),
+                      List.of(make.VarDef(make.Modifiers(Flags.PARAMETER |
+                                                         Flags.MANDATED),
                                             names.fromString("name"),
                                             make.Type(syms.stringType), null)),
                       List.<JCExpression>nil(), // thrown
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Feb 21 17:43:57 2013 -0800
@@ -35,7 +35,7 @@
 import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
 import com.sun.tools.javac.comp.DeferredAttr.DeferredType;
 import com.sun.tools.javac.comp.Infer.InferenceContext;
-import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
+import com.sun.tools.javac.comp.Infer.FreeTypeListener;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionContext.Candidate;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.*;
@@ -564,7 +564,7 @@
                                     methodCheck,
                                     warn);
 
-        methodCheck.argumentsAcceptable(env, currentResolutionContext.deferredAttrContext(m, infer.emptyContext),
+        methodCheck.argumentsAcceptable(env, currentResolutionContext.deferredAttrContext(m, infer.emptyContext, resultInfo, warn),
                                 argtypes, mt.getParameterTypes(), warn);
         return mt;
     }
@@ -741,7 +741,7 @@
                 inferenceContext.addFreeTypeListener(List.of(t), new FreeTypeListener() {
                     @Override
                     public void typesInferred(InferenceContext inferenceContext) {
-                        varargsAccessible(env, inferenceContext.asInstType(t, types), inferenceContext);
+                        varargsAccessible(env, inferenceContext.asInstType(t), inferenceContext);
                     }
                 });
             } else {
@@ -785,8 +785,8 @@
 
         public boolean compatible(Type found, Type req, Warner warn) {
             return strict ?
-                    types.isSubtypeUnchecked(found, deferredAttrContext.inferenceContext.asFree(req, types), warn) :
-                    types.isConvertible(found, deferredAttrContext.inferenceContext.asFree(req, types), warn);
+                    types.isSubtypeUnchecked(found, deferredAttrContext.inferenceContext.asFree(req), warn) :
+                    types.isConvertible(found, deferredAttrContext.inferenceContext.asFree(req), warn);
         }
 
         public void report(DiagnosticPosition pos, JCDiagnostic details) {
@@ -3589,8 +3589,8 @@
             candidates = candidates.append(c);
         }
 
-        DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceContext) {
-            return deferredAttr.new DeferredAttrContext(attrMode, sym, step, inferenceContext);
+        DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceContext, ResultInfo pendingResult, Warner warn) {
+            return deferredAttr.new DeferredAttrContext(attrMode, sym, step, inferenceContext, pendingResult != null ? pendingResult.checkContext.deferredAttrContext() : deferredAttr.emptyDeferredAttrContext, warn);
         }
 
         /**
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Feb 21 17:43:57 2013 -0800
@@ -134,6 +134,11 @@
      **/
     public boolean preferSource;
 
+    /**
+     * The currently selected profile.
+     */
+    public final Profile profile;
+
     /** The log to use for verbose output
      */
     final Log log;
@@ -284,16 +289,20 @@
         annotate = Annotate.instance(context);
         verbose        = options.isSet(VERBOSE);
         checkClassFile = options.isSet("-checkclassfile");
+
         Source source = Source.instance(context);
         allowGenerics    = source.allowGenerics();
         allowVarargs     = source.allowVarargs();
         allowAnnotations = source.allowAnnotations();
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
         allowDefaultMethods = source.allowDefaultMethods();
+
         saveParameterNames = options.isSet("save-parameter-names");
         cacheCompletionFailure = options.isUnset("dev");
         preferSource = "source".equals(options.get("-Xprefer"));
 
+        profile = Profile.instance(context);
+
         completionFailureName =
             options.isSet("failcomplete")
             ? names.fromString(options.get("failcomplete"))
@@ -1370,7 +1379,18 @@
                 CompoundAnnotationProxy proxy = readCompoundAnnotation();
                 if (proxy.type.tsym == syms.proprietaryType.tsym)
                     sym.flags_field |= PROPRIETARY;
-                else
+                else if (proxy.type.tsym == syms.profileType.tsym) {
+                    if (profile != Profile.DEFAULT) {
+                        for (Pair<Name,Attribute> v: proxy.values) {
+                            if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
+                                Attribute.Constant c = (Attribute.Constant) v.snd;
+                                if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
+                                    sym.flags_field |= NOT_IN_PROFILE;
+                                }
+                            }
+                        }
+                    }
+                } else
                     proxies.append(proxy);
             }
             annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
@@ -1470,12 +1490,13 @@
         position.type = type;
 
         switch (type) {
-        // type cast
-        case CAST:
         // instanceof
         case INSTANCEOF:
         // new expression
         case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
             position.offset = nextChar();
             break;
         // local variable
@@ -1524,9 +1545,12 @@
         case METHOD_FORMAL_PARAMETER:
             position.parameter_index = nextByte();
             break;
+        // type cast
+        case CAST:
         // method/constructor/reference type argument
         case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
         case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
         case METHOD_REFERENCE_TYPE_ARGUMENT:
             position.offset = nextChar();
             position.type_index = nextByte();
@@ -1535,10 +1559,6 @@
         case METHOD_RETURN:
         case FIELD:
             break;
-        // lambda formal parameter
-        case LAMBDA_FORMAL_PARAMETER:
-            position.parameter_index = nextByte();
-            break;
         case UNKNOWN:
             throw new AssertionError("jvm.ClassReader: UNKNOWN target type should never occur!");
         default:
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -728,14 +728,24 @@
      * Write method parameter names attribute.
      */
     int writeMethodParametersAttr(MethodSymbol m) {
-        if (m.params != null && 0 != m.params.length()) {
-            int attrIndex = writeAttr(names.MethodParameters);
-            databuf.appendByte(m.params.length());
+        MethodType ty = m.externalType(types).asMethodType();
+        final int allparams = ty.argtypes.size();
+        if (m.params != null && allparams != 0) {
+            final int attrIndex = writeAttr(names.MethodParameters);
+            databuf.appendByte(allparams);
+            // Write extra parameters first
+            for (VarSymbol s : m.extraParams) {
+                final int flags =
+                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
+                    ((int) m.flags() & SYNTHETIC);
+                databuf.appendChar(pool.put(s.name));
+                databuf.appendInt(flags);
+            }
+            // Now write the real parameters
             for (VarSymbol s : m.params) {
-                // TODO: expand to cover synthesized, once we figure out
-                // how to represent that.
-                final int flags = (int) s.flags() & (FINAL | SYNTHETIC);
-                // output parameter info
+                final int flags =
+                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
+                    ((int) m.flags() & SYNTHETIC);
                 databuf.appendChar(pool.put(s.name));
                 databuf.appendInt(flags);
             }
@@ -992,12 +1002,13 @@
     void writePosition(TypeAnnotationPosition p) {
         databuf.appendByte(p.type.targetTypeValue()); // TargetType tag is a byte
         switch (p.type) {
-        // type cast
-        case CAST:
         // instanceof
         case INSTANCEOF:
         // new expression
         case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
             databuf.appendChar(p.offset);
             break;
         // local variable
@@ -1042,9 +1053,12 @@
         case METHOD_FORMAL_PARAMETER:
             databuf.appendByte(p.parameter_index);
             break;
+        // type cast
+        case CAST:
         // method/constructor/reference type argument
         case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
         case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
         case METHOD_REFERENCE_TYPE_ARGUMENT:
             databuf.appendChar(p.offset);
             databuf.appendByte(p.type_index);
@@ -1053,10 +1067,6 @@
         case METHOD_RETURN:
         case FIELD:
             break;
-        // lambda formal parameter
-        case LAMBDA_FORMAL_PARAMETER:
-            databuf.appendByte(p.parameter_index);
-            break;
         case UNKNOWN:
             throw new AssertionError("jvm.ClassWriter: UNKNOWN target type should never occur!");
         default:
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Feb 21 17:43:57 2013 -0800
@@ -513,7 +513,8 @@
         // that contains them as its body.
         if (clinitCode.length() != 0) {
             MethodSymbol clinit = new MethodSymbol(
-                STATIC, names.clinit,
+                STATIC | (c.flags() & STRICTFP),
+                names.clinit,
                 new MethodType(
                     List.<Type>nil(), syms.voidType,
                     List.<Type>nil(), syms.methodClass),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Profile.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,105 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.jvm;
+
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Options;
+import java.util.EnumSet;
+import java.util.Set;
+
+import static com.sun.tools.javac.main.Option.PROFILE;
+
+/** The target profile.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public enum Profile {
+    COMPACT1("compact1", 1, Target.JDK1_8),
+    COMPACT2("compact2", 2, Target.JDK1_8),
+    COMPACT3("compact3", 3, Target.JDK1_8),
+
+    DEFAULT {
+        @Override
+        public boolean isValid(Target t) {
+            return true;
+        }
+    };
+
+    private static final Context.Key<Profile> profileKey =
+        new Context.Key<Profile>();
+
+    public static Profile instance(Context context) {
+        Profile instance = context.get(profileKey);
+        if (instance == null) {
+            Options options = Options.instance(context);
+            String profileString = options.get(PROFILE);
+            if (profileString != null) instance = lookup(profileString);
+            if (instance == null) instance = DEFAULT;
+            context.put(profileKey, instance);
+        }
+        return instance;
+    }
+
+    public final String name;
+    public final int value;
+    final Set<Target> targets;
+
+    Profile() {
+        name = null;
+        value = Integer.MAX_VALUE;
+        targets = null;
+    }
+
+    Profile(String name, int value, Target t, Target... targets) {
+        this.name = name;
+        this.value = value;
+        this.targets = EnumSet.of(t, targets);
+    }
+
+    public static Profile lookup(String name) {
+        // the set of values is small enough to do linear search
+        for (Profile p: values()) {
+            if (name.equals(p.name))
+                return p;
+        }
+        return null;
+    }
+
+    public static Profile lookup(int value) {
+        // the set of values is small enough to do linear search
+        for (Profile p: values()) {
+            if (value == p.value)
+                return p;
+        }
+        return null;
+    }
+
+    public boolean isValid(Target t) {
+        return targets.contains(t);
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Feb 21 17:43:57 2013 -0800
@@ -31,7 +31,7 @@
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.util.*;
 
-import static com.sun.tools.javac.main.Option.*;
+import static com.sun.tools.javac.main.Option.TARGET;
 
 /** The classfile version target.
  *
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Feb 21 17:43:57 2013 -0800
@@ -49,6 +49,7 @@
 import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.file.CacheFSInfo;
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.processing.AnnotationProcessingError;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
@@ -76,7 +77,7 @@
 
     /** The log to use for diagnostic output.
      */
-    Log log;
+    public Log log;
 
     /**
      * If true, certain errors will cause an exception, such as command line
@@ -165,6 +166,7 @@
         this.ownName = name;
         this.out = out;
     }
+
     /** A table of all options that's passed to the JavaCompiler constructor.  */
     private Options options = null;
 
@@ -307,6 +309,15 @@
             }
         }
 
+        String profileString = options.get(PROFILE);
+        if (profileString != null) {
+            Profile profile = Profile.lookup(profileString);
+            if (!profile.isValid(target)) {
+                warning("warn.profile.target.conflict", profileString, target.name);
+                return null;
+            }
+        }
+
         // handle this here so it works even if no other options given
         String showClass = options.get("showClass");
         if (showClass != null) {
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Option.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Option.java	Thu Feb 21 17:43:57 2013 -0800
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.code.Lint;
 import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.util.Log;
@@ -218,6 +219,18 @@
         }
     },
 
+    PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String operand) {
+            Profile profile = Profile.lookup(operand);
+            if (profile == null) {
+                helper.error("err.invalid.profile", operand);
+                return true;
+            }
+            return super.process(helper, option, operand);
+        }
+    },
+
     VERSION("-version", "opt.version", STANDARD, INFO) {
         @Override
         public boolean process(OptionHelper helper, String option) {
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Thu Feb 21 17:43:57 2013 -0800
@@ -760,6 +760,16 @@
         return names.fromString(cs.toString());
     }
 
+    @Override
+    public boolean isFunctionalInterface(TypeElement element) {
+        if (element.getKind() != ElementKind.INTERFACE)
+            return false;
+        else {
+            TypeSymbol tsym = cast(TypeSymbol.class, element);
+            return types.isFunctionalInterface(tsym);
+        }
+    }
+
     /**
      * Returns the tree node and compilation unit corresponding to this
      * element, or null if they can't be found.
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1164,7 +1164,7 @@
             } else return illegal();
             break;
         case MONKEYS_AT:
-            // Only annotated cast types are valid
+            // Only annotated cast types and method references are valid
             List<JCAnnotation> typeAnnos = typeAnnotationsOpt();
             if (typeAnnos.isEmpty()) {
                 // else there would be no '@'
@@ -1175,17 +1175,27 @@
 
             if ((mode & TYPE) == 0) {
                 // Type annotations on class literals no longer legal
-                if (!expr.hasTag(Tag.SELECT)) {
+                switch (expr.getTag()) {
+                case REFERENCE: {
+                    JCMemberReference mref = (JCMemberReference) expr;
+                    mref.expr = toP(F.at(pos).AnnotatedType(typeAnnos, mref.expr));
+                    t = mref;
+                    break;
+                }
+                case SELECT: {
+                    JCFieldAccess sel = (JCFieldAccess) expr;
+
+                    if (sel.name != names._class) {
+                        return illegal();
+                    } else {
+                        log.error(token.pos, "no.annotations.on.dot.class");
+                        return expr;
+                    }
+                }
+                default:
                     return illegal(typeAnnos.head.pos);
                 }
-                JCFieldAccess sel = (JCFieldAccess)expr;
-
-                if (sel.name != names._class) {
-                    return illegal();
-                } else {
-                    log.error(token.pos, "no.annotations.on.dot.class");
-                    return expr;
-                }
+
             } else {
                 // Type annotations targeting a cast
                 t = insertAnnotationsToMostInner(expr, typeAnnos, false);
@@ -1457,18 +1467,40 @@
     /**
      * If we see an identifier followed by a '&lt;' it could be an unbound
      * method reference or a binary expression. To disambiguate, look for a
-     * matching '&gt;' and see if the subsequent terminal is either '.' or '#'.
+     * matching '&gt;' and see if the subsequent terminal is either '.' or '::'.
      */
     @SuppressWarnings("fallthrough")
     boolean isUnboundMemberRef() {
         int pos = 0, depth = 0;
-        for (Token t = S.token(pos) ; ; t = S.token(++pos)) {
+        outer: for (Token t = S.token(pos) ; ; t = S.token(++pos)) {
             switch (t.kind) {
                 case IDENTIFIER: case UNDERSCORE: case QUES: case EXTENDS: case SUPER:
                 case DOT: case RBRACKET: case LBRACKET: case COMMA:
                 case BYTE: case SHORT: case INT: case LONG: case FLOAT:
                 case DOUBLE: case BOOLEAN: case CHAR:
+                case MONKEYS_AT:
                     break;
+
+                case LPAREN:
+                    // skip annotation values
+                    int nesting = 0;
+                    for (; ; pos++) {
+                        TokenKind tk2 = S.token(pos).kind;
+                        switch (tk2) {
+                            case EOF:
+                                return false;
+                            case LPAREN:
+                                nesting++;
+                                break;
+                            case RPAREN:
+                                nesting--;
+                                if (nesting == 0) {
+                                    continue outer;
+                                }
+                                break;
+                        }
+                    }
+
                 case LT:
                     depth++; break;
                 case GTGTGT:
@@ -1494,7 +1526,7 @@
     /**
      * If we see an identifier followed by a '&lt;' it could be an unbound
      * method reference or a binary expression. To disambiguate, look for a
-     * matching '&gt;' and see if the subsequent terminal is either '.' or '#'.
+     * matching '&gt;' and see if the subsequent terminal is either '.' or '::'.
      */
     @SuppressWarnings("fallthrough")
     ParensResult analyzeParens() {
@@ -3022,7 +3054,7 @@
         boolean checkForImports = true;
         boolean firstTypeDecl = true;
         while (token.kind != EOF) {
-            if (token.pos <= endPosTable.errorEndPos) {
+            if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) {
                 // error recovery
                 skip(checkForImports, false, false, false);
                 if (token.kind == EOF)
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 21 17:43:57 2013 -0800
@@ -485,6 +485,10 @@
 compiler.err.illegal.forward.ref=\
     illegal forward reference
 
+# 0: symbol, 1: string
+compiler.err.not.in.profile=\
+    {0} is not available in profile ''{1}''
+
 # 0: symbol
 compiler.warn.forward.ref=\
     reference to variable ''{0}'' before it has been initialized
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/javac.properties	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/javac.properties	Thu Feb 21 17:43:57 2013 -0800
@@ -69,6 +69,8 @@
     Pass <flag> directly to the runtime system
 javac.opt.encoding=\
     Specify character encoding used by source files
+javac.opt.profile=\
+    Check that API used is available in the specified profile
 javac.opt.target=\
     Generate class files for specific VM version
 javac.opt.source=\
@@ -97,6 +99,8 @@
     <directory>
 javac.opt.arg.encoding=\
     <encoding>
+javac.opt.arg.profile=\
+    <profile>
 javac.opt.arg.release=\
     <release>
 javac.opt.arg.number=\
@@ -175,6 +179,8 @@
      key in annotation processor option ''{0}'' is not a dot-separated sequence of identifiers
 javac.err.invalid.flag=\
     invalid flag: {0}
+javac.err.invalid.profile=\
+    invalid profile: {0}
 javac.err.invalid.target=\
     invalid target release: {0}
 javac.err.no.source.files=\
@@ -191,6 +197,8 @@
     source release {0} requires target release {1}
 javac.warn.target.default.source.conflict=\
     target release {0} conflicts with default source release {1}
+javac.warn.profile.target.conflict=\
+    profile {0} is not valid for target release {1}
 javac.err.dir.not.found=\
     directory not found: {0}
 javac.err.file.not.found=\
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Thu Feb 21 17:43:57 2013 -0800
@@ -34,11 +34,11 @@
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Types;
-import com.sun.tools.javac.jvm.ClassReader;
 import com.sun.tools.javac.jvm.ClassWriter;
 import com.sun.tools.javac.jvm.Pool;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Pair;
 
 import java.io.File;
@@ -47,6 +47,7 @@
 import java.util.EnumSet;
 import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.Set;
 
@@ -85,7 +86,10 @@
  *
  * @author Peter von der Ah\u00e9
  */
-@SupportedOptions({"com.sun.tools.javac.sym.Jar","com.sun.tools.javac.sym.Dest"})
+@SupportedOptions({
+    "com.sun.tools.javac.sym.Jar",
+    "com.sun.tools.javac.sym.Dest",
+    "com.sun.tools.javac.sym.Profiles"})
 @SupportedAnnotationTypes("*")
 public class CreateSymbols extends AbstractProcessor {
 
@@ -106,6 +110,7 @@
             processingEnv.getMessager()
                 .printMessage(Diagnostic.Kind.ERROR, e.getLocalizedMessage());
         } catch (Throwable t) {
+            t.printStackTrace();
             Throwable cause = t.getCause();
             if (cause == null)
                 cause = t;
@@ -121,12 +126,17 @@
         Set<String> documented = new HashSet<String>();
         Set<PackageSymbol> packages =
             ((JavacProcessingEnvironment)processingEnv).getSpecifiedPackages();
-        String jarName = processingEnv.getOptions().get("com.sun.tools.javac.sym.Jar");
+        Map<String,String> pOptions = processingEnv.getOptions();
+        String jarName = pOptions.get("com.sun.tools.javac.sym.Jar");
         if (jarName == null)
             throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Jar=LOCATION_OF_JAR");
-        String destName = processingEnv.getOptions().get("com.sun.tools.javac.sym.Dest");
+        String destName = pOptions.get("com.sun.tools.javac.sym.Dest");
         if (destName == null)
             throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Dest=LOCATION_OF_JAR");
+        String profileSpec=pOptions.get("com.sun.tools.javac.sym.Profiles");
+        if (profileSpec == null)
+            throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Profiles=PROFILES_SPEC");
+        Profiles profiles = Profiles.read(new File(profileSpec));
 
         for (PackageSymbol psym : packages) {
             String name = psym.getQualifiedName().toString();
@@ -166,12 +176,19 @@
             tool.getTask(null, fm, null, options, null, null);
         com.sun.tools.javac.main.JavaCompiler compiler =
             com.sun.tools.javac.main.JavaCompiler.instance(task.getContext());
-        ClassReader reader = ClassReader.instance(task.getContext());
         ClassWriter writer = ClassWriter.instance(task.getContext());
         Symtab syms = Symtab.instance(task.getContext());
-        Attribute.Compound proprietary =
+        Names names = Names.instance(task.getContext());
+        Attribute.Compound proprietaryAnno =
             new Attribute.Compound(syms.proprietaryType,
                                    List.<Pair<Symbol.MethodSymbol,Attribute>>nil());
+        Attribute.Compound[] profileAnnos = new Attribute.Compound[profiles.getProfileCount() + 1];
+        Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().lookup(names.value).sym;
+        for (int i = 1; i < profileAnnos.length; i++) {
+            profileAnnos[i] = new Attribute.Compound(syms.profileType,
+                    List.<Pair<Symbol.MethodSymbol, Attribute>>of(
+                    new Pair<Symbol.MethodSymbol, Attribute>(profileValue, new Attribute.Constant(syms.intType, i))));
+        }
 
         Type.moreInfo = true;
         Types types = Types.instance(task.getContext());
@@ -208,8 +225,11 @@
             }
             ClassSymbol cs = (ClassSymbol) sym;
             if (addLegacyAnnotation) {
-                cs.annotations.prepend(List.of(proprietary));
+                cs.annotations.prepend(List.of(proprietaryAnno));
             }
+            int p = profiles.getProfile(cs.fullname.toString().replace(".", "/"));
+            if (0 < p && p < profileAnnos.length)
+                cs.annotations.prepend(List.of(profileAnnos[p]));
             writeClass(pool, cs, writer);
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,298 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.sym;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import com.sun.tools.javac.util.Assert;
+
+/**
+ * Provide details about profile contents.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public abstract class Profiles {
+    // for debugging
+    public static void main(String[] args) throws IOException {
+        Profiles p = Profiles.read(new File(args[0]));
+        if (args.length >= 2) {
+            Map<Integer,Set<String>> lists = new TreeMap<Integer,Set<String>>();
+            for (int i = 1; i <= 4; i++)
+                lists.put(i, new TreeSet<String>());
+
+            File rt_jar_lst = new File(args[1]);
+            for (String line: Files.readAllLines(rt_jar_lst.toPath(), Charset.defaultCharset())) {
+                if (line.endsWith(".class")) {
+                    String type = line.substring(0, line.length() - 6);
+                    int profile = p.getProfile(type);
+                    for (int i = profile; i <= 4; i++)
+                        lists.get(i).add(type);
+                }
+            }
+
+            for (int i = 1; i <= 4; i++) {
+                BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"));
+                try {
+                    for (String type: lists.get(i)) {
+                        out.write(type);
+                        out.newLine();
+                    }
+                } finally {
+                    out.close();
+                }
+            }
+        }
+    }
+
+    public static Profiles read(File file) throws IOException {
+        BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
+        try {
+            Properties p = new Properties();
+            p.load(in);
+            if (p.containsKey("java/lang/Object"))
+                return new SimpleProfiles(p);
+            else
+                return new MakefileProfiles(p);
+        } finally {
+            in.close();
+        }
+    }
+
+    public abstract int getProfileCount();
+
+    public abstract int getProfile(String typeName);
+
+    public abstract Set<String> getPackages(int profile);
+
+    private static class MakefileProfiles extends Profiles {
+        static class Package {
+            final Package parent;
+            final String name;
+
+            Map<String, Package> subpackages = new TreeMap<String, Package>();
+
+            int profile;
+            Map<String, Integer> includedTypes = new TreeMap<String,Integer>();
+            Map<String, Integer> excludedTypes = new TreeMap<String,Integer>();
+
+            Package(Package parent, String name) {
+                this.parent = parent;
+                this.name = name;
+            }
+
+            int getProfile() {
+                return (parent == null) ? profile : Math.max(parent.getProfile(), profile);
+            }
+
+            int getProfile(String simpleTypeName) {
+                Integer i;
+                if ((i = includedTypes.get(simpleTypeName)) != null)
+                    return i;
+                if ((i = includedTypes.get("*")) != null)
+                    return i;
+                if ((i = excludedTypes.get(simpleTypeName)) != null)
+                    return i + 1;
+                if ((i = excludedTypes.get("*")) != null)
+                    return i + 1;
+                return getProfile();
+            }
+
+            String getName() {
+                return (parent == null) ? name : (parent.getName() + "/" + name);
+            }
+
+            void getPackages(int profile, Set<String> results) {
+                int prf = getProfile();
+                if (prf != 0 && profile >= prf)
+                    results.add(getName());
+                for (Package pkg: subpackages.values())
+                    pkg.getPackages(profile, results);
+            }
+        }
+
+        final static Map<String, Package> packages = new TreeMap<String, Package>();
+        int maxProfile;
+
+        MakefileProfiles(Properties p) {
+            int profile = 1;
+            while (true) {
+                String inclPackages = p.getProperty("PROFILE_" + profile + "_RTJAR_INCLUDE_PACKAGES");
+                if (inclPackages == null)
+                    break;
+                for (String pkg: inclPackages.substring(1).trim().split("\\s+")) {
+                    if (pkg.endsWith("/"))
+                        pkg = pkg.substring(0, pkg.length() - 1);
+                    includePackage(profile, pkg);
+                }
+                String inclTypes =  p.getProperty("PROFILE_" + profile + "_RTJAR_INCLUDE_TYPES");
+                if (inclTypes != null) {
+                    for (String type: inclTypes.replace("$$", "$").split("\\s+")) {
+                        if (type.endsWith(".class"))
+                            includeType(profile, type.substring(0, type.length() - 6));
+                    }
+                }
+                String exclTypes =  p.getProperty("PROFILE_" + profile + "_RTJAR_EXCLUDE_TYPES");
+                if (exclTypes != null) {
+                    for (String type: exclTypes.replace("$$", "$").split("\\s+")) {
+                        if (type.endsWith(".class"))
+                            excludeType(profile, type.substring(0, type.length() - 6));
+                    }
+                }
+                maxProfile = profile;
+                profile++;
+            }
+        }
+
+        @Override
+        public int getProfileCount() {
+            return maxProfile;
+        }
+
+        @Override
+        public int getProfile(String typeName) {
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            return p.getProfile(simpleName);
+        }
+
+        @Override
+        public Set<String> getPackages(int profile) {
+            Set<String> results = new TreeSet<String>();
+            for (Package p: packages.values())
+                p.getPackages(profile, results);
+            return results;
+        }
+
+        private void includePackage(int profile, String packageName) {
+//            System.err.println("include package " + packageName);
+            Package p = getPackage(packageName);
+            Assert.check(p.profile == 0);
+            p.profile = profile;
+        }
+
+        private void includeType(int profile, String typeName) {
+//            System.err.println("include type " + typeName);
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            Assert.check(!p.includedTypes.containsKey(simpleName));
+            p.includedTypes.put(simpleName, profile);
+        }
+
+        private void excludeType(int profile, String typeName) {
+//            System.err.println("exclude type " + typeName);
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            Assert.check(!p.excludedTypes.containsKey(simpleName));
+            p.excludedTypes.put(simpleName, profile);
+        }
+
+        private Package getPackage(String packageName) {
+            int sep = packageName.lastIndexOf("/");
+            Package parent;
+            Map<String, Package> parentSubpackages;
+            String simpleName;
+            if (sep == -1) {
+                parent = null;
+                parentSubpackages = packages;
+                simpleName = packageName;
+            } else {
+                parent = getPackage(packageName.substring(0, sep));
+                parentSubpackages = parent.subpackages;
+                simpleName = packageName.substring(sep + 1);
+            }
+
+            Package p = parentSubpackages.get(simpleName);
+            if (p == null) {
+                parentSubpackages.put(simpleName, p = new Package(parent, simpleName));
+            }
+            return p;
+        }
+    }
+
+    private static class SimpleProfiles extends Profiles {
+        private final Map<String, Integer> map;
+        private final int profileCount;
+
+        SimpleProfiles(Properties p) {
+            int max = 0;
+            map = new HashMap<String, Integer>();
+            for (Map.Entry<Object,Object> e: p.entrySet()) {
+                String typeName = (String) e.getKey();
+                int profile = Integer.valueOf((String) e.getValue());
+                map.put(typeName, profile);
+                max = Math.max(max, profile);
+            }
+            profileCount = max;
+        }
+
+        @Override
+        public int getProfileCount() {
+            return profileCount;
+        }
+
+        @Override
+        public int getProfile(String typeName) {
+            return map.get(typeName);
+        }
+
+        @Override
+        public Set<String> getPackages(int profile) {
+            Set<String> results = new TreeSet<String>();
+            for (Map.Entry<String,Integer> e: map.entrySet()) {
+                String tn = e.getKey();
+                int prf = e.getValue();
+                int sep = tn.lastIndexOf("/");
+                if (sep > 0 && profile >= prf)
+                    results.add(tn);
+            }
+            return results;
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Feb 21 17:43:57 2013 -0800
@@ -235,6 +235,7 @@
         switch(tree.getTag()) {
             case TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty();
             case NEWCLASS: return isDiamond(((JCNewClass)tree).clazz);
+            case ANNOTATED_TYPE: return isDiamond(((JCAnnotatedType)tree).underlyingType);
             default: return false;
         }
     }
@@ -335,6 +336,8 @@
             case TYPEAPPLY:
             case TYPEARRAY:
                 return true;
+            case ANNOTATED_TYPE:
+                return isStaticSelector(((JCAnnotatedType)base).underlyingType, names);
             default:
                 return false;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -45,6 +45,7 @@
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.CapturedType;
 import com.sun.tools.javac.file.BaseFileObject;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.Pretty;
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
@@ -197,6 +198,9 @@
         else if (arg instanceof JavaFileObject) {
             return ((JavaFileObject)arg).getName();
         }
+        else if (arg instanceof Profile) {
+            return ((Profile)arg).name;
+        }
         else if (arg instanceof Formattable) {
             return ((Formattable)arg).toString(l, messages);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/GraphUtils.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.util;
+
+/** <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class GraphUtils {
+
+    /**
+     * This class is a basic abstract class for representing a node.
+     * A node is associated with a given data.
+     */
+    public static abstract class Node<D> {
+        public final D data;
+
+        public Node(D data) {
+            this.data = data;
+        }
+
+        public abstract Iterable<? extends Node<D>> getDependencies();
+
+        public abstract String printDependency(Node<D> to);
+
+        @Override
+        public String toString() {
+            return data.toString();
+        }
+    }
+
+    /**
+     * This class specialized Node, by adding elements that are required in order
+     * to perform Tarjan computation of strongly connected components.
+     */
+    public static abstract class TarjanNode<D> extends Node<D> implements Comparable<TarjanNode<D>> {
+        int index = -1;
+        int lowlink;
+        boolean active;
+
+        public TarjanNode(D data) {
+            super(data);
+        }
+
+        public abstract Iterable<? extends TarjanNode<D>> getDependencies();
+
+        public int compareTo(TarjanNode<D> o) {
+            return (index < o.index) ? -1 : (index == o.index) ? 0 : 1;
+        }
+    }
+
+    /**
+     * Tarjan's algorithm to determine strongly connected components of a
+     * directed graph in linear time. Works on TarjanNode.
+     */
+    public static <D, N extends TarjanNode<D>> List<? extends List<? extends N>> tarjan(Iterable<? extends N> nodes) {
+        ListBuffer<List<N>> cycles = ListBuffer.lb();
+        ListBuffer<N> stack = ListBuffer.lb();
+        int index = 0;
+        for (N node: nodes) {
+            if (node.index == -1) {
+                index += tarjan(node, index, stack, cycles);
+            }
+        }
+        return cycles.toList();
+    }
+
+    private static <D, N extends TarjanNode<D>> int tarjan(N v, int index, ListBuffer<N> stack, ListBuffer<List<N>> cycles) {
+        v.index = index;
+        v.lowlink = index;
+        index++;
+        stack.prepend(v);
+        v.active = true;
+        for (TarjanNode<D> nd: v.getDependencies()) {
+            @SuppressWarnings("unchecked")
+            N n = (N)nd;
+            if (n.index == -1) {
+                tarjan(n, index, stack, cycles);
+                v.lowlink = Math.min(v.lowlink, n.lowlink);
+            } else if (stack.contains(n)) {
+                v.lowlink = Math.min(v.lowlink, n.index);
+            }
+        }
+        if (v.lowlink == v.index) {
+            N n;
+            ListBuffer<N> cycle = ListBuffer.lb();
+            do {
+                n = stack.remove();
+                n.active = false;
+                cycle.add(n);
+            } while (n != v);
+            cycles.add(cycle.toList());
+        }
+        return index;
+    }
+
+    /**
+     * Debugging: dot representation of a set of connected nodes. The resulting
+     * dot representation will use {@code Node.toString} to display node labels
+     * and {@code Node.printDependency} to display edge labels. The resulting
+     * representation is also customizable with a graph name and a header.
+     */
+    public static <D> String toDot(Iterable<? extends TarjanNode<D>> nodes, String name, String header) {
+        StringBuilder buf = new StringBuilder();
+        buf.append(String.format("digraph %s {\n", name));
+        buf.append(String.format("label = \"%s\";\n", header));
+        //dump nodes
+        for (TarjanNode<D> n : nodes) {
+            buf.append(String.format("%s [label = \"%s\"];\n", n.hashCode(), n.toString()));
+        }
+        //dump arcs
+        for (TarjanNode<D> from : nodes) {
+            for (TarjanNode<D> to : from.getDependencies()) {
+                buf.append(String.format("%s -> %s [label = \" %s \"];\n",
+                        from.hashCode(), to.hashCode(), from.printDependency(to)));
+            }
+        }
+        buf.append("}\n");
+        return buf.toString();
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Thu Feb 21 17:43:57 2013 -0800
@@ -96,6 +96,26 @@
         return res.reverse();
     }
 
+    public List<A> intersect(List<A> that) {
+        ListBuffer<A> buf = ListBuffer.lb();
+        for (A el : this) {
+            if (that.contains(el)) {
+                buf.append(el);
+            }
+        }
+        return buf.toList();
+    }
+
+    public List<A> diff(List<A> that) {
+        ListBuffer<A> buf = ListBuffer.lb();
+        for (A el : this) {
+            if (!that.contains(el)) {
+                buf.append(el);
+            }
+        }
+        return buf.toList();
+    }
+
     /** Construct a list consisting of given element.
      */
     public static <A> List<A> of(A x1) {
--- a/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -24,6 +24,7 @@
  */
 package com.sun.tools.javac.util;
 
+import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -96,7 +97,7 @@
         this.diags = JCDiagnostic.Factory.instance(context);
         this.types = Types.instance(context);
         this.messages = JavacMessages.instance(context);
-        whereClauses = new LinkedHashMap<WhereClauseKind, Map<Type, JCDiagnostic>>();
+        whereClauses = new EnumMap<WhereClauseKind, Map<Type, JCDiagnostic>>(WhereClauseKind.class);
         configuration = new RichConfiguration(Options.instance(context), formatter);
         for (WhereClauseKind kind : WhereClauseKind.values())
             whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Thu Feb 21 17:43:57 2013 -0800
@@ -801,7 +801,9 @@
             doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
         }
 
-        if (doclintOpts.size() == 1
+        if (doclintOpts.isEmpty()) {
+            doclintOpts.add(DocLint.XMSGS_OPTION);
+        } else if (doclintOpts.size() == 1
                 && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
             return;
         }
--- a/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -91,12 +91,13 @@
         print(pos.type);
 
         switch (pos.type) {
-        // type cast
-        case CAST:
         // instanceof
         case INSTANCEOF:
         // new expression
         case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
             if (showOffsets) {
                 print(", offset=");
                 print(pos.offset);
@@ -162,9 +163,12 @@
             print(", param_index=");
             print(pos.parameter_index);
             break;
+        // type cast
+        case CAST:
         // method/constructor/reference type argument
         case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
         case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
         case METHOD_REFERENCE_TYPE_ARGUMENT:
             if (showOffsets) {
                 print(", offset=");
@@ -177,11 +181,6 @@
         case METHOD_RETURN:
         case FIELD:
             break;
-        // lambda formal parameter
-        case LAMBDA_FORMAL_PARAMETER:
-            print(", param_index=");
-            print(pos.parameter_index);
-            break;
         case UNKNOWN:
             throw new AssertionError("AnnotationWriter: UNKNOWN target type should never occur!");
         default:
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -400,12 +400,14 @@
         println(header);
         for (MethodParameters_attribute.Entry entry :
                  attr.method_parameter_table) {
+            String namestr =
+                entry.name_index != 0 ?
+                constantWriter.stringValue(entry.name_index) : "<no name>";
             String flagstr =
-                (0 != (entry.flags & ACC_FINAL) ? " final" : "") +
-                (0 != (entry.flags & ACC_SYNTHETIC) ? " synthetic" : "");
-            println(String.format(format,
-                                  constantWriter.stringValue(entry.name_index),
-                                  flagstr));
+                (0 != (entry.flags & ACC_FINAL) ? "final " : "") +
+                (0 != (entry.flags & ACC_MANDATED) ? "mandated " : "") +
+                (0 != (entry.flags & ACC_SYNTHETIC) ? "synthetic" : "");
+            println(String.format(format, namestr, flagstr));
         }
         indent(-1);
         return null;
--- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -362,7 +362,8 @@
         }
 
         try {
-            handleOptions(options, false);
+            if (options != null)
+                handleOptions(options, false);
         } catch (BadArgs e) {
             throw new IllegalArgumentException(e.getMessage());
         }
--- a/langtools/src/share/classes/javax/lang/model/element/Element.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/javax/lang/model/element/Element.java	Thu Feb 21 17:43:57 2013 -0800
@@ -149,12 +149,15 @@
     <A extends Annotation> A getAnnotation(Class<A> annotationType);
 
     /**
-     * Returns an array of all of this element's annotation for the
-     * specified type if such annotations are present, else an empty
-     * array.  The annotation may be either inherited or directly
-     * present on this element. This method will look through a container
-     * annotation (if present) if the supplied annotation type is
-     * repeatable.
+     * Returns annotations that are <em>present</em> on this element.
+     *
+     * If there are no annotations <em>present</em> on this element, the return
+     * value is an array of length 0.
+     *
+     * The difference between this method and {@link #getAnnotation(Class)}
+     * is that this method detects if its argument is a <em>repeatable
+     * annotation type</em> (JLS 9.6), and if so, attempts to find one or more
+     * annotations of that type by "looking through" a container annotation.
      *
      * <p> The annotations returned by this method could contain an element
      * whose value is of type {@code Class}.
@@ -189,14 +192,14 @@
      *
      * @see #getAnnotationMirrors()
      * @see #getAnnotation(java.lang.Class)
-     * @see java.lang.reflect.AnnotatedElement#getAnnotations
+     * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType
      * @see EnumConstantNotPresentException
      * @see AnnotationTypeMismatchException
      * @see IncompleteAnnotationException
      * @see MirroredTypeException
      * @see MirroredTypesException
      */
-    <A extends Annotation> A[] getAnnotations(Class<A> annotationType);
+    <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType);
 
     /**
      * Returns the modifiers of this element, excluding annotations.
--- a/langtools/src/share/classes/javax/lang/model/element/TypeElement.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/javax/lang/model/element/TypeElement.java	Thu Feb 21 17:43:57 2013 -0800
@@ -111,7 +111,6 @@
      */
     Name getQualifiedName();
 
-
     /**
      * Returns the simple name of this type element.
      *
@@ -152,7 +151,6 @@
      */
     List<? extends TypeParameterElement> getTypeParameters();
 
-
     /**
      * Returns the package of a top-level type and returns the
      * immediately lexically enclosing element for a {@linkplain
--- a/langtools/src/share/classes/javax/lang/model/util/Elements.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/src/share/classes/javax/lang/model/util/Elements.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -249,4 +249,14 @@
      * @param cs the character sequence to return as a name
      */
     Name getName(CharSequence cs);
+
+    /**
+     * Returns {@code true} if the type element is a functional interface, {@code false} otherwise.
+     *
+     * @param type the type element being examined
+     * @return {@code true} if the element is a functional interface, {@code false} otherwise
+     * @jls 9.8 Functional Interfaces
+     * @since 1.8
+     */
+    boolean isFunctionalInterface(TypeElement type);
 }
--- a/langtools/test/com/sun/javadoc/T6735320/T6735320.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/com/sun/javadoc/T6735320/T6735320.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -47,8 +47,8 @@
 
     public static void main(String... args) {
         T6735320 tester = new T6735320();
-        if (tester.runJavadoc(ARGS) != 0) {
-            throw new AssertionError("non-zero return code from javadoc");
+        if (tester.runJavadoc(ARGS) == 0) {
+            throw new AssertionError("zero return code from javadoc");
         }
         if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
             throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,186 @@
+/*
+ * 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      8006124
+ * @summary  Test javadoc support for profiles.
+ * @author   Bhavesh Patel
+ * @library  ../lib/
+ * @build    JavadocTester TestProfiles
+ * @run main TestProfiles
+ */
+public class TestProfiles extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "8006124";
+    private static final String PROFILE_BUG_ID = BUG_ID + "-1";
+    private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
+    //Javadoc arguments.
+    private static final String[] ARGS1 = new String[]{
+        "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath", SRC_DIR + FS
+        + "profile-rtjar-includes.txt", "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
+    };
+    private static final String[] ARGS2 = new String[]{
+        "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
+    };
+    //Input for string tests for profiles.
+    private static final String[][] PROFILES_TEST = {
+        // Tests for profile-overview-frame.html listing all profiles.
+        {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
+            "<span><a href=\"overview-frame.html\" "
+            + "target=\"profileListFrame\">All Packages</a></span>"
+        },
+        {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
+            "<li><a href=\"compact1-frame.html\" target=\"profileListFrame\">"
+            + "compact1</a></li>"
+        },
+        // Tests for profileName-frame.html listing all packages in a profile.
+        {PROFILE_BUG_ID + FS + "compact2-frame.html",
+            "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">"
+            + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+            + "target=\"profileListFrame\">All Profiles</a></span>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-frame.html",
+            "<li><a href=\"pkg4/compact2-package-frame.html\" "
+            + "target=\"packageFrame\">pkg4</a></li>"
+        },
+        // Test for profileName-package-frame.html listing all types in a
+        // package of a profile.
+        {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
+            "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+            + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a>"
+        },
+        // Tests for profileName-summary.html listing the summary for a profile.
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL
+            + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<h3><a href=\"pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a></h3>"
+        },
+        // Tests for profileName-package-summary.html listing the summary for a
+        // package in a profile.
+        {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
+            + "</a></li>"
+        },
+        {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<div class=\"subTitle\">compact3</div>"
+        },
+        //Test for "overview-frame.html" showing the "All Profiles" link.
+        {PROFILE_BUG_ID + FS + "overview-frame.html",
+            "<span><a href=\"profile-overview-frame.html\" "
+            + "target=\"profileListFrame\">All Profiles</a></span>"
+        },
+        //Test for "className.html" showing the profile information for the type.
+        {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
+            "<div class=\"subTitle\">compact1, compact2, compact3</div>"
+        }
+    };
+    private static final String[][] PROFILES_NEGATED_TEST = {
+        {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html",
+            "<div class=\"subTitle\">compact1"
+        },
+        {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html",
+            "<div class=\"subTitle\">compact1"
+        },
+        {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
+            "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
+            + "target=\"classFrame\">Anno1Pkg4</a></li>"
+        }
+    };
+    private static final String[][] PACKAGES_TEST = {
+        {PACKAGE_BUG_ID + FS + "overview-frame.html",
+            "<h2 title=\"Packages\">Packages</h2>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
+            "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
+            + "target=\"classFrame\">pkg4</a></h1>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
+            "<div class=\"header\">" + NL + "<h1 title=\"Package\" "
+            + "class=\"title\">Package&nbsp;pkg4</h1>" + NL + "</div>"
+        }
+    };
+    private static final String[][] PACKAGES_NEGATED_TEST = {
+        {PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
+            "<span><a href=\"overview-frame.html\" "
+            + "target=\"profileListFrame\">All Packages</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "compact2-frame.html",
+            "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">"
+            + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+            + "target=\"profileListFrame\">All Profiles</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
+            "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+            + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a>"
+        },
+        {PACKAGE_BUG_ID + FS + "compact2-summary.html",
+            "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<div class=\"subTitle\">compact3</div>"
+        },
+        {PACKAGE_BUG_ID + FS + "overview-frame.html",
+            "<span><a href=\"profile-overview-frame.html\" "
+            + "target=\"profileListFrame\">All Profiles</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
+            "<div class=\"subTitle\">compact1, compact2, compact3</div>"
+        }
+    };
+
+    /**
+     * The entry point of the test.
+     *
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestProfiles tester = new TestProfiles();
+        run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
+        run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg1/Class1Pkg1.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 pkg1;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg1/Class2Pkg1.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 pkg1;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class2Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg1/Class3Pkg1.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 pkg1;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class3Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg1/Interface1Pkg1.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,48 @@
+/*
+ * 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 pkg1;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg1 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+
+    /**
+     * Another test method.
+     *
+     * @param c blah.
+     */
+    void method2(int c);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg2/Anno1Pkg2.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package pkg2;
+
+import java.lang.annotation.*;
+
+/**
+ * Test Annotation class.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface Anno1Pkg2 {
+    /**
+     * Comment.
+     */
+    String[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg2/Anno2Pkg2.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package pkg2;
+
+import java.lang.annotation.*;
+
+/*
+ * A sample interface.
+ */
+public @interface Anno2Pkg2 {
+    boolean value() default true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg2/Class1Pkg2.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+package pkg2;
+
+/**
+ * Another test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg2 {
+
+    /**
+     * A sample enum.
+     */
+    public static enum ModalExclusionType {
+        /**
+         * Test comment.
+         */
+        NO_EXCLUDE,
+        /**
+         * Another comment.
+         */
+        APPLICATION_EXCLUDE
+    };
+
+    /**
+     * A string constant.
+     */
+    public static final String CONSTANT1 = "C2";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg3/Class1Pkg3.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 pkg3;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg3 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg3/Class2Pkg3.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 pkg3;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class2Pkg3 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg3/Interface1Pkg3.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,48 @@
+/*
+ * 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 pkg3;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg3 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+
+    /**
+     * Another test method.
+     *
+     * @param c blah.
+     */
+    void method2(int c);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg4/Anno1Pkg4.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package pkg4;
+
+import java.lang.annotation.*;
+
+/**
+ * Test Annotation class.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface Anno1Pkg4 {
+    /**
+     * Comment.
+     */
+    String[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg4/Class1Pkg4.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 pkg4;
+
+/**
+ * Another test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg4 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg5/Class1Pkg5.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 pkg5;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg5 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg5/Interface1Pkg5.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,40 @@
+/*
+ * 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 pkg5;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg5 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/profile-rtjar-includes.txt	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,42 @@
+PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
+    pkg2 
+
+PROFILE_1_RTJAR_INCLUDE_TYPES := \
+    pkg3/Class1Pkg3.class
+
+PROFILE_1_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_1_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
+    pkg4 
+
+PROFILE_2_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_2_RTJAR_EXCLUDE_TYPES := \
+    pkg4/Anno1Pkg4.class 
+
+PROFILE_2_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
+    pkg5 
+
+PROFILE_3_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_3_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_3_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_4_RTJAR_INCLUDE_PACKAGES := \
+    pkg1 
+
+PROFILE_4_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_4_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_4_INCLUDE_METAINF_SERVICES :=  
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/ParaTagTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,55 @@
+/*
+ * 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 8007566
+ * @summary DocLint too aggressive with not allowed here: <p>
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs ParaTagTest.java
+ */
+
+/**
+ * First line.
+ * <p> Para c1.</p>
+ * <p> Para c2.
+ * <p> Para c3.</p>
+ */
+public class ParaTagTest {
+    /**
+     * m1 <code>code </code>.
+     * <p> Para m1.
+     * <p> Para m2.
+     */
+    public void m() {}
+
+    /**
+     * m2.
+     * <p> Para z1.
+     * <p> Para z2.
+     * <pre>
+     *    Preformat 1.
+     * </pre>
+     */
+    public void z() {}
+}
--- a/langtools/test/tools/javac/6758789/T6758789b.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/6758789/T6758789b.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,4 +1,4 @@
-T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
+T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<java.lang.Object>
 T6758789b.java:16:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
 - compiler.err.warnings.and.werror
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,107 @@
+/*
+ * 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 7166455
+ * @summary javac doesn't set ACC_STRICT bit on <clinit> for strictfp class
+ * @run main CheckACC_STRICTFlagOnclinitTest
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.File;
+import java.io.IOException;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Method;
+
+import static com.sun.tools.classfile.AccessFlags.ACC_STRICT;
+
+public strictfp class CheckACC_STRICTFlagOnclinitTest {
+    private static final String AssertionErrorMessage =
+        "All methods should have the ACC_STRICT access flag " +
+        "please check output";
+    private static final String offendingMethodErrorMessage =
+        "Method %s of class %s doesn't have the ACC_STRICT access flag";
+
+    static {
+        class Foo {
+            class Bar {
+                void m11() {}
+            }
+            void m1() {}
+        }
+    }
+    void m2() {
+        class Any {
+            void m21() {}
+        }
+    }
+
+    private List<String> errors = new ArrayList<>();
+
+    public static void main(String[] args)
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        new CheckACC_STRICTFlagOnclinitTest().run();
+    }
+
+    private void run()
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        String testClasses = System.getProperty("test.classes");
+        check(testClasses,
+              "CheckACC_STRICTFlagOnclinitTest.class",
+              "CheckACC_STRICTFlagOnclinitTest$1Foo.class",
+              "CheckACC_STRICTFlagOnclinitTest$1Foo$Bar.class",
+              "CheckACC_STRICTFlagOnclinitTest$1Any.class");
+        if (errors.size() > 0) {
+            for (String error: errors) {
+                System.err.println(error);
+            }
+            throw new AssertionError(AssertionErrorMessage);
+        }
+    }
+
+    void check(String dir, String... fileNames)
+        throws
+            IOException,
+            ConstantPoolException,
+            Descriptor.InvalidDescriptor {
+        for (String fileName : fileNames) {
+            ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName));
+
+            for (Method method : classFileToCheck.methods) {
+                if ((method.access_flags.flags & ACC_STRICT) == 0) {
+                    errors.add(String.format(offendingMethodErrorMessage,
+                            method.getName(classFileToCheck.constant_pool),
+                            classFileToCheck.getName()));
+                }
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/7167125/DiffResultAfterSameOperationInnerClasses.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,61 @@
+/*
+ * 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
+ * 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 7167125
+ * @summary Two variables after the same operation in a inner class return
+ * different results
+ * @run main DiffResultAfterSameOperationInnerClasses
+ */
+
+public class DiffResultAfterSameOperationInnerClasses {
+    public int i = 1;
+    private int j = 1;
+    public String s1 = "Hi, ";
+    private String s2 = "Hi, ";
+
+    public static void main(String[] args) {
+        InnerClass inner =
+                new DiffResultAfterSameOperationInnerClasses().new InnerClass();
+        if (!inner.test()) {
+            throw new AssertionError("Different results after same calculation");
+        }
+    }
+
+    class InnerClass {
+        public boolean test() {
+            i += i += 1;
+            j += j += 1;
+
+            s1 += s1 += "dude";
+            s2 += s2 += "dude";
+
+            System.out.println("s1 = " + s1);
+            System.out.println("s2 = " + s2);
+
+            return (i == j && i == 3 &&
+                    s1.equals(s2) && s1.endsWith("Hi, Hi, dude"));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,130 @@
+/*
+ * 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 8005931
+ * @summary javac doesn't set ACC_STRICT for classes with package access
+ * @run main CheckACC_STRICTFlagOnPkgAccessClassTest
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Method;
+
+import static com.sun.tools.classfile.AccessFlags.ACC_STRICT;
+
+public class CheckACC_STRICTFlagOnPkgAccessClassTest {
+
+    private static final String AssertionErrorMessage =
+        "All methods should have the ACC_STRICT access flag " +
+        "please check output";
+    private static final String CompilationErrorMessage =
+        "Error thrown when compiling the following source:\n";
+    private static final String offendingMethodErrorMessage =
+        "Method %s of class %s doesn't have the ACC_STRICT access flag";
+
+    JavaSource source = new JavaSource();
+
+    private List<String> errors = new ArrayList<>();
+
+    public static void main(String[] args)
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        new CheckACC_STRICTFlagOnPkgAccessClassTest().run(comp);
+    }
+
+    private void run(JavaCompiler comp)
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        compile(comp);
+        check();
+        if (errors.size() > 0) {
+            for (String error: errors) {
+                System.err.println(error);
+            }
+            throw new AssertionError(AssertionErrorMessage);
+        }
+    }
+
+    private void compile(JavaCompiler comp) {
+        JavacTask ct = (JavacTask)comp.getTask(null, null, null, null, null,
+                Arrays.asList(source));
+        try {
+            if (!ct.call()) {
+                throw new AssertionError(CompilationErrorMessage +
+                        source.getCharContent(true));
+            }
+        } catch (Throwable ex) {
+            throw new AssertionError(CompilationErrorMessage +
+                    source.getCharContent(true));
+        }
+    }
+
+    void check()
+        throws
+            IOException,
+            ConstantPoolException,
+            Descriptor.InvalidDescriptor {
+        ClassFile classFileToCheck = ClassFile.read(new File("Test.class"));
+
+        for (Method method : classFileToCheck.methods) {
+            if ((method.access_flags.flags & ACC_STRICT) == 0) {
+                errors.add(String.format(offendingMethodErrorMessage,
+                        method.getName(classFileToCheck.constant_pool),
+                        classFileToCheck.getName()));
+            }
+        }
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String source = "strictfp class Test {" +
+                "    Test(){}" +
+                "    void m(){}" +
+                "}";
+
+        public JavaSource() {
+            super(URI.create("Test.java"), JavaFileObject.Kind.SOURCE);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}
--- a/langtools/test/tools/javac/Diagnostics/6799605/T6799605.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/Diagnostics/6799605/T6799605.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,4 +1,4 @@
-T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.type.captureof: 1, ?, T6799605<compiler.misc.type.captureof: 1, ?>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
+T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.incompatible.eq.upper.bounds: T, compiler.misc.type.captureof: 1, ?, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
 T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
 T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?))}
 3 errors
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java	Thu Feb 21 17:43:57 2013 -0800
@@ -40,14 +40,17 @@
         IMPORTINHERITED("import java.lang.annotation.Inherited;\n"),
         IMPORTRETENTION("import java.lang.annotation.Retention;\n" +
                         "\nimport java.lang.annotation.RetentionPolicy;\n"),
+        IMPORTSTMTS("import java.lang.annotation.*;\n"),
         REPEATABLE("\n@Repeatable(FooContainer.class)\n"),
         CONTAINER("@interface FooContainer {\n" +"  Foo[] value();\n}\n"),
         BASE("@interface Foo {}\n"),
+        BASEANNO("@Foo"),
         REPEATABLEANNO("\n@Foo() @Foo()"),
         DEPRECATED("\n@Deprecated"),
         DOCUMENTED("\n@Documented"),
         INHERITED("\n@Inherited"),
-        RETENTION("@Retention(RetentionPolicy.#VAL)\n");
+        RETENTION("@Retention(RetentionPolicy.#VAL)\n"),
+        TARGET("\n@Target(#VAL)\n");
 
         private String val;
 
@@ -69,6 +72,7 @@
     public static final String template =
             "/*PACKAGE*/\n" +
             "//pkg test;\n\n" +
+            "/*ANNODATA*/\n" + // import statements, declaration of Foo/FooContainer
             "/*TYPE*/ //class\n" +
             "class #ClassName {\n" +
             "  /*FIELD*/ //instance var\n" +
@@ -97,7 +101,11 @@
             "interface TestInterface {}\n\n" +
             "/*TYPE*/\n" +
             "/*ANNOTATION_TYPE*/\n" +
-            "@interface TestAnnotationType{}\n";
+            "@interface TestAnnotationType{}\n" +
+            "class TestPkg {}\n" +
+            "class TestTypeAnno </*TYPE_PARAMETER*/ T extends Object> {\n" +
+            "  String /*TYPE_USE*/[] arr;\n" +
+            "}";
 
     // Create and compile FileObject using values for className and contents
     public static boolean compileCode(String className, String contents,
@@ -150,3 +158,4 @@
         }
     }
 }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/TargetAnnoCombo.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,469 @@
+/*
+ * 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      7195131
+ * @author   sogoel
+ * @summary  Combo test for all possible combinations for Target values
+ * @build    Helper
+ * @compile  TargetAnnoCombo.java TestCaseGenerator.java
+ * @run main TargetAnnoCombo
+ */
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaFileObject;
+
+/*
+ * TargetAnnoCombo gets a list of test case numbers using TestCaseGenerator.
+ * For each of the test case number, @Target sets for base and container annotations
+ * are determined, source files are generated, compiled, and the result is verified
+ * based on if the @Target set for base and container is a positive or negative combination.
+ *
+ * @Target sets for base and container annotations are determined using a bit mapping of
+ * 10 ElementType enum constants defined in JDK8.
+ *
+ * Bit      Target value
+ *  0  "ElementType.ANNOTATION_TYPE"
+ *  1  "ElementType.CONSTRUCTOR"
+ *  2  "ElementType.FIELD"
+ *  3  "ElementType.LOCAL_VARIABLE"
+ *  4  "ElementType.METHOD"
+ *  5  "ElementType.TYPE"
+ *  6  "ElementType.PARAMETER"
+ *  7  "ElementType.PACKAGE"
+ *  8  "ElementType.TYPE_USE"
+ *  9  "ElementType.TYPE_PARAMETER"
+ *
+ * Group 1:
+ * 20 bits mapping, representing a test case number, is used for all target set
+ * combinations ( 0 to 1048575 ) including empty @Target sets => @Target({}).
+ * From this 20 bits, 10 bits are for base followed by 10 bits for container
+ * where each bit maps to an ElementType enum constant defined in JDK8.
+ *
+ * Examples:
+ * Test case number: 4, binary: 100 => container=100, base=[], container=["ElementType.FIELD"]
+ * Test case number: 1003575, binary: 11110101000000110111 => base=1111010100, container=0000110111;
+ *                   base=["ElementType.PARAMETER", "ElementType.TYPE_USE", "ElementType.METHOD", "ElementType.FIELD", "ElementType.PACKAGE", "ElementType.TYPE_PARAMETER"],
+ *                   container=["ElementType.TYPE", "ElementType.METHOD", "ElementType.ANNOTATION_TYPE", "ElementType.CONSTRUCTOR", "ElementType.FIELD"]
+ *
+ * In the following groups, no @Target set is represented by null.
+ * Group 2:
+ * @Target is not defined on base.
+ * Target sets for container are determined using the 10-bit binary number
+ * resulting in 1024 test cases, mapping them to test case numbers from
+ * 1048576 to (1048576 + 1023) => 1048576 to 1049599.
+ *
+ * Example:
+ * Test case number: 1048587 => 1048587 - 1048576 = test case 11 in Group 2, binary: 1011 =>
+ *                   base = null,
+ *                   container = ["ElementType.ANNOTATION_TYPE","ElementType.CONSTRUCTOR","ElementType.LOCAL_VARIABLE"]
+ *
+ * Group 3:
+ * @Target is not defined on container
+ * Target sets for base are determined using the 10-bit binary number
+ * resulting in 1024 test cases, mapping them to test case numbers from
+ * 1049600 to (1049600 + 1023) => 1049600 to 1050623.
+ *
+ * Example:
+ * Test case number: 1049708 => 1049708 - 1049600 = test case 108 in Group 3, binary: 1101100 =>
+ *                   base = ["ElementType.FIELD", "ElementType.LOCAL_VARIABLE", "ElementType.TYPE", "ElementType.PARAMETER"],
+ *                   container = null
+ *
+ * For the above group, test case number: 1049855 gives compiler error, JDK-8006547 filed
+ *
+ * Group 4:
+ * @Target not defined for both base and container annotations.
+ *
+ * This is the last test and corresponds to test case number 1050624. base=null, container=null
+ *
+ * Examples to run this test:
+ * 1. Run a specific test case number:
+ *    ${JTREG} -DTestCaseNum=10782 -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
+ * 2. Run specific number of tests:
+ *    ${JTREG} -DNumberOfTests=4 -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
+ * 3. Run specific number of tests with a seed:
+ *    ${JTREG} -DNumberOfTests=4 -DTestSeed=-972894659 -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
+ * 4. Run tests in default mode (number of tests = 1000):
+ *    ${JTREG} -DTestMode=DEFAULT -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
+ * 5. Run all tests (FULL mode):
+ *    ${JTREG} -DTestMode=FULL -samevm -jdk:${JAVA_TEST} -reportDir ${REPORT} -workDir ${WORK} TargetAnnoCombo.java
+ *
+ */
+
+public class TargetAnnoCombo {
+    int errors = 0;
+    static final String TESTPKG = "testpkg";
+    /*
+     *  Set it to true to get more debug information including base and
+     *  container target sets for a given test case number
+     */
+    static final boolean DEBUG = false;
+
+    // JDK 5/6/7/8 Targets
+    static final String[] targetVals = {"ElementType.ANNOTATION_TYPE",
+      "ElementType.CONSTRUCTOR", "ElementType.FIELD",
+      "ElementType.LOCAL_VARIABLE", "ElementType.METHOD",
+      "ElementType.TYPE", "ElementType.PARAMETER",
+      "ElementType.PACKAGE", "ElementType.TYPE_USE",
+      "ElementType.TYPE_PARAMETER"};
+
+    // TYPE_USE and TYPE_PARAMETER (added in JDK8) are not part of default Target set
+    static final int DEFAULT_TARGET_CNT = 8;
+
+    public static void main(String args[]) throws Exception {
+
+        /* maxTestNum = (base and container combinations of targetVals elems [0 - 1048575 combos])
+         *              + (combinations where base or container has no Target [1024 combos])
+         *              + (no -1 even though 1st test is number 0 as last test is where both
+         *                 base and container have no target)
+         */
+
+        int maxTestNum = (int)Math.pow(2, 2*targetVals.length) + 2*(int)Math.pow(2, targetVals.length);
+        TestCaseGenerator tcg = new TestCaseGenerator(maxTestNum);
+        TargetAnnoCombo tac = new TargetAnnoCombo();
+
+        int testCtr = 0;
+        int testCase = -1;
+        while ( (testCase=tcg.getNextTestCase()) != -1 ) {
+            tac.executeTestCase(testCase, maxTestNum);
+            testCtr++;
+        }
+
+        System.out.println("Total tests run: " + testCtr);
+        if (tac.errors > 0)
+            throw new Exception(tac.errors + " errors found");
+    }
+
+    /*
+     * For given testCase, determine the base and container annotation Target sets,
+     * get if testCase should compile, get test source file(s), get compilation result and verify.
+     *
+     */
+    private void executeTestCase(int testCase, int maxTestNum) {
+
+        // Determine base and container annotation Target sets for the testCase
+        Set<String> baseAnnoTarget = null;
+        Set<String> conAnnoTarget = null;
+
+        //Number of base and container combinations [0 - 1048575 combos]
+        int baseContCombos = (int)Math.pow(2, 2*targetVals.length);
+        //Number of either base or container combinations when one of them has no @Target [1024 combos]
+        int targetValsCombos = (int)Math.pow(2, targetVals.length);
+
+        if (testCase >= baseContCombos) {
+            //Base annotation do not have @Target
+            if (testCase < baseContCombos + targetValsCombos) {
+                baseAnnoTarget = null;
+                conAnnoTarget = getSetFromBitVec(Integer.toBinaryString(testCase - baseContCombos));
+            } else if (testCase < baseContCombos + 2*targetValsCombos) {
+                //Container annotation do not have @Target
+                baseAnnoTarget = getSetFromBitVec(Integer.toBinaryString(testCase - baseContCombos - targetValsCombos));
+                conAnnoTarget = null;
+            } else {
+                //Both Base and Container annotation do not have @Target
+                baseAnnoTarget = null;
+                conAnnoTarget = null;
+            }
+        } else {
+            //TestCase number is represented as 10-bits for base followed by container bits
+            String bin = Integer.toBinaryString(testCase);
+            String base="", cont=bin;
+            if (bin.length() > targetVals.length){
+                base = bin.substring(0, bin.length() - targetVals.length);
+                cont = bin.substring(bin.length() - targetVals.length,bin.length());
+            }
+            baseAnnoTarget = getSetFromBitVec(base);
+            conAnnoTarget = getSetFromBitVec(cont);
+        }
+
+        debugPrint("Test case number = " + testCase + " => binary = " + Integer.toBinaryString(testCase));
+        debugPrint(" => baseAnnoTarget = " + baseAnnoTarget);
+        debugPrint(" => containerAnnoTarget = " + conAnnoTarget);
+
+        // Determine if a testCase should compile or not
+        String className = "TC" + testCase;
+        boolean shouldCompile = isValidSubSet(baseAnnoTarget, conAnnoTarget);
+
+        // Get test source file(s)
+        Iterable<? extends JavaFileObject> files = getFileList(className, baseAnnoTarget,
+                conAnnoTarget, shouldCompile);
+
+        // Get result of compiling test src file(s)
+        boolean result = getCompileResult(className, shouldCompile, files);
+
+        // List test src code if test fails
+        if(!result) {
+            System.out.println("FAIL: Test " + testCase);
+            try {
+                for (JavaFileObject f: files) {
+                    System.out.println("File: " + f.getName() + "\n" + f.getCharContent(true));
+                }
+            } catch (IOException ioe) {
+                System.out.println("Exception: " + ioe);
+            }
+        } else {
+            debugPrint("PASS: Test " + testCase);
+        }
+    }
+
+    // Get a Set<String> based on bits that are set to 1
+    public Set<String> getSetFromBitVec(String bitVec) {
+        Set<String> ret = new HashSet<>();
+        char[] bit = bitVec.toCharArray();
+        for (int i=bit.length-1, j=0; i>=0; i--, j++){
+            if (bit[i] == '1') {
+                ret.add(targetVals[j]);
+            }
+        }
+        return ret;
+    }
+
+    // Compile the test source file(s) and return test result
+    private boolean getCompileResult(String className, boolean shouldCompile,
+            Iterable<? extends JavaFileObject> files) {
+
+        DiagnosticCollector<JavaFileObject> diagnostics =
+                new DiagnosticCollector<JavaFileObject>();
+        Helper.compileCode(diagnostics, files);
+
+        // Test case pass or fail
+        boolean ok = false;
+
+        String errMesg = "";
+        int numDiags = diagnostics.getDiagnostics().size();
+
+        if (numDiags == 0) {
+            if (shouldCompile) {
+                debugPrint("Test passed, compiled as expected.");
+                ok = true;
+            } else {
+                errMesg = "Test failed, compiled unexpectedly.";
+                ok = false;
+            }
+        } else {
+            if (shouldCompile) {
+                // did not compile
+                errMesg = "Test failed, did not compile.";
+                ok = false;
+            } else {
+                // Error in compilation as expected
+                String expectedErrKey = "compiler.err.invalid.repeatable." +
+                        "annotation.incompatible.target";
+                for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
+                    if((d.getKind() == Diagnostic.Kind.ERROR) &&
+                        d.getCode().contains(expectedErrKey)) {
+                        // Error message as expected
+                        debugPrint("Error message as expected.");
+                        ok = true;
+                        break;
+                    } else {
+                        // error message is incorrect
+                        ok = false;
+                    }
+                }
+                if (!ok) {
+                    errMesg = "Incorrect error received when compiling " +
+                        className + ", expected: " + expectedErrKey;
+                }
+            }
+        }
+
+        if(!ok) {
+            error(errMesg);
+            for (Diagnostic<?> d : diagnostics.getDiagnostics())
+                System.out.println(" Diags: " + d);
+        }
+        return ok;
+    }
+
+    private void debugPrint(String string) {
+        if(DEBUG)
+            System.out.println(string);
+    }
+
+    // Create src code and corresponding JavaFileObjects
+    private Iterable<? extends JavaFileObject> getFileList(String className,
+            Set<String> baseAnnoTarget, Set<String> conAnnoTarget,
+            boolean shouldCompile) {
+
+        String srcContent = "";
+        String pkgInfoContent = "";
+        String template = Helper.template;
+        String baseTarget = "", conTarget = "";
+
+        String target = Helper.ContentVars.TARGET.getVal();
+        if(baseAnnoTarget != null) {
+            baseTarget = target.replace("#VAL", baseAnnoTarget.toString())
+                                  .replace("[", "{").replace("]", "}");
+        }
+        if(conAnnoTarget != null) {
+            conTarget = target.replace("#VAL", conAnnoTarget.toString())
+                                 .replace("[", "{").replace("]", "}");
+        }
+
+        String annoData = Helper.ContentVars.IMPORTSTMTS.getVal() +
+                          conTarget +
+                          Helper.ContentVars.CONTAINER.getVal() +
+                          baseTarget +
+                          Helper.ContentVars.REPEATABLE.getVal() +
+                          Helper.ContentVars.BASE.getVal();
+
+        JavaFileObject pkgInfoFile = null;
+
+        /*
+         *  If shouldCompile = true and no @Target is specified for container annotation,
+         *  then all 8 ElementType enum constants are applicable as targets for
+         *  container annotation.
+         */
+        if(shouldCompile && conAnnoTarget == null) {
+            //conAnnoTarget = new HashSet<String>(Arrays.asList(targetVals));
+            conAnnoTarget = getDefaultTargetSet();
+        }
+
+        if(shouldCompile) {
+            boolean isPkgCasePresent = new ArrayList<String>(conAnnoTarget).contains("ElementType.PACKAGE");
+            String repeatableAnno = Helper.ContentVars.BASEANNO.getVal() + " " + Helper.ContentVars.BASEANNO.getVal();
+            for(String s: conAnnoTarget) {
+                s = s.replace("ElementType.","");
+                String replaceStr = "/*"+s+"*/";
+                if(s.equalsIgnoreCase("PACKAGE")) {
+                    //Create packageInfo file
+                    String pkgInfoName = TESTPKG + "." + "package-info";
+                    pkgInfoContent = repeatableAnno + "\npackage " + TESTPKG + ";" + annoData;
+                    pkgInfoFile = Helper.getFile(pkgInfoName, pkgInfoContent);
+                } else {
+                    template = template.replace(replaceStr, repeatableAnno);
+                    //srcContent = template.replace("#ClassName",className);
+                    if(!isPkgCasePresent) {
+                        srcContent = template.replace("/*ANNODATA*/", annoData).replace("#ClassName",className);
+                    } else {
+                        replaceStr = "/*PACKAGE*/";
+                        srcContent = template.replace(replaceStr, "package " + TESTPKG + ";")
+                                     .replace("#ClassName", className);
+                    }
+                }
+            }
+        } else {
+            // For invalid cases, compilation should fail at declaration site
+            template = "class #ClassName {}";
+            srcContent = annoData + template.replace("#ClassName",className);
+        }
+        JavaFileObject srcFile = Helper.getFile(className, srcContent);
+        Iterable<? extends JavaFileObject> files = null;
+        if(pkgInfoFile != null)
+            files = Arrays.asList(pkgInfoFile,srcFile);
+        else
+            files = Arrays.asList(srcFile);
+        return files;
+    }
+
+    private Set<String> getDefaultTargetSet() {
+        Set<String> defaultSet = new HashSet<>();
+        int ctr = 0;
+        for(String s : targetVals) {
+            if(ctr++ < DEFAULT_TARGET_CNT) {
+                defaultSet.add(s);
+            }
+        }
+        return defaultSet;
+    }
+
+    private boolean isValidSubSet(Set<String> baseAnnoTarget, Set<String> conAnnoTarget) {
+        /*
+         *  RULE 1: conAnnoTarget should be a subset of baseAnnoTarget
+         *  RULE 2: For empty @Target ({}) - annotation cannot be applied anywhere
+         *         - Empty sets for both is valid
+         *         - Empty baseTarget set is invalid with non-empty conTarget set
+         *         - Non-empty baseTarget set is valid with empty conTarget set
+         *  RULE 3: For no @Target specified - annotation can be applied to any JDK 7 targets
+         *         - No @Target for both is valid
+         *         - No @Target for baseTarget set with @Target conTarget set is valid
+         *         - @Target for baseTarget set with no @Target for conTarget is invalid
+         */
+
+
+        /* If baseAnno has no @Target, Foo can be either applied to @Target specified for container annotation
+         * else will be applicable for all default targets if no @Target is present for container annotation.
+         * In both cases, the set will be a valid set with no @Target for base annotation
+         */
+        if(baseAnnoTarget == null) {
+            if(conAnnoTarget == null) return true;
+            return !(conAnnoTarget.contains("ElementType.TYPE_USE") || conAnnoTarget.contains("ElementType.TYPE_PARAMETER"));
+        }
+
+        Set<String> tempBaseSet = new HashSet<>(baseAnnoTarget);
+        // If BaseAnno has TYPE, then ANNOTATION_TYPE is allowed by default
+        if(baseAnnoTarget.contains("ElementType.TYPE")) {
+            tempBaseSet.add("ElementType.ANNOTATION_TYPE");
+        }
+
+        /*
+         * If containerAnno has no @Target, only valid case if baseAnnoTarget has all targets defined
+         * else invalid set
+         */
+        if(conAnnoTarget == null) {
+            return (tempBaseSet.containsAll(getDefaultTargetSet()));
+        }
+
+        // At this point, neither conAnnoTarget or baseAnnoTarget are null
+        if(conAnnoTarget.size() == 0) return true;
+
+        // At this point, conAnnoTarget is non-empty
+        if (baseAnnoTarget.size() == 0) return false;
+
+        // At this point, neither conAnnoTarget or baseAnnoTarget are empty
+        return tempBaseSet.containsAll(conAnnoTarget);
+    }
+
+    void error(String msg) {
+        System.out.println("ERROR: " + msg);
+        errors++;
+    }
+
+    // Lists the start and end range for the given set of target vals
+    void showGroups() {
+        //Group 1: All target set combinations ( 0 to 1048575 ) including empty @Target sets => @Target({})
+        int grpEnd1 = (int)Math.pow(2, 2*targetVals.length) - 1;
+        System.out.println("[Group 1]: 0 - " + grpEnd1);
+
+        //Group 2: @Target not defined for base annotation ( 1048576 - 1049599 ).
+        System.out.print("[Group 2]: " + (grpEnd1 + 1) + " - ");
+        int grpEnd2 = grpEnd1 + 1 + (int)Math.pow(2, targetVals.length) - 1;
+        System.out.println(grpEnd2);
+
+        //Group 3: @Target not defined for container annotation ( 1049600 - 1050623 ).
+        System.out.print("[Group 3]: " + (grpEnd2 + 1) + " - ");
+        int grpEnd3 = grpEnd2 + 1 + (int)Math.pow(2, targetVals.length) - 1;
+        System.out.println(grpEnd3);
+
+        //Group 4: @Target not defined for both base and container annotations ( 1050624 ).
+        System.out.println("[Group 4]: " + (grpEnd3 + 1));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/TestCaseGenerator.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,191 @@
+/*
+ * 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.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+
+/* System properties:
+ * NumberOfTests, TestMode, and TestCaseNum are mutually exclusive
+ * TestSeed will be used only with NumberOfTests or TestMode, otherwise it will be ignored
+ * -DNumberOfTests=[0 to 2^20+2^11+1]
+ * -DTestMode=[FULL|DEFAULT]
+ * -DTestSeed=[seedNumber]
+ * -DTestCaseNum=[0 to 2^20+2^11+1]
+ */
+public class TestCaseGenerator {
+    // Total number of tests to be run
+    int numberOfTests = -1;
+    //Single test case
+    int testCaseNum = -1;
+    //Seed used to generate test cases
+    int testSeed;
+
+    int maxTestNum;
+    Random randNum;
+
+    // used in getNextTestCase
+    int curTestNum;
+    int testCompletedCount;
+    HashSet<Integer> uniqueTestSet;
+
+    static final int DEFAULT_TEST_COUNT = 250;
+
+    /*
+     *  Get parameter values from command line to set numberOfTests, testCaseNum,
+     *  and testSeed
+     */
+    public TestCaseGenerator(int maxTestNum) {
+        this.maxTestNum = maxTestNum;
+
+        // Set values for variables based on input from command line
+
+        // TestMode system property
+        String testModeVal = System.getProperty("TestMode");
+        if(testModeVal != null && !testModeVal.isEmpty()) {
+            switch (testModeVal.toUpperCase()) {
+            case "FULL":
+                numberOfTests = maxTestNum;
+                break;
+            case "DEFAULT":
+                numberOfTests = DEFAULT_TEST_COUNT;
+                break;
+            default:
+                System.out.println("Invalid property value " + testModeVal +
+                        " for numberOfTests. Possible range: 0 to " +
+                        maxTestNum + ". Ignoring property");
+                numberOfTests = -1;
+            }
+        }
+
+        // NumberOfTests system property
+        String numTestsStr = System.getProperty("NumberOfTests");
+        if(numTestsStr != null && !numTestsStr.isEmpty()) {
+            int numTests = -1;
+            try {
+                numTests = Integer.parseInt(numTestsStr);
+                if (numTests < 0 || numTests > maxTestNum) {
+                    throw new NumberFormatException();
+                }
+            } catch(NumberFormatException nfe) {
+                System.out.println("Invalid NumberOfTests property value " +
+                        numTestsStr + ". Possible range: 0 to " + maxTestNum +
+                        "Reset to default: " + DEFAULT_TEST_COUNT);
+                numTests = DEFAULT_TEST_COUNT;
+            }
+
+            if (numberOfTests != -1 && numTests != -1) {
+                System.out.println("TestMode and NumberOfTests cannot be set together. Ignoring TestMode.");
+            }
+            numberOfTests = numTests;
+        }
+
+        // TestSeed system property
+        String seedVal = System.getProperty("TestSeed");
+        if(seedVal != null && !seedVal.isEmpty()) {
+            try {
+                testSeed = Integer.parseInt(seedVal);
+            } catch(NumberFormatException nfe) {
+                Random srand = new Random();
+                testSeed = srand.nextInt();
+            }
+        } else {
+            Random srand = new Random();
+            testSeed = srand.nextInt();
+        }
+
+        // TestCaseNum system property
+        String testNumStr = System.getProperty("TestCaseNum");
+        if(testNumStr != null && !testNumStr.isEmpty()) {
+            try {
+                testCaseNum = Integer.parseInt(testNumStr);
+                if (testCaseNum < 0 || testCaseNum > maxTestNum) {
+                    throw new NumberFormatException();
+                }
+            } catch(NumberFormatException nfe) {
+                System.out.println("Invalid TestCaseNumber property value " +
+                        testNumStr + ". Possible value in range: 0 to " +
+                        maxTestNum + ". Defaulting to last test case.");
+                testCaseNum = maxTestNum;
+            }
+
+            if ( numberOfTests != -1) {
+                System.out.println("TestMode or NumberOfTests cannot be set along with TestCaseNum. Ignoring TestCaseNumber.");
+                testCaseNum = -1;
+            }
+        }
+
+        if (numberOfTests == -1 && testCaseNum == -1) {
+            numberOfTests = DEFAULT_TEST_COUNT;
+            System.out.println("Setting TestMode to default, will run " + numberOfTests + "tests.");
+        }
+
+        /*
+         *  By this point in code, we will have:
+         *  - testSeed: as per TestSeed or a Random one
+         *  - numberOfTests to run or -1 to denote not set
+         *  - testCaseNum to run or -1 to denote not set
+         */
+
+        /*
+         * If numberOfTests = maxTestNum, all tests are to be run,
+         * so no randNum will be required
+         */
+        if (numberOfTests != -1 && numberOfTests < maxTestNum) {
+            System.out.println("Seed = " + testSeed);
+            randNum = new Random(testSeed);
+            uniqueTestSet = new HashSet<>();
+        }
+
+        testCompletedCount = 0;
+        // to be used to keep sequential count when running all tests
+        curTestNum = 0;
+    }
+
+    /*
+     * returns next test case number to run
+     * returns -1 when there are no more tests to run
+     */
+    public int getNextTestCase() {
+        if (testCaseNum != -1) {
+            int nextTC = testCaseNum;
+            testCaseNum = -1;
+            return nextTC;
+        }
+        if (++testCompletedCount <= numberOfTests) {
+            if (numberOfTests == maxTestNum) {
+                //all the tests need to be run, so just return
+                //next test case sequentially
+                return curTestNum++;
+            } else {
+                int nextTC = -1;
+                // Ensuring unique test are run
+                while(!uniqueTestSet.add(nextTC = randNum.nextInt(maxTestNum))) {
+                }
+                return nextTC;
+            }
+        }
+        return -1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/LazyConstantValue.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
+ * @bug 8008077
+ * @summary Type annotations in a lazy constant need to be attributed
+ *   in the correct order.
+ * @author Werner Dietl
+ * @compile LazyConstantValue.java
+ */
+
+import java.lang.annotation.*;
+
+class ClassA {
+    Object o = ClassB.lcv;
+}
+
+class ClassB {
+    static final String[] lcv = new @TA String[0];
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TA {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariable.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,43 @@
+/*
+ * 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 8008077
+ * @summary Type annotations on a type variable, where the bound of
+ *   the type variable is also annotated, need to be processed correctly.
+ * @author Werner Dietl
+ * @compile TypeVariable.java
+ */
+
+import java.lang.annotation.*;
+
+class TypeVariable {
+    <TV extends  @TA Object> TV cast(TV p) {
+        return (@TA TV) p;
+    }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TA {}
+
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/VoidGenericMethod.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/VoidGenericMethod.java	Thu Feb 21 17:43:57 2013 -0800
@@ -21,6 +21,8 @@
  * questions.
  */
 
+import java.lang.annotation.*;
+
 /*
  * @test
  * @bug 6843077 8006775
@@ -29,7 +31,8 @@
  * @compile/fail VoidGenericMethod.java
  */
 class VoidGenericMethod {
-  public <T> @A void method() { }
+  public @A <T> void method() { }
 }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/Lambda.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,59 @@
+/*
+ * 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 8008077
+ * @summary new type annotation location: lambda expressions
+ * @compile Lambda.java
+ * @author Werner Dietl
+ */
+
+import java.lang.annotation.*;
+
+public class Lambda {
+
+    interface LambdaInt {
+        <S, T> void generic(S p1, T p2);
+    }
+
+    static class LambdaImpl implements LambdaInt {
+        <S, T> LambdaImpl(S p1, T p2) {}
+        public <S, T> void generic(S p1, T p2) {}
+    }
+
+    LambdaInt getMethodRefTA(LambdaImpl r) {
+        return r::<@TA Object, @TB Object>generic;
+    }
+
+    LambdaInt getConstructorRefTA() {
+        return LambdaImpl::<@TA Object, @TB Object>new;
+    }
+
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TA { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TB { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,262 @@
+/*
+ * 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 8008077
+ * @summary Test population of reference info for lambda expressions
+ * @compile -g Driver.java ReferenceInfoUtil.java Lambda.java
+ * @run main Driver Lambda
+ * @author Werner Dietl
+ */
+
+import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+public class Lambda {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String returnMethodRef1() {
+        return
+                "class Lambda {" +
+                "  public String getName() { return \"Lambda!\"; }" +
+                "}" +
+
+                "class Test {" +
+                "  java.util.function.Function<Lambda, String> lambda() {" +
+                "    return @TA @TB Lambda::getName;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TD", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TE", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 })
+    })
+    public String returnMethodRef2() {
+        return
+                "class Lambda<S, T> {" +
+                "  public String getName() { return \"Lambda!\"; }" +
+                "}" +
+
+                "class Test {" +
+                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
+                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::getName;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "CTA", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "CTB", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "CTC", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 })
+    })
+    public String returnMethodRef3() {
+        return
+                "class Lambda<S, T> {" +
+                "  public String getName() { return \"Lambda!\"; }" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTA {" +
+                "  String value();" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTB {" +
+                "  int age();" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTC {" +
+                "  String name();" +
+                "}" +
+
+                "class Test {" +
+                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
+                "    return @CTA(\"x\") Lambda<@CTB(age = 5) Integer, @CTC(name = \"y\") Float>::getName;" +
+                "  }" +
+                "}";
+    }
+
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String returnConstructorRef1() {
+        return
+                "class Lambda {" +
+                "  Lambda() { }" +
+                "}" +
+
+                "class Test {" +
+                "  Runnable lambda() {" +
+                "    return @TA @TB Lambda::new;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TD", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TE", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 })
+    })
+    public String returnConstructorRef2() {
+        return
+                "class Lambda<S, T> {" +
+                "  Lambda() { }" +
+                "}" +
+
+                "class Test {" +
+                "  Runnable lambda() {" +
+                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::new;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "CTA", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "CTB", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "CTC", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 })
+    })
+    public String returnConstructorRef3() {
+        return
+                "class Lambda<S, T> {" +
+                "  Lambda() { }" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTA {" +
+                "  String value();" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTB {" +
+                "  int age();" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTC {" +
+                "  String name();" +
+                "}" +
+
+                "class Test {" +
+                "  Runnable lambda() {" +
+                "    return @CTA(\"x\") Lambda<@CTB(age = 5) Integer, @CTC(name = \"y\") Float>::new;" +
+                "  }" +
+                "}";
+    }
+
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_REFERENCE_TYPE_ARGUMENT,
+                 offset = ReferenceInfoUtil.IGNORE_VALUE,
+                 typeIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_REFERENCE_TYPE_ARGUMENT,
+                 offset = ReferenceInfoUtil.IGNORE_VALUE,
+                 typeIndex = 1)
+    })
+    public String returnMethodRefTA1() {
+        return
+                "interface Lambda {" +
+                "  <S, T> void generic(S p1, T p2);" +
+                "}" +
+
+                "class LambdaImpl implements Lambda {" +
+                "  public <S, T> void generic(S p1, T p2) {}" +
+                "}" +
+
+                "class Test {" +
+                "  Lambda lambda(LambdaImpl r) {" +
+                "    return r::<@TA Object, @TB Object>generic;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
+                 offset = ReferenceInfoUtil.IGNORE_VALUE,
+                 typeIndex = 0),
+        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
+                 offset = ReferenceInfoUtil.IGNORE_VALUE,
+                 typeIndex = 1)
+    })
+    public String returnConstructorRefTA2() {
+        return
+                "interface Lambda {" +
+                "  <S, T> void generic(S p1, T p2);" +
+                "}" +
+
+                "class LambdaImpl implements Lambda {" +
+                "  <S, T> LambdaImpl(S p1, T p2) {}" +
+                "  public <S, T> void generic(S p1, T p2) {}" +
+                "}" +
+
+                "class Test {" +
+                "  Lambda lambda() {" +
+                "    return LambdaImpl::<@TA Object, @TB Object>new;" +
+                "  }" +
+                "}";
+    }
+
+}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java	Thu Feb 21 17:43:57 2013 -0800
@@ -93,6 +93,28 @@
     }
 
     @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1)
+    })
+    public String methodParamAsArray2() {
+        return "void test(Object b, @TA @TB String [] a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1)
+    })
+    public String methodParamAsArray3() {
+        return "void test(Object b, @TA @TB @TC String [] a) { }";
+    }
+
+    @TADescriptions({
         @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1),
         @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
                 genericLocation = { 0, 0 }, paramIndex = 1),
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java	Thu Feb 21 17:43:57 2013 -0800
@@ -31,118 +31,170 @@
  */
 public class TypeCasts {
 
-    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
     public String returnObject() {
         return "Object returnObject() { return (@TA String)null; }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TC", type = CAST,
-                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String returnObjectArray() {
         return "Object returnObjectArray() { return (@TC String @TA [] @TB [])null; }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String returnObjectGeneric() {
         return "Object returnObjectGeneric() { return (@TA List<@TB String>)null; }";
     }
 
-    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
     public String returnPrim() {
         return "Object returnPrim() { return (@TA int)0; }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String returnPrimArray() {
         return "Object returnPrimArray() { return (@TB int @TA [])null; }";
     }
 
-    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
     public String initObject() {
         return "void initObject() { Object a =  (@TA String)null; }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String initObjectArray() {
         return "void initObjectArray() { Object a = (@TB String @TA [])null; }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String initObjectGeneric() {
         return "void initObjectGeneric() { Object a = (@TA List<@TB String>)null; }";
     }
 
-    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
     public String initPrim() {
         return "void initPrim() { Object a =  (@TA int)0; }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String initPrimArray() {
         return "void initPrimArray() { Object a = (@TB int @TA [])null; }";
     }
 
-    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
     public String eqtestObject() {
         return "void eqtestObject() { if (null == (@TA String)null); }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String eqtestObjectArray() {
         return "void eqtestObjectArray() { if (null == (@TB String @TA [])null); }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String eqtestObjectGeneric() {
         return "void eqtestObjectGeneric() { if (null == (@TA List<@TB String >)null); }";
     }
 
-    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
     // compiler optimizes away compile time constants casts
     public String eqtestPrim() {
         return "void eqtestPrim(int a) { if (0 == (@TA int)a); }";
     }
 
     @TADescriptions({
-        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
         @TADescription(annotation = "TB", type = CAST,
-                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
     })
     public String eqtestPrimArray() {
         return "void eqtestPrimArray() { if (null == (@TB int @TA [])null); }";
     }
 
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1),
+        @TADescription(annotation = "TC", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1,
+                genericLocation = {3, 0})
+    })
+    public String intersection1() {
+        return "void intersection() { Object o = (@TA String & @TB Comparable<@TC String>) null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1),
+        @TADescription(annotation = "TC", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1,
+                genericLocation = {3, 0}),
+        @TADescription(annotation = "TD", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 2),
+    })
+    public String intersection2() {
+        return "void intersection() { Object o = (@TA String & @TB Comparable<@TC String> & @TD CharSequence) null; }";
+    }
 }
--- a/langtools/test/tools/javac/api/8007344/Test.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/api/8007344/Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -41,6 +41,7 @@
 import javax.lang.model.element.TypeElement;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
 
 import com.sun.source.doctree.DocCommentTree;
 import com.sun.source.tree.*;
@@ -83,6 +84,7 @@
         File thisFile = new File(testSrc, getClass().getName() + ".java");
         JavacTool javac = JavacTool.create();
         StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
         Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(thisFile);
         testAnnoProcessor(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
         testTaskListener(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
--- a/langtools/test/tools/javac/api/T6306137.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/api/T6306137.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -25,6 +25,8 @@
  * @test
  * @bug     6306137
  * @summary JSR 199: encoding option doesn't affect standard file manager
+ * @compile -encoding utf-8 T6306137.java
+ * @run main T6306137
  * @author  Peter von der Ahé
  */
 
--- a/langtools/test/tools/javac/diags/examples/CantApplyDiamond1.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/diags/examples/CantApplyDiamond1.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,7 +23,7 @@
 
 // key: compiler.err.prob.found.req
 // key: compiler.misc.cant.apply.diamond.1
-// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
+// key: compiler.misc.incompatible.eq.upper.bounds
 // key: compiler.misc.diamond
 
 class CantApplyDiamond1<X> {
--- a/langtools/test/tools/javac/diags/examples/InferredDoNotConformToEq.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/diags/examples/InferredDoNotConformToEq.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,6 +23,7 @@
 
 // key: compiler.err.cant.apply.symbol
 // key: compiler.misc.inferred.do.not.conform.to.eq.bounds
+// options: -source 7 -Xlint:-options
 
 import java.util.*;
 
--- a/langtools/test/tools/javac/diags/examples/InferredDoNotConformToUpper.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/diags/examples/InferredDoNotConformToUpper.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,6 +23,7 @@
 
 // key: compiler.err.cant.apply.symbol
 // key: compiler.misc.inferred.do.not.conform.to.upper.bounds
+// options: -source 7 -Xlint:-options
 
 import java.util.*;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotInProfile.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.not.in.profile
+// options: -profile compact1
+
+class NotInProfile {
+    Class<?> c = java.awt.Frame.class;
+}
--- a/langtools/test/tools/javac/diags/examples/WhereFreshTvar.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/diags/examples/WhereFreshTvar.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,7 +24,7 @@
 // key: compiler.misc.where.fresh.typevar
 // key: compiler.misc.where.description.typevar
 // key: compiler.err.prob.found.req
-// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
+// key: compiler.misc.inconvertible.types
 // options: -XDdiags=where,simpleNames
 // run: simple
 
@@ -33,5 +33,5 @@
 class WhereFreshTvar {
     <T extends List<T>> T m() {}
 
-    { List<String> ls = m(); }
+    { Object o = (List<String>)m(); }
 }
--- a/langtools/test/tools/javac/generics/7015430/T7015430.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/7015430/T7015430.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,14 +1,14 @@
-T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
+T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
 T7015430.java:41:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
 T7015430.java:50:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
 T7015430.java:50:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
-T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
+T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
 T7015430.java:68:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
 T7015430.java:77:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
 T7015430.java:77:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
 T7015430.java:104:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
 T7015430.java:104:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
-T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
+T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
 T7015430.java:113:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
 T7015430.java:41:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
 T7015430.java:68:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
--- a/langtools/test/tools/javac/generics/7151802/T7151802.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/7151802/T7151802.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,5 +1,5 @@
 T7151802.java:14:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get1, Z, T7151802.Foo, kindname.class, T7151802
-T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<Z>
+T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.Object>
 T7151802.java:22:30: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get3, T7151802.Foo<Z>, T7151802.Foo, kindname.class, T7151802
 T7151802.java:30:36: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get5, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7151802
 T7151802.java:38:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.String>
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg06.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg06.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,2 +1,2 @@
-Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))
+Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))
 1 error
--- a/langtools/test/tools/javac/generics/inference/6278587/T6278587Neg.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/inference/6278587/T6278587Neg.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
@@ -23,10 +23,11 @@
 
 /*
  * @test
- * @bug     6278587
+ * @bug     6278587 8007464
  * @summary Inference broken for subtypes of subtypes of F-bounded types
  * @author  Peter von der Ah\u00e9
- * @compile/fail T6278587Neg.java
+ * @compile/fail -source 7 T6278587Neg.java
+ * @compile T6278587Neg.java
  */
 
 public abstract class T6278587Neg {
--- a/langtools/test/tools/javac/generics/inference/6638712/T6638712d.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/inference/6638712/T6638712d.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,2 +1,2 @@
-T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.String, java.lang.Integer)
+T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.incompatible.eq.lower.bounds: U, java.lang.String, java.lang.Integer)
 1 error
--- a/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,2 +1,2 @@
-T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Boolean,java.lang.Object)
+T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Boolean,java.lang.Object)
 1 error
--- a/langtools/test/tools/javac/generics/inference/7154127/T7154127.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/inference/7154127/T7154127.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,8 +1,9 @@
 /**
  * @test /nodynamiccopyright/
- * @bug 7154127
+ * @bug 7154127 8007464
  * @summary Inference cleanup: remove bound check analysis from visitors in Types.java
- * @compile/fail/ref=T7154127.out -XDrawDiagnostics T7154127.java
+ * @compile/fail/ref=T7154127.out -Xlint:-options -source 7 -XDrawDiagnostics T7154127.java
+ * @compile T7154127.java
  */
 class T7154127 {
 
--- a/langtools/test/tools/javac/generics/inference/7154127/T7154127.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/inference/7154127/T7154127.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,2 +1,2 @@
-T7154127.java:19:49: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: Y, T7154127.D,T7154127.B<U>)
+T7154127.java:20:49: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.bounds: Y, T7154127.B<U>,T7154127.D)
 1 error
--- a/langtools/test/tools/javac/generics/inference/7177306/T7177306a.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/inference/7177306/T7177306a.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,4 +1,4 @@
-T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<E>
+T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<java.lang.Object>
 T7177306a.java:13:33: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.List<E>, java.util.List, kindname.class, T7177306a
 T7177306a.java:13:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7177306a, T7177306a<java.lang.Object>
 - compiler.err.warnings.and.werror
--- a/langtools/test/tools/javac/generics/inference/7177306/T7177306e.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/inference/7177306/T7177306e.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,8 +1,9 @@
 /**
  * @test /nodynamiccopyright/
- * @bug 7177306
+ * @bug 7177306 8007464
  * @summary Regression: unchecked method call does not erase return type
- * @compile/fail/ref=T7177306e.out -XDrawDiagnostics T7177306e.java
+ * @compile/fail/ref=T7177306e.out -source 7 -Xlint:-options -XDrawDiagnostics T7177306e.java
+ * @compile/fail T7177306e.java
  */
 
 import java.util.List;
--- a/langtools/test/tools/javac/generics/inference/7177306/T7177306e.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/inference/7177306/T7177306e.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,2 +1,2 @@
-T7177306e.java:15:9: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<?>, java.util.List<compiler.misc.type.captureof: 1, ?>)
+T7177306e.java:16:9: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<?>, java.util.List<compiler.misc.type.captureof: 1, ?>)
 1 error
--- a/langtools/test/tools/javac/generics/odersky/BadTest4.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/generics/odersky/BadTest4.java	Thu Feb 21 17:43:57 2013 -0800
@@ -23,11 +23,12 @@
 
 /*
  * @test
- * @ bug
+ * @bug 8007464
  * @summary Negative regression test from odersky
  * @author odersky
  *
- * @compile/fail  BadTest4.java
+ * @compile/fail -source 7 BadTest4.java
+ * @compile BadTest4.java
  */
 
 class BadTest4 {
--- a/langtools/test/tools/javac/lambda/TargetType14.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/lambda/TargetType14.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,2 +1,2 @@
-TargetType14.java:20:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer, java.lang.String)
+TargetType14.java:20:29: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.lower.bounds: X, java.lang.Integer, java.lang.String)
 1 error
--- a/langtools/test/tools/javac/lambda/TargetType20.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/lambda/TargetType20.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,10 +1,33 @@
 /*
- * @test /nodynamiccopyright/
+ * 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 8003280
  * @summary Add lambda tests
  *  complex case of lambda return type that depends on generic method
  *          inference variable
- * @compile/fail/ref=TargetType20.out -XDrawDiagnostics TargetType20.java
+ * @compile -XDrawDiagnostics TargetType20.java
  */
 import java.util.*;
 
--- a/langtools/test/tools/javac/lambda/TargetType20.out	Thu Feb 21 15:46:37 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-TargetType20.java:19:10: compiler.err.cant.apply.symbol: kindname.method, call, TargetType20.SAM2<Z>,TargetType20.SAM2<Z>, @428,@459, kindname.class, TargetType20.Test, (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.String, java.lang.String,java.lang.Object)
-1 error
--- a/langtools/test/tools/javac/lambda/TargetType28.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/lambda/TargetType28.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,3 +1,2 @@
-TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Number, java.lang.Number,java.lang.String)
-TargetType28.java:21:33: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Number, java.lang.Number,java.lang.Integer)
-2 errors
+TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String,X, java.lang.Object,java.lang.Number)
+1 error
--- a/langtools/test/tools/javac/lambda/TargetType50.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/lambda/TargetType50.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,9 +1,32 @@
 /*
- * @test /nodynamiccopyright/
+ * 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 8003280
  * @summary Add lambda tests
  *  bad stuck check for method reference leads to javac crash
- * @compile/fail/ref=TargetType50.out -XDrawDiagnostics TargetType50.java
+ * @compile TargetType50.java
  */
 import java.util.*;
 
@@ -17,7 +40,7 @@
         static <Z> Sink<Z> make() { return null; }
     }
 
-    <Y, S extends Sink<Y>> List<Y> m(Factory<S> factory) {  }
+    <Y, S extends Sink<Y>> List<Y> m(Factory<S> factory) { return null; }
 
     void test() {
         List<?> l1 = m(Sink::new);
--- a/langtools/test/tools/javac/lambda/TargetType50.out	Thu Feb 21 15:46:37 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-TargetType50.java:25:28: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: TargetType50.Sink<java.lang.Object>, TargetType50.Sink<java.lang.String>)
-TargetType50.java:26:28: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: TargetType50.Sink<java.lang.Object>, TargetType50.Sink<java.lang.String>)
-2 errors
--- a/langtools/test/tools/javac/lambda/TargetType51.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/lambda/TargetType51.java	Thu Feb 21 17:43:57 2013 -0800
@@ -23,7 +23,9 @@
 
 /*
  * @test
- * @summary smoke test for combinator-like stuck analysis
+ * @bug 8005244
+ * @summary Implement overload resolution as per latest spec EDR
+ *          smoke test for combinator-like stuck analysis
  * @author  Maurizio Cimadamore
  * @compile TargetType51.java
  */
--- a/langtools/test/tools/javac/lambda/TargetType52.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/lambda/TargetType52.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1,6 +1,8 @@
 /*
  * @test /nodynamiccopyright/
- * @summary uncatched sam conversion failure exception lead to javac crash
+ * @bug 8005244
+ * @summary Implement overload resolution as per latest spec EDR
+ *          uncatched sam conversion failure exception lead to javac crash
  * @compile/fail/ref=TargetType52.out -XDrawDiagnostics TargetType52.java
  */
 class TargetType52 {
--- a/langtools/test/tools/javac/lambda/TargetType52.out	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/lambda/TargetType52.out	Thu Feb 21 17:43:57 2013 -0800
@@ -1,2 +1,2 @@
-TargetType52.java:15:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @444, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
+TargetType52.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @525, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType53.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,47 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          smoke test for graph inference
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType53.java
+ */
+import java.util.*;
+import java.util.stream.*;
+import java.util.function.*;
+
+class TargetType53 {
+
+    <P> List<List<P>> perm(List<P> l) { return null; }
+
+    void g(List<List<UnaryOperator<IntStream>>> l) { }
+
+    void test() {
+        List<List<UnaryOperator<IntStream>>> l =
+            perm(Arrays.asList(s -> s.sorted()));
+        g(perm(Arrays.asList(s -> s.sorted())));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType54.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,45 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          smoke test for graph inference
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType54.java
+ */
+import java.util.stream.*;
+import java.util.*;
+import static java.util.stream.Collectors.*;
+
+class TargetType54 {
+    void test(Stream<Integer> si) {
+        List<Integer> l1 = si.collect(toList());
+        List<Integer> l2 = si.collect(toCollection(ArrayList::new));
+        m(si.collect(toList()));
+        m(si.collect(toCollection(ArrayList::new)));
+    }
+
+    void m(List<Integer> l) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType55.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,42 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference
+ *          support smoke test for graph inference
+ * @compile TargetType55.java
+ */
+import java.util.function.*;
+
+class TargetType55  {
+
+    <R> void m(Function<Integer, R> collector) { }
+
+    <T, D> Function<T, Integer> g(D d, BinaryOperator<D> reducer) { return null; }
+
+    public void test() {
+        m(g((Integer)null, (x,y)->1));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType56.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,40 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          smoke test for graph inference
+ * @compile TargetType56.java
+ */
+class TargetType56 {
+    <Z> Z m(Z z) { return null; }
+
+    void test() {
+        double d1 = m(1);
+        double d2 = m((Integer)null);
+        double d3 = m(m(1));
+        double d4 = m(m((Integer)null));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType57.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8007464
+ * @summary Add graph inference support
+ *          more smoke tests for graph inference
+ * @compile/fail/ref=TargetType57.out -XDrawDiagnostics TargetType57.java
+ */
+import java.util.*;
+import java.util.function.*;
+
+class TargetType57 {
+
+    void test(List<Integer> list) {
+        m(list, s -> s.intValue(), s -> s.nonExistentMethod());
+    }
+
+    <U, R, S_IN, S_OUT> R m(List<S_IN> list,
+                        Function<S_IN, S_OUT> f1,
+                        Function<S_OUT, R> f2) { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType57.out	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,2 @@
+TargetType57.java:14:42: compiler.err.cant.resolve.location.args: kindname.method, nonExistentMethod, , , (compiler.misc.location.1: kindname.variable, s, java.lang.Integer)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType58.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 8007464
+ * @summary Add graph inference support
+ *          more smoke tests for graph inference
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType58.java
+ */
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+class TargetType58 {
+
+    void test(List<Integer> li) {
+        g(li, s -> s.substream(200), Collections.emptyList());
+    }
+
+    <T, U, S_OUT extends Stream<U>,
+            I extends Iterable<U>> Collection<U> g(Collection<T> coll, Function<Stream<T>, S_OUT> f, I i) {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType59.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8007464
+ * @summary Add graph inference support
+ *          more smoke tests for graph inference
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType59.java
+ */
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+class TargetType59 {
+
+    <T, R> Collector<T, R> m(Supplier<? extends R> supplier, BiConsumer<R, T> accumulator) {
+        return null;
+    }
+
+    <T, C extends Collection<T>> Collector<T,C> test1(Supplier<C> collectionFactory) {
+        return m(collectionFactory, Collection::add);
+    }
+
+    Collector<String, StringBuilder> test2(Supplier<StringBuilder> sb) {
+        return m(sb, StringBuilder::append);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType61.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,47 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          check that new wildcards inference strategy doesn't run into 7190296
+ * @compile TargetType61.java
+ */
+class TargetType61 {
+
+    interface Stream<T> {
+        void forEach(Sink<? super T> sink);
+    }
+
+    interface Sink<T> {
+        void put(T t);
+    }
+
+    public boolean add(CharSequence s) { return false; }
+
+    public void addAll(Stream<? extends CharSequence> stream) {
+        stream.forEach(this::add);
+        stream.forEach(e -> { add(e); });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/TargetType62.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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 8007464
+ * @summary Add graph inference support
+ *          check that new wildcards inference strategy doesn't run into 7190296
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType62.java
+ */
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+class TargetType61 {
+
+    Collector test(Function<Integer, Integer> classifier) {
+        return g(classifier, TreeMap::new, m(HashSet::new));
+    }
+
+    <R> Collector<Integer, R> m(Supplier<R> s) { return null; }
+
+    <T, K, D, M extends Map<K, D>>
+            Collector<T, M> g(Function<T, K> classifier, Supplier<M> mapFactory, Collector<T, D> downstream) { return null; }
+}
--- a/langtools/test/tools/javac/lib/DPrinter.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javac/lib/DPrinter.java	Thu Feb 21 17:43:57 2013 -0800
@@ -1006,6 +1006,7 @@
         public Void visitUndetVar(UndetVar type, Void ignore) {
             for (UndetVar.InferenceBound ib: UndetVar.InferenceBound.values())
                 printList("bounds." + ib, type.getBounds(ib));
+            printInt("declaredCount", type.declaredCount);
             printType("inst", type.inst, Details.SUMMARY);
             return visitDelegatedType(type);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/ElementRepAnnoTester.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,555 @@
+/*
+ * 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.annotation.Annotation;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.lang.model.type.MirroredTypeException;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+
+public class ElementRepAnnoTester extends JavacTestingAbstractProcessor {
+    // All methods to test.
+    final EnumSet<TestMethod> ALL_TEST_METHODS = EnumSet.allOf(TestMethod.class);
+    int count = 0;
+    int error = 0;
+
+    public boolean process(Set<? extends TypeElement> annotations,
+            RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            List<String> superClass = Arrays.asList("A", "B", "C", "D", "E",
+                    "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P");
+            // Go through all test classes
+            for (Element element : roundEnv.getRootElements()) {
+                // For now, no testing super classes (TODO)
+                if (element.getKind() == ElementKind.CLASS
+                        && !superClass.contains(element.getSimpleName().toString())) {
+                    // Compare expected and actual values from methods.
+                    checkAnnoValues(element, ALL_TEST_METHODS);
+                    // Now, look for enclosed elements in test classes.
+                    for (Element elements : element.getEnclosedElements()) {
+                        // Look for Methods annotations.
+                        if (elements.getKind() == ElementKind.METHOD
+                                && elements.getSimpleName().toString().equals("testMethod")) {
+                            checkAnnoValues(elements, ALL_TEST_METHODS);
+                        }
+                        // Look for Field annotations.
+                        if (elements.getKind() == ElementKind.FIELD
+                                && elements.getSimpleName().toString().equals("testField")) {
+                            checkAnnoValues(elements, ALL_TEST_METHODS);
+                        }
+                    }
+                }
+            }
+
+            if (error != 0) {
+                System.out.println("Total tests : " + count);
+                System.out.println("Total test failures : " + error);
+                throw new RuntimeException();
+            } else {
+                System.out.println("ALL TESTS PASSED. " + count);
+            }
+        }
+        return true;
+    }
+
+    enum TestMethod {
+        getAnnotation,
+        getAnnotationsByType,
+        getAllAnnotationMirrors,
+        getAnnotationMirrors
+    }
+
+    protected void checkAnnoValues(Element element, EnumSet<TestMethod> testMethods) {
+        boolean baseAnnoPresent = false;
+        boolean conAnnoPresent = false;
+        ExpectedBase eb = null;
+        ExpectedContainer ec = null;
+        // Getting the expected values to compare with.
+        eb = element.getAnnotation(ExpectedBase.class);
+        ec = element.getAnnotation(ExpectedContainer.class);
+
+        if (eb == null) {
+            System.out.println("Did not find ExpectedBase Annotation in  "
+                    + element.getSimpleName().toString() + ", Test will exit");
+            throw new RuntimeException();
+        }
+        if (ec == null) {
+            System.out.println("Did not find ExpectedContainer Annotation in "
+                    + element.getSimpleName().toString() + " Test will exit");
+            throw new RuntimeException();
+        }
+        // Look if all test cases have ExpectedBase and ExpectedContainer values().
+        TypeMirror valueBase = null;
+        TypeMirror valueCon = null;
+
+        try {
+            eb.value();
+        } catch (MirroredTypeException mte) {
+            valueBase = mte.getTypeMirror();
+        }
+
+        try {
+            ec.value();
+        } catch (MirroredTypeException mte1) {
+            valueCon = mte1.getTypeMirror();
+        }
+
+        String expectedBaseAnno = valueBase.toString();
+        String expectedConAnno = valueCon.toString();
+
+        if (!expectedBaseAnno.equals("java.lang.annotation.Annotation")) {
+            baseAnnoPresent = true;
+        }
+        if (!expectedConAnno.equalsIgnoreCase("java.lang.annotation.Annotation")) {
+            conAnnoPresent = true;
+        }
+
+        // Look into TestMethod and compare method's output with expected values.
+        for (TestMethod testMethod : testMethods) {
+            boolean isBasePass = true;
+            boolean isConPass = true;
+
+            switch (testMethod) {
+                case getAnnotation:
+                    if (baseAnnoPresent) {
+                        count++;
+                        Annotation actualAnno = getAnnotationBase(element);
+                        String expectedAnno = eb.getAnnotation();
+                        isBasePass = compareAnnotation(actualAnno, expectedAnno);
+                    }
+                    if (conAnnoPresent) {
+                        count++;
+                        Annotation actualAnno = getAnnotationContainer(element);
+                        String expectedAnno = ec.getAnnotation();
+                        isConPass = compareAnnotation(actualAnno, expectedAnno);
+                    }
+                    if (!isBasePass || !isConPass) {
+                        System.out.println("FAIL in " + element.getSimpleName()
+                                + "-" + element.getKind()
+                                + " method: getAnnotation(class <T>)");
+                        error++;
+                    }
+                    break;
+
+                case getAnnotationMirrors:
+                    if (baseAnnoPresent) {
+                        count++;
+                        List<? extends AnnotationMirror> actualDeclAnnos =
+                                element.getAnnotationMirrors();
+                        String[] expectedAnnos = eb.getAnnotationMirrors();
+                        isBasePass = compareArrVals(actualDeclAnnos, expectedAnnos);
+                    }
+                    if (conAnnoPresent) {
+                        isConPass = true;
+                    }
+                    if (!isBasePass || !isConPass) {
+                        System.out.println("FAIL in " + element.getSimpleName()
+                                + "-" + element.getKind()
+                                + " method: getAnnotationMirrors()");
+                        error++;
+                    }
+                    break;
+
+                case getAnnotationsByType:
+                    if (baseAnnoPresent) {
+                        count++;
+                        Annotation[] actualAnnosArgs = getAnnotationsBase(element);
+                        String[] expectedAnnos = eb.getAnnotationsByType();
+                        isBasePass = compareArrVals(actualAnnosArgs, expectedAnnos);
+                    }
+                    if (conAnnoPresent) {
+                        count++;
+                        Annotation[] actualAnnosArgs = getAnnotationsContainer(element);
+                        String[] expectedAnnos = ec.getAnnotationsByType();
+                        isConPass = compareArrVals(actualAnnosArgs, expectedAnnos);
+                    }
+                    if (!isBasePass || !isConPass) {
+                        System.out.println("FAIL in " + element.getSimpleName()
+                                + "-" + element.getKind()
+                                + " method: getAnnotationsByType(class <T>)");
+                        error++;
+                    }
+                    break;
+
+                case getAllAnnotationMirrors:
+                    if (baseAnnoPresent) {
+                        count++;
+                        Elements elements = processingEnv.getElementUtils();
+                        List<? extends AnnotationMirror> actualAnnosMirrors =
+                                elements.getAllAnnotationMirrors(element);
+                        String[] expectedAnnos = eb.getAllAnnotationMirrors();
+                        isBasePass = compareArrVals(actualAnnosMirrors, expectedAnnos);
+                    }
+                    if (conAnnoPresent) {
+                        isConPass = true;
+                    }
+                    if (!isBasePass || !isConPass) {
+                        System.out.println("FAIL in " + element.getSimpleName()
+                                + "-" + element.getKind()
+                                + " method: getAllAnnotationMirrors(e)");
+                        error++;
+                    }
+                    break;
+            }
+        }
+    }
+    // Sort tests to be run with different anno processors.
+    final List<String> singularAnno = Arrays.asList(
+            "SingularBasicTest"
+            );
+    final List<String> singularInheritedAnno = Arrays.asList(
+            "SingularInheritedATest"
+            );
+    final List<String> repeatableAnno = Arrays.asList(
+            "RepeatableBasicTest",
+            "MixRepeatableAndOfficialContainerBasicTest",
+            "OfficialContainerBasicTest",
+            "RepeatableOfficialContainerBasicTest"
+            );
+    final List<String> repeatableInheritedAnno = Arrays.asList(
+            "RepeatableInheritedTest",
+            "RepeatableOverrideATest",
+            "RepeatableOverrideBTest",
+            "OfficialContainerInheritedTest",
+            "MixRepeatableAndOfficialContainerInheritedA1Test",
+            "MixRepeatableAndOfficialContainerInheritedB1Test",
+            "MixRepeatableAndOfficialContainerInheritedA2Test",
+            "MixRepeatableAndOfficialContainerInheritedB2Test"
+            );
+    final List<String> repeatableContainerInheritedAnno = Arrays.asList(
+            "RepeatableOfficialContainerInheritedTest"
+            );
+    final List<String> unofficialAnno = Arrays.asList(
+            "UnofficialContainerBasicTest",
+            "MixSingularAndUnofficialContainerBasicTest"
+            );
+    final List<String> unofficialInheritedAnno = Arrays.asList(
+            "UnofficialContainerInheritedTest",
+            "SingularInheritedBTest",
+            "MixSingularAndUnofficialContainerInheritedA1Test",
+            "MixSingularAndUnofficialContainerInheritedB1Test",
+            "MixSingularAndUnofficialContainerInheritedA2Test",
+            "MixSingularAndUnofficialContainerInheritedB2Test"
+            );
+    // Respective container annotation for the different test cases to test.
+    final List<String> repeatableAnnoContainer = repeatableAnno;
+    final List<String> repeatableInheritedAnnoContainer = repeatableInheritedAnno;
+    final List<String> repeatableContainerInheritedAnnoContainer =
+            repeatableContainerInheritedAnno;
+    final List<String> unofficialAnnoContainer = unofficialAnno;
+    final List<String> unofficialInheritedAnnoContainer = unofficialInheritedAnno;
+
+    // Variables to verify if all test cases have been run.
+    private Annotation specialAnno = new Annotation() {
+       @Override
+        public Class annotationType() {
+            return null;
+        }
+    };
+    private Annotation[] specialAnnoArray = new Annotation[1];
+    private List<AnnotationMirror> specialAnnoMirrors =
+            new java.util.ArrayList<AnnotationMirror>(2);
+
+    private Annotation getAnnotationBase(Element e) {
+        Annotation actualAnno = specialAnno;
+
+        if (singularAnno.contains(
+                e.getEnclosingElement().toString())
+                || singularAnno.contains(
+                e.getSimpleName().toString())
+                || unofficialAnno.contains(
+                e.getEnclosingElement().toString())
+                || unofficialAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(Foo.class);
+        }
+        if (singularInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || singularInheritedAnno.contains(
+                e.getSimpleName().toString())
+                || unofficialInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || unofficialInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(FooInherited.class);
+        }
+        if (repeatableAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(Bar.class);
+        }
+        if (repeatableInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarInherited.class);
+        }
+        if (repeatableContainerInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableContainerInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarInheritedContainer.class);
+        }
+        return actualAnno;
+    }
+
+    private Annotation getAnnotationContainer(Element e) {
+        Annotation actualAnno = specialAnno;
+
+        if (repeatableAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarContainer.class);
+        }
+        if (repeatableInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarInheritedContainer.class);
+        }
+        if (repeatableContainerInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableContainerInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarInheritedContainerContainer.class);
+        }
+        if (unofficialAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || unofficialAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(UnofficialContainer.class);
+        }
+        if (unofficialInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || unofficialInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(UnofficialInheritedContainer.class);
+        }
+        return actualAnno;
+    }
+
+    private Annotation[] getAnnotationsBase(Element e) {
+        Annotation[] actualAnnosArgs = specialAnnoArray;
+
+        if (singularAnno.contains(
+                e.getEnclosingElement().toString())
+                || singularAnno.contains(
+                e.getSimpleName().toString())
+                || unofficialAnno.contains(
+                e.getEnclosingElement().toString())
+                || unofficialAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(Foo.class);
+        }
+        if (singularInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || singularInheritedAnno.contains(
+                e.getSimpleName().toString())
+                || unofficialInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || unofficialInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(FooInherited.class);
+        }
+        if (repeatableAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(Bar.class);
+        }
+        if (repeatableInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarInherited.class);
+        }
+        if (repeatableContainerInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableContainerInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainer.class);
+        }
+        return actualAnnosArgs;
+    }
+
+    private Annotation[] getAnnotationsContainer(Element e) {
+        Annotation[] actualAnnosArgs = specialAnnoArray;
+
+        if (repeatableAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarContainer.class);
+        }
+        if (repeatableInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainer.class);
+        }
+        if (repeatableContainerInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableContainerInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainerContainer.class);
+        }
+        if (unofficialAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || unofficialAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(UnofficialContainer.class);
+        }
+        if (unofficialInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || unofficialInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(UnofficialInheritedContainer.class);
+        }
+        return actualAnnosArgs;
+    }
+
+    // Array comparison: Length should be same and all expected values
+    // should be present in actualAnnos[].
+    private boolean compareArrVals(Annotation[] actualAnnos, String[] expectedAnnos) {
+        // Look if test case was run.
+        if (actualAnnos == specialAnnoArray) {
+            return false; // no testcase matches
+        }
+        if (actualAnnos.length != expectedAnnos.length) {
+            System.out.println("Length not same. "
+                    + " actualAnnos length = " + actualAnnos.length
+                    + " expectedAnnos length = " + expectedAnnos.length);
+            printArrContents(actualAnnos);
+            printArrContents(expectedAnnos);
+            return false;
+        } else {
+            int i = 0;
+            String[] actualArr = new String[actualAnnos.length];
+            for (Annotation a : actualAnnos) {
+                actualArr[i++] = a.toString();
+            }
+            List<String> actualList = Arrays.asList(actualArr);
+            List<String> expectedList = Arrays.asList(expectedAnnos);
+
+            if (!actualList.containsAll(expectedList)) {
+                System.out.println("Array values are not same");
+                printArrContents(actualAnnos);
+                printArrContents(expectedAnnos);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    // Array comparison: Length should be same and all expected values
+    // should be present in actualAnnos List<?>.
+    private boolean compareArrVals(List<? extends AnnotationMirror> actualAnnos,
+            String[] expectedAnnos) {
+        // Look if test case was run.
+        if (actualAnnos == specialAnnoMirrors) {
+            return false; //no testcase run
+        }
+        if (actualAnnos.size() != expectedAnnos.length) {
+            System.out.println("Length not same. "
+                    + " actualAnnos length = " + actualAnnos.size()
+                    + " expectedAnnos length = " + expectedAnnos.length);
+            printArrContents(actualAnnos);
+            printArrContents(expectedAnnos);
+            return false;
+        } else {
+            int i = 0;
+            String[] actualArr = new String[actualAnnos.size()];
+            String annoTypeName = "";
+            for (AnnotationMirror annotationMirror : actualAnnos) {
+                if (annotationMirror.getAnnotationType().toString().contains("Expected")) {
+                    annoTypeName = annotationMirror.getAnnotationType().toString();
+                } else {
+                     annoTypeName = annotationMirror.toString();
+                }
+                actualArr[i++] = annoTypeName;
+            }
+            List<String> actualList = Arrays.asList(actualArr);
+            List<String> expectedList = Arrays.asList(expectedAnnos);
+
+            if (!actualList.containsAll(expectedList)) {
+                System.out.println("Array values are not same");
+                printArrContents(actualAnnos);
+                printArrContents(expectedAnnos);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private void printArrContents(Annotation[] actualAnnos) {
+        for (Annotation a : actualAnnos) {
+            System.out.println("actualAnnos values = " + a);
+        }
+    }
+
+    private void printArrContents(String[] expectedAnnos) {
+        for (String s : expectedAnnos) {
+            System.out.println("expectedAnnos values =  " + s);
+        }
+    }
+
+    private void printArrContents(List<? extends AnnotationMirror> actualAnnos) {
+        for (AnnotationMirror annotationMirror : actualAnnos) {
+            System.out.println("actualAnnos values = " + annotationMirror);
+        }
+    }
+
+    private boolean compareAnnotation(Annotation actualAnno, String expectedAnno) {
+        //String actualAnnoName = "";
+        boolean isSame = true;
+        // Look if test case was run.
+        if (actualAnno == specialAnno) {
+            return false; //no testcase run
+        }
+        if (actualAnno != null) {
+            if (!actualAnno.toString().equalsIgnoreCase(expectedAnno)) {
+                System.out.println("Anno did not match. "
+                        + " expectedAnno = " + expectedAnno
+                        + " actualAnno = " + actualAnno);
+                isSame = false;
+            } else {
+                isSame = true;
+            }
+        } else {
+            if (expectedAnno.compareToIgnoreCase("null") == 0) {
+                isSame = true;
+            } else {
+                System.out.println("Actual anno is null");
+                isSame = false;
+            }
+        }
+        return isSame;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,119 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Bar.class,
+        getAnnotation = "@Bar(value=0)",
+        getAnnotationsByType = {
+            "@Bar(value=0)",
+            "@Bar(value=1)",
+            "@Bar(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@Bar(0)",
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@Bar(0)",
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarContainer.class,
+        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+@Bar(value = 0)
+@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+class MixRepeatableAndOfficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "@Bar(value=0)",
+            getAnnotationsByType = {
+                "@Bar(value=0)",
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@Bar(0)",
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Bar(0)",
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @Bar(value = 0)
+    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "@Bar(value=0)",
+            getAnnotationsByType = {
+                "@Bar(value=0)",
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@Bar(0)",
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Bar(0)",
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @Bar(value = 0)
+    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+    void testMethod() {}
+   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerInheritedA1Test.java
+ */
+
+@BarInherited(value = 0)
+class E {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=0)",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInherited(0)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+class MixRepeatableAndOfficialContainerInheritedA1Test extends E {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA2Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,67 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerInheritedA2Test.java
+ */
+
+@BarInherited(value = 0)
+class N {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=3)",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)",
+            "@BarInherited(value=3)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInherited(3)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInherited(3)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+@BarInherited(value = 3)
+class MixRepeatableAndOfficialContainerInheritedA2Test extends N {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerInheritedB1Test.java
+ */
+
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+class M {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=0)",
+        getAnnotationsByType = {"@BarInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@BarInherited(0)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInherited(value = 0)
+class MixRepeatableAndOfficialContainerInheritedB1Test extends M {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerInheritedB2Test.java
+ */
+
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+@BarInherited(value = 3)
+class H {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=0)",
+        getAnnotationsByType = {"@BarInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@BarInherited(0)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInherited(value = 0)
+class MixRepeatableAndOfficialContainerInheritedB2Test extends H {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerBasicTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,112 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only MixSingularAndUnofficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Foo.class,
+        getAnnotation = "@Foo(value=0)",
+        getAnnotationsByType = {"@Foo(value=0)"},
+        getAllAnnotationMirrors = {
+            "@Foo(0)",
+            "@UnofficialContainer({@Foo(1), @Foo(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@Foo(0)",
+            "@UnofficialContainer({@Foo(1), @Foo(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialContainer.class,
+        getAnnotation = "@UnofficialContainer("
+        + "value=[@Foo(value=1), @Foo(value=2)])",
+        getAnnotationsByType = {"@UnofficialContainer("
+                + "value=[@Foo(value=1), @Foo(value=2)])"})
+@Foo(value = 0)
+@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+class MixSingularAndUnofficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "@Foo(value=0)",
+            getAnnotationsByType = {"@Foo(value=0)"},
+            getAllAnnotationMirrors = {
+                "@Foo(0)",
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Foo(0)",
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = UnofficialContainer.class,
+            getAnnotation = "@UnofficialContainer("
+            + "value=[@Foo(value=1), @Foo(value=2)])",
+            getAnnotationsByType = {"@UnofficialContainer("
+                    + "value=[@Foo(value=1), @Foo(value=2)])"})
+    @Foo(value = 0)
+    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "@Foo(value=0)",
+            getAnnotationsByType = {"@Foo(value=0)"},
+            getAllAnnotationMirrors = {
+                "@Foo(0)",
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Foo(0)",
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = UnofficialContainer.class,
+            getAnnotation = "@UnofficialContainer("
+            + "value=[@Foo(value=1), @Foo(value=2)])",
+            getAnnotationsByType = {"@UnofficialContainer("
+                    + "value=[@Foo(value=1), @Foo(value=2)])"})
+    @Foo(value = 0)
+    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA1Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,61 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixSingularAndUnofficialContainerInheritedA1Test.java
+ */
+
+@FooInherited(value = 0)
+class L {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=0)",
+        getAnnotationsByType = {"@FooInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(0)",
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
+class MixSingularAndUnofficialContainerInheritedA1Test extends L {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA2Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixSingularAndUnofficialContainerInheritedA2Test.java
+ */
+
+@FooInherited(value = 0)
+class K {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=3)",
+        getAnnotationsByType = {"@FooInherited(value=3)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(3)",
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "@FooInherited(3)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
+@FooInherited(value = 3)
+class MixSingularAndUnofficialContainerInheritedA2Test extends K {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB1Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,61 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixSingularAndUnofficialContainerInheritedB1Test.java
+ */
+
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1),@FooInherited(value = 2)})
+class J {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=0)",
+        getAnnotationsByType = {"@FooInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(0)",
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@FooInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+@FooInherited(value = 0)
+class MixSingularAndUnofficialContainerInheritedB1Test extends J {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB2Test.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,62 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixSingularAndUnofficialContainerInheritedB2Test.java
+ */
+
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
+@FooInherited(value = 3)
+class G {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=0)",
+        getAnnotationsByType = {"@FooInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(0)",
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@FooInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+@FooInherited(value = 0)
+class MixSingularAndUnofficialContainerInheritedB2Test extends G{}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerBasicTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only OfficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Bar.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@Bar(value=1)",
+            "@Bar(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarContainer.class,
+        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+class OfficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerInheritedTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,60 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only OfficialContainerInheritedTest.java
+ */
+
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+class D {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+class OfficialContainerInheritedTest extends D {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,109 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Bar.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@Bar(value=1)",
+            "@Bar(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarContainer.class,
+        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+@Bar(value = 1)
+@Bar(value = 2)
+class RepeatableBasicTest {
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @Bar(value = 1)
+    @Bar(value = 2)
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @Bar(value = 1)
+    @Bar(value = 2)
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableInheritedTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,61 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableInheritedTest.java
+ */
+
+@BarInherited(value = 1)
+@BarInherited(value = 2)
+class I {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+class RepeatableInheritedTest extends I {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerBasicTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableOfficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Bar.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {},
+        getAllAnnotationMirrors = {
+            "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarContainer.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@BarContainer(value=[@Bar(value=1)])",
+            "@BarContainer(value=[@Bar(value=2)])"})
+@BarContainer(value = {@Bar(value = 1)})
+@BarContainer(value = {@Bar(value = 2)})
+class RepeatableOfficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {},
+            getAllAnnotationMirrors = {
+                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@BarContainer(value=[@Bar(value=1)])",
+                "@BarContainer(value=[@Bar(value=2)])"})
+    @BarContainer(value = {@Bar(value = 1)})
+    @BarContainer(value = {@Bar(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {},
+            getAllAnnotationMirrors = {
+                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@BarContainer(value=[@Bar(value=1)])",
+                "@BarContainer(value=[@Bar(value=2)])"})
+    @BarContainer(value = {@Bar(value = 1)})
+    @BarContainer(value = {@Bar(value = 2)})
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerInheritedTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,66 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * RepeatableOfficialContainerInheritedTest.java
+ */
+
+@BarInheritedContainer(value = {@BarInherited(value = 1)})
+@BarInheritedContainer(value = {@BarInherited(value = 2)})
+class O {}
+
+@ExpectedBase(
+        value = BarInheritedContainer.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@BarInheritedContainer(value=[@BarInherited(value=1)])",
+            "@BarInheritedContainer(value=[@BarInherited(value=2)])"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInheritedContainerContainer("
+                + "{@BarInheritedContainer({@BarInherited(1)}),"
+                + " @BarInheritedContainer({@BarInherited(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainerContainer.class,
+        getAnnotation = "@BarInheritedContainerContainer("
+        + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)]),"
+        + " @BarInheritedContainer(value=[@BarInherited(value=2)])])",
+        getAnnotationsByType = {"@BarInheritedContainerContainer("
+                + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)]),"
+        + " @BarInheritedContainer(value=[@BarInherited(value=2)])])"})
+class RepeatableOfficialContainerInheritedTest extends O {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideATest.java
+ */
+
+@BarInherited(value = 1)
+@BarInherited(value = 2)
+class B {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=3)",
+        getAnnotationsByType = {"@BarInherited(value=3)"},
+        getAllAnnotationMirrors = {
+            "@BarInherited(3)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInherited(3)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInherited(value = 3)
+class RepeatableOverrideATest extends B {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideBTest.java
+ */
+
+@BarInherited(value = 0)
+class C {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=0)",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInherited(0)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInherited(value = 1)
+@BarInherited(value = 2)
+class RepeatableOverrideBTest extends C {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/SingularBasicTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,89 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only SingularBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Foo.class,
+        getAnnotation = "@Foo(value=0)",
+        getAnnotationsByType = {"@Foo(value=0)"},
+        getAllAnnotationMirrors = {
+            "@Foo(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@Foo(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer
+@Foo(value = 0)
+public class SingularBasicTest {
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "@Foo(value=0)",
+            getAnnotationsByType = {"@Foo(value=0)"},
+            getAllAnnotationMirrors = {
+                "@Foo(0)",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Foo(0)",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer
+    @Foo(value = 0)
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "@Foo(value=0)",
+            getAnnotationsByType = {"@Foo(value=0)"},
+            getAllAnnotationMirrors = {
+                "@Foo(0)",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Foo(0)",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer
+    @Foo(value = 0)
+    void testMethod() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/SingularInheritedATest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,52 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only SingularInheritedATest.java
+ */
+
+@FooInherited(value = 0)
+class A {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=0)",
+        getAnnotationsByType = {"@FooInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer
+class SingularInheritedATest extends A {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/SingularInheritedBTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,57 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only SingularInheritedBTest.java
+ */
+
+@FooInherited(value = 1)
+class P {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=2)",
+        getAnnotationsByType = {"@FooInherited(value=2)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(2)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@FooInherited(2)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {})
+@FooInherited(value = 2)
+class SingularInheritedBTest extends P {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerBasicTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,97 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only UnofficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Foo.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {},
+        getAllAnnotationMirrors = {
+            "@UnofficialContainer({@Foo(1), @Foo(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@UnofficialContainer({@Foo(1), @Foo(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialContainer.class,
+        getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
+        getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+class UnofficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {},
+            getAllAnnotationMirrors = {
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = UnofficialContainer.class,
+            getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
+            getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {},
+            getAllAnnotationMirrors = {
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = UnofficialContainer.class,
+            getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
+            getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerInheritedTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,58 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * UnofficialContainerInheritedTest.java
+ */
+
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1),@FooInherited(value = 2)})
+class F {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {},
+        getAllAnnotationMirrors = {
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+class UnofficialContainerInheritedTest extends F {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/Bar.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+import java.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(BarContainer.class)
+public @interface Bar {
+    int value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarContainer.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+import java.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(BarContainerContainer.class)
+public @interface BarContainer {
+    Bar[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarContainerContainer.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+import java.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface BarContainerContainer {
+    BarContainer[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInherited.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,33 @@
+/*
+ * 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.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@Repeatable(BarInheritedContainer.class)
+public @interface BarInherited {
+    int value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInheritedContainer.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,33 @@
+/*
+ * 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.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@Repeatable(BarInheritedContainerContainer.class)
+public @interface BarInheritedContainer {
+    BarInherited[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInheritedContainerContainer.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+import java.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface BarInheritedContainerContainer {
+    BarInheritedContainer[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/ExpectedBase.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,36 @@
+/*
+ * 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.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectedBase {
+    Class<? extends Annotation> value() default Annotation.class;
+    String getAnnotation() default "";
+    String[] getAllAnnotationMirrors() default {};
+    String[] getAnnotationMirrors() default {};
+    // Java SE 8 methods.
+    String[] getAnnotationsByType() default {};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/ExpectedContainer.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,34 @@
+/*
+ * 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.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectedContainer {
+    Class<? extends Annotation> value() default Annotation.class;
+    String getAnnotation() default "";
+    // Java SE 8 methods.
+    String[] getAnnotationsByType() default {};
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/Foo.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Foo {
+    int value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/FooInherited.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+import java.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface FooInherited {
+    int value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/UnofficialContainer.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface UnofficialContainer {
+    Foo[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/UnofficialInheritedContainer.java	Thu Feb 21 17:43:57 2013 -0800
@@ -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.
+ */
+
+import java.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface UnofficialInheritedContainer {
+    FooInherited[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,115 @@
+/*
+ * 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 8007574
+ * @summary Test Elements.isFunctionalInterface
+ * @author  Joseph D. Darcy
+ * @library /tools/javac/lib
+ * @build   JavacTestingAbstractProcessor TestIsFunctionalInterface
+ * @compile -processor TestIsFunctionalInterface TestIsFunctionalInterface.java
+ */
+
+import java.util.Set;
+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 java.io.*;
+
+/**
+ * Test basic workings of Elements.isFunctionalInterface
+ */
+public class TestIsFunctionalInterface extends JavacTestingAbstractProcessor {
+    private int count = 0;
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            for(TypeElement type : typesIn(roundEnv.getElementsAnnotatedWith(ExpectedIsFunInt.class))) {
+                count++;
+                System.out.println(type);
+                if (elements.isFunctionalInterface(type) !=
+                    type.getAnnotation(ExpectedIsFunInt.class).value()) {
+                    messager.printMessage(ERROR,
+                                          "Mismatch between expected and computed isFunctionalInterface",
+                                          type);
+                }
+            }
+        } else {
+            if (count <= 0)
+                messager.printMessage(ERROR, "No types with ExpectedIsFunInt processed.");
+            }
+    return true;
+    }
+}
+
+@interface ExpectedIsFunInt {
+    boolean value();
+}
+
+// Examples below from the lambda specification documents.
+
+@ExpectedIsFunInt(false) // Equals is already an implicit member
+interface Foo1 { boolean equals(Object obj); }
+
+@ExpectedIsFunInt(true) // Bar has one abstract non-Object method
+interface Bar1 extends Foo1 { int compare(String o1, String o2); }
+
+
+@ExpectedIsFunInt(true) // Comparator has one abstract non-Object method
+interface LocalComparator<T> {
+ boolean equals(Object obj);
+ int compare(T o1, T o2);
+}
+
+@ExpectedIsFunInt(false) // Method Object.clone is not public
+interface Foo2 {
+  int m();
+  Object clone();
+}
+
+interface X1 { int m(Iterable<String> arg); }
+interface Y1 { int m(Iterable<String> arg); }
+@ExpectedIsFunInt(true) // Two methods, but they have the same signature
+interface Z1 extends X1, Y1 {}
+
+interface X2 { Iterable m(Iterable<String> arg); }
+interface Y2 { Iterable<String> m(Iterable arg); }
+@ExpectedIsFunInt(true) // Y.m is a subsignature & return-type-substitutable
+interface Z2 extends X2, Y2 {}
+
+interface Action<T> {
+    T doit();
+}
+@ExpectedIsFunInt(true)
+interface LocalExecutor { <T> T execute(Action<T> a); }
+
+interface X5 { <T> T execute(Action<T> a); }
+interface Y5 { <S> S execute(Action<S> a); }
+@ExpectedIsFunInt(true) // Functional: signatures are "the same"
+interface Exec5 extends X5, Y5 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/profiles/ProfileOptionTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8004182
+ * @summary Add support for profiles in javac
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.javac.jvm.Target;
+
+
+public class ProfileOptionTest {
+    public static void main(String... args) throws Exception {
+        new ProfileOptionTest().run();
+    }
+
+    private final JavaCompiler javac = JavacTool.create();
+    private final StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
+
+
+    // ---------- Test cases, invoked reflectively via run. ----------
+
+    @Test
+    void testInvalidProfile_CommandLine() throws Exception {
+        JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
+        String badName = "foo";
+        List<String> opts = Arrays.asList("-profile", badName);
+        StringWriter sw = new StringWriter();
+        try {
+            JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
+                Arrays.asList(fo));
+            throw new Exception("expected exception not thrown");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+    }
+
+    @Test
+    void testInvalidProfile_API() throws Exception {
+        String badName = "foo";
+        String[] opts = { "-profile", badName };
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(opts, pw);
+
+        // sadly, command line errors are not (yet?) reported to
+        // the diag listener
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out.trim());
+
+        if (!out.contains("invalid profile: " + badName)) {
+            error("expected message not found");
+        }
+    }
+
+    @Test
+    void testTargetProfileCombinations() throws Exception {
+        JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
+        for (Target t: Target.values()) {
+            switch (t) {
+                case JDK1_1: case JDK1_2: // no equivalent -source
+                case JDK1_4_1: case JDK1_4_2: case JSR14: // transitional values
+                    continue;
+            }
+
+            for (Profile p: Profile.values()) {
+                List<String> opts = new ArrayList<String>();
+                opts.addAll(Arrays.asList("-source", t.name, "-target", t.name));
+                opts.add("-Xlint:-options"); // dont warn about no -bootclasspath
+                if (p != Profile.DEFAULT)
+                    opts.addAll(Arrays.asList("-profile", p.name));
+                StringWriter sw = new StringWriter();
+                JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
+                        Arrays.asList(fo));
+                task.analyze();
+
+                // sadly, command line errors are not (yet?) reported to
+                // the diag listener
+                String out = sw.toString();
+                if (!out.isEmpty())
+                    System.err.println(out.trim());
+
+                switch (t) {
+                    case JDK1_8:
+                        if (!out.isEmpty())
+                            error("unexpected output from compiler");
+                        break;
+                    default:
+                        if (p != Profile.DEFAULT
+                                && !out.contains("profile " + p.name
+                                    + " is not valid for target release " + t.name)) {
+                            error("expected message not found");
+                        }
+                }
+            }
+        }
+    }
+
+    @Test
+    void testClassesInProfiles() throws Exception {
+        for (Profile p: Profile.values()) {
+            for (Map.Entry<Profile, List<JavaFileObject>> e: testClasses.entrySet()) {
+                for (JavaFileObject fo: e.getValue()) {
+                    DiagnosticCollector<JavaFileObject> dl =
+                            new DiagnosticCollector<JavaFileObject>();
+                    List<String> opts = (p == Profile.DEFAULT)
+                            ? Collections.<String>emptyList()
+                            : Arrays.asList("-profile", p.name);
+                    JavacTask task = (JavacTask) javac.getTask(null, fm, dl, opts, null,
+                            Arrays.asList(fo));
+                    task.analyze();
+
+                    List<String> expectDiagCodes = (p.value >= e.getKey().value)
+                            ? Collections.<String>emptyList()
+                            : Arrays.asList("compiler.err.not.in.profile");
+
+                    checkDiags(opts + " " + fo.getName(), dl.getDiagnostics(), expectDiagCodes);
+                }
+            }
+        }
+    }
+
+    Map<Profile, List<JavaFileObject>> testClasses =
+            new EnumMap<Profile, List<JavaFileObject>>(Profile.class);
+
+    void initTestClasses() {
+        // The following table assumes the existence of specific classes
+        // in specific profiles, as defined in the Java SE 8 spec.
+        init(Profile.COMPACT1,
+                java.lang.String.class);
+
+        init(Profile.COMPACT2,
+                javax.xml.XMLConstants.class);
+
+        init(Profile.COMPACT3,
+                javax.script.Bindings.class,
+                com.sun.security.auth.PolicyFile.class); // specifically included in 3
+
+        init(Profile.DEFAULT,
+                java.beans.BeanInfo.class,
+                javax.management.remote.rmi._RMIServer_Stub.class); // specifically excluded in 3
+    }
+
+    void init(Profile p, Class<?>... classes) {
+        List<JavaFileObject> srcs = new ArrayList<JavaFileObject>();
+        for (Class<?> c: classes) {
+            String name = "T" + c.getSimpleName();
+            String src =
+                    "class T" + name + "{" + "\n" +
+                    "    Class<?> c = " + c.getName() + ".class;\n" +
+                    "}";
+            srcs.add(new StringJavaFileObject(name + ".java", src));
+        }
+        testClasses.put(p, srcs);
+    }
+
+    void checkDiags(String msg, List<Diagnostic<? extends JavaFileObject>> diags, List<String> expectDiagCodes) {
+        System.err.print(msg);
+        if (diags.isEmpty())
+            System.err.println(" OK");
+        else {
+            System.err.println();
+            System.err.println(diags);
+        }
+
+        List<String> foundDiagCodes = new ArrayList<String>();
+        for (Diagnostic<? extends JavaFileObject> d: diags)
+            foundDiagCodes.add(d.getCode());
+
+        if (!foundDiagCodes.equals(expectDiagCodes)) {
+            System.err.println("Found diag codes:    " + foundDiagCodes);
+            System.err.println("Expected diag codes: " + expectDiagCodes);
+            error("expected diagnostics not found");
+        }
+    }
+
+    /** Marker annotation for test cases. */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Test { }
+
+    /** Run all test cases. */
+    void run() throws Exception {
+        initTestClasses();
+
+        for (Method m: getClass().getDeclaredMethods()) {
+            Annotation a = m.getAnnotation(Test.class);
+            if (a != null) {
+                System.err.println(m.getName());
+                try {
+                    m.invoke(this, new Object[] { });
+                } catch (InvocationTargetException e) {
+                    Throwable cause = e.getCause();
+                    throw (cause instanceof Exception) ? ((Exception) cause) : e;
+                }
+                System.err.println();
+            }
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+    private static class StringJavaFileObject extends SimpleJavaFileObject {
+        StringJavaFileObject(String name, String text) {
+            super(URI.create(name), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+        @Override
+        public CharSequence getCharContent(boolean b) {
+            return text;
+        }
+        private String text;
+    }
+}
--- a/langtools/test/tools/javadoc/doclint/DocLintTest.java	Thu Feb 21 15:46:37 2013 -0800
+++ b/langtools/test/tools/javadoc/doclint/DocLintTest.java	Thu Feb 21 17:43:57 2013 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8004834
+ * @bug 8004834 8007610
  * @summary Add doclint support into javadoc
  */
 
@@ -157,6 +157,10 @@
                 Main.Result.OK,
                 EnumSet.of(Message.DL_WRN12));
 
+        test(Arrays.asList(rawDiags, "-private"),
+                Main.Result.ERROR,
+                EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
+
         test(Arrays.asList(rawDiags, "-Xdoclint:syntax", "-private"),
                 Main.Result.ERROR,
                 EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javap/8006334/JavapTaskCtorFailWithNPE.java	Thu Feb 21 17:43:57 2013 -0800
@@ -0,0 +1,85 @@
+/*
+ * 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 8006334
+ * @summary javap: JavapTask constructor breaks with null pointer exception if
+ * parameter options is null
+ */
+
+import java.io.File;
+import java.util.Arrays;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.Locale;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import com.sun.tools.javap.JavapFileManager;
+import com.sun.tools.javap.JavapTask;
+
+public class JavapTaskCtorFailWithNPE {
+
+    //we will also check the output just to confirm that we get the expected one
+    private static final String expOutput =
+        "Compiled from \"JavapTaskCtorFailWithNPE.java\"\n" +
+        "public class JavapTaskCtorFailWithNPE {\n" +
+        "  public JavapTaskCtorFailWithNPE();\n" +
+        "  public static void main(java.lang.String[]);\n" +
+        "}\n";
+
+    public static void main(String[] args) {
+        new JavapTaskCtorFailWithNPE().run();
+    }
+
+    private void run() {
+        File classToCheck = new File(System.getProperty("test.classes"),
+            getClass().getSimpleName() + ".class");
+
+        DiagnosticCollector<JavaFileObject> dc =
+                new DiagnosticCollector<JavaFileObject>();
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        JavaFileManager fm = JavapFileManager.create(dc, pw);
+        JavapTask t = new JavapTask(pw, fm, dc, null,
+                Arrays.asList(classToCheck.getPath()));
+        boolean ok = t.run();
+        if (!ok)
+            throw new Error("javap failed unexpectedly");
+
+        List<Diagnostic<? extends JavaFileObject>> diags = dc.getDiagnostics();
+        for (Diagnostic<? extends JavaFileObject> d: diags) {
+            if (d.getKind() == Diagnostic.Kind.ERROR)
+                throw new AssertionError(d.getMessage(Locale.ENGLISH));
+        }
+        String lineSep = System.getProperty("line.separator");
+        String out = sw.toString().replace(lineSep, "\n");
+        if (!out.equals(expOutput)) {
+            throw new AssertionError("The output is not equal to the one expected");
+        }
+    }
+
+}
--- a/make/scripts/webrev.ksh	Thu Feb 21 15:46:37 2013 -0800
+++ b/make/scripts/webrev.ksh	Thu Feb 21 17:43:57 2013 -0800
@@ -19,7 +19,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
 # Use is subject to license terms.
 #
 # This script takes a file list and a workspace and builds a set of html files
@@ -27,7 +27,7 @@
 # Documentation is available via 'webrev -h'.
 #
 
-WEBREV_UPDATED=23.18-hg
+WEBREV_UPDATED=23.18-hg+jbs
 
 HTML='<?xml version="1.0"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -146,7 +146,7 @@
 #
 bug2url()
 {
-	sed -e 's|[0-9]\{5,\}|<a href=\"'$BUGURL'&\">&</a>|g'
+	sed -e 's|[0-9]\{5,\}|<a href=\"'$BUGURL$IDPREFIX'&\">&</a>|g'
 }
 
 #
@@ -230,8 +230,8 @@
 #   $ sdiff_to_html old/usr/src/tools/scripts/webrev.sh \
 #         new/usr/src/tools/scripts/webrev.sh \
 #         webrev.sh usr/src/tools/scripts \
-#         '<a href="http://monaco.sfbay.sun.com/detail.jsp?cr=1234567">
-#          1234567</a> my bugid' > <file>.html
+#         '<a href="https://jbs.oracle.com/bugs/browse/JDK-1234567">
+#          JDK-1234567</a> my bugid' > <file>.html
 #
 # framed_sdiff() is then called which creates $2.frames.html
 # in the webrev tree.
@@ -1160,7 +1160,7 @@
 	            print "$comm"
 	            return
 	        fi
-	  
+
 	        print "$comm" | html_quote | bug2url | sac2url
                 )
         fi
@@ -1418,7 +1418,7 @@
                   next;}
         END       {for (tree in trees)
                         { rev=revs[trees[tree]];
-                          if (rev > 0) 
+                          if (rev > 0)
                                 {printf("%s %d\n",trees[tree],rev-1)}
                         }}' | while read LINE
     do
@@ -1459,7 +1459,7 @@
 {
     TREE=$1
     HGCMD="hg -R $CWS/$TREE status $FSTAT_OPT"
-    
+
     $HGCMD -mdn 2>/dev/null | $FILTER | while read F
     do
         echo $TREE/$F
@@ -1543,7 +1543,7 @@
 			 if (n == 0)
 				{ printf("A %s/%s\n",tree,$2)}
 			 else
-				{ printf("A %s\n",$2)}; 
+				{ printf("A %s\n",$2)};
 			 next}
 	/^ /		{n=index($1,tree);
 			 if (n == 0)
@@ -1604,7 +1604,7 @@
 # We need at least one of default-push or default paths set in .hg/hgrc
 # If neither are set we don't know who to compare with.
 
-function flist_from_mercurial 
+function flist_from_mercurial
 {
 #	if [ "${PWS##ssh://}" != "$PWS" -o \
 #	     "${PWS##http://}" != "$PWS" -o \
@@ -1757,7 +1757,7 @@
 	elif [[ "$OS" == "Linux" ]]; then
 	    DEVTOOLS="/java/devtools/linux/bin"
 	fi
-	    
+
 	ppath=$PATH
 	ppath=$ppath:/usr/sfw/bin:/usr/bin:/usr/sbin
 	ppath=$ppath:/opt/teamware/bin:/opt/onbld/bin
@@ -1844,7 +1844,7 @@
 	ssh_host=`echo $CMD | sed -e 's/ssh:\/\/\([^/]*\)\/.*/\1/'`
 	ssh_dir=`echo $CMD | sed -e 's/ssh:\/\/[^/]*\/\(.*\)/\1/'`
     fi
-    
+
 }
 
 function build_old_new_mercurial
@@ -2096,7 +2096,7 @@
 		PARENT_REV=$OPTARG;;
 
 	v)	print "$0 version: $WEBREV_UPDATED";;
-		
+
 
 	?)	usage;;
 	esac
@@ -2338,7 +2338,7 @@
 	#
 	[[ -z $codemgr_ws && -n $CODEMGR_WS ]] && codemgr_ws=$CODEMGR_WS
 	[[ -z $codemgr_ws && -n $WSPACE ]] && codemgr_ws=`$WSPACE name`
-	    
+
 	if [[ -n $codemgr_ws && ! -d $codemgr_ws ]]; then
 		print -u2 "$codemgr_ws: no such workspace"
 		exit 1
@@ -2521,10 +2521,16 @@
 #    Bug IDs will be replaced by a URL.  Order of precedence
 #    is: default location, $WEBREV_BUGURL, the -O flag.
 #
-BUGURL='http://monaco.sfbay.sun.com/detail.jsp?cr='
+BUGURL='https://jbs.oracle.com/bugs/browse/'
 [[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL"
-[[ -n "$Oflag" ]] && \
+if [[ -n "$Oflag" ]]; then
+    CRID=`echo $CRID | sed -e 's/JDK-//'`
     BUGURL='http://bugs.sun.com/bugdatabase/view_bug.do?bug_id='
+    IDPREFIX=''
+else
+    IDPREFIX='JDK-'
+fi
+
 
 #
 #    Likewise, ARC cases will be replaced by a URL.  Order of precedence
@@ -2561,7 +2567,7 @@
 
 #
 # Should we ignore changes in white spaces when generating diffs?
-# 
+#
 if [[ -n $bflag ]]; then
     DIFFOPTS="-t"
 else
@@ -2748,7 +2754,7 @@
 		fi
 	    fi
 	else
-	    
+
 	    #
 	    # If we have old and new versions of the file then run the
 	    # appropriate diffs.  This is complicated by a couple of factors:
@@ -3000,22 +3006,31 @@
 # external URL has a <title> like:
 # <title>Bug ID: 6641309 Wrong Cookie separator used in HttpURLConnection</title>
 # while internal URL has <title> like:
-# <title>6641309: Wrong Cookie separator used in HttpURLConnection</title>
+# <title>[#JDK-6641309] Wrong Cookie separator used in HttpURLConnection</title>
 #
 if [[ -n $CRID ]]; then
     for id in $CRID
     do
+        if [[ -z "$Oflag" ]]; then
+            #add "JDK-" to raw bug id for jbs links.
+            id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'`
+        fi
         print "<tr><th>Bug id:</th><td>"
         url="${BUGURL}${id}"
-        if [[ -n $WGET ]]; then
-            msg=`$WGET -q $url -O - | grep '<title>' | sed 's/<title>\(.*\)<\/title>/\1/' | sed 's/Bug ID://'`
+        if [[ -n "$Oflag" ]]; then
+            cleanup='s/Bug ID: \([0-9]\{5,\}\) \(.*\)/JDK-\1 : \2/'
+        else
+            cleanup='s|\[#\(JDK-[0-9]\{5,\}\)\] \(.*\)|\1 : \2|'
         fi
-        if [[ -n $msg ]]; then
-            print "<a href=\"$url\">$msg</a>"
-        else
-            print $id | bug2url
+        if [[ -n $WGET ]]; then
+            msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '<title>' | sed 's/<title>\(.*\)<\/title>/\1/' | sed "$cleanup"`
         fi
-        
+        if [[ -z $msg ]]; then
+            msg="${id}"
+        fi
+
+        print "<a href=\"$url\">$msg</a>"
+
         print "</td></tr>"
     done
 fi
@@ -3179,4 +3194,3 @@
 
 print "Done."
 print "Output to: $WDIR"
-
--- a/test/Makefile	Thu Feb 21 15:46:37 2013 -0800
+++ b/test/Makefile	Thu Feb 21 17:43:57 2013 -0800
@@ -38,8 +38,8 @@
 define SUBDIR_TEST # subdirectory target
 if [ -d $1 ] ; then \
   if [ -r $1/test/Makefile ] ; then \
-    echo "$(MAKE) -C $1/test $2" ; \
-    $(MAKE) -C $1/test $2 ; \
+    echo "$(MAKE) -k -C $1/test $2" ; \
+    $(MAKE) -k -C $1/test $2 ; \
   else \
     echo "ERROR: File does not exist: $1/test/Makefile"; \
     exit 1; \
@@ -53,7 +53,7 @@
 LANGTOOLS_TEST_LIST = langtools_jtreg
 
 # Test target list for jdk repository
-JDK_DEFAULT_TEST_LIST = \
+JDK_ALL_TEST_LIST = \
 	jdk_beans1 \
 	jdk_io  \
 	jdk_lang  \
@@ -64,10 +64,7 @@
 	jdk_security1 \
 	jdk_text  \
 	jdk_util  \
-	jdk_time
-
-# These tests are not part of the default testing list
-JDK_NONDEFAULT_TEST_LIST = \
+	jdk_time \
 	jdk_awt \
 	jdk_beans2 jdk_beans3  \
 	jdk_management \
@@ -80,14 +77,14 @@
 	jdk_jdi \
 	jdk_jfr
 
-# All jdk tests
-JDK_ALL_TEST_LIST = $(JDK_DEFAULT_TEST_LIST) $(JDK_NONDEFAULT_TEST_LIST)
+# Theses are meta test targets in jdk
+JDK_META_TEST_LIST = jdk_all jdk_default jdk_core
 
 # These are the current jck test targets in the jdk repository
 JDK_JCK7_LIST = jck7devtools jck7compiler jck7runtime
 
-# Default test target (everything)
-default: $(JDK_DEFAULT_TEST_LIST) $(LANGTOOLS_TEST_LIST)
+# Default test target (core)
+default: jdk_core $(LANGTOOLS_TEST_LIST)
 
 # All testing
 all: $(JDK_ALL_TEST_LIST) $(LANGTOOLS_TEST_LIST)
@@ -95,7 +92,8 @@
 # Test targets
 $(LANGTOOLS_TEST_LIST):
 	@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), $(subst langtools_,,$@))
-$(JDK_ALL_TEST_LIST) $(JDK_JCK7_LIST):
+
+$(JDK_ALL_TEST_LIST) $(JDK_META_TEST_LIST) $(JDK_JCK7_LIST):
 	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), $@)
 
 clean:
@@ -104,7 +102,7 @@
 
 # Phony targets (e.g. these are not filenames)
 .PHONY: all clean \
-        $(JDK_ALL_TEST_LIST) $(JDK_JCK7_LIST) \
+        $(JDK_ALL_TEST_LIST) $(JDK_META_TEST_LIST) $(JDK_JCK7_LIST) \
         $(LANGTOOLS_TEST_LIST)
 
 ################################################################