Merge
authormullan
Fri, 11 Oct 2013 09:17:18 -0400
changeset 20775 a7cd22051d8f
parent 20774 330ea6efa3fd (current diff)
parent 20773 65f064b13df0 (diff)
child 20776 6c440a257019
child 20777 ad30bd042ffd
Merge
hotspot/test/testlibrary/AssertsTest.java
hotspot/test/testlibrary/OutputAnalyzerReportingTest.java
hotspot/test/testlibrary/OutputAnalyzerTest.java
jdk/makefiles/Tools.gmk
jdk/src/macosx/classes/sun/lwawt/SelectionClearListener.java
jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java
jdk/src/share/classes/com/sun/jdi/connect/package.html
jdk/src/share/classes/com/sun/jdi/connect/spi/package.html
jdk/src/share/classes/com/sun/jdi/event/package.html
jdk/src/share/classes/com/sun/jdi/package.html
jdk/src/share/classes/com/sun/jdi/request/package.html
jdk/src/share/classes/com/sun/management/package.html
jdk/src/share/classes/com/sun/tools/attach/package.html
jdk/src/share/classes/com/sun/tools/attach/spi/package.html
jdk/src/share/classes/com/sun/tools/jconsole/package.html
jdk/src/share/classes/java/lang/invoke/InvokeGeneric.java
jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java
jdk/test/com/oracle/security/ucrypto/TestAES.java
jdk/test/com/oracle/security/ucrypto/TestDigest.java
jdk/test/com/oracle/security/ucrypto/TestRSA.java
jdk/test/com/oracle/security/ucrypto/UcryptoTest.java
jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh
jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/lib/solaris-i586/libLauncher.so
jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/lib/solaris-sparc/libLauncher.so
jdk/test/java/time/tck/java/time/chrono/TCKChronologySerialization.java
--- a/.hgtags	Fri Oct 11 08:43:07 2013 -0400
+++ b/.hgtags	Fri Oct 11 09:17:18 2013 -0400
@@ -230,3 +230,5 @@
 514b0b69fb9683ef52062fd962a3e0644431f64d jdk8-b106
 892889f445755790ae90e61775bfb59ddc6182b5 jdk8-b107
 74049f7a28b48c14910106a75d9f2504169c352e jdk8-b108
+af9a674e12a16da1a4bd53e4990ddb1121a21ef1 jdk8-b109
+b5d2bf482a3ea1cca08c994512804ffbc73de0a1 jdk8-b110
--- a/.hgtags-top-repo	Fri Oct 11 08:43:07 2013 -0400
+++ b/.hgtags-top-repo	Fri Oct 11 09:17:18 2013 -0400
@@ -230,3 +230,5 @@
 8e7b4d9fb00fdf1334376aeac050c9bca6d1b383 jdk8-b106
 0874bb4707b723d5bb108d379c557cf41529d1a7 jdk8-b107
 9286a6e61291246d88af713f1ef79adeea30fe2e jdk8-b108
+91f47e8da5c60de58ed195e9b57f3bf192a18f83 jdk8-b109
+4faa09c7fe555de086dd9048d3c5cc92317d6f45 jdk8-b110
--- a/NewMakefile.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/NewMakefile.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -66,7 +66,7 @@
     else
         # We are building multiple configurations.
         # First, find out the valid targets
-        # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
+        # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
         # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
         all_phony_targets=$(filter-out $(global_targets) bundles-only, $(strip $(shell \
             $(MAKE) -p -q -f common/makefiles/Main.gmk FRC SPEC=$(firstword $(SPEC)) | \
--- a/common/autoconf/generated-configure.sh	Fri Oct 11 08:43:07 2013 -0400
+++ b/common/autoconf/generated-configure.sh	Fri Oct 11 09:17:18 2013 -0400
@@ -1016,8 +1016,8 @@
 enable_unlimited_crypto
 with_milestone
 with_update_version
+with_user_release_suffix
 with_build_number
-with_user_release_suffix
 with_boot_jdk
 with_boot_jdk_jvmargs
 with_add_source_root
@@ -1755,10 +1755,10 @@
   --with-cacerts-file     specify alternative cacerts file
   --with-milestone        Set milestone value for build [internal]
   --with-update-version   Set update version value for build [b00]
-  --with-build-number     Set build number value for build [b00]
   --with-user-release-suffix
                           Add a custom string to the version string if build
                           number isn't set.[username_builddateb00]
+  --with-build-number     Set build number value for build [b00]
   --with-boot-jdk         path to Boot JDK (used to bootstrap build) [probed]
   --with-boot-jdk-jvmargs specify JVM arguments to be passed to all
                           invocations of the Boot JDK, overriding the default
@@ -3818,7 +3818,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1379504921
+DATE_WHEN_GENERATED=1381162713
 
 ###############################################################################
 #
@@ -10935,7 +10935,7 @@
 
 if test "x$SUPPORT_HEADFUL" = xyes; then
     # We are building both headful and headless.
-    headful_msg="inlude support for both headful and headless"
+    headful_msg="include support for both headful and headless"
 fi
 
 if test "x$SUPPORT_HEADFUL" = xno; then
@@ -11048,6 +11048,18 @@
 fi
 
 
+# Check whether --with-user-release-suffix was given.
+if test "${with_user_release_suffix+set}" = set; then :
+  withval=$with_user_release_suffix;
+fi
+
+if test "x$with_user_release_suffix" = xyes; then
+  as_fn_error $? "Release suffix must have a value" "$LINENO" 5
+elif test "x$with_user_release_suffix" != x; then
+  USER_RELEASE_SUFFIX="$with_user_release_suffix"
+fi
+
+
 # Check whether --with-build-number was given.
 if test "${with_build_number+set}" = set; then :
   withval=$with_build_number;
@@ -11058,27 +11070,16 @@
 elif test "x$with_build_number" != x; then
   JDK_BUILD_NUMBER="$with_build_number"
 fi
+# Define default USER_RELEASE_SUFFIX if BUILD_NUMBER and USER_RELEASE_SUFFIX are not set
 if test "x$JDK_BUILD_NUMBER" = x; then
   JDK_BUILD_NUMBER=b00
-fi
-
-
-# Check whether --with-user-release-suffix was given.
-if test "${with_user_release_suffix+set}" = set; then :
-  withval=$with_user_release_suffix;
-fi
-
-if test "x$with_user_release_suffix" = xyes; then
-  as_fn_error $? "Release suffix must have a value" "$LINENO" 5
-elif test "x$with_user_release_suffix" != x; then
-  USER_RELEASE_SUFFIX="$with_user_release_suffix"
-else
-  BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
-  # Avoid [:alnum:] since it depends on the locale.
-  CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'`
-  USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-fi
-
+  if test "x$USER_RELEASE_SUFFIX" = x; then
+    BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
+    # Avoid [:alnum:] since it depends on the locale.
+    CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'`
+    USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+fi
 
 # Now set the JDK version, milestone, build number etc.
 
@@ -11095,6 +11096,7 @@
 
 
 
+
 COPYRIGHT_YEAR=`date +'%Y'`
 
 
--- a/common/autoconf/jdk-options.m4	Fri Oct 11 08:43:07 2013 -0400
+++ b/common/autoconf/jdk-options.m4	Fri Oct 11 09:17:18 2013 -0400
@@ -316,7 +316,7 @@
 
 if test "x$SUPPORT_HEADFUL" = xyes; then
     # We are building both headful and headless.
-    headful_msg="inlude support for both headful and headless"
+    headful_msg="include support for both headful and headless"
 fi
 
 if test "x$SUPPORT_HEADFUL" = xno; then
@@ -426,6 +426,14 @@
   JDK_UPDATE_VERSION="$with_update_version"
 fi
 
+AC_ARG_WITH(user-release-suffix, [AS_HELP_STRING([--with-user-release-suffix], 
+        [Add a custom string to the version string if build number isn't set.@<:@username_builddateb00@:>@])])
+if test "x$with_user_release_suffix" = xyes; then
+  AC_MSG_ERROR([Release suffix must have a value])
+elif test "x$with_user_release_suffix" != x; then
+  USER_RELEASE_SUFFIX="$with_user_release_suffix"
+fi
+
 AC_ARG_WITH(build-number, [AS_HELP_STRING([--with-build-number], 
                           [Set build number value for build @<:@b00@:>@])])
 if test "x$with_build_number" = xyes; then
@@ -433,25 +441,19 @@
 elif test "x$with_build_number" != x; then
   JDK_BUILD_NUMBER="$with_build_number"
 fi
+# Define default USER_RELEASE_SUFFIX if BUILD_NUMBER and USER_RELEASE_SUFFIX are not set
 if test "x$JDK_BUILD_NUMBER" = x; then
   JDK_BUILD_NUMBER=b00
+  if test "x$USER_RELEASE_SUFFIX" = x; then
+    BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
+    # Avoid [:alnum:] since it depends on the locale.
+    CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'`
+    USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
 fi
 
-AC_ARG_WITH(user-release-suffix, [AS_HELP_STRING([--with-user-release-suffix], 
-        [Add a custom string to the version string if build number isn't set.@<:@username_builddateb00@:>@])])
-if test "x$with_user_release_suffix" = xyes; then
-  AC_MSG_ERROR([Release suffix must have a value])
-elif test "x$with_user_release_suffix" != x; then
-  USER_RELEASE_SUFFIX="$with_user_release_suffix"
-else
-  BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
-  # Avoid [:alnum:] since it depends on the locale.
-  CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'`
-  USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-fi
+# Now set the JDK version, milestone, build number etc.
 AC_SUBST(USER_RELEASE_SUFFIX)
-
-# Now set the JDK version, milestone, build number etc.
 AC_SUBST(JDK_MAJOR_VERSION)
 AC_SUBST(JDK_MINOR_VERSION)
 AC_SUBST(JDK_MICRO_VERSION)
--- a/common/autoconf/spec.gmk.in	Fri Oct 11 08:43:07 2013 -0400
+++ b/common/autoconf/spec.gmk.in	Fri Oct 11 09:17:18 2013 -0400
@@ -161,6 +161,7 @@
 COMPANY_NAME:=@COMPANY_NAME@
 MACOSX_BUNDLE_NAME_BASE=@MACOSX_BUNDLE_NAME_BASE@
 MACOSX_BUNDLE_ID_BASE=@MACOSX_BUNDLE_ID_BASE@
+USER_RELEASE_SUFFIX=@USER_RELEASE_SUFFIX@
 
 # Different version strings generated from the above information.
 JDK_VERSION:=@JDK_VERSION@
@@ -173,8 +174,8 @@
 else
   RELEASE=$(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
 endif
-ifeq ($(JDK_BUILD_NUMBER),b00)
-  USER_RELEASE_SUFFIX=@USER_RELEASE_SUFFIX@
+
+ifneq ($(USER_RELEASE_SUFFIX),)
   FULL_VERSION=$(RELEASE)-$(USER_RELEASE_SUFFIX)-$(JDK_BUILD_NUMBER)
 else
   FULL_VERSION=$(RELEASE)-$(JDK_BUILD_NUMBER)
--- a/common/bin/compare.sh	Fri Oct 11 08:43:07 2013 -0400
+++ b/common/bin/compare.sh	Fri Oct 11 09:17:18 2013 -0400
@@ -76,13 +76,13 @@
     TMP=1
 
     if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
-        TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \
+        TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
             $GREP '^[<>]' | \
             $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
 	         -e '/[<>] Created-By: .* (Oracle Corporation).*/d')
     fi
     if test "x$SUFFIX" = "xjava"; then
-        TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \
+        TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
             $GREP '^[<>]' | \
             $SED -e '/[<>] \* from.*\.idl/d' \
                  -e '/[<>] \*.*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
@@ -121,8 +121,8 @@
 #  	    | $SED -e '/^#/d' -e '/^$/d' \
 #            -e :a -e '/\\$/N; s/\\\n//; ta' \
 #  	    -e 's/^[ \t]*//;s/[ \t]*$//' \
-#	    -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned
-        TMP=$(LANG=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
+#	    -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
+        TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
     fi
     if test -n "$TMP"; then
         echo Files $OTHER_FILE and $THIS_FILE differ
@@ -410,11 +410,11 @@
     CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
     # On solaris, there is no -q option.
     if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
-        LANG=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
+        LC_ALL=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
             | $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \
             > $CONTENTS_DIFF_FILE
     else
-        LANG=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
+        LC_ALL=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
     fi
 
     ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
@@ -459,11 +459,11 @@
         if [ -n "$SHOW_DIFFS" ]; then
             for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
                 if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
-                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
+                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
                 elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
-                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
+                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
                 else
-                    LANG=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
+                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
                 fi
             done
         fi
@@ -703,7 +703,7 @@
 	$NM -a $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
     fi
     
-    LANG=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
+    LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
     if [ -s $WORK_FILE_BASE.symbols.diff ]; then
         SYM_MSG=" diff  "
         if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
@@ -732,8 +732,8 @@
 	(cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2</dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
 	(cd $FILE_WORK_DIR && $RM -f $NAME)
 	
-	LANG=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
-	LANG=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
+	LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
+	LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
 	
 	if [ -s $WORK_FILE_BASE.deps.diff ]; then
             if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
@@ -768,7 +768,7 @@
     if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then
         $FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1
         $FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1
-        LANG=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff
+        LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff
         
         if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
             ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}')
@@ -802,7 +802,7 @@
         $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1
         $DIS_CMD $THIS_FILE  | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this  2>&1
         
-        LANG=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
+        LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
         
         if [ -s $WORK_FILE_BASE.dis.diff ]; then
             DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
--- a/common/makefiles/JavaCompilation.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/common/makefiles/JavaCompilation.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -159,7 +159,7 @@
         endif
     endif
 
-    # Utility macros, to make the shell script receipt somewhat easier to dechipher.
+    # Utility macros, to make the shell script receipt somewhat easier to decipher.
 
     # The capture contents macro finds all files (matching the patterns, typically
     # .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.
@@ -520,7 +520,7 @@
         # Using plain javac to batch compile everything.
         $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch
 
-        # When buliding in batch, put headers in a temp dir to filter out those that actually
+        # When building in batch, put headers in a temp dir to filter out those that actually
         # changed before copying them to the real header dir.
         ifneq (,$$($1_HEADERS))
             $1_HEADERS_ARG := -h $$($1_HEADERS).tmp
--- a/common/makefiles/Jprt.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/common/makefiles/Jprt.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -200,13 +200,8 @@
 	$(RM) $@
 	$(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@
 
-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
-  SRC_JDK_IMAGE_DIR := $(JDK_OVERLAY_IMAGE_DIR)
-  SRC_JRE_IMAGE_DIR := $(JRE_OVERLAY_IMAGE_DIR)
-else
-  SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
-  SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
-endif
+SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
+SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
 SRC_JDK_BUNDLE_DIR := $(JDK_BUNDLE_DIR)
 SRC_JRE_BUNDLE_DIR := $(JRE_BUNDLE_DIR)
 
@@ -215,10 +210,10 @@
 bundles-only: start-make
 	@$(call TargetEnter)
 	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
-	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
-	$(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
+	$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
+	$(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
 	if [ -d  $(BUILD_OUTPUT)/install/bundles ] ; then \
-           $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
+           $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
         fi
 	@$(call TargetExit)
 
--- a/common/makefiles/Main.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/common/makefiles/Main.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -68,10 +68,6 @@
 all: images docs
 	@$(call CheckIfMakeAtEnd)
 
-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
-  all: overlay-images
-endif
-
 # Setup a rule for SPEC file that fails if executed. This check makes sure the configuration
 # is up to date after changes to configure
 $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
--- a/corba/.hgtags	Fri Oct 11 08:43:07 2013 -0400
+++ b/corba/.hgtags	Fri Oct 11 09:17:18 2013 -0400
@@ -230,3 +230,5 @@
 2e3a056c84a71eba78945c18b05397858ffd7ad0 jdk8-b106
 23fc34133152692b725db4bd617b4c8dfd6ccb05 jdk8-b107
 a4bb3b4500164748a9c33b2283cfda76d89f25ab jdk8-b108
+428428cf5e06163322144cfb5367e1faa86acf20 jdk8-b109
+3d2b7ce93c5c2e3db748f29c3d29620a8b3b748a jdk8-b110
--- a/hotspot/.hgtags	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/.hgtags	Fri Oct 11 09:17:18 2013 -0400
@@ -379,3 +379,7 @@
 a09fe9d1e016c285307507a5793bc4fa6215e9c9 hs25-b50
 85072013aad46050a362d10ab78e963121c8014c jdk8-b108
 566db1b0e6efca31f181456e54c8911d0192410d hs25-b51
+c81dd5393a5e333df7cb1f6621f5897ada6522b5 jdk8-b109
+58043478c26d4e8bf48700acea5f97aba8b417d4 hs25-b52
+6209b0ed51c086d4127bac0e086c8f326d1764d7 jdk8-b110
+562a3d356de67670b4172b82aca2d30743449e04 hs25-b53
--- a/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/agent/src/os/linux/LinuxDebuggerLocal.c	Fri Oct 11 09:17:18 2013 -0400
@@ -29,6 +29,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdlib.h>
 #include <string.h>
 #include <limits.h>
 
@@ -80,7 +81,7 @@
   (JNIEnv *env, jclass cls) {
   jclass listClass;
 
-  if (init_libproc(getenv("LIBSAPROC_DEBUG")) != true) {
+  if (init_libproc(getenv("LIBSAPROC_DEBUG") != NULL) != true) {
      THROW_NEW_DEBUGGER_EXCEPTION("can't initialize libproc");
   }
 
--- a/hotspot/agent/src/os/linux/ps_core.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/agent/src/os/linux/ps_core.c	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -698,29 +698,58 @@
 
 // read segments of a shared object
 static bool read_lib_segments(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* lib_ehdr, uintptr_t lib_base) {
-   int i = 0;
-   ELF_PHDR* phbuf;
-   ELF_PHDR* lib_php = NULL;
+  int i = 0;
+  ELF_PHDR* phbuf;
+  ELF_PHDR* lib_php = NULL;
+
+  int page_size=sysconf(_SC_PAGE_SIZE);
 
-   if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL)
-      return false;
+  if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) {
+    return false;
+  }
+
+  // we want to process only PT_LOAD segments that are not writable.
+  // i.e., text segments. The read/write/exec (data) segments would
+  // have been already added from core file segments.
+  for (lib_php = phbuf, i = 0; i < lib_ehdr->e_phnum; i++) {
+    if ((lib_php->p_type == PT_LOAD) && !(lib_php->p_flags & PF_W) && (lib_php->p_filesz != 0)) {
+
+      uintptr_t target_vaddr = lib_php->p_vaddr + lib_base;
+      map_info *existing_map = core_lookup(ph, target_vaddr);
 
-   // we want to process only PT_LOAD segments that are not writable.
-   // i.e., text segments. The read/write/exec (data) segments would
-   // have been already added from core file segments.
-   for (lib_php = phbuf, i = 0; i < lib_ehdr->e_phnum; i++) {
-      if ((lib_php->p_type == PT_LOAD) && !(lib_php->p_flags & PF_W) && (lib_php->p_filesz != 0)) {
-         if (add_map_info(ph, lib_fd, lib_php->p_offset, lib_php->p_vaddr + lib_base, lib_php->p_filesz) == NULL)
-            goto err;
+      if (existing_map == NULL){
+        if (add_map_info(ph, lib_fd, lib_php->p_offset,
+                          target_vaddr, lib_php->p_filesz) == NULL) {
+          goto err;
+        }
+      } else {
+        if ((existing_map->memsz != page_size) &&
+            (existing_map->fd != lib_fd) &&
+            (existing_map->memsz != lib_php->p_filesz)){
+
+          print_debug("address conflict @ 0x%lx (size = %ld, flags = %d\n)",
+                        target_vaddr, lib_php->p_filesz, lib_php->p_flags);
+          goto err;
+        }
+
+        /* replace PT_LOAD segment with library segment */
+        print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n",
+                     existing_map->memsz, lib_php->p_filesz);
+
+        existing_map->fd = lib_fd;
+        existing_map->offset = lib_php->p_offset;
+        existing_map->memsz = lib_php->p_filesz;
       }
-      lib_php++;
-   }
+    }
+
+    lib_php++;
+  }
 
-   free(phbuf);
-   return true;
+  free(phbuf);
+  return true;
 err:
-   free(phbuf);
-   return false;
+  free(phbuf);
+  return false;
 }
 
 // process segments from interpreter (ld.so or ld-linux.so)
--- a/hotspot/agent/src/os/linux/ps_proc.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/agent/src/os/linux/ps_proc.c	Fri Oct 11 09:17:18 2013 -0400
@@ -27,6 +27,8 @@
 #include <string.h>
 #include <signal.h>
 #include <errno.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 #include <sys/ptrace.h>
 #include "libproc_impl.h"
 
--- a/hotspot/agent/src/os/linux/salibelf.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/agent/src/os/linux/salibelf.c	Fri Oct 11 09:17:18 2013 -0400
@@ -25,6 +25,7 @@
 #include "salibelf.h"
 #include <stdlib.h>
 #include <unistd.h>
+#include <string.h>
 
 extern void print_debug(const char*,...);
 
--- a/hotspot/agent/src/os/linux/symtab.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/agent/src/os/linux/symtab.c	Fri Oct 11 09:17:18 2013 -0400
@@ -305,7 +305,7 @@
 
   unsigned char *bytes
     = (unsigned char*)(note+1) + note->n_namesz;
-  unsigned char *filename
+  char *filename
     = (build_id_to_debug_filename (note->n_descsz, bytes));
 
   fd = pathmap_open(filename);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Fri Oct 11 09:17:18 2013 -0400
@@ -134,15 +134,13 @@
      private String type;
      private String name;
      private Address addr;
-     private String kind;
-     private int origin;
+     private int flags;
 
-     private Flag(String type, String name, Address addr, String kind, int origin) {
+     private Flag(String type, String name, Address addr, int flags) {
         this.type = type;
         this.name = name;
         this.addr = addr;
-        this.kind = kind;
-        this.origin = origin;
+        this.flags = flags;
      }
 
      public String getType() {
@@ -157,12 +155,8 @@
         return addr;
      }
 
-     public String getKind() {
-        return kind;
-     }
-
      public int getOrigin() {
-        return origin;
+        return flags & 0xF;  // XXX can we get the mask bits from somewhere?
      }
 
      public boolean isBool() {
@@ -173,8 +167,7 @@
         if (Assert.ASSERTS_ENABLED) {
            Assert.that(isBool(), "not a bool flag!");
         }
-        return addr.getCIntegerAt(0, boolType.getSize(), boolType.isUnsigned())
-               != 0;
+        return addr.getCIntegerAt(0, boolType.getSize(), boolType.isUnsigned()) != 0;
      }
 
      public boolean isIntx() {
@@ -843,11 +836,10 @@
 
     Address flagAddr = flagType.getAddressField("flags").getValue();
 
-    AddressField typeFld = flagType.getAddressField("type");
-    AddressField nameFld = flagType.getAddressField("name");
-    AddressField addrFld = flagType.getAddressField("addr");
-    AddressField kindFld = flagType.getAddressField("kind");
-    CIntField originFld = new CIntField(flagType.getCIntegerField("origin"), 0);
+    AddressField typeFld = flagType.getAddressField("_type");
+    AddressField nameFld = flagType.getAddressField("_name");
+    AddressField addrFld = flagType.getAddressField("_addr");
+    CIntField flagsFld = new CIntField(flagType.getCIntegerField("_flags"), 0);
 
     long flagSize = flagType.getSize(); // sizeof(Flag)
 
@@ -856,9 +848,8 @@
       String type = CStringUtilities.getString(typeFld.getValue(flagAddr));
       String name = CStringUtilities.getString(nameFld.getValue(flagAddr));
       Address addr = addrFld.getValue(flagAddr);
-      String kind = CStringUtilities.getString(kindFld.getValue(flagAddr));
-      int origin = (int)originFld.getValue(flagAddr);
-      commandLineFlags[f] = new Flag(type, name, addr, kind, origin);
+      int flags = (int)flagsFld.getValue(flagAddr);
+      commandLineFlags[f] = new Flag(type, name, addr, flags);
       flagAddr = flagAddr.addOffsetTo(flagSize);
     }
 
--- a/hotspot/make/bsd/makefiles/fastdebug.make	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/make/bsd/makefiles/fastdebug.make	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -59,5 +59,5 @@
 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug
 
 VERSION = fastdebug
-SYSDEFS += -DASSERT
+SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS
 PICFLAGS = DEFAULT
--- a/hotspot/make/bsd/makefiles/gcc.make	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/make/bsd/makefiles/gcc.make	Fri Oct 11 09:17:18 2013 -0400
@@ -247,7 +247,7 @@
 
 ifeq ($(USE_CLANG), true)
   # However we need to clean the code up before we can unrestrictedly enable this option with Clang
-  WARNINGS_ARE_ERRORS += -Wno-unused-value -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
+  WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
   WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare
 # Not yet supported by clang in Xcode 4.6.2
 #  WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare
@@ -262,7 +262,7 @@
   # conversions which might affect the values. Only enable it in earlier versions.
   WARNING_FLAGS = -Wunused-function
   ifeq ($(USE_CLANG),)
-    WARNINGS_FLAGS += -Wconversion
+    WARNING_FLAGS += -Wconversion
   endif
 endif
 
--- a/hotspot/make/excludeSrc.make	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/make/excludeSrc.make	Fri Oct 11 09:17:18 2013 -0400
@@ -88,7 +88,7 @@
 	g1ErgoVerbose.cpp g1GCPhaseTimes.cpp g1HRPrinter.cpp g1HotCardCache.cpp g1Log.cpp \
 	g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp \
 	g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1_globals.cpp heapRegion.cpp \
-	heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \
+	g1BiasedArray.cpp heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \
 	ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp \
 	adjoiningGenerations.cpp adjoiningVirtualSpaces.cpp asPSOldGen.cpp asPSYoungGen.cpp \
 	cardTableExtension.cpp gcTaskManager.cpp gcTaskThread.cpp objectStartArray.cpp \
--- a/hotspot/make/hotspot_version	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/make/hotspot_version	Fri Oct 11 09:17:18 2013 -0400
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=51
+HS_BUILD_NUMBER=53
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/make/linux/makefiles/fastdebug.make	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/make/linux/makefiles/fastdebug.make	Fri Oct 11 09:17:18 2013 -0400
@@ -59,5 +59,5 @@
 MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug
 
 VERSION = optimized
-SYSDEFS += -DASSERT
+SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS
 PICFLAGS = DEFAULT
--- a/hotspot/make/linux/makefiles/gcc.make	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/make/linux/makefiles/gcc.make	Fri Oct 11 09:17:18 2013 -0400
@@ -208,7 +208,7 @@
 
 ifeq ($(USE_CLANG), true)
   # However we need to clean the code up before we can unrestrictedly enable this option with Clang
-  WARNINGS_ARE_ERRORS += -Wno-unused-value -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
+  WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
   WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare
   WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess
   WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
--- a/hotspot/make/windows/makefiles/fastdebug.make	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/make/windows/makefiles/fastdebug.make	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -38,7 +38,7 @@
 !include ../local.make
 !include compile.make
 
-CXX_FLAGS=$(CXX_FLAGS) $(FASTDEBUG_OPT_OPTION)
+CXX_FLAGS=$(CXX_FLAGS) $(FASTDEBUG_OPT_OPTION) /D "CHECK_UNHANDLED_OOPS"
 
 !include $(WorkSpace)/make/windows/makefiles/vm.make
 !include local.make
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -764,7 +764,7 @@
 #ifdef CC_INTERP
         *oop_result = istate->_oop_temp;
 #else
-        oop obj = (oop) at(interpreter_frame_oop_temp_offset);
+        oop obj = cast_to_oop(at(interpreter_frame_oop_temp_offset));
         assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
         *oop_result = obj;
 #endif // CC_INTERP
@@ -788,7 +788,7 @@
     switch(type) {
       case T_OBJECT:
       case T_ARRAY: {
-        oop obj = (oop)*tos_addr;
+        oop obj = cast_to_oop(*tos_addr);
         assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
         *oop_result = obj;
         break;
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,6 +121,7 @@
 
 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register target, Register temp,
                                             bool for_compiler_entry) {
+  Label L_no_such_method;
   assert(method == G5_method, "interpreter calling convention");
   assert_different_registers(method, target, temp);
 
@@ -133,6 +134,9 @@
     const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset());
     __ ld(interp_only, temp);
     __ cmp_and_br_short(temp, 0, Assembler::zero, Assembler::pt, run_compiled_code);
+    // Null method test is replicated below in compiled case,
+    // it might be able to address across the verify_thread()
+    __ br_null_short(G5_method, Assembler::pn, L_no_such_method);
     __ ld_ptr(G5_method, in_bytes(Method::interpreter_entry_offset()), target);
     __ jmp(target, 0);
     __ delayed()->nop();
@@ -141,11 +145,19 @@
     // it doesn't matter, since this is interpreter code.
   }
 
+  // Compiled case, either static or fall-through from runtime conditional
+  __ br_null_short(G5_method, Assembler::pn, L_no_such_method);
+
   const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
                                                      Method::from_interpreted_offset();
   __ ld_ptr(G5_method, in_bytes(entry_offset), target);
   __ jmp(target, 0);
   __ delayed()->nop();
+
+  __ bind(L_no_such_method);
+  AddressLiteral ame(StubRoutines::throw_AbstractMethodError_entry());
+  __ jump_to(ame, temp);
+  __ delayed()->nop();
 }
 
 void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -358,7 +358,7 @@
         oop_Relocation *r = iter.oop_reloc();
         if (oop_addr == NULL) {
           oop_addr = r->oop_addr();
-          *oop_addr = (oop)x;
+          *oop_addr = cast_to_oop(x);
         } else {
           assert(oop_addr == r->oop_addr(), "must be only one set-oop here");
         }
@@ -478,7 +478,7 @@
         oop_Relocation *r = iter.oop_reloc();
         if (oop_addr == NULL) {
           oop_addr = r->oop_addr();
-          *oop_addr = (oop)x;
+          *oop_addr = cast_to_oop(x);
         } else {
           assert(oop_addr == r->oop_addr(), "must be only one set-oop here");
         }
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Fri Oct 11 09:17:18 2013 -0400
@@ -2018,6 +2018,15 @@
   return L7_REGP_mask();
 }
 
+const RegMask Matcher::mathExactI_result_proj_mask() {
+  return G1_REGI_mask();
+}
+
+const RegMask Matcher::mathExactI_flags_proj_mask() {
+  return INT_FLAGS_mask();
+}
+
+
 %}
 
 
@@ -4245,12 +4254,16 @@
     greater_equal(0xB);
     less_equal(0x2);
     greater(0xA);
+    overflow(0x7);
+    no_overflow(0xF);
   %}
 %}
 
 // Comparison Op, unsigned
 operand cmpOpU() %{
   match(Bool);
+  predicate(n->as_Bool()->_test._test != BoolTest::overflow &&
+            n->as_Bool()->_test._test != BoolTest::no_overflow);
 
   format %{ "u" %}
   interface(COND_INTER) %{
@@ -4260,12 +4273,16 @@
     greater_equal(0xD);
     less_equal(0x4);
     greater(0xC);
+    overflow(0x7);
+    no_overflow(0xF);
   %}
 %}
 
 // Comparison Op, pointer (same as unsigned)
 operand cmpOpP() %{
   match(Bool);
+  predicate(n->as_Bool()->_test._test != BoolTest::overflow &&
+            n->as_Bool()->_test._test != BoolTest::no_overflow);
 
   format %{ "p" %}
   interface(COND_INTER) %{
@@ -4275,12 +4292,16 @@
     greater_equal(0xD);
     less_equal(0x4);
     greater(0xC);
+    overflow(0x7);
+    no_overflow(0xF);
   %}
 %}
 
 // Comparison Op, branch-register encoding
 operand cmpOp_reg() %{
   match(Bool);
+  predicate(n->as_Bool()->_test._test != BoolTest::overflow &&
+            n->as_Bool()->_test._test != BoolTest::no_overflow);
 
   format %{ "" %}
   interface(COND_INTER) %{
@@ -4290,12 +4311,16 @@
     greater_equal(0x7);
     less_equal   (0x2);
     greater      (0x6);
+    overflow(0x7); // not supported
+    no_overflow(0xF); // not supported
   %}
 %}
 
 // Comparison Code, floating, unordered same as less
 operand cmpOpF() %{
   match(Bool);
+  predicate(n->as_Bool()->_test._test != BoolTest::overflow &&
+            n->as_Bool()->_test._test != BoolTest::no_overflow);
 
   format %{ "fl" %}
   interface(COND_INTER) %{
@@ -4305,12 +4330,17 @@
     greater_equal(0xB);
     less_equal(0xE);
     greater(0x6);
+
+    overflow(0x7); // not supported
+    no_overflow(0xF); // not supported
   %}
 %}
 
 // Used by long compare
 operand cmpOp_commute() %{
   match(Bool);
+  predicate(n->as_Bool()->_test._test != BoolTest::overflow &&
+            n->as_Bool()->_test._test != BoolTest::no_overflow);
 
   format %{ "" %}
   interface(COND_INTER) %{
@@ -4320,6 +4350,8 @@
     greater_equal(0x2);
     less_equal(0xB);
     greater(0x3);
+    overflow(0x7);
+    no_overflow(0xF);
   %}
 %}
 
--- a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -52,6 +52,11 @@
 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
   const int sparc_code_length = VtableStub::pd_code_size_limit(true);
   VtableStub* s = new(sparc_code_length) VtableStub(true, vtable_index);
+  // Can be NULL if there is no free space in the code cache.
+  if (s == NULL) {
+    return NULL;
+  }
+
   ResourceMark rm;
   CodeBuffer cb(s->entry_point(), sparc_code_length);
   MacroAssembler* masm = new MacroAssembler(&cb);
@@ -125,6 +130,11 @@
 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
   const int sparc_code_length = VtableStub::pd_code_size_limit(false);
   VtableStub* s = new(sparc_code_length) VtableStub(false, itable_index);
+  // Can be NULL if there is no free space in the code cache.
+  if (s == NULL) {
+    return NULL;
+  }
+
   ResourceMark rm;
   CodeBuffer cb(s->entry_point(), sparc_code_length);
   MacroAssembler* masm = new MacroAssembler(&cb);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -4769,7 +4769,7 @@
 }
 
 void Assembler::adcq(Register dst, Register src) {
-  (int) prefixq_and_encode(dst->encoding(), src->encoding());
+  (void) prefixq_and_encode(dst->encoding(), src->encoding());
   emit_arith(0x13, 0xC0, dst, src);
 }
 
@@ -4824,7 +4824,7 @@
 }
 
 void Assembler::andq(Register dst, Register src) {
-  (int) prefixq_and_encode(dst->encoding(), src->encoding());
+  (void) prefixq_and_encode(dst->encoding(), src->encoding());
   emit_arith(0x23, 0xC0, dst, src);
 }
 
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -639,7 +639,7 @@
 #ifdef CC_INTERP
         obj = istate->_oop_temp;
 #else
-        obj = (oop) at(interpreter_frame_oop_temp_offset);
+        obj = cast_to_oop(at(interpreter_frame_oop_temp_offset));
 #endif // CC_INTERP
       } else {
         oop* obj_p = (oop*)tos_addr;
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -114,6 +114,11 @@
 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp,
                                             bool for_compiler_entry) {
   assert(method == rbx, "interpreter calling convention");
+
+   Label L_no_such_method;
+   __ testptr(rbx, rbx);
+   __ jcc(Assembler::zero, L_no_such_method);
+
   __ verify_method_ptr(method);
 
   if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
@@ -138,6 +143,9 @@
   const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
                                                      Method::from_interpreted_offset();
   __ jmp(Address(method, entry_offset));
+
+  __ bind(L_no_such_method);
+  __ jump(RuntimeAddress(StubRoutines::throw_AbstractMethodError_entry()));
 }
 
 void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
@@ -475,7 +483,7 @@
   const char* mh_reg_name = has_mh ? "rcx_mh" : "rcx";
   tty->print_cr("MH %s %s="PTR_FORMAT" sp="PTR_FORMAT,
                 adaptername, mh_reg_name,
-                mh, entry_sp);
+                (void *)mh, entry_sp);
 
   if (Verbose) {
     tty->print_cr("Registers:");
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -58,6 +58,11 @@
 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
   const int i486_code_length = VtableStub::pd_code_size_limit(true);
   VtableStub* s = new(i486_code_length) VtableStub(true, vtable_index);
+  // Can be NULL if there is no free space in the code cache.
+  if (s == NULL) {
+    return NULL;
+  }
+
   ResourceMark rm;
   CodeBuffer cb(s->entry_point(), i486_code_length);
   MacroAssembler* masm = new MacroAssembler(&cb);
@@ -132,6 +137,11 @@
   //            add code here, bump the code stub size returned by pd_code_size_limit!
   const int i486_code_length = VtableStub::pd_code_size_limit(false);
   VtableStub* s = new(i486_code_length) VtableStub(false, itable_index);
+  // Can be NULL if there is no free space in the code cache.
+  if (s == NULL) {
+    return NULL;
+  }
+
   ResourceMark rm;
   CodeBuffer cb(s->entry_point(), i486_code_length);
   MacroAssembler* masm = new MacroAssembler(&cb);
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -49,6 +49,11 @@
 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
   const int amd64_code_length = VtableStub::pd_code_size_limit(true);
   VtableStub* s = new(amd64_code_length) VtableStub(true, vtable_index);
+  // Can be NULL if there is no free space in the code cache.
+  if (s == NULL) {
+    return NULL;
+  }
+
   ResourceMark rm;
   CodeBuffer cb(s->entry_point(), amd64_code_length);
   MacroAssembler* masm = new MacroAssembler(&cb);
@@ -126,6 +131,11 @@
   // returned by pd_code_size_limit!
   const int amd64_code_length = VtableStub::pd_code_size_limit(false);
   VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index);
+  // Can be NULL if there is no free space in the code cache.
+  if (s == NULL) {
+    return NULL;
+  }
+
   ResourceMark rm;
   CodeBuffer cb(s->entry_point(), amd64_code_length);
   MacroAssembler* masm = new MacroAssembler(&cb);
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Fri Oct 11 09:17:18 2013 -0400
@@ -351,7 +351,7 @@
         int format) {
 #ifdef ASSERT
   if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) {
-    assert(oop(d32)->is_oop() && (ScavengeRootsInCode || !oop(d32)->is_scavengable()), "cannot embed scavengable oops in code");
+    assert(cast_to_oop(d32)->is_oop() && (ScavengeRootsInCode || !cast_to_oop(d32)->is_scavengable()), "cannot embed scavengable oops in code");
   }
 #endif
   cbuf.relocate(cbuf.insts_mark(), rspec, format);
@@ -1534,6 +1534,14 @@
   return EBP_REG_mask();
 }
 
+const RegMask Matcher::mathExactI_result_proj_mask() {
+  return EAX_REG_mask();
+}
+
+const RegMask Matcher::mathExactI_flags_proj_mask() {
+  return INT_FLAGS_mask();
+}
+
 // Returns true if the high 32 bits of the value is known to be zero.
 bool is_operand_hi32_zero(Node* n) {
   int opc = n->Opcode();
@@ -4922,6 +4930,8 @@
     greater_equal(0xD, "ge");
     less_equal(0xE, "le");
     greater(0xF, "g");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -4939,6 +4949,8 @@
     greater_equal(0x3, "nb");
     less_equal(0x6, "be");
     greater(0x7, "nbe");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -4957,6 +4969,8 @@
     greater_equal(0x3, "nb");
     less_equal(0x6, "be");
     greater(0x7, "nbe");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -4974,6 +4988,8 @@
     greater_equal(0x3, "nb");
     less_equal(0x6, "be");
     greater(0x7, "nbe");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -4981,6 +4997,8 @@
 operand cmpOp_fcmov() %{
   match(Bool);
 
+  predicate(n->as_Bool()->_test._test != BoolTest::overflow &&
+            n->as_Bool()->_test._test != BoolTest::no_overflow);
   format %{ "" %}
   interface(COND_INTER) %{
     equal        (0x0C8);
@@ -4989,6 +5007,8 @@
     greater_equal(0x1C0);
     less_equal   (0x0D0);
     greater      (0x1D0);
+    overflow(0x0, "o"); // not really supported by the instruction
+    no_overflow(0x1, "no"); // not really supported by the instruction
   %}
 %}
 
@@ -5004,6 +5024,8 @@
     greater_equal(0xE, "le");
     less_equal(0xD, "ge");
     greater(0xC, "l");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -7496,6 +7518,31 @@
 
 //----------Arithmetic Instructions--------------------------------------------
 //----------Addition Instructions----------------------------------------------
+
+instruct addExactI_rReg(eAXRegI dst, rRegI src, eFlagsReg cr)
+%{
+  match(AddExactI dst src);
+  effect(DEF cr);
+
+  format %{ "ADD    $dst, $src\t# addExact int" %}
+  ins_encode %{
+    __ addl($dst$$Register, $src$$Register);
+  %}
+  ins_pipe(ialu_reg_reg);
+%}
+
+instruct addExactI_rReg_imm(eAXRegI dst, immI src, eFlagsReg cr)
+%{
+  match(AddExactI dst src);
+  effect(DEF cr);
+
+  format %{ "ADD    $dst, $src\t# addExact int" %}
+  ins_encode %{
+    __ addl($dst$$Register, $src$$constant);
+  %}
+  ins_pipe(ialu_reg_reg);
+%}
+
 // Integer Addition Instructions
 instruct addI_eReg(rRegI dst, rRegI src, eFlagsReg cr) %{
   match(Set dst (AddI dst src));
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Fri Oct 11 09:17:18 2013 -0400
@@ -529,7 +529,7 @@
   if (rspec.reloc()->type() == relocInfo::oop_type &&
       d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
     assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop");
-    assert(oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code");
+    assert(cast_to_oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !cast_to_oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code");
   }
 #endif
   cbuf.relocate(cbuf.insts_mark(), rspec, format);
@@ -556,7 +556,7 @@
   if (rspec.reloc()->type() == relocInfo::oop_type &&
       d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) {
     assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop");
-    assert(oop(d64)->is_oop() && (ScavengeRootsInCode || !oop(d64)->is_scavengable()),
+    assert(cast_to_oop(d64)->is_oop() && (ScavengeRootsInCode || !cast_to_oop(d64)->is_scavengable()),
            "cannot embed scavengable oops in code");
   }
 #endif
@@ -1649,6 +1649,14 @@
   return PTR_RBP_REG_mask();
 }
 
+const RegMask Matcher::mathExactI_result_proj_mask() {
+  return INT_RAX_REG_mask();
+}
+
+const RegMask Matcher::mathExactI_flags_proj_mask() {
+  return INT_FLAGS_mask();
+}
+
 %}
 
 //----------ENCODING BLOCK-----------------------------------------------------
@@ -4133,6 +4141,8 @@
     greater_equal(0xD, "ge");
     less_equal(0xE, "le");
     greater(0xF, "g");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -4151,6 +4161,8 @@
     greater_equal(0x3, "nb");
     less_equal(0x6, "be");
     greater(0x7, "nbe");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -4170,6 +4182,8 @@
     greater_equal(0x3, "nb");
     less_equal(0x6, "be");
     greater(0x7, "nbe");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -4187,6 +4201,8 @@
     greater_equal(0x3, "nb");
     less_equal(0x6, "be");
     greater(0x7, "nbe");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
   %}
 %}
 
@@ -6922,6 +6938,30 @@
 //----------Arithmetic Instructions--------------------------------------------
 //----------Addition Instructions----------------------------------------------
 
+instruct addExactI_rReg(rax_RegI dst, rRegI src, rFlagsReg cr)
+%{
+  match(AddExactI dst src);
+  effect(DEF cr);
+
+  format %{ "addl    $dst, $src\t# addExact int" %}
+  ins_encode %{
+    __ addl($dst$$Register, $src$$Register);
+  %}
+  ins_pipe(ialu_reg_reg);
+%}
+
+instruct addExactI_rReg_imm(rax_RegI dst, immI src, rFlagsReg cr)
+%{
+  match(AddExactI dst src);
+  effect(DEF cr);
+
+  format %{ "addl    $dst, $src\t# addExact int" %}
+  ins_encode %{
+    __ addl($dst$$Register, $src$$constant);
+  %}
+  ins_pipe(ialu_reg_reg);
+%}
+
 instruct addI_rReg(rRegI dst, rRegI src, rFlagsReg cr)
 %{
   match(Set dst (AddI dst src));
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -4839,6 +4839,10 @@
 
   Linux::capture_initial_stack(JavaThread::stack_size_at_create());
 
+#if defined(IA32)
+  workaround_expand_exec_shield_cs_limit();
+#endif
+
   Linux::libpthread_init();
   if (PrintMiscellaneous && (Verbose || WizardMode)) {
      tty->print_cr("[HotSpot is running with %s, %s(%s)]\n",
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -876,3 +876,46 @@
 #endif
 }
 #endif
+
+
+/*
+ * IA32 only: execute code at a high address in case buggy NX emulation is present. I.e. avoid CS limit
+ * updates (JDK-8023956).
+ */
+void os::workaround_expand_exec_shield_cs_limit() {
+#if defined(IA32)
+  size_t page_size = os::vm_page_size();
+  /*
+   * Take the highest VA the OS will give us and exec
+   *
+   * Although using -(pagesz) as mmap hint works on newer kernel as you would
+   * think, older variants affected by this work-around don't (search forward only).
+   *
+   * On the affected distributions, we understand the memory layout to be:
+   *
+   *   TASK_LIMIT= 3G, main stack base close to TASK_LIMT.
+   *
+   * A few pages south main stack will do it.
+   *
+   * If we are embedded in an app other than launcher (initial != main stack),
+   * we don't have much control or understanding of the address space, just let it slide.
+   */
+  char* hint = (char*) (Linux::initial_thread_stack_bottom() -
+                        ((StackYellowPages + StackRedPages + 1) * page_size));
+  char* codebuf = os::reserve_memory(page_size, hint);
+  if ( (codebuf == NULL) || (!os::commit_memory(codebuf, page_size, true)) ) {
+    return; // No matter, we tried, best effort.
+  }
+  if (PrintMiscellaneous && (Verbose || WizardMode)) {
+     tty->print_cr("[CS limit NX emulation work-around, exec code at: %p]", codebuf);
+  }
+
+  // Some code to exec: the 'ret' instruction
+  codebuf[0] = 0xC3;
+
+  // Call the code in the codebuf
+  __asm__ volatile("call *%0" : : "r"(codebuf));
+
+  // keep the page mapped so CS limit isn't reduced.
+#endif
+}
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -36,4 +36,17 @@
   // Note: Currently only used in 64 bit Windows implementations
   static bool register_code_area(char *low, char *high) { return true; }
 
+  /*
+   * Work-around for broken NX emulation using CS limit, Red Hat patch "Exec-Shield"
+   * (IA32 only).
+   *
+   * Map and execute at a high VA to prevent CS lazy updates race with SMP MM
+   * invalidation.Further code generation by the JVM will no longer cause CS limit
+   * updates.
+   *
+   * Affects IA32: RHEL 5 & 6, Ubuntu 10.04 (LTS), 10.10, 11.04, 11.10, 12.04.
+   * @see JDK-8023956
+   */
+  static void workaround_expand_exec_shield_cs_limit();
+
 #endif // OS_CPU_LINUX_X86_VM_OS_LINUX_X86_HPP
--- a/hotspot/src/share/vm/adlc/adlparse.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/adlc/adlparse.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -3395,12 +3395,16 @@
   char *greater_equal;
   char *less_equal;
   char *greater;
+  char *overflow;
+  char *no_overflow;
   const char *equal_format = "eq";
   const char *not_equal_format = "ne";
   const char *less_format = "lt";
   const char *greater_equal_format = "ge";
   const char *less_equal_format = "le";
   const char *greater_format = "gt";
+  const char *overflow_format = "o";
+  const char *no_overflow_format = "no";
 
   if (_curchar != '%') {
     parse_err(SYNERR, "Missing '%%{' for 'cond_interface' block.\n");
@@ -3437,6 +3441,12 @@
     else if ( strcmp(field,"greater") == 0 ) {
       greater = interface_field_parse(&greater_format);
     }
+    else if ( strcmp(field,"overflow") == 0 ) {
+      overflow = interface_field_parse(&overflow_format);
+    }
+    else if ( strcmp(field,"no_overflow") == 0 ) {
+      no_overflow = interface_field_parse(&no_overflow_format);
+    }
     else {
       parse_err(SYNERR, "Expected keyword, base|index|scale|disp,  or '%%}' ending interface.\n");
       return NULL;
@@ -3455,7 +3465,9 @@
                                        less,          less_format,
                                        greater_equal, greater_equal_format,
                                        less_equal,    less_equal_format,
-                                       greater,       greater_format);
+                                       greater,       greater_format,
+                                       overflow,      overflow_format,
+                                       no_overflow,   no_overflow_format);
   return inter;
 }
 
--- a/hotspot/src/share/vm/adlc/archDesc.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/adlc/archDesc.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1192,6 +1192,8 @@
          || strcmp(idealName,"CmpF") == 0
          || strcmp(idealName,"FastLock") == 0
          || strcmp(idealName,"FastUnlock") == 0
+         || strcmp(idealName,"AddExactI") == 0
+         || strcmp(idealName,"FlagsProj") == 0
          || strcmp(idealName,"Bool") == 0
          || strcmp(idealName,"Binary") == 0 ) {
       // Removed ConI from the must_clone list.  CPUs that cannot use
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -2757,14 +2757,18 @@
                              const char* less,          const char* less_format,
                              const char* greater_equal, const char* greater_equal_format,
                              const char* less_equal,    const char* less_equal_format,
-                             const char* greater,       const char* greater_format)
+                             const char* greater,       const char* greater_format,
+                             const char* overflow,      const char* overflow_format,
+                             const char* no_overflow,   const char* no_overflow_format)
   : Interface("COND_INTER"),
     _equal(equal),                 _equal_format(equal_format),
     _not_equal(not_equal),         _not_equal_format(not_equal_format),
     _less(less),                   _less_format(less_format),
     _greater_equal(greater_equal), _greater_equal_format(greater_equal_format),
     _less_equal(less_equal),       _less_equal_format(less_equal_format),
-    _greater(greater),             _greater_format(greater_format) {
+    _greater(greater),             _greater_format(greater_format),
+    _overflow(overflow),           _overflow_format(overflow_format),
+    _no_overflow(no_overflow),     _no_overflow_format(no_overflow_format) {
 }
 CondInterface::~CondInterface() {
   // not owner of any character arrays
@@ -2777,12 +2781,14 @@
 // Write info to output files
 void CondInterface::output(FILE *fp) {
   Interface::output(fp);
-  if ( _equal  != NULL )     fprintf(fp," equal       == %s\n", _equal);
-  if ( _not_equal  != NULL ) fprintf(fp," not_equal   == %s\n", _not_equal);
-  if ( _less  != NULL )      fprintf(fp," less        == %s\n", _less);
-  if ( _greater_equal  != NULL ) fprintf(fp," greater_equal   == %s\n", _greater_equal);
-  if ( _less_equal  != NULL ) fprintf(fp," less_equal  == %s\n", _less_equal);
-  if ( _greater  != NULL )    fprintf(fp," greater     == %s\n", _greater);
+  if ( _equal  != NULL )     fprintf(fp," equal        == %s\n", _equal);
+  if ( _not_equal  != NULL ) fprintf(fp," not_equal    == %s\n", _not_equal);
+  if ( _less  != NULL )      fprintf(fp," less         == %s\n", _less);
+  if ( _greater_equal  != NULL ) fprintf(fp," greater_equal    == %s\n", _greater_equal);
+  if ( _less_equal  != NULL ) fprintf(fp," less_equal   == %s\n", _less_equal);
+  if ( _greater  != NULL )    fprintf(fp," greater      == %s\n", _greater);
+  if ( _overflow != NULL )    fprintf(fp," overflow     == %s\n", _overflow);
+  if ( _no_overflow != NULL ) fprintf(fp," no_overflow  == %s\n", _no_overflow);
   // fprintf(fp,"\n");
 }
 
--- a/hotspot/src/share/vm/adlc/formssel.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/adlc/formssel.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -798,12 +798,16 @@
   const char *_greater_equal;
   const char *_less_equal;
   const char *_greater;
+  const char *_overflow;
+  const char *_no_overflow;
   const char *_equal_format;
   const char *_not_equal_format;
   const char *_less_format;
   const char *_greater_equal_format;
   const char *_less_equal_format;
   const char *_greater_format;
+  const char *_overflow_format;
+  const char *_no_overflow_format;
 
   // Public Methods
   CondInterface(const char* equal,         const char* equal_format,
@@ -811,7 +815,9 @@
                 const char* less,          const char* less_format,
                 const char* greater_equal, const char* greater_equal_format,
                 const char* less_equal,    const char* less_equal_format,
-                const char* greater,       const char* greater_format);
+                const char* greater,       const char* greater_format,
+                const char* overflow,      const char* overflow_format,
+                const char* no_overflow,   const char* no_overflow_format);
   ~CondInterface();
 
   void dump();
--- a/hotspot/src/share/vm/adlc/output_h.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/adlc/output_h.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -388,6 +388,8 @@
   fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format);
   fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format);
   fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print(\"%s\");\n",i,cond->_overflow_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print(\"%s\");\n",i,cond->_no_overflow_format);
 }
 
 // Output code that dumps constant values, increment "i" if type is constant
@@ -1208,6 +1210,8 @@
       fprintf(fp,"    case  BoolTest::ne : return not_equal();\n");
       fprintf(fp,"    case  BoolTest::le : return less_equal();\n");
       fprintf(fp,"    case  BoolTest::ge : return greater_equal();\n");
+      fprintf(fp,"    case  BoolTest::overflow : return overflow();\n");
+      fprintf(fp,"    case  BoolTest::no_overflow: return no_overflow();\n");
       fprintf(fp,"    default : ShouldNotReachHere(); return 0;\n");
       fprintf(fp,"    }\n");
       fprintf(fp,"  };\n");
@@ -1373,6 +1377,14 @@
         if( greater != NULL ) {
           define_oper_interface(fp, *oper, _globalNames, "greater", greater);
         }
+        const char *overflow = cInterface->_overflow;
+        if( overflow != NULL ) {
+          define_oper_interface(fp, *oper, _globalNames, "overflow", overflow);
+        }
+        const char *no_overflow = cInterface->_no_overflow;
+        if( no_overflow != NULL ) {
+          define_oper_interface(fp, *oper, _globalNames, "no_overflow", no_overflow);
+        }
       } // end Conditional Interface
       // Check if it is a Constant Interface
       else if (oper->_interface->is_ConstInterface() != NULL ) {
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -4219,7 +4219,9 @@
     }
   }
 
-  if (!PrintInlining)  return;
+  if (!PrintInlining && !compilation()->method()->has_option("PrintInlining")) {
+    return;
+  }
   CompileTask::print_inlining(callee, scope()->level(), bci(), msg);
   if (success && CIPrintMethodCodes) {
     callee->print_codes();
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1019,7 +1019,7 @@
               n_copy->set_data((intx) (load_klass()));
             } else {
               assert(mirror() != NULL, "klass not set");
-              n_copy->set_data((intx) (mirror()));
+              n_copy->set_data(cast_from_oop<intx>(mirror()));
             }
 
             if (TracePatching) {
@@ -1031,7 +1031,7 @@
           assert(n_copy->data() == 0 ||
                  n_copy->data() == (intptr_t)Universe::non_oop_word(),
                  "illegal init value");
-          n_copy->set_data((intx) (appendix()));
+          n_copy->set_data(cast_from_oop<intx>(appendix()));
 
           if (TracePatching) {
             Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);
@@ -1078,14 +1078,17 @@
           // replace instructions
           // first replace the tail, then the call
 #ifdef ARM
-          if(load_klass_or_mirror_patch_id && !VM_Version::supports_movw()) {
+          if((load_klass_or_mirror_patch_id ||
+              stub_id == Runtime1::load_appendix_patching_id) &&
+             !VM_Version::supports_movw()) {
             nmethod* nm = CodeCache::find_nmethod(instr_pc);
             address addr = NULL;
             assert(nm != NULL, "invalid nmethod_pc");
             RelocIterator mds(nm, copy_buff, copy_buff + 1);
             while (mds.next()) {
               if (mds.type() == relocInfo::oop_type) {
-                assert(stub_id == Runtime1::load_mirror_patching_id, "wrong stub id");
+                assert(stub_id == Runtime1::load_mirror_patching_id ||
+                       stub_id == Runtime1::load_appendix_patching_id, "wrong stub id");
                 oop_Relocation* r = mds.oop_reloc();
                 addr = (address)r->oop_addr();
                 break;
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1787,7 +1787,7 @@
     if (_location != _in_method)  break;  // only allow for methods
     if (!privileged)              break;  // only allow in privileged code
     return _method_LambdaForm_Hidden;
-  case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_invoke_Stable_signature):
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature):
     if (_location != _in_field)   break;  // only allow for fields
     if (!privileged)              break;  // only allow in privileged code
     return _field_Stable;
@@ -2545,7 +2545,9 @@
       if (method->is_final()) {
         *has_final_method = true;
       }
-      if (is_interface && !method->is_abstract() && !method->is_static()) {
+      if (is_interface && !(*has_default_methods)
+        && !method->is_abstract() && !method->is_static()
+        && !method->is_private()) {
         // default method
         *has_default_methods = true;
       }
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -261,7 +261,7 @@
                   k,
                   k->external_name(),
                   k->class_loader_data(),
-                  k->class_loader(),
+                  (void *)k->class_loader(),
                   loader_name());
   }
 }
@@ -297,7 +297,7 @@
   if (TraceClassLoaderData) {
     ResourceMark rm;
     tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this);
-    tty->print(" for instance "PTR_FORMAT" of %s", class_loader(),
+    tty->print(" for instance "PTR_FORMAT" of %s", (void *)class_loader(),
                loader_name());
     if (is_anonymous()) {
       tty->print(" for anonymous class  "PTR_FORMAT " ", _klasses);
@@ -458,7 +458,7 @@
 void ClassLoaderData::dump(outputStream * const out) {
   ResourceMark rm;
   out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {",
-      this, class_loader(),
+      this, (void *)class_loader(),
       class_loader() != NULL ? class_loader()->klass() : NULL, loader_name());
   if (claimed()) out->print(" claimed ");
   if (is_unloading()) out->print(" unloading ");
@@ -553,7 +553,7 @@
         ResourceMark rm;
         tty->print("[ClassLoaderData: ");
         tty->print("create class loader data "PTR_FORMAT, cld);
-        tty->print(" for instance "PTR_FORMAT" of %s", cld->class_loader(),
+        tty->print(" for instance "PTR_FORMAT" of %s", (void *)cld->class_loader(),
                    cld->loader_name());
         tty->print_cr("]");
       }
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -325,6 +325,7 @@
 
   Method* _selected_target;  // Filled in later, if a unique target exists
   Symbol* _exception_message; // If no unique target is found
+  Symbol* _exception_name;    // If no unique target is found
 
   bool contains_method(Method* method) {
     int* lookup = _member_index.get(method);
@@ -350,7 +351,7 @@
  public:
 
   MethodFamily()
-      : _selected_target(NULL), _exception_message(NULL) {}
+      : _selected_target(NULL), _exception_message(NULL), _exception_name(NULL) {}
 
   void set_target_if_empty(Method* m) {
     if (_selected_target == NULL && !m->is_overpass()) {
@@ -383,6 +384,7 @@
 
   Method* get_selected_target() { return _selected_target; }
   Symbol* get_exception_message() { return _exception_message; }
+  Symbol* get_exception_name() { return _exception_name; }
 
   // Either sets the target or the exception error message
   void determine_target(InstanceKlass* root, TRAPS) {
@@ -400,15 +402,18 @@
 
     if (qualified_methods.length() == 0) {
       _exception_message = generate_no_defaults_message(CHECK);
+      _exception_name = vmSymbols::java_lang_AbstractMethodError();
     } else if (qualified_methods.length() == 1) {
       Method* method = qualified_methods.at(0);
       if (method->is_abstract()) {
         _exception_message = generate_abstract_method_message(method, CHECK);
+        _exception_name = vmSymbols::java_lang_AbstractMethodError();
       } else {
         _selected_target = qualified_methods.at(0);
       }
     } else {
       _exception_message = generate_conflicts_message(&qualified_methods,CHECK);
+      _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError();
     }
 
     assert((has_target() ^ throws_exception()) == 1,
@@ -459,8 +464,9 @@
 
   void print_exception(outputStream* str, int indent) {
     assert(throws_exception(), "Should be called otherwise");
+    assert(_exception_name != NULL, "exception_name should be set");
     streamIndentor si(str, indent * 2);
-    str->indent().print_cr("%s", _exception_message->as_C_string());
+    str->indent().print_cr("%s: %s", _exception_name->as_C_string(), _exception_message->as_C_string());
   }
 #endif // ndef PRODUCT
 };
@@ -670,7 +676,10 @@
     InstanceKlass* iklass = current_class();
 
     Method* m = iklass->find_method(_method_name, _method_signature);
-    if (m != NULL) {
+    // private interface methods are not candidates for default methods
+    // invokespecial to private interface methods doesn't use default method logic
+    // future: take access controls into account for superclass methods
+    if (m != NULL && (!iklass->is_interface() || m->is_public())) {
       if (_family == NULL) {
         _family = new StatefulMethodFamily();
       }
@@ -782,202 +791,9 @@
 #endif // ndef PRODUCT
 }
 
-/**
- * Interface inheritance rules were used to find a unique default method
- * candidate for the resolved class. This
- * method is only viable if it would also be in the set of default method
- * candidates if we ran a full analysis on the current class.
- *
- * The only reason that the method would not be in the set of candidates for
- * the current class is if that there's another matching method
- * which is "more specific" than the found method -- i.e., one could find a
- * path in the interface hierarchy in which the matching method appears
- * before we get to '_target'.
- *
- * In order to determine this, we examine all of the implemented
- * interfaces.  If we find path that leads to the '_target' interface, then
- * we examine that path to see if there are any methods that would shadow
- * the selected method along that path.
- */
-class ShadowChecker : public HierarchyVisitor<ShadowChecker> {
- protected:
-  Thread* THREAD;
-
-  InstanceKlass* _target;
-
-  Symbol* _method_name;
-  InstanceKlass* _method_holder;
-  bool _found_shadow;
 
 
- public:
-
-  ShadowChecker(Thread* thread, Symbol* name, InstanceKlass* holder,
-                InstanceKlass* target)
-                : THREAD(thread), _method_name(name), _method_holder(holder),
-                _target(target), _found_shadow(false) {}
-
-  void* new_node_data(InstanceKlass* cls) { return NULL; }
-  void free_node_data(void* data) { return; }
-
-  bool visit() {
-    InstanceKlass* ik = current_class();
-    if (ik == _target && current_depth() == 1) {
-      return false; // This was the specified super -- no need to search it
-    }
-    if (ik == _method_holder || ik == _target) {
-      // We found a path that should be examined to see if it shadows _method
-      if (path_has_shadow()) {
-        _found_shadow = true;
-        cancel_iteration();
-      }
-      return false; // no need to continue up hierarchy
-    }
-    return true;
-  }
-
-  virtual bool path_has_shadow() = 0;
-  bool found_shadow() { return _found_shadow; }
-};
-
-// Used for Invokespecial.
-// Invokespecial is allowed to invoke a concrete interface method
-// and can be used to disambuiguate among qualified candidates,
-// which are methods in immediate superinterfaces,
-// but may not be used to invoke a candidate that would be shadowed
-// from the perspective of the caller.
-// Invokespecial is also used in the overpass generation today
-// We re-run the shadowchecker because we can't distinguish this case,
-// but it should return the same answer, since the overpass target
-// is now the invokespecial caller.
-class ErasedShadowChecker : public ShadowChecker {
- private:
-  bool path_has_shadow() {
-
-    for (int i = current_depth() - 1; i > 0; --i) {
-      InstanceKlass* ik = class_at_depth(i);
-
-      if (ik->is_interface()) {
-        int end;
-        int start = ik->find_method_by_name(_method_name, &end);
-        if (start != -1) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
- public:
-
-  ErasedShadowChecker(Thread* thread, Symbol* name, InstanceKlass* holder,
-                InstanceKlass* target)
-    : ShadowChecker(thread, name, holder, target) {}
-};
-
-// Find the unique qualified candidate from the perspective of the super_class
-// which is the resolved_klass, which must be an immediate superinterface
-// of klass
-Method* find_erased_super_default(InstanceKlass* current_class, InstanceKlass* super_class, Symbol* method_name, Symbol* sig, TRAPS) {
-
-  FindMethodsByErasedSig visitor(method_name, sig);
-  visitor.run(super_class);      // find candidates from resolved_klass
-
-  MethodFamily* family;
-  visitor.get_discovered_family(&family);
-
-  if (family != NULL) {
-    family->determine_target(current_class, CHECK_NULL);  // get target from current_class
-
-    if (family->has_target()) {
-      Method* target = family->get_selected_target();
-      InstanceKlass* holder = InstanceKlass::cast(target->method_holder());
-
-      // Verify that the identified method is valid from the context of
-      // the current class, which is the caller class for invokespecial
-      // link resolution, i.e. ensure there it is not shadowed.
-      // You can use invokespecial to disambiguate interface methods, but
-      // you can not use it to skip over an interface method that would shadow it.
-      ErasedShadowChecker checker(THREAD, target->name(), holder, super_class);
-      checker.run(current_class);
-
-      if (checker.found_shadow()) {
-#ifndef PRODUCT
-        if (TraceDefaultMethods) {
-          tty->print_cr("    Only candidate found was shadowed.");
-        }
-#endif // ndef PRODUCT
-        THROW_MSG_(vmSymbols::java_lang_AbstractMethodError(),
-                   "Accessible default method not found", NULL);
-      } else {
-#ifndef PRODUCT
-        if (TraceDefaultMethods) {
-          family->print_sig_on(tty, target->signature(), 1);
-        }
-#endif // ndef PRODUCT
-        return target;
-      }
-    } else {
-      assert(family->throws_exception(), "must have target or throw");
-      THROW_MSG_(vmSymbols::java_lang_AbstractMethodError(),
-                 family->get_exception_message()->as_C_string(), NULL);
-   }
-  } else {
-    // no method found
-    ResourceMark rm(THREAD);
-    THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(),
-              Method::name_and_sig_as_C_string(current_class,
-                                               method_name, sig), NULL);
-  }
-}
-// This is called during linktime when we find an invokespecial call that
-// refers to a direct superinterface.  It indicates that we should find the
-// default method in the hierarchy of that superinterface, and if that method
-// would have been a candidate from the point of view of 'this' class, then we
-// return that method.
-// This logic assumes that the super is a direct superclass of the caller
-Method* DefaultMethods::find_super_default(
-    Klass* cls, Klass* super, Symbol* method_name, Symbol* sig, TRAPS) {
-
-  ResourceMark rm(THREAD);
-
-  assert(cls != NULL && super != NULL, "Need real classes");
-
-  InstanceKlass* current_class = InstanceKlass::cast(cls);
-  InstanceKlass* super_class = InstanceKlass::cast(super);
-
-  // Keep entire hierarchy alive for the duration of the computation
-  KeepAliveRegistrar keepAlive(THREAD);
-  KeepAliveVisitor loadKeepAlive(&keepAlive);
-  loadKeepAlive.run(current_class);   // get hierarchy from current class
-
-#ifndef PRODUCT
-  if (TraceDefaultMethods) {
-    tty->print_cr("Finding super default method %s.%s%s from %s",
-      super_class->name()->as_C_string(),
-      method_name->as_C_string(), sig->as_C_string(),
-      current_class->name()->as_C_string());
-  }
-#endif // ndef PRODUCT
-
-  assert(super_class->is_interface(), "only call for default methods");
-
-  Method* target = NULL;
-  target = find_erased_super_default(current_class, super_class,
-                                     method_name, sig, CHECK_NULL);
-
-#ifndef PRODUCT
-  if (target != NULL) {
-    if (TraceDefaultMethods) {
-      tty->print("    Returning ");
-      print_method(tty, target, true);
-      tty->print_cr("");
-    }
-  }
-#endif // ndef PRODUCT
-  return target;
-}
-
-#ifndef PRODUCT
+#ifdef ASSERT
 // Return true is broad type is a covariant return of narrow type
 static bool covariant_return_type(BasicType narrow, BasicType broad) {
   if (narrow == broad) {
@@ -988,7 +804,7 @@
   }
   return false;
 }
-#endif // ndef PRODUCT
+#endif
 
 static int assemble_redirect(
     BytecodeConstantPool* cp, BytecodeBuffer* buffer,
@@ -1035,10 +851,9 @@
   return parameter_count;
 }
 
-static int assemble_abstract_method_error(
-    BytecodeConstantPool* cp, BytecodeBuffer* buffer, Symbol* message, TRAPS) {
+static int assemble_method_error(
+    BytecodeConstantPool* cp, BytecodeBuffer* buffer, Symbol* errorName, Symbol* message, TRAPS) {
 
-  Symbol* errorName = vmSymbols::java_lang_AbstractMethodError();
   Symbol* init = vmSymbols::object_initializer_name();
   Symbol* sig = vmSymbols::string_void_signature();
 
@@ -1150,8 +965,7 @@
             &bpool, &buffer, slot->signature(), selected, CHECK);
         }
       } else if (method->throws_exception()) {
-        max_stack = assemble_abstract_method_error(
-            &bpool, &buffer, method->get_exception_message(), CHECK);
+        max_stack = assemble_method_error(&bpool, &buffer, method->get_exception_name(), method->get_exception_message(), CHECK);
       }
       if (max_stack != 0) {
         AccessFlags flags = accessFlags_from(
@@ -1281,4 +1095,3 @@
     MetadataFactory::free_array(cld, original_ordering);
   }
 }
-
--- a/hotspot/src/share/vm/classfile/defaultMethods.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/defaultMethods.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -44,15 +44,5 @@
   // the class.
   static void generate_default_methods(
       InstanceKlass* klass, GrowableArray<Method*>* mirandas, TRAPS);
-
-
-  // Called during linking when an invokespecial to an direct interface
-  // method is found.  Selects and returns a method if there is a unique
-  // default method in the 'super_iface' part of the hierarchy which is
-  // also a candidate default for 'this_klass'.  Otherwise throws an AME.
-  static Method* find_super_default(
-      Klass* this_klass, Klass* super_iface,
-      Symbol* method_name, Symbol* method_sig, TRAPS);
 };
-
 #endif // SHARE_VM_CLASSFILE_DEFAULTMETHODS_HPP
--- a/hotspot/src/share/vm/classfile/dictionary.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -264,7 +264,7 @@
     }
     if (method_type() != NULL) {
       if (printed)  st->print(" and ");
-      st->print(INTPTR_FORMAT, method_type());
+      st->print(INTPTR_FORMAT, (void *)method_type());
       printed = true;
     }
     st->print_cr(printed ? "" : "(empty)");
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -438,6 +438,29 @@
   return true;
 }
 
+bool java_lang_String::equals(oop str1, oop str2) {
+  assert(str1->klass() == SystemDictionary::String_klass(),
+         "must be java String");
+  assert(str2->klass() == SystemDictionary::String_klass(),
+         "must be java String");
+  typeArrayOop value1  = java_lang_String::value(str1);
+  int          offset1 = java_lang_String::offset(str1);
+  int          length1 = java_lang_String::length(str1);
+  typeArrayOop value2  = java_lang_String::value(str2);
+  int          offset2 = java_lang_String::offset(str2);
+  int          length2 = java_lang_String::length(str2);
+
+  if (length1 != length2) {
+    return false;
+  }
+  for (int i = 0; i < length1; i++) {
+    if (value1->char_at(i + offset1) != value2->char_at(i + offset2)) {
+      return false;
+    }
+  }
+  return true;
+}
+
 void java_lang_String::print(Handle java_string, outputStream* st) {
   oop          obj    = java_string();
   assert(obj->klass() == SystemDictionary::String_klass(), "must be java_string");
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -182,6 +182,7 @@
   static unsigned int hash_string(oop java_string);
 
   static bool equals(oop java_string, jchar* chars, int len);
+  static bool equals(oop str1, oop str2);
 
   // Conversion between '.' and '/' formats
   static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); }
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -341,7 +341,7 @@
 
 Symbol* SymbolTable::basic_add(int index_arg, u1 *name, int len,
                                unsigned int hashValue_arg, bool c_heap, TRAPS) {
-  assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),
+  assert(!Universe::heap()->is_in_reserved(name),
          "proposed name of symbol must be stable");
 
   // Don't allow symbols to be created which cannot fit in a Symbol*.
@@ -685,7 +685,7 @@
   if (found_string != NULL) return found_string;
 
   debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
-  assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),
+  assert(!Universe::heap()->is_in_reserved(name),
          "proposed name of symbol must be stable");
 
   Handle string;
@@ -807,6 +807,8 @@
   }
 }
 
+// This verification is part of Universe::verify() and needs to be quick.
+// See StringTable::verify_and_compare() below for exhaustive verification.
 void StringTable::verify() {
   for (int i = 0; i < the_table()->table_size(); ++i) {
     HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
@@ -825,6 +827,162 @@
   the_table()->dump_table(st, "StringTable");
 }
 
+StringTable::VerifyRetTypes StringTable::compare_entries(
+                                      int bkt1, int e_cnt1,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr1,
+                                      int bkt2, int e_cnt2,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr2) {
+  // These entries are sanity checked by verify_and_compare_entries()
+  // before this function is called.
+  oop str1 = e_ptr1->literal();
+  oop str2 = e_ptr2->literal();
+
+  if (str1 == str2) {
+    tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") "
+                  "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]",
+                  (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2);
+    return _verify_fail_continue;
+  }
+
+  if (java_lang_String::equals(str1, str2)) {
+    tty->print_cr("ERROR: identical String values in entry @ "
+                  "bucket[%d][%d] and entry @ bucket[%d][%d]",
+                  bkt1, e_cnt1, bkt2, e_cnt2);
+    return _verify_fail_continue;
+  }
+
+  return _verify_pass;
+}
+
+StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr,
+                                      StringTable::VerifyMesgModes mesg_mode) {
+
+  VerifyRetTypes ret = _verify_pass;  // be optimistic
+
+  oop str = e_ptr->literal();
+  if (str == NULL) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt,
+                    e_cnt);
+    }
+    // NULL oop means no more verifications are possible
+    return _verify_fail_done;
+  }
+
+  if (str->klass() != SystemDictionary::String_klass()) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]",
+                    bkt, e_cnt);
+    }
+    // not a String means no more verifications are possible
+    return _verify_fail_done;
+  }
+
+  unsigned int h = java_lang_String::hash_string(str);
+  if (e_ptr->hash() != h) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], "
+                    "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h);
+    }
+    ret = _verify_fail_continue;
+  }
+
+  if (the_table()->hash_to_index(h) != bkt) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], "
+                    "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h,
+                    the_table()->hash_to_index(h));
+    }
+    ret = _verify_fail_continue;
+  }
+
+  return ret;
+}
+
+// See StringTable::verify() above for the quick verification that is
+// part of Universe::verify(). This verification is exhaustive and
+// reports on every issue that is found. StringTable::verify() only
+// reports on the first issue that is found.
+//
+// StringTable::verify_entry() checks:
+// - oop value != NULL (same as verify())
+// - oop value is a String
+// - hash(String) == hash in entry (same as verify())
+// - index for hash == index of entry (same as verify())
+//
+// StringTable::compare_entries() checks:
+// - oops are unique across all entries
+// - String values are unique across all entries
+//
+int StringTable::verify_and_compare_entries() {
+  assert(StringTable_lock->is_locked(), "sanity check");
+
+  int  fail_cnt = 0;
+
+  // first, verify all the entries individually:
+  for (int bkt = 0; bkt < the_table()->table_size(); bkt++) {
+    HashtableEntry<oop, mtSymbol>* e_ptr = the_table()->bucket(bkt);
+    for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) {
+      VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs);
+      if (ret != _verify_pass) {
+        fail_cnt++;
+      }
+    }
+  }
+
+  // Optimization: if the above check did not find any failures, then
+  // the comparison loop below does not need to call verify_entry()
+  // before calling compare_entries(). If there were failures, then we
+  // have to call verify_entry() to see if the entry can be passed to
+  // compare_entries() safely. When we call verify_entry() in the loop
+  // below, we do so quietly to void duplicate messages and we don't
+  // increment fail_cnt because the failures have already been counted.
+  bool need_entry_verify = (fail_cnt != 0);
+
+  // second, verify all entries relative to each other:
+  for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) {
+    HashtableEntry<oop, mtSymbol>* e_ptr1 = the_table()->bucket(bkt1);
+    for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) {
+      if (need_entry_verify) {
+        VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1,
+                                          _verify_quietly);
+        if (ret == _verify_fail_done) {
+          // cannot use the current entry to compare against other entries
+          continue;
+        }
+      }
+
+      for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) {
+        HashtableEntry<oop, mtSymbol>* e_ptr2 = the_table()->bucket(bkt2);
+        int e_cnt2;
+        for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) {
+          if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) {
+            // skip the entries up to and including the one that
+            // we're comparing against
+            continue;
+          }
+
+          if (need_entry_verify) {
+            VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2,
+                                              _verify_quietly);
+            if (ret == _verify_fail_done) {
+              // cannot compare against this entry
+              continue;
+            }
+          }
+
+          // compare two entries, report and count any failures:
+          if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2)
+              != _verify_pass) {
+            fail_cnt++;
+          }
+        }
+      }
+    }
+  }
+  return fail_cnt;
+}
 
 // Create a new table and using alternate hash code, populate the new table
 // with the existing strings.   Set flag to use the alternate hash code afterwards.
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -311,6 +311,26 @@
   static void verify();
   static void dump(outputStream* st);
 
+  enum VerifyMesgModes {
+    _verify_quietly    = 0,
+    _verify_with_mesgs = 1
+  };
+
+  enum VerifyRetTypes {
+    _verify_pass          = 0,
+    _verify_fail_continue = 1,
+    _verify_fail_done     = 2
+  };
+
+  static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
+                                        HashtableEntry<oop, mtSymbol>* e_ptr1,
+                                        int bkt2, int e_cnt2,
+                                        HashtableEntry<oop, mtSymbol>* e_ptr2);
+  static VerifyRetTypes verify_entry(int bkt, int e_cnt,
+                                     HashtableEntry<oop, mtSymbol>* e_ptr,
+                                     VerifyMesgModes mesg_mode);
+  static int verify_and_compare_entries();
+
   // Sharing
   static void copy_buckets(char** top, char*end) {
     the_table()->Hashtable<oop, mtSymbol>::copy_buckets(top, end);
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -270,7 +270,7 @@
   template(java_lang_invoke_LambdaForm,               "java/lang/invoke/LambdaForm")              \
   template(java_lang_invoke_ForceInline_signature,    "Ljava/lang/invoke/ForceInline;")           \
   template(java_lang_invoke_DontInline_signature,     "Ljava/lang/invoke/DontInline;")            \
-  template(sun_invoke_Stable_signature,               "Lsun/invoke/Stable;")                      \
+  template(java_lang_invoke_Stable_signature,         "Ljava/lang/invoke/Stable;")                \
   template(java_lang_invoke_LambdaForm_Compiled_signature, "Ljava/lang/invoke/LambdaForm$Compiled;") \
   template(java_lang_invoke_LambdaForm_Hidden_signature, "Ljava/lang/invoke/LambdaForm$Hidden;")  \
   template(java_lang_invoke_MagicLambdaImpl,          "java/lang/invoke/MagicLambdaImpl")         \
@@ -631,6 +631,10 @@
   do_name(log_name,"log")       do_name(log10_name,"log10")     do_name(pow_name,"pow")                                 \
   do_name(exp_name,"exp")       do_name(min_name,"min")         do_name(max_name,"max")                                 \
                                                                                                                         \
+  do_name(addExact_name,"addExact")                                                                                     \
+  do_name(subtractExact_name,"subtractExact")                                                                           \
+  do_name(multiplyExact_name,"multiplyExact")                                                                           \
+                                                                                                                        \
   do_intrinsic(_dabs,                     java_lang_Math,         abs_name,   double_double_signature,           F_S)   \
   do_intrinsic(_dsin,                     java_lang_Math,         sin_name,   double_double_signature,           F_S)   \
   do_intrinsic(_dcos,                     java_lang_Math,         cos_name,   double_double_signature,           F_S)   \
@@ -643,6 +647,7 @@
   do_intrinsic(_dexp,                     java_lang_Math,         exp_name,   double_double_signature,           F_S)   \
   do_intrinsic(_min,                      java_lang_Math,         min_name,   int2_int_signature,                F_S)   \
   do_intrinsic(_max,                      java_lang_Math,         max_name,   int2_int_signature,                F_S)   \
+  do_intrinsic(_addExact,                 java_lang_Math,         addExact_name, int2_int_signature,             F_S)   \
                                                                                                                         \
   do_intrinsic(_floatToRawIntBits,        java_lang_Float,        floatToRawIntBits_name,   float_int_signature, F_S)   \
    do_name(     floatToRawIntBits_name,                          "floatToRawIntBits")                                   \
--- a/hotspot/src/share/vm/code/codeCache.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -124,7 +124,6 @@
 int CodeCache::_number_of_nmethods_with_dependencies = 0;
 bool CodeCache::_needs_cache_clean = false;
 nmethod* CodeCache::_scavenge_root_nmethods = NULL;
-nmethod* CodeCache::_saved_nmethods = NULL;
 
 int CodeCache::_codemem_full_count = 0;
 
@@ -464,96 +463,11 @@
 }
 #endif //PRODUCT
 
-/**
- * Remove and return nmethod from the saved code list in order to reanimate it.
- */
-nmethod* CodeCache::reanimate_saved_code(Method* m) {
-  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-  nmethod* saved = _saved_nmethods;
-  nmethod* prev = NULL;
-  while (saved != NULL) {
-    if (saved->is_in_use() && saved->method() == m) {
-      if (prev != NULL) {
-        prev->set_saved_nmethod_link(saved->saved_nmethod_link());
-      } else {
-        _saved_nmethods = saved->saved_nmethod_link();
-      }
-      assert(saved->is_speculatively_disconnected(), "shouldn't call for other nmethods");
-      saved->set_speculatively_disconnected(false);
-      saved->set_saved_nmethod_link(NULL);
-      if (PrintMethodFlushing) {
-        saved->print_on(tty, " ### nmethod is reconnected");
-      }
-      if (LogCompilation && (xtty != NULL)) {
-        ttyLocker ttyl;
-        xtty->begin_elem("nmethod_reconnected compile_id='%3d'", saved->compile_id());
-        xtty->method(m);
-        xtty->stamp();
-        xtty->end_elem();
-      }
-      return saved;
-    }
-    prev = saved;
-    saved = saved->saved_nmethod_link();
-  }
-  return NULL;
-}
-
-/**
- * Remove nmethod from the saved code list in order to discard it permanently
- */
-void CodeCache::remove_saved_code(nmethod* nm) {
-  // For conc swpr this will be called with CodeCache_lock taken by caller
-  assert_locked_or_safepoint(CodeCache_lock);
-  assert(nm->is_speculatively_disconnected(), "shouldn't call for other nmethods");
-  nmethod* saved = _saved_nmethods;
-  nmethod* prev = NULL;
-  while (saved != NULL) {
-    if (saved == nm) {
-      if (prev != NULL) {
-        prev->set_saved_nmethod_link(saved->saved_nmethod_link());
-      } else {
-        _saved_nmethods = saved->saved_nmethod_link();
-      }
-      if (LogCompilation && (xtty != NULL)) {
-        ttyLocker ttyl;
-        xtty->begin_elem("nmethod_removed compile_id='%3d'", nm->compile_id());
-        xtty->stamp();
-        xtty->end_elem();
-      }
-      return;
-    }
-    prev = saved;
-    saved = saved->saved_nmethod_link();
-  }
-  ShouldNotReachHere();
-}
-
-void CodeCache::speculatively_disconnect(nmethod* nm) {
-  assert_locked_or_safepoint(CodeCache_lock);
-  assert(nm->is_in_use() && !nm->is_speculatively_disconnected(), "should only disconnect live nmethods");
-  nm->set_saved_nmethod_link(_saved_nmethods);
-  _saved_nmethods = nm;
-  if (PrintMethodFlushing) {
-    nm->print_on(tty, " ### nmethod is speculatively disconnected");
-  }
-  if (LogCompilation && (xtty != NULL)) {
-    ttyLocker ttyl;
-    xtty->begin_elem("nmethod_disconnected compile_id='%3d'", nm->compile_id());
-    xtty->method(nm->method());
-    xtty->stamp();
-    xtty->end_elem();
-  }
-  nm->method()->clear_code();
-  nm->set_speculatively_disconnected(true);
-}
-
 
 void CodeCache::gc_prologue() {
   assert(!nmethod::oops_do_marking_is_active(), "oops_do_marking_epilogue must be called");
 }
 
-
 void CodeCache::gc_epilogue() {
   assert_locked_or_safepoint(CodeCache_lock);
   FOR_ALL_ALIVE_BLOBS(cb) {
--- a/hotspot/src/share/vm/code/codeCache.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -57,7 +57,6 @@
   static int _number_of_nmethods_with_dependencies;
   static bool _needs_cache_clean;
   static nmethod* _scavenge_root_nmethods;  // linked via nm->scavenge_root_link()
-  static nmethod* _saved_nmethods;          // Linked list of speculatively disconnected nmethods.
 
   static void verify_if_often() PRODUCT_RETURN;
 
@@ -167,17 +166,12 @@
   static size_t  capacity()                      { return _heap->capacity(); }
   static size_t  max_capacity()                  { return _heap->max_capacity(); }
   static size_t  unallocated_capacity()          { return _heap->unallocated_capacity(); }
-  static bool    needs_flushing()                { return unallocated_capacity() < CodeCacheFlushingMinimumFreeSpace; }
   static double  reverse_free_ratio();
 
   static bool needs_cache_clean()                { return _needs_cache_clean; }
   static void set_needs_cache_clean(bool v)      { _needs_cache_clean = v;    }
   static void clear_inline_caches();             // clear all inline caches
 
-  static nmethod* reanimate_saved_code(Method* m);
-  static void remove_saved_code(nmethod* nm);
-  static void speculatively_disconnect(nmethod* nm);
-
   // Deoptimization
   static int  mark_for_deoptimization(DepChange& changes);
 #ifdef HOTSWAP
--- a/hotspot/src/share/vm/code/compiledIC.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/code/compiledIC.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -160,7 +160,7 @@
 // High-level access to an inline cache. Guaranteed to be MT-safe.
 
 
-void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
+bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
   assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
   assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic");
   assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?");
@@ -170,8 +170,10 @@
     assert(bytecode == Bytecodes::_invokeinterface, "");
     int itable_index = call_info->itable_index();
     entry = VtableStubs::find_itable_stub(itable_index);
+    if (entry == false) {
+      return false;
+    }
 #ifdef ASSERT
-    assert(entry != NULL, "entry not computed");
     int index = call_info->resolved_method()->itable_index();
     assert(index == itable_index, "CallInfo pre-computes this");
 #endif //ASSERT
@@ -184,6 +186,9 @@
     int vtable_index = call_info->vtable_index();
     assert(call_info->resolved_klass()->verify_vtable_index(vtable_index), "sanity check");
     entry = VtableStubs::find_vtable_stub(vtable_index);
+    if (entry == NULL) {
+      return false;
+    }
     InlineCacheBuffer::create_transition_stub(this, NULL, entry);
   }
 
@@ -200,6 +205,7 @@
   // race because the IC entry was complete when we safepointed so
   // cleaning it immediately is harmless.
   // assert(is_megamorphic(), "sanity check");
+  return true;
 }
 
 
--- a/hotspot/src/share/vm/code/compiledIC.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/code/compiledIC.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -226,7 +226,10 @@
   //
   void set_to_clean();  // Can only be called during a safepoint operation
   void set_to_monomorphic(CompiledICInfo& info);
-  void set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS);
+
+  // Returns true if successful and false otherwise. The call can fail if memory
+  // allocation in the code cache fails.
+  bool set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS);
 
   static void compute_monomorphic_entry(methodHandle method, KlassHandle receiver_klass,
                                         bool is_optimized, bool static_bound, CompiledICInfo& info, TRAPS);
--- a/hotspot/src/share/vm/code/nmethod.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -462,7 +462,6 @@
   _state                      = alive;
   _marked_for_reclamation     = 0;
   _has_flushed_dependencies   = 0;
-  _speculatively_disconnected = 0;
   _has_unsafe_access          = 0;
   _has_method_handle_invokes  = 0;
   _lazy_critical_native       = 0;
@@ -481,7 +480,6 @@
   _osr_link                = NULL;
   _scavenge_root_link      = NULL;
   _scavenge_root_state     = 0;
-  _saved_nmethod_link      = NULL;
   _compiler                = NULL;
 
 #ifdef HAVE_DTRACE_H
@@ -686,6 +684,7 @@
     _osr_entry_point         = NULL;
     _exception_cache         = NULL;
     _pc_desc_cache.reset_to(NULL);
+    _hotness_counter         = NMethodSweeper::hotness_counter_reset_val();
 
     code_buffer->copy_values_to(this);
     if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
@@ -770,6 +769,7 @@
     _osr_entry_point         = NULL;
     _exception_cache         = NULL;
     _pc_desc_cache.reset_to(NULL);
+    _hotness_counter         = NMethodSweeper::hotness_counter_reset_val();
 
     code_buffer->copy_values_to(this);
     debug_only(verify_scavenge_root_oops());
@@ -842,6 +842,7 @@
     _comp_level              = comp_level;
     _compiler                = compiler;
     _orig_pc_offset          = orig_pc_offset;
+    _hotness_counter         = NMethodSweeper::hotness_counter_reset_val();
 
     // Section offsets
     _consts_offset           = content_offset()      + code_buffer->total_offset_of(code_buffer->consts());
@@ -1176,7 +1177,7 @@
 
 // This is a private interface with the sweeper.
 void nmethod::mark_as_seen_on_stack() {
-  assert(is_not_entrant(), "must be a non-entrant method");
+  assert(is_alive(), "Must be an alive method");
   // Set the traversal mark to ensure that the sweeper does 2
   // cleaning passes before moving to zombie.
   set_stack_traversal_mark(NMethodSweeper::traversal_count());
@@ -1261,7 +1262,7 @@
 
   set_osr_link(NULL);
   //set_scavenge_root_link(NULL); // done by prune_scavenge_root_nmethods
-  NMethodSweeper::notify(this);
+  NMethodSweeper::notify();
 }
 
 void nmethod::invalidate_osr_method() {
@@ -1351,6 +1352,15 @@
       nmethod_needs_unregister = true;
     }
 
+    // Must happen before state change. Otherwise we have a race condition in
+    // nmethod::can_not_entrant_be_converted(). I.e., a method can immediately
+    // transition its state from 'not_entrant' to 'zombie' without having to wait
+    // for stack scanning.
+    if (state == not_entrant) {
+      mark_as_seen_on_stack();
+      OrderAccess::storestore();
+    }
+
     // Change state
     _state = state;
 
@@ -1369,11 +1379,6 @@
       HandleMark hm;
       method()->clear_code();
     }
-
-    if (state == not_entrant) {
-      mark_as_seen_on_stack();
-    }
-
   } // leave critical region under Patching_lock
 
   // When the nmethod becomes zombie it is no longer alive so the
@@ -1416,7 +1421,7 @@
   }
 
   // Make sweeper aware that there is a zombie method that needs to be removed
-  NMethodSweeper::notify(this);
+  NMethodSweeper::notify();
 
   return true;
 }
@@ -1451,10 +1456,6 @@
     CodeCache::drop_scavenge_root_nmethod(this);
   }
 
-  if (is_speculatively_disconnected()) {
-    CodeCache::remove_saved_code(this);
-  }
-
 #ifdef SHARK
   ((SharkCompiler *) compiler())->free_compiled_method(insts_begin());
 #endif // SHARK
@@ -1965,7 +1966,7 @@
     if (!_detected_scavenge_root)  _print_nm->print_on(tty, "new scavenge root");
     tty->print_cr(""PTR_FORMAT"[offset=%d] detected scavengable oop "PTR_FORMAT" (found at "PTR_FORMAT")",
                   _print_nm, (int)((intptr_t)p - (intptr_t)_print_nm),
-                  (intptr_t)(*p), (intptr_t)p);
+                  (void *)(*p), (intptr_t)p);
     (*p)->print();
   }
 #endif //PRODUCT
@@ -2345,7 +2346,7 @@
       _ok = false;
     }
     tty->print_cr("*** non-oop "PTR_FORMAT" found at "PTR_FORMAT" (offset %d)",
-                  (intptr_t)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
+                  (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
   }
   virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
 };
@@ -2466,7 +2467,7 @@
       _ok = false;
     }
     tty->print_cr("*** scavengable oop "PTR_FORMAT" found at "PTR_FORMAT" (offset %d)",
-                  (intptr_t)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
+                  (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
     (*p)->print();
   }
   virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
--- a/hotspot/src/share/vm/code/nmethod.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -119,7 +119,6 @@
   // To support simple linked-list chaining of nmethods:
   nmethod*  _osr_link;         // from InstanceKlass::osr_nmethods_head
   nmethod*  _scavenge_root_link; // from CodeCache::scavenge_root_nmethods
-  nmethod*  _saved_nmethod_link; // from CodeCache::speculatively_disconnect
 
   static nmethod* volatile _oops_do_mark_nmethods;
   nmethod*        volatile _oops_do_mark_link;
@@ -165,7 +164,6 @@
 
   // protected by CodeCache_lock
   bool _has_flushed_dependencies;            // Used for maintenance of dependencies (CodeCache_lock)
-  bool _speculatively_disconnected;          // Marked for potential unload
 
   bool _marked_for_reclamation;              // Used by NMethodSweeper (set only by sweeper)
   bool _marked_for_deoptimization;           // Used for stack deoptimization
@@ -180,7 +178,7 @@
   unsigned int _has_wide_vectors:1;          // Preserve wide vectors at safepoints
 
   // Protected by Patching_lock
-  unsigned char _state;                      // {alive, not_entrant, zombie, unloaded}
+  volatile unsigned char _state;             // {alive, not_entrant, zombie, unloaded}
 
 #ifdef ASSERT
   bool _oops_are_stale;  // indicates that it's no longer safe to access oops section
@@ -202,11 +200,18 @@
 
   // not_entrant method removal. Each mark_sweep pass will update
   // this mark to current sweep invocation count if it is seen on the
-  // stack.  An not_entrant method can be removed when there is no
+  // stack.  An not_entrant method can be removed when there are no
   // more activations, i.e., when the _stack_traversal_mark is less than
   // current sweep traversal index.
   long _stack_traversal_mark;
 
+  // The _hotness_counter indicates the hotness of a method. The higher
+  // the value the hotter the method. The hotness counter of a nmethod is
+  // set to [(ReservedCodeCacheSize / (1024 * 1024)) * 2] each time the method
+  // is active while stack scanning (mark_active_nmethods()). The hotness
+  // counter is decreased (by 1) while sweeping.
+  int _hotness_counter;
+
   ExceptionCache *_exception_cache;
   PcDescCache     _pc_desc_cache;
 
@@ -382,6 +387,10 @@
 
   int total_size        () const;
 
+  void dec_hotness_counter()        { _hotness_counter--; }
+  void set_hotness_counter(int val) { _hotness_counter = val; }
+  int  hotness_counter() const      { return _hotness_counter; }
+
   // Containment
   bool consts_contains       (address addr) const { return consts_begin       () <= addr && addr < consts_end       (); }
   bool insts_contains        (address addr) const { return insts_begin        () <= addr && addr < insts_end        (); }
@@ -408,8 +417,8 @@
   // alive.  It is used when an uncommon trap happens.  Returns true
   // if this thread changed the state of the nmethod or false if
   // another thread performed the transition.
-  bool  make_not_entrant()                        { return make_not_entrant_or_zombie(not_entrant); }
-  bool  make_zombie()                             { return make_not_entrant_or_zombie(zombie); }
+  bool  make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); }
+  bool  make_zombie()      { return make_not_entrant_or_zombie(zombie); }
 
   // used by jvmti to track if the unload event has been reported
   bool  unload_reported()                         { return _unload_reported; }
@@ -437,9 +446,6 @@
   bool  has_method_handle_invokes() const         { return _has_method_handle_invokes; }
   void  set_has_method_handle_invokes(bool z)     { _has_method_handle_invokes = z; }
 
-  bool  is_speculatively_disconnected() const     { return _speculatively_disconnected; }
-  void  set_speculatively_disconnected(bool z)    { _speculatively_disconnected = z; }
-
   bool  is_lazy_critical_native() const           { return _lazy_critical_native; }
   void  set_lazy_critical_native(bool z)          { _lazy_critical_native = z; }
 
@@ -499,9 +505,6 @@
   nmethod* scavenge_root_link() const                  { return _scavenge_root_link; }
   void     set_scavenge_root_link(nmethod *n)          { _scavenge_root_link = n; }
 
-  nmethod* saved_nmethod_link() const                  { return _saved_nmethod_link; }
-  void     set_saved_nmethod_link(nmethod *n)          { _saved_nmethod_link = n; }
-
  public:
 
   // Sweeper support
--- a/hotspot/src/share/vm/code/vtableStubs.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/code/vtableStubs.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -46,12 +46,9 @@
 address VtableStub::_chunk_end         = NULL;
 VMReg   VtableStub::_receiver_location = VMRegImpl::Bad();
 
-static int num_vtable_chunks = 0;
-
 
 void* VtableStub::operator new(size_t size, int code_size) throw() {
   assert(size == sizeof(VtableStub), "mismatched size");
-  num_vtable_chunks++;
   // compute real VtableStub size (rounded to nearest word)
   const int real_size = round_to(code_size + sizeof(VtableStub), wordSize);
   // malloc them in chunks to minimize header overhead
@@ -60,7 +57,7 @@
     const int bytes = chunk_factor * real_size + pd_code_alignment();
     BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
     if (blob == NULL) {
-      vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "CodeCache: no room for vtable chunks");
+      return NULL;
     }
     _chunk = blob->content_begin();
     _chunk_end = _chunk + bytes;
@@ -121,6 +118,12 @@
     } else {
       s = create_itable_stub(vtable_index);
     }
+
+    // Creation of vtable or itable can fail if there is not enough free space in the code cache.
+    if (s == NULL) {
+      return NULL;
+    }
+
     enter(is_vtable_stub, vtable_index, s);
     if (PrintAdapterHandlers) {
       tty->print_cr("Decoding VtableStub %s[%d]@%d",
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -634,19 +634,36 @@
   NMethodSweeper::possibly_sweep();
 
   MutexLocker locker(lock());
-  // Wait for an available CompileTask.
+  // If _first is NULL we have no more compile jobs. There are two reasons for
+  // having no compile jobs: First, we compiled everything we wanted. Second,
+  // we ran out of code cache so compilation has been disabled. In the latter
+  // case we perform code cache sweeps to free memory such that we can re-enable
+  // compilation.
   while (_first == NULL) {
-    // There is no work to be done right now.  Wait.
-    if (UseCodeCacheFlushing && (!CompileBroker::should_compile_new_jobs() || CodeCache::needs_flushing())) {
-      // During the emergency sweeping periods, wake up and sweep occasionally
-      bool timedout = lock()->wait(!Mutex::_no_safepoint_check_flag, NmethodSweepCheckInterval*1000);
-      if (timedout) {
+    if (UseCodeCacheFlushing && !CompileBroker::should_compile_new_jobs()) {
+      // Wait a certain amount of time to possibly do another sweep.
+      // We must wait until stack scanning has happened so that we can
+      // transition a method's state from 'not_entrant' to 'zombie'.
+      long wait_time = NmethodSweepCheckInterval * 1000;
+      if (FLAG_IS_DEFAULT(NmethodSweepCheckInterval)) {
+        // Only one thread at a time can do sweeping. Scale the
+        // wait time according to the number of compiler threads.
+        // As a result, the next sweep is likely to happen every 100ms
+        // with an arbitrary number of threads that do sweeping.
+        wait_time = 100 * CICompilerCount;
+      }
+      bool timeout = lock()->wait(!Mutex::_no_safepoint_check_flag, wait_time);
+      if (timeout) {
         MutexUnlocker ul(lock());
-        // When otherwise not busy, run nmethod sweeping
         NMethodSweeper::possibly_sweep();
       }
     } else {
-      // During normal operation no need to wake up on timer
+      // If there are no compilation tasks and we can compile new jobs
+      // (i.e., there is enough free space in the code cache) there is
+      // no need to invoke the sweeper. As a result, the hotness of methods
+      // remains unchanged. This behavior is desired, since we want to keep
+      // the stable state, i.e., we do not want to evict methods from the
+      // code cache if it is unnecessary.
       lock()->wait();
     }
   }
@@ -1227,16 +1244,9 @@
         return method_code;
       }
     }
-    if (method->is_not_compilable(comp_level)) return NULL;
-
-    if (UseCodeCacheFlushing) {
-      nmethod* saved = CodeCache::reanimate_saved_code(method());
-      if (saved != NULL) {
-        method->set_code(method, saved);
-        return saved;
-      }
+    if (method->is_not_compilable(comp_level)) {
+      return NULL;
     }
-
   } else {
     // osr compilation
 #ifndef TIERED
@@ -1585,9 +1595,6 @@
       if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) {
         // the code cache is really full
         handle_full_code_cache();
-      } else if (UseCodeCacheFlushing && CodeCache::needs_flushing()) {
-        // Attempt to start cleaning the code cache while there is still a little headroom
-        NMethodSweeper::handle_full_code_cache(false);
       }
 
       CompileTask* task = queue->get();
@@ -1943,7 +1950,11 @@
     }
 #endif
     if (UseCodeCacheFlushing) {
-      NMethodSweeper::handle_full_code_cache(true);
+      // Since code cache is full, immediately stop new compiles
+      if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) {
+        NMethodSweeper::log_sweep("disable_compiler");
+        NMethodSweeper::possibly_sweep();
+      }
     } else {
       UseCompiler               = false;
       AlwaysCompileLoopMethods  = false;
--- a/hotspot/src/share/vm/compiler/oopMap.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/compiler/oopMap.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -628,7 +628,7 @@
 
 
 // Returns value of location as an int
-intptr_t value_of_loc(oop *pointer) { return (intptr_t)(*pointer); }
+intptr_t value_of_loc(oop *pointer) { return cast_from_oop<intptr_t>((*pointer)); }
 
 
 void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -9065,7 +9065,7 @@
   return !stack->isEmpty();
 }
 
-#define BUSY  (oop(0x1aff1aff))
+#define BUSY  (cast_to_oop<intptr_t>(0x1aff1aff))
 // (MT-safe) Get a prefix of at most "num" from the list.
 // The overflow list is chained through the mark word of
 // each object in the list. We fetch the entire list,
@@ -9098,7 +9098,7 @@
     return false;
   }
   // Grab the entire list; we'll put back a suffix
-  oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list);
+  oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
   Thread* tid = Thread::current();
   // Before "no_of_gc_threads" was introduced CMSOverflowSpinCount was
   // set to ParallelGCThreads.
@@ -9113,7 +9113,7 @@
       return false;
     } else if (_overflow_list != BUSY) {
       // Try and grab the prefix
-      prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list);
+      prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
     }
   }
   // If the list was found to be empty, or we spun long
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -2694,7 +2694,7 @@
 
     if (print_it) {
       _out->print_cr(" "PTR_FORMAT"%s",
-                     o, (over_tams) ? " >" : (marked) ? " M" : "");
+                     (void *)o, (over_tams) ? " >" : (marked) ? " M" : "");
       PrintReachableOopClosure oopCl(_out, _vo, _all);
       o->oop_iterate_no_header(&oopCl);
     }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -81,7 +81,7 @@
                                          size_t* marked_bytes_array,
                                          BitMap* task_card_bm) {
   G1CollectedHeap* g1h = _g1h;
-  CardTableModRefBS* ct_bs = (CardTableModRefBS*) (g1h->barrier_set());
+  CardTableModRefBS* ct_bs = g1h->g1_barrier_set();
 
   HeapWord* start = mr.start();
   HeapWord* end = mr.end();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc_implementation/g1/g1BiasedArray.hpp"
+
+#ifndef PRODUCT
+void G1BiasedMappedArrayBase::verify_index(idx_t index) const {
+  guarantee(_base != NULL, "Array not initialized");
+  guarantee(index < length(), err_msg("Index out of bounds index: "SIZE_FORMAT" length: "SIZE_FORMAT, index, length()));
+}
+
+void G1BiasedMappedArrayBase::verify_biased_index(idx_t biased_index) const {
+  guarantee(_biased_base != NULL, "Array not initialized");
+  guarantee(biased_index >= bias() && biased_index < (bias() + length()),
+    err_msg("Biased index out of bounds, index: "SIZE_FORMAT" bias: "SIZE_FORMAT" length: "SIZE_FORMAT, biased_index, bias(), length()));
+}
+
+void G1BiasedMappedArrayBase::verify_biased_index_inclusive_end(idx_t biased_index) const {
+  guarantee(_biased_base != NULL, "Array not initialized");
+  guarantee(biased_index >= bias() && biased_index <= (bias() + length()),
+    err_msg("Biased index out of inclusive bounds, index: "SIZE_FORMAT" bias: "SIZE_FORMAT" length: "SIZE_FORMAT, biased_index, bias(), length()));
+}
+
+class TestMappedArray : public G1BiasedMappedArray<int> {
+protected:
+  virtual int default_value() const { return 0xBAADBABE; }
+public:
+  static void test_biasedarray() {
+    const size_t REGION_SIZE_IN_WORDS = 512;
+    const size_t NUM_REGIONS = 20;
+    HeapWord* fake_heap = (HeapWord*)LP64_ONLY(0xBAAA00000) NOT_LP64(0xBA000000); // Any value that is non-zero
+
+    TestMappedArray array;
+    array.initialize(fake_heap, fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS,
+            REGION_SIZE_IN_WORDS * HeapWordSize);
+    // Check address calculation (bounds)
+    assert(array.bottom_address_mapped() == fake_heap,
+      err_msg("bottom mapped address should be "PTR_FORMAT", but is "PTR_FORMAT, fake_heap, array.bottom_address_mapped()));
+    assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be");
+
+    int* bottom = array.address_mapped_to(fake_heap);
+    assert((void*)bottom == (void*) array.base(), "must be");
+    int* end = array.address_mapped_to(fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS);
+    assert((void*)end == (void*)(array.base() + array.length()), "must be");
+    // The entire array should contain default value elements
+    for (int* current = bottom; current < end; current++) {
+      assert(*current == array.default_value(), "must be");
+    }
+
+    // Test setting values in the table
+
+    HeapWord* region_start_address = fake_heap + REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2);
+    HeapWord* region_end_address = fake_heap + (REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2) + REGION_SIZE_IN_WORDS - 1);
+
+    // Set/get by address tests: invert some value; first retrieve one
+    int actual_value = array.get_by_index(NUM_REGIONS / 2);
+    array.set_by_index(NUM_REGIONS / 2, ~actual_value);
+    // Get the same value by address, should correspond to the start of the "region"
+    int value = array.get_by_address(region_start_address);
+    assert(value == ~actual_value, "must be");
+    // Get the same value by address, at one HeapWord before the start
+    value = array.get_by_address(region_start_address - 1);
+    assert(value == array.default_value(), "must be");
+    // Get the same value by address, at the end of the "region"
+    value = array.get_by_address(region_end_address);
+    assert(value == ~actual_value, "must be");
+    // Make sure the next value maps to another index
+    value = array.get_by_address(region_end_address + 1);
+    assert(value == array.default_value(), "must be");
+
+    // Reset the value in the array
+    array.set_by_address(region_start_address + (region_end_address - region_start_address) / 2, actual_value);
+
+    // The entire array should have the default value again
+    for (int* current = bottom; current < end; current++) {
+      assert(*current == array.default_value(), "must be");
+    }
+
+    // Set/get by index tests: invert some value
+    idx_t index = NUM_REGIONS / 2;
+    actual_value = array.get_by_index(index);
+    array.set_by_index(index, ~actual_value);
+
+    value = array.get_by_index(index);
+    assert(value == ~actual_value, "must be");
+
+    value = array.get_by_index(index - 1);
+    assert(value == array.default_value(), "must be");
+
+    value = array.get_by_index(index + 1);
+    assert(value == array.default_value(), "must be");
+
+    array.set_by_index(0, 0);
+    value = array.get_by_index(0);
+    assert(value == 0, "must be");
+
+    array.set_by_index(array.length() - 1, 0);
+    value = array.get_by_index(array.length() - 1);
+    assert(value == 0, "must be");
+
+    array.set_by_index(index, 0);
+
+    // The array should have three zeros, and default values otherwise
+    size_t num_zeros = 0;
+    for (int* current = bottom; current < end; current++) {
+      assert(*current == array.default_value() || *current == 0, "must be");
+      if (*current == 0) {
+        num_zeros++;
+      }
+    }
+    assert(num_zeros == 3, "must be");
+  }
+};
+
+void TestG1BiasedArray_test() {
+  TestMappedArray::test_biasedarray();
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP
+
+#include "utilities/debug.hpp"
+#include "memory/allocation.inline.hpp"
+
+// Implements the common base functionality for arrays that contain provisions
+// for accessing its elements using a biased index.
+// The element type is defined by the instantiating the template.
+class G1BiasedMappedArrayBase VALUE_OBJ_CLASS_SPEC {
+  friend class VMStructs;
+public:
+  typedef size_t idx_t;
+protected:
+  address _base;          // the real base address
+  size_t _length;         // the length of the array
+  address _biased_base;   // base address biased by "bias" elements
+  size_t _bias;           // the bias, i.e. the offset biased_base is located to the right in elements
+  uint _shift_by;         // the amount of bits to shift right when mapping to an index of the array.
+
+protected:
+
+  G1BiasedMappedArrayBase() : _base(NULL), _length(0), _biased_base(NULL),
+    _bias(0), _shift_by(0) { }
+
+  // Allocate a new array, generic version.
+  static address create_new_base_array(size_t length, size_t elem_size) {
+    assert(length > 0, "just checking");
+    assert(elem_size > 0, "just checking");
+    return NEW_C_HEAP_ARRAY(u_char, length * elem_size, mtGC);
+  }
+
+  // Initialize the members of this class. The biased start address of this array
+  // is the bias (in elements) multiplied by the element size.
+  void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) {
+    assert(base != NULL, "just checking");
+    assert(length > 0, "just checking");
+    assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %zd, larger than word size?", shift_by));
+    _base = base;
+    _length = length;
+    _biased_base = base - (bias * elem_size);
+    _bias = bias;
+    _shift_by = shift_by;
+  }
+
+  // Allocate and initialize this array to cover the heap addresses in the range
+  // of [bottom, end).
+  void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) {
+    assert(mapping_granularity_in_bytes > 0, "just checking");
+    assert(is_power_of_2(mapping_granularity_in_bytes),
+      err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes));
+    assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0,
+      err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT,
+        mapping_granularity_in_bytes, bottom));
+    assert((uintptr_t)end % mapping_granularity_in_bytes == 0,
+      err_msg("end mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT,
+        mapping_granularity_in_bytes, end));
+    size_t num_target_elems = (end - bottom) / (mapping_granularity_in_bytes / HeapWordSize);
+    idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes;
+    address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes);
+    initialize_base(base, num_target_elems, bias, target_elem_size_in_bytes, log2_intptr(mapping_granularity_in_bytes));
+  }
+
+  size_t bias() const { return _bias; }
+  uint shift_by() const { return _shift_by; }
+
+  void verify_index(idx_t index) const PRODUCT_RETURN;
+  void verify_biased_index(idx_t biased_index) const PRODUCT_RETURN;
+  void verify_biased_index_inclusive_end(idx_t biased_index) const PRODUCT_RETURN;
+
+public:
+   // Return the length of the array in elements.
+   size_t length() const { return _length; }
+};
+
+// Array that provides biased access and mapping from (valid) addresses in the
+// heap into this array.
+template<class T>
+class G1BiasedMappedArray : public G1BiasedMappedArrayBase {
+public:
+  typedef G1BiasedMappedArrayBase::idx_t idx_t;
+
+  T* base() const { return (T*)G1BiasedMappedArrayBase::_base; }
+  // Return the element of the given array at the given index. Assume
+  // the index is valid. This is a convenience method that does sanity
+  // checking on the index.
+  T get_by_index(idx_t index) const {
+    verify_index(index);
+    return this->base()[index];
+  }
+
+  // Set the element of the given array at the given index to the
+  // given value. Assume the index is valid. This is a convenience
+  // method that does sanity checking on the index.
+  void set_by_index(idx_t index, T value) {
+    verify_index(index);
+    this->base()[index] = value;
+  }
+
+  // The raw biased base pointer.
+  T* biased_base() const { return (T*)G1BiasedMappedArrayBase::_biased_base; }
+
+  // Return the element of the given array that covers the given word in the
+  // heap. Assumes the index is valid.
+  T get_by_address(HeapWord* value) const {
+    idx_t biased_index = ((uintptr_t)value) >> this->shift_by();
+    this->verify_biased_index(biased_index);
+    return biased_base()[biased_index];
+  }
+
+  // Set the value of the array entry that corresponds to the given array.
+  void set_by_address(HeapWord * address, T value) {
+    idx_t biased_index = ((uintptr_t)address) >> this->shift_by();
+    this->verify_biased_index(biased_index);
+    biased_base()[biased_index] = value;
+  }
+
+protected:
+  // Returns the address of the element the given address maps to
+  T* address_mapped_to(HeapWord* address) {
+    idx_t biased_index = ((uintptr_t)address) >> this->shift_by();
+    this->verify_biased_index_inclusive_end(biased_index);
+    return biased_base() + biased_index;
+  }
+
+public:
+  // Return the smallest address (inclusive) in the heap that this array covers.
+  HeapWord* bottom_address_mapped() const {
+    return (HeapWord*) ((uintptr_t)this->bias() << this->shift_by());
+  }
+
+  // Return the highest address (exclusive) in the heap that this array covers.
+  HeapWord* end_address_mapped() const {
+    return (HeapWord*) ((uintptr_t)(this->bias() + this->length()) << this->shift_by());
+  }
+
+protected:
+  virtual T default_value() const = 0;
+  // Set all elements of the given array to the given value.
+  void clear() {
+    T value = default_value();
+    for (idx_t i = 0; i < length(); i++) {
+      set_by_index(i, value);
+    }
+  }
+public:
+  G1BiasedMappedArray() {}
+
+  // Allocate and initialize this array to cover the heap addresses in the range
+  // of [bottom, end).
+  void initialize(HeapWord* bottom, HeapWord* end, size_t mapping_granularity) {
+    G1BiasedMappedArrayBase::initialize(bottom, end, sizeof(T), mapping_granularity);
+    this->clear();
+  }
+};
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1BIASEDARRAY_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -65,9 +65,7 @@
     // threshold limit is no more than this.
     guarantee(G1ConcRSHotCardLimit <= max_jubyte, "sanity");
 
-    ModRefBarrierSet* bs = _g1h->mr_bs();
-    guarantee(bs->is_a(BarrierSet::CardTableModRef), "Precondition");
-    _ct_bs = (CardTableModRefBS*)bs;
+    _ct_bs = _g1h->g1_barrier_set();
     _ct_bot = _ct_bs->byte_for_const(_g1h->reserved_region().start());
 
     // Allocate/Reserve the counts table
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -125,10 +125,8 @@
   int _histo[256];
 public:
   ClearLoggedCardTableEntryClosure() :
-    _calls(0)
+    _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set())
   {
-    _g1h = G1CollectedHeap::heap();
-    _ctbs = (CardTableModRefBS*)_g1h->barrier_set();
     for (int i = 0; i < 256; i++) _histo[i] = 0;
   }
   bool do_card_ptr(jbyte* card_ptr, int worker_i) {
@@ -158,11 +156,8 @@
   CardTableModRefBS* _ctbs;
 public:
   RedirtyLoggedCardTableEntryClosure() :
-    _calls(0)
-  {
-    _g1h = G1CollectedHeap::heap();
-    _ctbs = (CardTableModRefBS*)_g1h->barrier_set();
-  }
+    _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set()) {}
+
   bool do_card_ptr(jbyte* card_ptr, int worker_i) {
     if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) {
       _calls++;
@@ -478,7 +473,7 @@
 
 void G1CollectedHeap::check_ct_logs_at_safepoint() {
   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
-  CardTableModRefBS* ct_bs = (CardTableModRefBS*)barrier_set();
+  CardTableModRefBS* ct_bs = g1_barrier_set();
 
   // Count the dirty cards at the start.
   CountNonCleanMemRegionClosure count1(this);
@@ -1205,7 +1200,7 @@
 };
 
 void G1CollectedHeap::clear_rsets_post_compaction() {
-  PostMCRemSetClearClosure rs_clear(this, mr_bs());
+  PostMCRemSetClearClosure rs_clear(this, g1_barrier_set());
   heap_region_iterate(&rs_clear);
 }
 
@@ -1777,7 +1772,6 @@
 }
 
 bool G1CollectedHeap::expand(size_t expand_bytes) {
-  size_t old_mem_size = _g1_storage.committed_size();
   size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes);
   aligned_expand_bytes = align_size_up(aligned_expand_bytes,
                                        HeapRegion::GrainBytes);
@@ -1787,6 +1781,13 @@
                 ergo_format_byte("attempted expansion amount"),
                 expand_bytes, aligned_expand_bytes);
 
+  if (_g1_storage.uncommitted_size() == 0) {
+    ergo_verbose0(ErgoHeapSizing,
+                      "did not expand the heap",
+                      ergo_format_reason("heap already fully expanded"));
+    return false;
+  }
+
   // First commit the memory.
   HeapWord* old_end = (HeapWord*) _g1_storage.high();
   bool successful = _g1_storage.expand_by(aligned_expand_bytes);
@@ -1845,7 +1846,6 @@
 }
 
 void G1CollectedHeap::shrink_helper(size_t shrink_bytes) {
-  size_t old_mem_size = _g1_storage.committed_size();
   size_t aligned_shrink_bytes =
     ReservedSpace::page_align_size_down(shrink_bytes);
   aligned_shrink_bytes = align_size_down(aligned_shrink_bytes,
@@ -2045,20 +2045,13 @@
   // Create the gen rem set (and barrier set) for the entire reserved region.
   _rem_set = collector_policy()->create_rem_set(_reserved, 2);
   set_barrier_set(rem_set()->bs());
-  if (barrier_set()->is_a(BarrierSet::ModRef)) {
-    _mr_bs = (ModRefBarrierSet*)_barrier_set;
-  } else {
-    vm_exit_during_initialization("G1 requires a mod ref bs.");
+  if (!barrier_set()->is_a(BarrierSet::G1SATBCTLogging)) {
+    vm_exit_during_initialization("G1 requires a G1SATBLoggingCardTableModRefBS");
     return JNI_ENOMEM;
   }
 
   // Also create a G1 rem set.
-  if (mr_bs()->is_a(BarrierSet::CardTableModRef)) {
-    _g1_rem_set = new G1RemSet(this, (CardTableModRefBS*)mr_bs());
-  } else {
-    vm_exit_during_initialization("G1 requires a cardtable mod ref bs.");
-    return JNI_ENOMEM;
-  }
+  _g1_rem_set = new G1RemSet(this, g1_barrier_set());
 
   // Carve out the G1 part of the heap.
 
@@ -2069,8 +2062,10 @@
   _g1_storage.initialize(g1_rs, 0);
   _g1_committed = MemRegion((HeapWord*)_g1_storage.low(), (size_t) 0);
   _hrs.initialize((HeapWord*) _g1_reserved.start(),
-                  (HeapWord*) _g1_reserved.end(),
-                  _expansion_regions);
+                  (HeapWord*) _g1_reserved.end());
+  assert(_hrs.max_length() == _expansion_regions,
+         err_msg("max length: %u expansion regions: %u",
+                 _hrs.max_length(), _expansion_regions));
 
   // Do later initialization work for concurrent refinement.
   _cg1r->init();
@@ -3679,6 +3674,11 @@
   assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
   // Fill TLAB's and such
   ensure_parsability(true);
+
+  if (G1SummarizeRSetStats && (G1SummarizeRSetStatsPeriod > 0) &&
+      (total_collections() % G1SummarizeRSetStatsPeriod == 0)) {
+    g1_rem_set()->print_periodic_summary_info("Before GC RS summary");
+  }
 }
 
 void G1CollectedHeap::gc_epilogue(bool full /* Ignored */) {
@@ -3687,7 +3687,7 @@
       (G1SummarizeRSetStatsPeriod > 0) &&
       // we are at the end of the GC. Total collections has already been increased.
       ((total_collections() - 1) % G1SummarizeRSetStatsPeriod == 0)) {
-    g1_rem_set()->print_periodic_summary_info();
+    g1_rem_set()->print_periodic_summary_info("After GC RS summary");
   }
 
   // FIXME: what is this about?
@@ -4548,7 +4548,7 @@
   : _g1h(g1h),
     _refs(g1h->task_queue(queue_num)),
     _dcq(&g1h->dirty_card_queue_set()),
-    _ct_bs((CardTableModRefBS*)_g1h->barrier_set()),
+    _ct_bs(g1h->g1_barrier_set()),
     _g1_rem(g1h->g1_rem_set()),
     _hash_seed(17), _queue_num(queue_num),
     _term_attempts(0),
@@ -4615,7 +4615,7 @@
   assert(!has_partial_array_mask(ref), err_msg("ref=" PTR_FORMAT, ref));
   oop p = oopDesc::load_decode_heap_oop(ref);
   assert(_g1h->is_in_g1_reserved(p),
-         err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p)));
+         err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
   return true;
 }
 
@@ -4625,11 +4625,11 @@
     // Must be in the collection set--it's already been copied.
     oop p = clear_partial_array_mask(ref);
     assert(_g1h->obj_in_cs(p),
-           err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p)));
+           err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
   } else {
     oop p = oopDesc::load_decode_heap_oop(ref);
     assert(_g1h->is_in_g1_reserved(p),
-           err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, intptr_t(p)));
+           err_msg("ref=" PTR_FORMAT " p=" PTR_FORMAT, ref, (void *)p));
   }
   return true;
 }
@@ -5977,11 +5977,11 @@
 }
 
 class G1ParCleanupCTTask : public AbstractGangTask {
-  CardTableModRefBS* _ct_bs;
+  G1SATBCardTableModRefBS* _ct_bs;
   G1CollectedHeap* _g1h;
   HeapRegion* volatile _su_head;
 public:
-  G1ParCleanupCTTask(CardTableModRefBS* ct_bs,
+  G1ParCleanupCTTask(G1SATBCardTableModRefBS* ct_bs,
                      G1CollectedHeap* g1h) :
     AbstractGangTask("G1 Par Cleanup CT Task"),
     _ct_bs(ct_bs), _g1h(g1h) { }
@@ -6004,9 +6004,9 @@
 #ifndef PRODUCT
 class G1VerifyCardTableCleanup: public HeapRegionClosure {
   G1CollectedHeap* _g1h;
-  CardTableModRefBS* _ct_bs;
+  G1SATBCardTableModRefBS* _ct_bs;
 public:
-  G1VerifyCardTableCleanup(G1CollectedHeap* g1h, CardTableModRefBS* ct_bs)
+  G1VerifyCardTableCleanup(G1CollectedHeap* g1h, G1SATBCardTableModRefBS* ct_bs)
     : _g1h(g1h), _ct_bs(ct_bs) { }
   virtual bool doHeapRegion(HeapRegion* r) {
     if (r->is_survivor()) {
@@ -6020,7 +6020,7 @@
 
 void G1CollectedHeap::verify_not_dirty_region(HeapRegion* hr) {
   // All of the region should be clean.
-  CardTableModRefBS* ct_bs = (CardTableModRefBS*)barrier_set();
+  G1SATBCardTableModRefBS* ct_bs = g1_barrier_set();
   MemRegion mr(hr->bottom(), hr->end());
   ct_bs->verify_not_dirty_region(mr);
 }
@@ -6033,13 +6033,13 @@
   // not dirty that area (one less thing to have to do while holding
   // a lock). So we can only verify that [bottom(),pre_dummy_top()]
   // is dirty.
-  CardTableModRefBS* ct_bs = (CardTableModRefBS*) barrier_set();
+  G1SATBCardTableModRefBS* ct_bs = g1_barrier_set();
   MemRegion mr(hr->bottom(), hr->pre_dummy_top());
   ct_bs->verify_dirty_region(mr);
 }
 
 void G1CollectedHeap::verify_dirty_young_list(HeapRegion* head) {
-  CardTableModRefBS* ct_bs = (CardTableModRefBS*) barrier_set();
+  G1SATBCardTableModRefBS* ct_bs = g1_barrier_set();
   for (HeapRegion* hr = head; hr != NULL; hr = hr->get_next_young_region()) {
     verify_dirty_region(hr);
   }
@@ -6051,7 +6051,7 @@
 #endif
 
 void G1CollectedHeap::cleanUpCardTable() {
-  CardTableModRefBS* ct_bs = (CardTableModRefBS*) (barrier_set());
+  G1SATBCardTableModRefBS* ct_bs = g1_barrier_set();
   double start = os::elapsedTime();
 
   {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -31,6 +31,7 @@
 #include "gc_implementation/g1/g1HRPrinter.hpp"
 #include "gc_implementation/g1/g1MonitoringSupport.hpp"
 #include "gc_implementation/g1/g1RemSet.hpp"
+#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #include "gc_implementation/g1/g1YCTypes.hpp"
 #include "gc_implementation/g1/heapRegionSeq.hpp"
 #include "gc_implementation/g1/heapRegionSets.hpp"
@@ -703,7 +704,7 @@
     if (_g1_committed.contains((HeapWord*) obj)) {
       // no need to subtract the bottom of the heap from obj,
       // _in_cset_fast_test is biased
-      uintx index = (uintx) obj >> HeapRegion::LogOfHRGrainBytes;
+      uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes;
       bool ret = _in_cset_fast_test[index];
       // let's make sure the result is consistent with what the slower
       // test returns
@@ -791,8 +792,6 @@
 
   // The g1 remembered set of the heap.
   G1RemSet* _g1_rem_set;
-  // And it's mod ref barrier set, used to track updates for the above.
-  ModRefBarrierSet* _mr_bs;
 
   // A set of cards that cover the objects for which the Rsets should be updated
   // concurrently after the collection.
@@ -1127,7 +1126,6 @@
 
   // The rem set and barrier set.
   G1RemSet* g1_rem_set() const { return _g1_rem_set; }
-  ModRefBarrierSet* mr_bs() const { return _mr_bs; }
 
   unsigned get_gc_time_stamp() {
     return _gc_time_stamp;
@@ -1346,6 +1344,10 @@
 
   virtual bool is_in_closed_subset(const void* p) const;
 
+  G1SATBCardTableModRefBS* g1_barrier_set() {
+    return (G1SATBCardTableModRefBS*) barrier_set();
+  }
+
   // This resets the card table to all zeros.  It is used after
   // a collection pause which used the card table to claim cards.
   void cleanUpCardTable();
@@ -1875,7 +1877,7 @@
   G1CollectedHeap* _g1h;
   RefToScanQueue*  _refs;
   DirtyCardQueue   _dcq;
-  CardTableModRefBS* _ct_bs;
+  G1SATBCardTableModRefBS* _ct_bs;
   G1RemSet* _g1_rem;
 
   G1ParGCAllocBufferContainer  _surviving_alloc_buffer;
@@ -1914,7 +1916,7 @@
   void   add_to_undo_waste(size_t waste)         { _undo_waste += waste; }
 
   DirtyCardQueue& dirty_card_queue()             { return _dcq;  }
-  CardTableModRefBS* ctbs()                      { return _ct_bs; }
+  G1SATBCardTableModRefBS* ctbs()                { return _ct_bs; }
 
   template <class T> void immediate_rs_update(HeapRegion* from, T* p, int tid) {
     if (!from->is_survivor()) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -134,7 +134,7 @@
   assert(containing_hr->is_in(end - 1), "it should also contain end - 1");
 
   MemRegion mr(start, end);
-  ((CardTableModRefBS*)_g1h->barrier_set())->dirty(mr);
+  g1_barrier_set()->dirty(mr);
 }
 
 inline RefToScanQueue* G1CollectedHeap::task_queue(int i) const {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -41,11 +41,11 @@
 private:
   G1CollectedHeap* _g1;
   DirtyCardQueue *_dcq;
-  CardTableModRefBS* _ct_bs;
+  G1SATBCardTableModRefBS* _ct_bs;
 
 public:
   UpdateRSetDeferred(G1CollectedHeap* g1, DirtyCardQueue* dcq) :
-    _g1(g1), _ct_bs((CardTableModRefBS*)_g1->barrier_set()), _dcq(dcq) {}
+    _g1(g1), _ct_bs(_g1->g1_barrier_set()), _dcq(dcq) {}
 
   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
   virtual void do_oop(      oop* p) { do_oop_work(p); }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -220,7 +220,7 @@
 public:
   G1PrepareCompactClosure(CompactibleSpace* cs)
   : _g1h(G1CollectedHeap::heap()),
-    _mrbs(G1CollectedHeap::heap()->mr_bs()),
+    _mrbs(_g1h->g1_barrier_set()),
     _cp(NULL, cs, cs->initialize_threshold()),
     _humongous_proxy_set("G1MarkSweep Humongous Proxy Set") { }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -91,12 +91,12 @@
 }
 
 template <class T> inline T* set_partial_array_mask(T obj) {
-  assert(((uintptr_t)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!");
-  return (T*) ((uintptr_t)obj | G1_PARTIAL_ARRAY_MASK);
+  assert(((uintptr_t)(void *)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!");
+  return (T*) ((uintptr_t)(void *)obj | G1_PARTIAL_ARRAY_MASK);
 }
 
 template <class T> inline oop clear_partial_array_mask(T* ref) {
-  return oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK);
+  return cast_to_oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK);
 }
 
 class G1ParScanPartialArrayClosure : public G1ParClosureSuper {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -83,7 +83,9 @@
   for (uint i = 0; i < n_workers(); i++) {
     _cset_rs_update_cl[i] = NULL;
   }
-  _prev_period_summary.initialize(this, n_workers());
+  if (G1SummarizeRSetStats) {
+    _prev_period_summary.initialize(this);
+  }
 }
 
 G1RemSet::~G1RemSet() {
@@ -109,7 +111,7 @@
   CodeBlobToOopClosure* _code_root_cl;
 
   G1BlockOffsetSharedArray* _bot_shared;
-  CardTableModRefBS *_ct_bs;
+  G1SATBCardTableModRefBS *_ct_bs;
 
   double _strong_code_root_scan_time_sec;
   int    _worker_i;
@@ -130,7 +132,7 @@
   {
     _g1h = G1CollectedHeap::heap();
     _bot_shared = _g1h->bot_shared();
-    _ct_bs = (CardTableModRefBS*) (_g1h->barrier_set());
+    _ct_bs = _g1h->g1_barrier_set();
     _block_size = MAX2<int>(G1RSetScanBlockSize, 1);
   }
 
@@ -505,12 +507,7 @@
   ScrubRSClosure(BitMap* region_bm, BitMap* card_bm) :
     _g1h(G1CollectedHeap::heap()),
     _region_bm(region_bm), _card_bm(card_bm),
-    _ctbs(NULL)
-  {
-    ModRefBarrierSet* bs = _g1h->mr_bs();
-    guarantee(bs->is_a(BarrierSet::CardTableModRef), "Precondition");
-    _ctbs = (CardTableModRefBS*)bs;
-  }
+    _ctbs(_g1h->g1_barrier_set()) {}
 
   bool doHeapRegion(HeapRegion* r) {
     if (!r->continuesHumongous()) {
@@ -731,19 +728,19 @@
   return has_refs_into_cset;
 }
 
-void G1RemSet::print_periodic_summary_info() {
+void G1RemSet::print_periodic_summary_info(const char* header) {
   G1RemSetSummary current;
-  current.initialize(this, n_workers());
+  current.initialize(this);
 
   _prev_period_summary.subtract_from(&current);
-  print_summary_info(&_prev_period_summary);
+  print_summary_info(&_prev_period_summary, header);
 
   _prev_period_summary.set(&current);
 }
 
 void G1RemSet::print_summary_info() {
   G1RemSetSummary current;
-  current.initialize(this, n_workers());
+  current.initialize(this);
 
   print_summary_info(&current, " Cumulative RS summary");
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -145,7 +145,7 @@
   virtual void print_summary_info();
 
   // Print accumulated summary info from the last time called.
-  virtual void print_periodic_summary_info();
+  virtual void print_periodic_summary_info(const char* header);
 
   // Prepare remembered set for verification.
   virtual void prepare_for_verify();
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -77,12 +77,12 @@
   return _rs_threads_vtimes[thread];
 }
 
-void G1RemSetSummary::initialize(G1RemSet* remset, uint num_workers) {
+void G1RemSetSummary::initialize(G1RemSet* remset) {
   assert(_rs_threads_vtimes == NULL, "just checking");
   assert(remset != NULL, "just checking");
 
   _remset = remset;
-  _num_vtimes = num_workers;
+  _num_vtimes = ConcurrentG1Refine::thread_num();
   _rs_threads_vtimes = NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC);
   memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
 
@@ -125,25 +125,115 @@
   _sampling_thread_vtime = other->sampling_thread_vtime() - _sampling_thread_vtime;
 }
 
+static double percent_of(size_t numerator, size_t denominator) {
+  if (denominator != 0) {
+    return (double)numerator / denominator * 100.0f;
+  } else {
+    return 0.0f;
+  }
+}
+
+static size_t round_to_K(size_t value) {
+  return value / K;
+}
+
+class RegionTypeCounter VALUE_OBJ_CLASS_SPEC {
+private:
+  const char* _name;
+
+  size_t _rs_mem_size;
+  size_t _cards_occupied;
+  size_t _amount;
+
+  size_t _code_root_mem_size;
+  size_t _code_root_elems;
+
+  double rs_mem_size_percent_of(size_t total) {
+    return percent_of(_rs_mem_size, total);
+  }
+
+  double cards_occupied_percent_of(size_t total) {
+    return percent_of(_cards_occupied, total);
+  }
+
+  double code_root_mem_size_percent_of(size_t total) {
+    return percent_of(_code_root_mem_size, total);
+  }
+
+  double code_root_elems_percent_of(size_t total) {
+    return percent_of(_code_root_elems, total);
+  }
+
+  size_t amount() const { return _amount; }
+
+public:
+
+  RegionTypeCounter(const char* name) : _name(name), _rs_mem_size(0), _cards_occupied(0),
+    _amount(0), _code_root_mem_size(0), _code_root_elems(0) { }
+
+  void add(size_t rs_mem_size, size_t cards_occupied, size_t code_root_mem_size,
+    size_t code_root_elems) {
+    _rs_mem_size += rs_mem_size;
+    _cards_occupied += cards_occupied;
+    _code_root_mem_size += code_root_mem_size;
+    _code_root_elems += code_root_elems;
+    _amount++;
+  }
+
+  size_t rs_mem_size() const { return _rs_mem_size; }
+  size_t cards_occupied() const { return _cards_occupied; }
+
+  size_t code_root_mem_size() const { return _code_root_mem_size; }
+  size_t code_root_elems() const { return _code_root_elems; }
+
+  void print_rs_mem_info_on(outputStream * out, size_t total) {
+    out->print_cr("    %8dK (%5.1f%%) by %zd %s regions", round_to_K(rs_mem_size()), rs_mem_size_percent_of(total), amount(), _name);
+  }
+
+  void print_cards_occupied_info_on(outputStream * out, size_t total) {
+    out->print_cr("     %8d (%5.1f%%) entries by %zd %s regions", cards_occupied(), cards_occupied_percent_of(total), amount(), _name);
+  }
+
+  void print_code_root_mem_info_on(outputStream * out, size_t total) {
+    out->print_cr("    %8dK (%5.1f%%) by %zd %s regions", round_to_K(code_root_mem_size()), code_root_mem_size_percent_of(total), amount(), _name);
+  }
+
+  void print_code_root_elems_info_on(outputStream * out, size_t total) {
+    out->print_cr("     %8d (%5.1f%%) elements by %zd %s regions", code_root_elems(), code_root_elems_percent_of(total), amount(), _name);
+  }
+};
+
+
 class HRRSStatsIter: public HeapRegionClosure {
-  size_t _occupied;
+private:
+  RegionTypeCounter _young;
+  RegionTypeCounter _humonguous;
+  RegionTypeCounter _free;
+  RegionTypeCounter _old;
+  RegionTypeCounter _all;
 
-  size_t _total_rs_mem_sz;
   size_t _max_rs_mem_sz;
   HeapRegion* _max_rs_mem_sz_region;
 
-  size_t _total_code_root_mem_sz;
+  size_t total_rs_mem_sz() const            { return _all.rs_mem_size(); }
+  size_t total_cards_occupied() const       { return _all.cards_occupied(); }
+
+  size_t max_rs_mem_sz() const              { return _max_rs_mem_sz; }
+  HeapRegion* max_rs_mem_sz_region() const  { return _max_rs_mem_sz_region; }
+
   size_t _max_code_root_mem_sz;
   HeapRegion* _max_code_root_mem_sz_region;
+
+  size_t total_code_root_mem_sz() const     { return _all.code_root_mem_size(); }
+  size_t total_code_root_elems() const      { return _all.code_root_elems(); }
+
+  size_t max_code_root_mem_sz() const       { return _max_code_root_mem_sz; }
+  HeapRegion* max_code_root_mem_sz_region() const { return _max_code_root_mem_sz_region; }
+
 public:
-  HRRSStatsIter() :
-    _occupied(0),
-    _total_rs_mem_sz(0),
-    _max_rs_mem_sz(0),
-    _max_rs_mem_sz_region(NULL),
-    _total_code_root_mem_sz(0),
-    _max_code_root_mem_sz(0),
-    _max_code_root_mem_sz_region(NULL)
+  HRRSStatsIter() : _all("All"), _young("Young"), _humonguous("Humonguous"),
+    _free("Free"), _old("Old"), _max_code_root_mem_sz_region(NULL), _max_rs_mem_sz_region(NULL),
+    _max_rs_mem_sz(0), _max_code_root_mem_sz(0)
   {}
 
   bool doHeapRegion(HeapRegion* r) {
@@ -156,46 +246,95 @@
       _max_rs_mem_sz = rs_mem_sz;
       _max_rs_mem_sz_region = r;
     }
-    _total_rs_mem_sz += rs_mem_sz;
-
+    size_t occupied_cards = hrrs->occupied();
     size_t code_root_mem_sz = hrrs->strong_code_roots_mem_size();
-    if (code_root_mem_sz > _max_code_root_mem_sz) {
-      _max_code_root_mem_sz = code_root_mem_sz;
+    if (code_root_mem_sz > max_code_root_mem_sz()) {
       _max_code_root_mem_sz_region = r;
     }
-    _total_code_root_mem_sz += code_root_mem_sz;
+    size_t code_root_elems = hrrs->strong_code_roots_list_length();
 
-    size_t occ = hrrs->occupied();
-    _occupied += occ;
+    RegionTypeCounter* current = NULL;
+    if (r->is_young()) {
+      current = &_young;
+    } else if (r->isHumongous()) {
+      current = &_humonguous;
+    } else if (r->is_empty()) {
+      current = &_free;
+    } else {
+      current = &_old;
+    }
+    current->add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems);
+    _all.add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems);
+
     return false;
   }
-  size_t total_rs_mem_sz() { return _total_rs_mem_sz; }
-  size_t max_rs_mem_sz() { return _max_rs_mem_sz; }
-  HeapRegion* max_rs_mem_sz_region() { return _max_rs_mem_sz_region; }
-  size_t total_code_root_mem_sz() { return _total_code_root_mem_sz; }
-  size_t max_code_root_mem_sz() { return _max_code_root_mem_sz; }
-  HeapRegion* max_code_root_mem_sz_region() { return _max_code_root_mem_sz_region; }
-  size_t occupied() { return _occupied; }
+
+  void print_summary_on(outputStream* out) {
+    RegionTypeCounter* counters[] = { &_young, &_humonguous, &_free, &_old, NULL };
+
+    out->print_cr("\n Current rem set statistics");
+    out->print_cr("  Total per region rem sets sizes = "SIZE_FORMAT"K."
+                  " Max = "SIZE_FORMAT"K.",
+                  round_to_K(total_rs_mem_sz()), round_to_K(max_rs_mem_sz()));
+    for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
+      (*current)->print_rs_mem_info_on(out, total_rs_mem_sz());
+    }
+
+    out->print_cr("   Static structures = "SIZE_FORMAT"K,"
+                  " free_lists = "SIZE_FORMAT"K.",
+                  round_to_K(HeapRegionRemSet::static_mem_size()),
+                  round_to_K(HeapRegionRemSet::fl_mem_size()));
+
+    out->print_cr("    "SIZE_FORMAT" occupied cards represented.",
+                  total_cards_occupied());
+    for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
+      (*current)->print_cards_occupied_info_on(out, total_cards_occupied());
+    }
+
+    // Largest sized rem set region statistics
+    HeapRegionRemSet* rem_set = max_rs_mem_sz_region()->rem_set();
+    out->print_cr("    Region with largest rem set = "HR_FORMAT", "
+                  "size = "SIZE_FORMAT "K, occupied = "SIZE_FORMAT"K.",
+                  HR_FORMAT_PARAMS(max_rs_mem_sz_region()),
+                  round_to_K(rem_set->mem_size()),
+                  round_to_K(rem_set->occupied()));
+
+    // Strong code root statistics
+    HeapRegionRemSet* max_code_root_rem_set = max_code_root_mem_sz_region()->rem_set();
+    out->print_cr("  Total heap region code root sets sizes = "SIZE_FORMAT"K."
+                  "  Max = "SIZE_FORMAT"K.",
+                  round_to_K(total_code_root_mem_sz()),
+                  round_to_K(max_code_root_rem_set->strong_code_roots_mem_size()));
+    for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
+      (*current)->print_code_root_mem_info_on(out, total_code_root_mem_sz());
+    }
+
+    out->print_cr("    "SIZE_FORMAT" code roots represented.",
+                  total_code_root_elems());
+    for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) {
+      (*current)->print_code_root_elems_info_on(out, total_code_root_elems());
+    }
+
+    out->print_cr("    Region with largest amount of code roots = "HR_FORMAT", "
+                  "size = "SIZE_FORMAT "K, num_elems = "SIZE_FORMAT".",
+                  HR_FORMAT_PARAMS(max_code_root_mem_sz_region()),
+                  round_to_K(max_code_root_rem_set->strong_code_roots_mem_size()),
+                  round_to_K(max_code_root_rem_set->strong_code_roots_list_length()));
+  }
 };
 
-double calc_percentage(size_t numerator, size_t denominator) {
-  if (denominator != 0) {
-    return (double)numerator / denominator * 100.0;
-  } else {
-    return 0.0f;
-  }
-}
-
 void G1RemSetSummary::print_on(outputStream* out) {
-  out->print_cr("\n Concurrent RS processed "SIZE_FORMAT" cards",
+  out->print_cr("\n Recent concurrent refinement statistics");
+  out->print_cr("  Processed "SIZE_FORMAT" cards",
                 num_concurrent_refined_cards());
   out->print_cr("  Of %d completed buffers:", num_processed_buf_total());
   out->print_cr("     %8d (%5.1f%%) by concurrent RS threads.",
                 num_processed_buf_total(),
-                calc_percentage(num_processed_buf_rs_threads(), num_processed_buf_total()));
+                percent_of(num_processed_buf_rs_threads(), num_processed_buf_total()));
   out->print_cr("     %8d (%5.1f%%) by mutator threads.",
                 num_processed_buf_mutator(),
-                calc_percentage(num_processed_buf_mutator(), num_processed_buf_total()));
+                percent_of(num_processed_buf_mutator(), num_processed_buf_total()));
+  out->print_cr("  Did %d coarsenings.", num_coarsenings());
   out->print_cr("  Concurrent RS threads times (s)");
   out->print("     ");
   for (uint i = 0; i < _num_vtimes; i++) {
@@ -207,33 +346,5 @@
 
   HRRSStatsIter blk;
   G1CollectedHeap::heap()->heap_region_iterate(&blk);
-  // RemSet stats
-  out->print_cr("  Total heap region rem set sizes = "SIZE_FORMAT"K."
-                "  Max = "SIZE_FORMAT"K.",
-                blk.total_rs_mem_sz()/K, blk.max_rs_mem_sz()/K);
-  out->print_cr("  Static structures = "SIZE_FORMAT"K,"
-                " free_lists = "SIZE_FORMAT"K.",
-                HeapRegionRemSet::static_mem_size() / K,
-                HeapRegionRemSet::fl_mem_size() / K);
-  out->print_cr("    "SIZE_FORMAT" occupied cards represented.",
-                blk.occupied());
-  HeapRegion* max_rs_mem_sz_region = blk.max_rs_mem_sz_region();
-  HeapRegionRemSet* max_rs_rem_set = max_rs_mem_sz_region->rem_set();
-  out->print_cr("    Max size region = "HR_FORMAT", "
-                "size = "SIZE_FORMAT "K, occupied = "SIZE_FORMAT"K.",
-                HR_FORMAT_PARAMS(max_rs_mem_sz_region),
-                (max_rs_rem_set->mem_size() + K - 1)/K,
-                (max_rs_rem_set->occupied() + K - 1)/K);
-  out->print_cr("    Did %d coarsenings.", num_coarsenings());
-  // Strong code root stats
-  out->print_cr("  Total heap region code-root set sizes = "SIZE_FORMAT"K."
-                "  Max = "SIZE_FORMAT"K.",
-                blk.total_code_root_mem_sz()/K, blk.max_code_root_mem_sz()/K);
-  HeapRegion* max_code_root_mem_sz_region = blk.max_code_root_mem_sz_region();
-  HeapRegionRemSet* max_code_root_rem_set = max_code_root_mem_sz_region->rem_set();
-  out->print_cr("    Max size region = "HR_FORMAT", "
-                "size = "SIZE_FORMAT "K, num_elems = "SIZE_FORMAT".",
-                HR_FORMAT_PARAMS(max_code_root_mem_sz_region),
-                (max_code_root_rem_set->strong_code_roots_mem_size() + K - 1)/K,
-                (max_code_root_rem_set->strong_code_roots_list_length()));
+  blk.print_summary_on(out);
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -84,7 +84,7 @@
   void subtract_from(G1RemSetSummary* other);
 
   // initialize and get the first sampling
-  void initialize(G1RemSet* remset, uint num_workers);
+  void initialize(G1RemSet* remset);
 
   void print_on(outputStream* out);
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, 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
@@ -64,6 +64,27 @@
   }
 }
 
+bool G1SATBCardTableModRefBS::mark_card_deferred(size_t card_index) {
+  jbyte val = _byte_map[card_index];
+  // It's already processed
+  if ((val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val()) {
+    return false;
+  }
+  // Cached bit can be installed either on a clean card or on a claimed card.
+  jbyte new_val = val;
+  if (val == clean_card_val()) {
+    new_val = (jbyte)deferred_card_val();
+  } else {
+    if (val & claimed_card_val()) {
+      new_val = val | (jbyte)deferred_card_val();
+    }
+  }
+  if (new_val != val) {
+    Atomic::cmpxchg(new_val, &_byte_map[card_index], val);
+  }
+  return true;
+}
+
 G1SATBCardTableLoggingModRefBS::
 G1SATBCardTableLoggingModRefBS(MemRegion whole_heap,
                                int max_covered_regions) :
@@ -95,7 +116,7 @@
 G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field,
                                                        oop new_val) {
   uintptr_t field_uint = (uintptr_t)field;
-  uintptr_t new_val_uint = (uintptr_t)new_val;
+  uintptr_t new_val_uint = cast_from_oop<uintptr_t>(new_val);
   uintptr_t comb = field_uint ^ new_val_uint;
   comb = comb >> HeapRegion::LogOfHRGrainBytes;
   if (comb == 0) return;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -89,6 +89,42 @@
       write_ref_array_pre_work(dst, count);
     }
   }
+
+/*
+   Claimed and deferred bits are used together in G1 during the evacuation
+   pause. These bits can have the following state transitions:
+   1. The claimed bit can be put over any other card state. Except that
+      the "dirty -> dirty and claimed" transition is checked for in
+      G1 code and is not used.
+   2. Deferred bit can be set only if the previous state of the card
+      was either clean or claimed. mark_card_deferred() is wait-free.
+      We do not care if the operation is be successful because if
+      it does not it will only result in duplicate entry in the update
+      buffer because of the "cache-miss". So it's not worth spinning.
+ */
+
+  bool is_card_claimed(size_t card_index) {
+    jbyte val = _byte_map[card_index];
+    return (val & (clean_card_mask_val() | claimed_card_val())) == claimed_card_val();
+  }
+
+  void set_card_claimed(size_t card_index) {
+      jbyte val = _byte_map[card_index];
+      if (val == clean_card_val()) {
+        val = (jbyte)claimed_card_val();
+      } else {
+        val |= (jbyte)claimed_card_val();
+      }
+      _byte_map[card_index] = val;
+  }
+
+  bool mark_card_deferred(size_t card_index);
+
+  bool is_card_deferred(size_t card_index) {
+    jbyte val = _byte_map[card_index];
+    return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val();
+  }
+
 };
 
 // Adds card-table logging to the post-barrier.
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -637,7 +637,7 @@
           gclog_or_tty->print_cr("Object "PTR_FORMAT" in region "
                                  "["PTR_FORMAT", "PTR_FORMAT") is above "
                                  "top "PTR_FORMAT,
-                                 obj, _hr->bottom(), _hr->end(), _hr->top());
+                                 (void *)obj, _hr->bottom(), _hr->end(), _hr->top());
           _failures = true;
           return;
         }
@@ -951,12 +951,12 @@
         Klass* klass = obj->klass();
         if (!klass->is_metaspace_object()) {
           gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
-                                 "not metadata", klass, obj);
+                                 "not metadata", klass, (void *)obj);
           *failures = true;
           return;
         } else if (!klass->is_klass()) {
           gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
-                                 "not a klass", klass, obj);
+                                 "not a klass", klass, (void *)obj);
           *failures = true;
           return;
         } else {
@@ -971,7 +971,7 @@
           }
         }
       } else {
-        gclog_or_tty->print_cr(PTR_FORMAT" no an oop", obj);
+        gclog_or_tty->print_cr(PTR_FORMAT" no an oop", (void *)obj);
         *failures = true;
         return;
       }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -91,8 +91,8 @@
       gclog_or_tty->print_cr("    PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").",
                              from,
                              UseCompressedOops
-                             ? oopDesc::load_decode_heap_oop((narrowOop*)from)
-                             : oopDesc::load_decode_heap_oop((oop*)from));
+                             ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from)
+                             : (void *)oopDesc::load_decode_heap_oop((oop*)from));
     }
 
     HeapRegion* loc_hr = hr();
@@ -403,8 +403,8 @@
     gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
                                                     from,
                                                     UseCompressedOops
-                                                    ? oopDesc::load_decode_heap_oop((narrowOop*)from)
-                                                    : oopDesc::load_decode_heap_oop((oop*)from));
+                                                    ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from)
+                                                    : (void *)oopDesc::load_decode_heap_oop((oop*)from));
   }
 
   int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -71,27 +71,16 @@
 
 // Public
 
-void HeapRegionSeq::initialize(HeapWord* bottom, HeapWord* end,
-                               uint max_length) {
+void HeapRegionSeq::initialize(HeapWord* bottom, HeapWord* end) {
   assert((uintptr_t) bottom % HeapRegion::GrainBytes == 0,
          "bottom should be heap region aligned");
   assert((uintptr_t) end % HeapRegion::GrainBytes == 0,
          "end should be heap region aligned");
 
-  _length = 0;
-  _heap_bottom = bottom;
-  _heap_end = end;
-  _region_shift = HeapRegion::LogOfHRGrainBytes;
   _next_search_index = 0;
   _allocated_length = 0;
-  _max_length = max_length;
 
-  _regions = NEW_C_HEAP_ARRAY(HeapRegion*, max_length, mtGC);
-  memset(_regions, 0, (size_t) max_length * sizeof(HeapRegion*));
-  _regions_biased = _regions - ((uintx) bottom >> _region_shift);
-
-  assert(&_regions[0] == &_regions_biased[addr_to_index_biased(bottom)],
-         "bottom should be included in the region with index 0");
+  _regions.initialize(bottom, end, HeapRegion::GrainBytes);
 }
 
 MemRegion HeapRegionSeq::expand_by(HeapWord* old_end,
@@ -101,15 +90,15 @@
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
   HeapWord* next_bottom = old_end;
-  assert(_heap_bottom <= next_bottom, "invariant");
+  assert(heap_bottom() <= next_bottom, "invariant");
   while (next_bottom < new_end) {
-    assert(next_bottom < _heap_end, "invariant");
+    assert(next_bottom < heap_end(), "invariant");
     uint index = length();
 
-    assert(index < _max_length, "otherwise we cannot expand further");
+    assert(index < max_length(), "otherwise we cannot expand further");
     if (index == 0) {
       // We have not allocated any regions so far
-      assert(next_bottom == _heap_bottom, "invariant");
+      assert(next_bottom == heap_bottom(), "invariant");
     } else {
       // next_bottom should match the end of the last/previous region
       assert(next_bottom == at(index - 1)->end(), "invariant");
@@ -122,8 +111,8 @@
         // allocation failed, we bail out and return what we have done so far
         return MemRegion(old_end, next_bottom);
       }
-      assert(_regions[index] == NULL, "invariant");
-      _regions[index] = new_hr;
+      assert(_regions.get_by_index(index) == NULL, "invariant");
+      _regions.set_by_index(index, new_hr);
       increment_allocated_length();
     }
     // Have to increment the length first, otherwise we will get an
@@ -228,26 +217,26 @@
 
 #ifndef PRODUCT
 void HeapRegionSeq::verify_optional() {
-  guarantee(_length <= _allocated_length,
+  guarantee(length() <= _allocated_length,
             err_msg("invariant: _length: %u _allocated_length: %u",
-                    _length, _allocated_length));
-  guarantee(_allocated_length <= _max_length,
+                    length(), _allocated_length));
+  guarantee(_allocated_length <= max_length(),
             err_msg("invariant: _allocated_length: %u _max_length: %u",
-                    _allocated_length, _max_length));
-  guarantee(_next_search_index <= _length,
+                    _allocated_length, max_length()));
+  guarantee(_next_search_index <= length(),
             err_msg("invariant: _next_search_index: %u _length: %u",
-                    _next_search_index, _length));
+                    _next_search_index, length()));
 
-  HeapWord* prev_end = _heap_bottom;
+  HeapWord* prev_end = heap_bottom();
   for (uint i = 0; i < _allocated_length; i += 1) {
-    HeapRegion* hr = _regions[i];
+    HeapRegion* hr = _regions.get_by_index(i);
     guarantee(hr != NULL, err_msg("invariant: i: %u", i));
     guarantee(hr->bottom() == prev_end,
               err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT,
                       i, HR_FORMAT_PARAMS(hr), prev_end));
     guarantee(hr->hrs_index() == i,
               err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index()));
-    if (i < _length) {
+    if (i < length()) {
       // Asserts will fire if i is >= _length
       HeapWord* addr = hr->bottom();
       guarantee(addr_to_region(addr) == hr, "sanity");
@@ -265,8 +254,8 @@
       prev_end = hr->end();
     }
   }
-  for (uint i = _allocated_length; i < _max_length; i += 1) {
-    guarantee(_regions[i] == NULL, err_msg("invariant i: %u", i));
+  for (uint i = _allocated_length; i < max_length(); i += 1) {
+    guarantee(_regions.get_by_index(i) == NULL, err_msg("invariant i: %u", i));
   }
 }
 #endif // PRODUCT
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -25,10 +25,17 @@
 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP
 
+#include "gc_implementation/g1/g1BiasedArray.hpp"
+
 class HeapRegion;
 class HeapRegionClosure;
 class FreeRegionList;
 
+class G1HeapRegionTable : public G1BiasedMappedArray<HeapRegion*> {
+ protected:
+   virtual HeapRegion* default_value() const { return NULL; }
+};
+
 // This class keeps track of the region metadata (i.e., HeapRegion
 // instances). They are kept in the _regions array in address
 // order. A region's index in the array corresponds to its index in
@@ -44,35 +51,21 @@
 //
 // We keep track of three lengths:
 //
-// * _length (returned by length()) is the number of currently
+// * _committed_length (returned by length()) is the number of currently
 //   committed regions.
 // * _allocated_length (not exposed outside this class) is the
 //   number of regions for which we have HeapRegions.
-// * _max_length (returned by max_length()) is the maximum number of
-//   regions the heap can have.
+// * max_length() returns the maximum number of regions the heap can have.
 //
-// and maintain that: _length <= _allocated_length <= _max_length
+// and maintain that: _committed_length <= _allocated_length <= max_length()
 
 class HeapRegionSeq: public CHeapObj<mtGC> {
   friend class VMStructs;
 
-  // The array that holds the HeapRegions.
-  HeapRegion** _regions;
-
-  // Version of _regions biased to address 0
-  HeapRegion** _regions_biased;
+  G1HeapRegionTable _regions;
 
   // The number of regions committed in the heap.
-  uint _length;
-
-  // The address of the first reserved word in the heap.
-  HeapWord* _heap_bottom;
-
-  // The address of the last reserved word in the heap - 1.
-  HeapWord* _heap_end;
-
-  // The log of the region byte size.
-  uint _region_shift;
+  uint _committed_length;
 
   // A hint for which index to start searching from for humongous
   // allocations.
@@ -81,37 +74,33 @@
   // The number of regions for which we have allocated HeapRegions for.
   uint _allocated_length;
 
-  // The maximum number of regions in the heap.
-  uint _max_length;
-
   // Find a contiguous set of empty regions of length num, starting
   // from the given index.
   uint find_contiguous_from(uint from, uint num);
 
-  // Map a heap address to a biased region index. Assume that the
-  // address is valid.
-  inline uintx addr_to_index_biased(HeapWord* addr) const;
-
   void increment_allocated_length() {
-    assert(_allocated_length < _max_length, "pre-condition");
+    assert(_allocated_length < max_length(), "pre-condition");
     _allocated_length++;
   }
 
   void increment_length() {
-    assert(_length < _max_length, "pre-condition");
-    _length++;
+    assert(length() < max_length(), "pre-condition");
+    _committed_length++;
   }
 
   void decrement_length() {
-    assert(_length > 0, "pre-condition");
-    _length--;
+    assert(length() > 0, "pre-condition");
+    _committed_length--;
   }
 
+  HeapWord* heap_bottom() const { return _regions.bottom_address_mapped(); }
+  HeapWord* heap_end() const {return _regions.end_address_mapped(); }
+
  public:
   // Empty contructor, we'll initialize it with the initialize() method.
-  HeapRegionSeq() { }
+  HeapRegionSeq() : _regions(), _committed_length(0), _next_search_index(0), _allocated_length(0) { }
 
-  void initialize(HeapWord* bottom, HeapWord* end, uint max_length);
+  void initialize(HeapWord* bottom, HeapWord* end);
 
   // Return the HeapRegion at the given index. Assume that the index
   // is valid.
@@ -126,10 +115,10 @@
   inline HeapRegion* addr_to_region_unsafe(HeapWord* addr) const;
 
   // Return the number of regions that have been committed in the heap.
-  uint length() const { return _length; }
+  uint length() const { return _committed_length; }
 
   // Return the maximum number of regions in the heap.
-  uint max_length() const { return _max_length; }
+  uint max_length() const { return (uint)_regions.length(); }
 
   // Expand the sequence to reflect that the heap has grown from
   // old_end to new_end. Either create new HeapRegions, or re-use
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -28,28 +28,16 @@
 #include "gc_implementation/g1/heapRegion.hpp"
 #include "gc_implementation/g1/heapRegionSeq.hpp"
 
-inline uintx HeapRegionSeq::addr_to_index_biased(HeapWord* addr) const {
-  assert(_heap_bottom <= addr && addr < _heap_end,
-         err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT" end: "PTR_FORMAT,
-                 addr, _heap_bottom, _heap_end));
-  uintx index = (uintx) addr >> _region_shift;
-  return index;
-}
-
 inline HeapRegion* HeapRegionSeq::addr_to_region_unsafe(HeapWord* addr) const {
-  assert(_heap_bottom <= addr && addr < _heap_end,
-         err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT" end: "PTR_FORMAT,
-                 addr, _heap_bottom, _heap_end));
-  uintx index_biased = addr_to_index_biased(addr);
-  HeapRegion* hr = _regions_biased[index_biased];
+  HeapRegion* hr = _regions.get_by_address(addr);
   assert(hr != NULL, "invariant");
   return hr;
 }
 
 inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const {
-  if (addr != NULL && addr < _heap_end) {
-    assert(addr >= _heap_bottom,
-          err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, _heap_bottom));
+  if (addr != NULL && addr < heap_end()) {
+    assert(addr >= heap_bottom(),
+          err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, heap_bottom()));
     return addr_to_region_unsafe(addr);
   }
   return NULL;
@@ -57,7 +45,7 @@
 
 inline HeapRegion* HeapRegionSeq::at(uint index) const {
   assert(index < length(), "pre-condition");
-  HeapRegion* hr = _regions[index];
+  HeapRegion* hr = _regions.get_by_index(index);
   assert(hr != NULL, "sanity");
   assert(hr->hrs_index() == index, "sanity");
   return hr;
--- a/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,14 @@
   static_field(HeapRegion, GrainBytes,        size_t)                         \
   static_field(HeapRegion, LogOfHRGrainBytes, int)                            \
                                                                               \
-  nonstatic_field(HeapRegionSeq,   _regions, HeapRegion**)                    \
-  nonstatic_field(HeapRegionSeq,   _length,  uint)                            \
+  nonstatic_field(G1HeapRegionTable, _base,             address)              \
+  nonstatic_field(G1HeapRegionTable, _length,           size_t)               \
+  nonstatic_field(G1HeapRegionTable, _biased_base,      address)              \
+  nonstatic_field(G1HeapRegionTable, _bias,             size_t)               \
+  nonstatic_field(G1HeapRegionTable, _shift_by,         uint)                 \
+                                                                              \
+  nonstatic_field(HeapRegionSeq,   _regions,            G1HeapRegionTable)    \
+  nonstatic_field(HeapRegionSeq,   _committed_length,   uint)                 \
                                                                               \
   nonstatic_field(G1CollectedHeap, _hrs,                HeapRegionSeq)        \
   nonstatic_field(G1CollectedHeap, _g1_committed,       MemRegion)            \
@@ -58,6 +64,8 @@
 
 #define VM_TYPES_G1(declare_type, declare_toplevel_type)                      \
                                                                               \
+  declare_toplevel_type(G1HeapRegionTable)                                    \
+                                                                              \
   declare_type(G1CollectedHeap, SharedHeap)                                   \
                                                                               \
   declare_type(HeapRegion, ContiguousSpace)                                   \
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1103,7 +1103,7 @@
   }
 }
 
-static const oop ClaimedForwardPtr = oop(0x4);
+static const oop ClaimedForwardPtr = cast_to_oop<intptr_t>(0x4);
 
 // Because of concurrency, there are times where an object for which
 // "is_forwarded()" is true contains an "interim" forwarding pointer
@@ -1226,7 +1226,7 @@
   if (TraceScavenge) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        is_in_reserved(new_obj) ? "copying" : "tenuring",
-       new_obj->klass()->internal_name(), old, new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
   }
 #endif
 
@@ -1347,7 +1347,7 @@
   if (TraceScavenge) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        is_in_reserved(new_obj) ? "copying" : "tenuring",
-       new_obj->klass()->internal_name(), old, new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
   }
 #endif
 
@@ -1436,7 +1436,7 @@
 // (although some performance comparisons would be useful since
 // single global lists have their own performance disadvantages
 // as we were made painfully aware not long ago, see 6786503).
-#define BUSY (oop(0x1aff1aff))
+#define BUSY (cast_to_oop<intptr_t>(0x1aff1aff))
 void ParNewGeneration::push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state) {
   assert(is_in_reserved(from_space_obj), "Should be from this generation");
   if (ParGCUseLocalOverflow) {
@@ -1512,7 +1512,7 @@
   if (_overflow_list == NULL) return false;
 
   // Otherwise, there was something there; try claiming the list.
-  oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list);
+  oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
   // Trim off a prefix of at most objsFromOverflow items
   Thread* tid = Thread::current();
   size_t spin_count = (size_t)ParallelGCThreads;
@@ -1526,7 +1526,7 @@
       return false;
     } else if (_overflow_list != BUSY) {
      // try and grab the prefix
-     prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list);
+     prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
     }
   }
   if (prefix == NULL || prefix == BUSY) {
--- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -84,7 +84,7 @@
         Space* sp = gch->space_containing(p);
         oop obj = oop(sp->block_start(p));
         assert((HeapWord*)obj < (HeapWord*)p, "Error");
-        tty->print_cr("Object: " PTR_FORMAT, obj);
+        tty->print_cr("Object: " PTR_FORMAT, (void *)obj);
         tty->print_cr("-------");
         obj->print();
         tty->print_cr("-----");
@@ -110,7 +110,7 @@
         if (TraceScavenge) {
           gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
              "forwarded ",
-             new_obj->klass()->internal_name(), p, obj, new_obj, new_obj->size());
+             new_obj->klass()->internal_name(), p, (void *)obj, (void *)new_obj, new_obj->size());
         }
 #endif
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -40,10 +40,8 @@
 
   void initialize_flags() {
     // Do basic sizing work
-    this->TwoGenerationCollectorPolicy::initialize_flags();
+    TwoGenerationCollectorPolicy::initialize_flags();
 
-    // If the user hasn't explicitly set the number of worker
-    // threads, set the count.
     assert(UseSerialGC ||
            !FLAG_IS_DEFAULT(ParallelGCThreads) ||
            (ParallelGCThreads > 0),
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,6 @@
  */
 
 #include "precompiled.hpp"
-#include "gc_implementation/parallelScavenge/generationSizer.hpp"
 #include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"
 #include "gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -53,7 +53,6 @@
 
 // Forward decls
 class elapsedTimer;
-class GenerationSizer;
 
 class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
  friend class PSGCAdaptivePolicyCounters;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -26,7 +26,6 @@
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
-#include "gc_implementation/parallelScavenge/generationSizer.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"
 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -27,7 +27,6 @@
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
-#include "gc_implementation/parallelScavenge/generationSizer.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
 #include "gc_implementation/parallelScavenge/pcTasks.hpp"
 #include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -333,7 +333,7 @@
     gclog_or_tty->print_cr("{%s %s 0x%x (%d)}",
                            "promotion-failure",
                            obj->klass()->internal_name(),
-                           obj, obj->size());
+                           (void *)obj, obj->size());
 
   }
 #endif
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -126,7 +126,7 @@
 
   oop* mask_chunked_array_oop(oop obj) {
     assert(!is_oop_masked((oop*) obj), "invariant");
-    oop* ret = (oop*) ((uintptr_t)obj | PS_CHUNKED_ARRAY_OOP_MASK);
+    oop* ret = (oop*) (cast_from_oop<uintptr_t>(obj) | PS_CHUNKED_ARRAY_OOP_MASK);
     assert(is_oop_masked(ret), "invariant");
     return ret;
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -225,7 +225,7 @@
   if (TraceScavenge) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
-       new_obj->klass()->internal_name(), o, new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
   }
 #endif
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -27,7 +27,6 @@
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
-#include "gc_implementation/parallelScavenge/generationSizer.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"
 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -81,7 +81,7 @@
   if (TraceScavenge &&  o->is_forwarded()) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        "forwarding",
-       new_obj->klass()->internal_name(), o, new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
   }
 #endif
 
--- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -215,7 +215,7 @@
       st->print_cr(" %s", buf);
     }
   } else {
-    st->print_cr(" " PTR_FORMAT, (intptr_t) value);
+    st->print_cr(" " PTR_FORMAT, (void *)value);
   }
 }
 
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,4 @@
 /*
- * 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
@@ -573,6 +572,16 @@
   }
 
   if (check_access) {
+    // JDK8 adds non-public interface methods, and accessability check requirement
+    assert(current_klass.not_null() , "current_klass should not be null");
+
+    // check if method can be accessed by the referring class
+    check_method_accessability(current_klass,
+                               resolved_klass,
+                               KlassHandle(THREAD, resolved_method->method_holder()),
+                               resolved_method,
+                               CHECK);
+
     HandleMark hm(THREAD);
     Handle loader (THREAD, InstanceKlass::cast(current_klass())->class_loader());
     Handle class_loader (THREAD, resolved_method->method_holder()->class_loader());
@@ -604,6 +613,20 @@
       }
     }
   }
+
+  if (TraceItables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokeinterface resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ",
+                   (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()),
+                   (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                   Method::name_and_sig_as_C_string(resolved_klass(),
+                                                    resolved_method->name(),
+                                                    resolved_method->signature()),
+                   resolved_method->method_holder()->internal_name()
+                  );
+    resolved_method->access_flags().print_on(tty);
+    tty->cr();
+  }
 }
 
 //------------------------------------------------------------------------------------------------------------------------
@@ -795,26 +818,12 @@
                                                    Symbol* method_name, Symbol* method_signature,
                                                    KlassHandle current_klass, bool check_access, TRAPS) {
 
-  if (resolved_klass->is_interface() && current_klass() != NULL) {
-    // If the target class is a direct interface, treat this as a "super"
-    // default call.
-    //
-    // If the current method is an overpass that happens to call a direct
-    // super-interface's method, then we'll end up rerunning the default method
-    // analysis even though we don't need to, but that's ok since it will end
-    // up with the same answer.
-    InstanceKlass* ik = InstanceKlass::cast(current_klass());
-    Array<Klass*>* interfaces = ik->local_interfaces();
-    int num_interfaces = interfaces->length();
-    for (int index = 0; index < num_interfaces; index++) {
-      if (interfaces->at(index) == resolved_klass()) {
-        Method* method = DefaultMethods::find_super_default(current_klass(),
-            resolved_klass(), method_name, method_signature, CHECK);
-        resolved_method = methodHandle(THREAD, method);
-        return;
-      }
-    }
-  }
+  // Invokespecial is called for multiple special reasons:
+  // <init>
+  // local private method invocation, for classes and interfaces
+  // superclass.method, which can also resolve to a default method
+  // and the selected method is recalculated relative to the direct superclass
+  // superinterface.method, which explicitly does not check shadowing
 
   resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, CHECK);
 
@@ -844,6 +853,26 @@
                                                          resolved_method->signature()));
     THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   }
+  if (TraceItables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokespecial resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ",
+                (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()),
+                (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                Method::name_and_sig_as_C_string(resolved_klass(),
+                                                 resolved_method->name(),
+                                                 resolved_method->signature()),
+                resolved_method->method_holder()->internal_name()
+               );
+    resolved_method->access_flags().print_on(tty);
+    if (resolved_method->method_holder()->is_interface() &&
+        !resolved_method->is_abstract()) {
+      tty->print("default");
+    }
+    if (resolved_method->is_overpass()) {
+      tty->print("overpass");
+    }
+    tty->cr();
+  }
 }
 
 // throws runtime exceptions
@@ -851,23 +880,24 @@
                                                   KlassHandle current_klass, bool check_access, TRAPS) {
 
   // resolved method is selected method unless we have an old-style lookup
+  // for a superclass method
+  // Invokespecial for a superinterface, resolved method is selected method,
+  // no checks for shadowing
   methodHandle sel_method(THREAD, resolved_method());
 
   // check if this is an old-style super call and do a new lookup if so
   { KlassHandle method_klass  = KlassHandle(THREAD,
                                             resolved_method->method_holder());
 
-    const bool direct_calling_default_method =
-      resolved_klass() != NULL && resolved_method() != NULL &&
-      resolved_klass->is_interface() && !resolved_method->is_abstract();
-
-    if (!direct_calling_default_method &&
-        check_access &&
+    if (check_access &&
         // a) check if ACC_SUPER flag is set for the current class
         (current_klass->is_super() || !AllowNonVirtualCalls) &&
-        // b) check if the method class is a superclass of the current class (superclass relation is not reflexive!)
-        current_klass->is_subtype_of(method_klass()) &&
-        current_klass() != method_klass() &&
+        // b) check if the class of the resolved_klass is a superclass
+        // (not supertype in order to exclude interface classes) of the current class.
+        // This check is not performed for super.invoke for interface methods
+        // in super interfaces.
+        current_klass->is_subclass_of(resolved_klass()) &&
+        current_klass() != resolved_klass() &&
         // c) check if the method is not <init>
         resolved_method->name() != vmSymbols::object_initializer_name()) {
       // Lookup super method
@@ -905,6 +935,23 @@
                                                       sel_method->signature()));
   }
 
+  if (TraceItables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokespecial selected method: resolved-class:%s, method:%s, method_holder:%s, access_flags: ",
+                 (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                 Method::name_and_sig_as_C_string(resolved_klass(),
+                                                  sel_method->name(),
+                                                  sel_method->signature()),
+                 sel_method->method_holder()->internal_name()
+                );
+    sel_method->access_flags().print_on(tty);
+    if (sel_method->method_holder()->is_interface() &&
+        !sel_method->is_abstract()) {
+      tty->print("default");
+    }
+    tty->cr();
+  }
+
   // setup result
   result.set_static(resolved_klass, sel_method, CHECK);
 }
@@ -927,6 +974,18 @@
   assert(resolved_method->name() != vmSymbols::object_initializer_name(), "should have been checked in verifier");
   assert(resolved_method->name() != vmSymbols::class_initializer_name (), "should have been checked in verifier");
 
+  // check if private interface method
+  if (resolved_klass->is_interface() && resolved_method->is_private()) {
+    ResourceMark rm(THREAD);
+    char buf[200];
+    jio_snprintf(buf, sizeof(buf), "private interface method requires invokespecial, not invokevirtual: method %s, caller-class:%s",
+                 Method::name_and_sig_as_C_string(resolved_klass(),
+                                                  resolved_method->name(),
+                                                  resolved_method->signature()),
+                   (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()));
+    THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
+  }
+
   // check if not static
   if (resolved_method->is_static()) {
     ResourceMark rm(THREAD);
@@ -936,6 +995,27 @@
                                                                                                              resolved_method->signature()));
     THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   }
+
+ if (PrintVtables && Verbose) {
+   ResourceMark rm(THREAD);
+   tty->print("invokevirtual resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ",
+                  (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()),
+                  (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                  Method::name_and_sig_as_C_string(resolved_klass(),
+                                                   resolved_method->name(),
+                                                   resolved_method->signature()),
+                  resolved_method->method_holder()->internal_name()
+                 );
+   resolved_method->access_flags().print_on(tty);
+   if (resolved_method->method_holder()->is_interface() &&
+       !resolved_method->is_abstract()) {
+     tty->print("default");
+   }
+   if (resolved_method->is_overpass()) {
+     tty->print("overpass");
+   }
+   tty->cr();
+ }
 }
 
 // throws runtime exceptions
@@ -1012,6 +1092,27 @@
                                                       selected_method->signature()));
   }
 
+  if (PrintVtables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokevirtual selected method: receiver-class:%s, resolved-class:%s, method:%s, method_holder:%s, vtable_index:%d, access_flags: ",
+                   (recv_klass.is_null() ? "<NULL>" : recv_klass->internal_name()),
+                   (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                   Method::name_and_sig_as_C_string(resolved_klass(),
+                                                    resolved_method->name(),
+                                                    resolved_method->signature()),
+                   selected_method->method_holder()->internal_name(),
+                   vtable_index
+                  );
+    selected_method->access_flags().print_on(tty);
+    if (selected_method->method_holder()->is_interface() &&
+        !selected_method->is_abstract()) {
+      tty->print("default");
+    }
+    if (resolved_method->is_overpass()) {
+      tty->print("overpass");
+    }
+    tty->cr();
+  }
   // setup result
   result.set_virtual(resolved_klass, recv_klass, resolved_method, selected_method, vtable_index, CHECK);
 }
@@ -1042,6 +1143,17 @@
     THROW(vmSymbols::java_lang_NullPointerException());
   }
 
+  // check if private interface method
+  if (resolved_klass->is_interface() && resolved_method->is_private()) {
+    ResourceMark rm(THREAD);
+    char buf[200];
+    jio_snprintf(buf, sizeof(buf), "private interface method requires invokespecial, not invokeinterface: method %s",
+                 Method::name_and_sig_as_C_string(resolved_klass(),
+                                                  resolved_method->name(),
+                                                  resolved_method->signature()));
+    THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
+  }
+
   // check if receiver klass implements the resolved interface
   if (!recv_klass->is_subtype_of(resolved_klass())) {
     ResourceMark rm(THREAD);
@@ -1071,28 +1183,15 @@
                                                       resolved_method->signature()));
   }
   // check access
-  if (sel_method->method_holder()->is_interface()) {
-    // Method holder is an interface. Throw Illegal Access Error if sel_method
-    // is neither public nor private.
-    if (!(sel_method->is_public() || sel_method->is_private())) {
-      ResourceMark rm(THREAD);
-      THROW_MSG(vmSymbols::java_lang_IllegalAccessError(),
-                Method::name_and_sig_as_C_string(recv_klass(),
-                                                 sel_method->name(),
-                                                 sel_method->signature()));
-    }
+  // Throw Illegal Access Error if sel_method is not public.
+  if (!sel_method->is_public()) {
+    ResourceMark rm(THREAD);
+    THROW_MSG(vmSymbols::java_lang_IllegalAccessError(),
+              Method::name_and_sig_as_C_string(recv_klass(),
+                                               sel_method->name(),
+                                               sel_method->signature()));
   }
-  else {
-    // Method holder is a class. Throw Illegal Access Error if sel_method
-    // is not public.
-    if (!sel_method->is_public()) {
-      ResourceMark rm(THREAD);
-      THROW_MSG(vmSymbols::java_lang_IllegalAccessError(),
-                Method::name_and_sig_as_C_string(recv_klass(),
-                                                 sel_method->name(),
-                                                 sel_method->signature()));
-    }
-  }
+
   // check if abstract
   if (check_null_and_abstract && sel_method->is_abstract()) {
     ResourceMark rm(THREAD);
@@ -1109,6 +1208,27 @@
     return;
   }
   int itable_index = resolved_method()->itable_index();
+
+  if (TraceItables && Verbose) {
+    ResourceMark rm(THREAD);
+    tty->print("invokeinterface selected method: receiver-class:%s, resolved-class:%s, method:%s, method_holder:%s, access_flags: ",
+                   (recv_klass.is_null() ? "<NULL>" : recv_klass->internal_name()),
+                   (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()),
+                   Method::name_and_sig_as_C_string(resolved_klass(),
+                                                    resolved_method->name(),
+                                                    resolved_method->signature()),
+                   sel_method->method_holder()->internal_name()
+                  );
+    sel_method->access_flags().print_on(tty);
+    if (sel_method->method_holder()->is_interface() &&
+        !sel_method->is_abstract()) {
+      tty->print("default");
+    }
+    if (resolved_method->is_overpass()) {
+      tty->print("overpass");
+    }
+    tty->cr();
+  }
   result.set_interface(resolved_klass, recv_klass, resolved_method, sel_method, itable_index, CHECK);
 }
 
@@ -1384,7 +1504,7 @@
                                                      THREAD);
   if (HAS_PENDING_EXCEPTION) {
     if (TraceMethodHandles) {
-      tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, PENDING_EXCEPTION);
+      tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, (void *)PENDING_EXCEPTION);
       PENDING_EXCEPTION->print();
     }
     if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -423,60 +423,6 @@
   inline_write_ref_field(field, newVal);
 }
 
-/*
-   Claimed and deferred bits are used together in G1 during the evacuation
-   pause. These bits can have the following state transitions:
-   1. The claimed bit can be put over any other card state. Except that
-      the "dirty -> dirty and claimed" transition is checked for in
-      G1 code and is not used.
-   2. Deferred bit can be set only if the previous state of the card
-      was either clean or claimed. mark_card_deferred() is wait-free.
-      We do not care if the operation is be successful because if
-      it does not it will only result in duplicate entry in the update
-      buffer because of the "cache-miss". So it's not worth spinning.
- */
-
-
-bool CardTableModRefBS::claim_card(size_t card_index) {
-  jbyte val = _byte_map[card_index];
-  assert(val != dirty_card_val(), "Shouldn't claim a dirty card");
-  while (val == clean_card_val() ||
-         (val & (clean_card_mask_val() | claimed_card_val())) != claimed_card_val()) {
-    jbyte new_val = val;
-    if (val == clean_card_val()) {
-      new_val = (jbyte)claimed_card_val();
-    } else {
-      new_val = val | (jbyte)claimed_card_val();
-    }
-    jbyte res = Atomic::cmpxchg(new_val, &_byte_map[card_index], val);
-    if (res == val) {
-      return true;
-    }
-    val = res;
-  }
-  return false;
-}
-
-bool CardTableModRefBS::mark_card_deferred(size_t card_index) {
-  jbyte val = _byte_map[card_index];
-  // It's already processed
-  if ((val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val()) {
-    return false;
-  }
-  // Cached bit can be installed either on a clean card or on a claimed card.
-  jbyte new_val = val;
-  if (val == clean_card_val()) {
-    new_val = (jbyte)deferred_card_val();
-  } else {
-    if (val & claimed_card_val()) {
-      new_val = val | (jbyte)deferred_card_val();
-    }
-  }
-  if (new_val != val) {
-    Atomic::cmpxchg(new_val, &_byte_map[card_index], val);
-  }
-  return true;
-}
 
 void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
                                                                  MemRegion mr,
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -339,34 +339,10 @@
     _byte_map[card_index] = dirty_card_val();
   }
 
-  bool is_card_claimed(size_t card_index) {
-    jbyte val = _byte_map[card_index];
-    return (val & (clean_card_mask_val() | claimed_card_val())) == claimed_card_val();
-  }
-
-  void set_card_claimed(size_t card_index) {
-      jbyte val = _byte_map[card_index];
-      if (val == clean_card_val()) {
-        val = (jbyte)claimed_card_val();
-      } else {
-        val |= (jbyte)claimed_card_val();
-      }
-      _byte_map[card_index] = val;
-  }
-
-  bool claim_card(size_t card_index);
-
   bool is_card_clean(size_t card_index) {
     return _byte_map[card_index] == clean_card_val();
   }
 
-  bool is_card_deferred(size_t card_index) {
-    jbyte val = _byte_map[card_index];
-    return (val & (clean_card_mask_val() | deferred_card_val())) == deferred_card_val();
-  }
-
-  bool mark_card_deferred(size_t card_index);
-
   // Card marking array base (adjusted for heap low boundary)
   // This would be the 0th element of _byte_map, if the heap started at 0x0.
   // But since the heap starts at some higher address, this points to somewhere
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -64,19 +64,21 @@
     vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified");
   }
 
-  if (!is_size_aligned(MaxMetaspaceSize, max_alignment())) {
-    FLAG_SET_ERGO(uintx, MaxMetaspaceSize,
-        restricted_align_down(MaxMetaspaceSize, max_alignment()));
-  }
+  // Do not use FLAG_SET_ERGO to update MaxMetaspaceSize, since this will
+  // override if MaxMetaspaceSize was set on the command line or not.
+  // This information is needed later to conform to the specification of the
+  // java.lang.management.MemoryUsage API.
+  //
+  // Ideally, we would be able to set the default value of MaxMetaspaceSize in
+  // globals.hpp to the aligned value, but this is not possible, since the
+  // alignment depends on other flags being parsed.
+  MaxMetaspaceSize = restricted_align_down(MaxMetaspaceSize, max_alignment());
 
   if (MetaspaceSize > MaxMetaspaceSize) {
-    FLAG_SET_ERGO(uintx, MetaspaceSize, MaxMetaspaceSize);
+    MetaspaceSize = MaxMetaspaceSize;
   }
 
-  if (!is_size_aligned(MetaspaceSize, min_alignment())) {
-    FLAG_SET_ERGO(uintx, MetaspaceSize,
-        restricted_align_down(MetaspaceSize, min_alignment()));
-  }
+  MetaspaceSize = restricted_align_down(MetaspaceSize, min_alignment());
 
   assert(MetaspaceSize <= MaxMetaspaceSize, "Must be");
 
@@ -135,15 +137,8 @@
 
 GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap,
                                            int max_covered_regions) {
-  switch (rem_set_name()) {
-  case GenRemSet::CardTable: {
-    CardTableRS* res = new CardTableRS(whole_heap, max_covered_regions);
-    return res;
-  }
-  default:
-    guarantee(false, "unrecognized GenRemSet::Name");
-    return NULL;
-  }
+  assert(rem_set_name() == GenRemSet::CardTable, "unrecognized GenRemSet::Name");
+  return new CardTableRS(whole_heap, max_covered_regions);
 }
 
 void CollectorPolicy::cleared_all_soft_refs() {
--- a/hotspot/src/share/vm/memory/gcLocker.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/gcLocker.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -122,7 +122,7 @@
     // strictly needed. It's added here to make it clear that
     // the GC will NOT be performed if any other caller
     // of GC_locker::lock() still needs GC locked.
-    if (!is_active()) {
+    if (!is_active_internal()) {
       _doing_gc = true;
       {
         // Must give up the lock while at a safepoint
--- a/hotspot/src/share/vm/memory/gcLocker.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/gcLocker.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -88,7 +88,7 @@
  public:
   // Accessors
   static bool is_active() {
-    assert(_needs_gc || SafepointSynchronize::is_at_safepoint(), "only read at safepoint");
+    assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint");
     return is_active_internal();
   }
   static bool needs_gc()       { return _needs_gc;                        }
--- a/hotspot/src/share/vm/memory/genRemSet.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/genRemSet.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -32,13 +32,8 @@
 // enumeration.)
 
 uintx GenRemSet::max_alignment_constraint(Name nm) {
-  switch (nm) {
-  case GenRemSet::CardTable:
-    return CardTableRS::ct_max_alignment_constraint();
-  default:
-    guarantee(false, "Unrecognized GenRemSet type.");
-    return (0); // Make Windows compiler happy
-  }
+  assert(nm == GenRemSet::CardTable, "Unrecognized GenRemSet type.");
+  return CardTableRS::ct_max_alignment_constraint();
 }
 
 class HasAccumulatedModifiedOopsClosure : public KlassClosure {
--- a/hotspot/src/share/vm/memory/heapInspection.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/heapInspection.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -150,11 +150,11 @@
   HEAP_INSPECTION_COLUMNS_DO(DECLARE_KLASS_SIZE_STATS_FIELD)
 
   static int count(oop x) {
-    return (HeapWordSize * ((x) ? (x)->size() : 0));
+    return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
   }
 
   static int count_array(objArrayOop x) {
-    return (HeapWordSize * ((x) ? (x)->size() : 0));
+    return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
   }
 
   template <class T> static int count(T* x) {
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -23,6 +23,7 @@
  */
 #include "precompiled.hpp"
 #include "gc_interface/collectedHeap.hpp"
+#include "memory/allocation.hpp"
 #include "memory/binaryTreeDictionary.hpp"
 #include "memory/freeList.hpp"
 #include "memory/collectorPolicy.hpp"
@@ -111,7 +112,7 @@
 // Has three lists of free chunks, and a total size and
 // count that includes all three
 
-class ChunkManager VALUE_OBJ_CLASS_SPEC {
+class ChunkManager : public CHeapObj<mtInternal> {
 
   // Free list of chunks of different sizes.
   //   SpecializedChunk
@@ -158,7 +159,12 @@
 
  public:
 
-  ChunkManager() : _free_chunks_total(0), _free_chunks_count(0) {}
+  ChunkManager(size_t specialized_size, size_t small_size, size_t medium_size)
+      : _free_chunks_total(0), _free_chunks_count(0) {
+    _free_chunks[SpecializedIndex].set_size(specialized_size);
+    _free_chunks[SmallIndex].set_size(small_size);
+    _free_chunks[MediumIndex].set_size(medium_size);
+  }
 
   // add or delete (return) a chunk to the global freelist.
   Metachunk* chunk_freelist_allocate(size_t word_size);
@@ -219,7 +225,7 @@
   void locked_print_free_chunks(outputStream* st);
   void locked_print_sum_free_chunks(outputStream* st);
 
-  void print_on(outputStream* st);
+  void print_on(outputStream* st) const;
 };
 
 // Used to manage the free list of Metablocks (a block corresponds
@@ -276,11 +282,6 @@
   // VirtualSpace
   Metachunk* first_chunk() { return (Metachunk*) bottom(); }
 
-  void inc_container_count();
-#ifdef ASSERT
-  uint container_count_slow();
-#endif
-
  public:
 
   VirtualSpaceNode(size_t byte_size);
@@ -314,8 +315,10 @@
   void inc_top(size_t word_size) { _top += word_size; }
 
   uintx container_count() { return _container_count; }
+  void inc_container_count();
   void dec_container_count();
 #ifdef ASSERT
+  uint container_count_slow();
   void verify_container_count();
 #endif
 
@@ -421,8 +424,6 @@
   VirtualSpaceNode* _virtual_space_list;
   // virtual space currently being used for allocations
   VirtualSpaceNode* _current_virtual_space;
-  // Free chunk list for all other metadata
-  ChunkManager      _chunk_manager;
 
   // Can this virtual list allocate >1 spaces?  Also, used to determine
   // whether to allocate unlimited small chunks in this virtual space
@@ -475,7 +476,6 @@
     return _current_virtual_space;
   }
 
-  ChunkManager* chunk_manager() { return &_chunk_manager; }
   bool is_class() const { return _is_class; }
 
   // Allocate the first virtualspace.
@@ -494,14 +494,7 @@
   void dec_virtual_space_count();
 
   // Unlink empty VirtualSpaceNodes and free it.
-  void purge();
-
-  // Used and capacity in the entire list of virtual spaces.
-  // These are global values shared by all Metaspaces
-  size_t capacity_words_sum();
-  size_t capacity_bytes_sum() { return capacity_words_sum() * BytesPerWord; }
-  size_t used_words_sum();
-  size_t used_bytes_sum() { return used_words_sum() * BytesPerWord; }
+  void purge(ChunkManager* chunk_manager);
 
   bool contains(const void *ptr);
 
@@ -582,18 +575,12 @@
   // Type of metadata allocated.
   Metaspace::MetadataType _mdtype;
 
-  // Chunk related size
-  size_t _medium_chunk_bunch;
-
   // List of chunks in use by this SpaceManager.  Allocations
   // are done from the current chunk.  The list is used for deallocating
   // chunks when the SpaceManager is freed.
   Metachunk* _chunks_in_use[NumberOfInUseLists];
   Metachunk* _current_chunk;
 
-  // Virtual space where allocation comes from.
-  VirtualSpaceList* _vs_list;
-
   // Number of small chunks to allocate to a manager
   // If class space manager, small chunks are unlimited
   static uint const _small_chunk_limit;
@@ -626,7 +613,9 @@
   }
 
   Metaspace::MetadataType mdtype() { return _mdtype; }
-  VirtualSpaceList* vs_list() const    { return _vs_list; }
+
+  VirtualSpaceList* vs_list()   const { return Metaspace::get_space_list(_mdtype); }
+  ChunkManager* chunk_manager() const { return Metaspace::get_chunk_manager(_mdtype); }
 
   Metachunk* current_chunk() const { return _current_chunk; }
   void set_current_chunk(Metachunk* v) {
@@ -648,18 +637,19 @@
 
  public:
   SpaceManager(Metaspace::MetadataType mdtype,
-               Mutex* lock,
-               VirtualSpaceList* vs_list);
+               Mutex* lock);
   ~SpaceManager();
 
   enum ChunkMultiples {
     MediumChunkMultiple = 4
   };
 
+  bool is_class() { return _mdtype == Metaspace::ClassType; }
+
   // Accessors
   size_t specialized_chunk_size() { return SpecializedChunk; }
-  size_t small_chunk_size() { return (size_t) vs_list()->is_class() ? ClassSmallChunk : SmallChunk; }
-  size_t medium_chunk_size() { return (size_t) vs_list()->is_class() ? ClassMediumChunk : MediumChunk; }
+  size_t small_chunk_size() { return (size_t) is_class() ? ClassSmallChunk : SmallChunk; }
+  size_t medium_chunk_size() { return (size_t) is_class() ? ClassMediumChunk : MediumChunk; }
   size_t medium_chunk_bunch() { return medium_chunk_size() * MediumChunkMultiple; }
 
   size_t allocated_blocks_words() const { return _allocated_blocks_words; }
@@ -762,7 +752,7 @@
   _container_count++;
   assert(_container_count == container_count_slow(),
          err_msg("Inconsistency in countainer_count _container_count " SIZE_FORMAT
-                 "container_count_slow() " SIZE_FORMAT,
+                 " container_count_slow() " SIZE_FORMAT,
                  _container_count, container_count_slow()));
 }
 
@@ -775,7 +765,7 @@
 void VirtualSpaceNode::verify_container_count() {
   assert(_container_count == container_count_slow(),
     err_msg("Inconsistency in countainer_count _container_count " SIZE_FORMAT
-            "container_count_slow() " SIZE_FORMAT, _container_count, container_count_slow()));
+            " container_count_slow() " SIZE_FORMAT, _container_count, container_count_slow()));
 }
 #endif
 
@@ -1020,7 +1010,7 @@
 // Walk the list of VirtualSpaceNodes and delete
 // nodes with a 0 container_count.  Remove Metachunks in
 // the node from their respective freelists.
-void VirtualSpaceList::purge() {
+void VirtualSpaceList::purge(ChunkManager* chunk_manager) {
   assert_lock_strong(SpaceManager::expand_lock());
   // Don't use a VirtualSpaceListIterator because this
   // list is being changed and a straightforward use of an iterator is not safe.
@@ -1042,7 +1032,7 @@
         prev_vsl->set_next(vsl->next());
       }
 
-      vsl->purge(chunk_manager());
+      vsl->purge(chunk_manager);
       dec_reserved_words(vsl->reserved_words());
       dec_committed_words(vsl->committed_words());
       dec_virtual_space_count();
@@ -1064,36 +1054,6 @@
 #endif
 }
 
-size_t VirtualSpaceList::used_words_sum() {
-  size_t allocated_by_vs = 0;
-  VirtualSpaceListIterator iter(virtual_space_list());
-  while (iter.repeat()) {
-    VirtualSpaceNode* vsl = iter.get_next();
-    // Sum used region [bottom, top) in each virtualspace
-    allocated_by_vs += vsl->used_words_in_vs();
-  }
-  assert(allocated_by_vs >= chunk_manager()->free_chunks_total_words(),
-    err_msg("Total in free chunks " SIZE_FORMAT
-            " greater than total from virtual_spaces " SIZE_FORMAT,
-            allocated_by_vs, chunk_manager()->free_chunks_total_words()));
-  size_t used =
-    allocated_by_vs - chunk_manager()->free_chunks_total_words();
-  return used;
-}
-
-// Space available in all MetadataVirtualspaces allocated
-// for metadata.  This is the upper limit on the capacity
-// of chunks allocated out of all the MetadataVirtualspaces.
-size_t VirtualSpaceList::capacity_words_sum() {
-  size_t capacity = 0;
-  VirtualSpaceListIterator iter(virtual_space_list());
-  while (iter.repeat()) {
-    VirtualSpaceNode* vsl = iter.get_next();
-    capacity += vsl->capacity_words_in_vs();
-  }
-  return capacity;
-}
-
 VirtualSpaceList::VirtualSpaceList(size_t word_size ) :
                                    _is_class(false),
                                    _virtual_space_list(NULL),
@@ -1104,10 +1064,6 @@
   MutexLockerEx cl(SpaceManager::expand_lock(),
                    Mutex::_no_safepoint_check_flag);
   bool initialization_succeeded = grow_vs(word_size);
-
-  _chunk_manager.free_chunks(SpecializedIndex)->set_size(SpecializedChunk);
-  _chunk_manager.free_chunks(SmallIndex)->set_size(SmallChunk);
-  _chunk_manager.free_chunks(MediumIndex)->set_size(MediumChunk);
   assert(initialization_succeeded,
     " VirtualSpaceList initialization should not fail");
 }
@@ -1123,9 +1079,6 @@
                    Mutex::_no_safepoint_check_flag);
   VirtualSpaceNode* class_entry = new VirtualSpaceNode(rs);
   bool succeeded = class_entry->initialize();
-  _chunk_manager.free_chunks(SpecializedIndex)->set_size(SpecializedChunk);
-  _chunk_manager.free_chunks(SmallIndex)->set_size(ClassSmallChunk);
-  _chunk_manager.free_chunks(MediumIndex)->set_size(ClassMediumChunk);
   assert(succeeded, " VirtualSpaceList initialization should not fail");
   link_vs(class_entry);
 }
@@ -1142,7 +1095,7 @@
   }
   // Reserve the space
   size_t vs_byte_size = vs_word_size * BytesPerWord;
-  assert(vs_byte_size % os::vm_page_size() == 0, "Not aligned");
+  assert(vs_byte_size % os::vm_allocation_granularity() == 0, "Not aligned");
 
   // Allocate the meta virtual space and initialize it.
   VirtualSpaceNode* new_entry = new VirtualSpaceNode(vs_byte_size);
@@ -1195,15 +1148,8 @@
                                            size_t grow_chunks_by_words,
                                            size_t medium_chunk_bunch) {
 
-  // Get a chunk from the chunk freelist
-  Metachunk* next = chunk_manager()->chunk_freelist_allocate(grow_chunks_by_words);
-
-  if (next != NULL) {
-    next->container()->inc_container_count();
-  } else {
-    // Allocate a chunk out of the current virtual space.
-    next = current_virtual_space()->get_chunk_vs(grow_chunks_by_words);
-  }
+  // Allocate a chunk out of the current virtual space.
+  Metachunk* next = current_virtual_space()->get_chunk_vs(grow_chunks_by_words);
 
   if (next == NULL) {
     // Not enough room in current virtual space.  Try to commit
@@ -1221,12 +1167,14 @@
       // being used for CompressedHeaders, don't allocate a new virtualspace.
       if (can_grow() && MetaspaceGC::should_expand(this, word_size)) {
         // Get another virtual space.
-          size_t grow_vs_words =
-            MAX2((size_t)VirtualSpaceSize, aligned_expand_vs_by_words);
+        size_t allocation_aligned_expand_words =
+            align_size_up(aligned_expand_vs_by_words, os::vm_allocation_granularity() / BytesPerWord);
+        size_t grow_vs_words =
+            MAX2((size_t)VirtualSpaceSize, allocation_aligned_expand_words);
         if (grow_vs(grow_vs_words)) {
           // Got it.  It's on the list now.  Get a chunk from it.
           assert(current_virtual_space()->expanded_words() == 0,
-              "New virtuals space nodes should not have expanded");
+              "New virtual space nodes should not have expanded");
 
           size_t grow_chunks_by_words_aligned = align_size_up(grow_chunks_by_words,
                                                               page_size_words);
@@ -1342,8 +1290,9 @@
   // reserved space, because this is a larger space prereserved for compressed
   // class pointers.
   if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) {
-    size_t real_allocated = Metaspace::space_list()->reserved_words() +
-              MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType);
+    size_t nonclass_allocated = MetaspaceAux::reserved_bytes(Metaspace::NonClassType);
+    size_t class_allocated    = MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType);
+    size_t real_allocated     = nonclass_allocated + class_allocated;
     if (real_allocated >= MaxMetaspaceSize) {
       return false;
     }
@@ -1536,15 +1485,15 @@
       if (dummy_chunk == NULL) {
         break;
       }
-      vsl->chunk_manager()->chunk_freelist_deallocate(dummy_chunk);
+      sm->chunk_manager()->chunk_freelist_deallocate(dummy_chunk);
 
       if (TraceMetadataChunkAllocation && Verbose) {
         gclog_or_tty->print("Metadebug::deallocate_chunk_a_lot: %d) ",
                                sm->sum_count_in_chunks_in_use());
         dummy_chunk->print_on(gclog_or_tty);
         gclog_or_tty->print_cr("  Free chunks total %d  count %d",
-                               vsl->chunk_manager()->free_chunks_total_words(),
-                               vsl->chunk_manager()->free_chunks_count());
+                               sm->chunk_manager()->free_chunks_total_words(),
+                               sm->chunk_manager()->free_chunks_count());
       }
     }
   } else {
@@ -1796,6 +1745,8 @@
   // work.
   chunk->set_is_free(false);
 #endif
+  chunk->container()->inc_container_count();
+
   slow_locked_verify();
   return chunk;
 }
@@ -1830,9 +1781,9 @@
   return chunk;
 }
 
-void ChunkManager::print_on(outputStream* out) {
+void ChunkManager::print_on(outputStream* out) const {
   if (PrintFLSStatistics != 0) {
-    humongous_dictionary()->report_statistics();
+    const_cast<ChunkManager *>(this)->humongous_dictionary()->report_statistics();
   }
 }
 
@@ -1979,8 +1930,8 @@
     }
   }
 
-  vs_list()->chunk_manager()->locked_print_free_chunks(st);
-  vs_list()->chunk_manager()->locked_print_sum_free_chunks(st);
+  chunk_manager()->locked_print_free_chunks(st);
+  chunk_manager()->locked_print_sum_free_chunks(st);
 }
 
 size_t SpaceManager::calc_chunk_size(size_t word_size) {
@@ -2084,9 +2035,7 @@
 }
 
 SpaceManager::SpaceManager(Metaspace::MetadataType mdtype,
-                           Mutex* lock,
-                           VirtualSpaceList* vs_list) :
-  _vs_list(vs_list),
+                           Mutex* lock) :
   _mdtype(mdtype),
   _allocated_blocks_words(0),
   _allocated_chunks_words(0),
@@ -2172,9 +2121,7 @@
   MutexLockerEx fcl(SpaceManager::expand_lock(),
                     Mutex::_no_safepoint_check_flag);
 
-  ChunkManager* chunk_manager = vs_list()->chunk_manager();
-
-  chunk_manager->slow_locked_verify();
+  chunk_manager()->slow_locked_verify();
 
   dec_total_from_size_metrics();
 
@@ -2188,8 +2135,8 @@
 
   // Have to update before the chunks_in_use lists are emptied
   // below.
-  chunk_manager->inc_free_chunks_total(allocated_chunks_words(),
-                                       sum_count_in_chunks_in_use());
+  chunk_manager()->inc_free_chunks_total(allocated_chunks_words(),
+                                         sum_count_in_chunks_in_use());
 
   // Add all the chunks in use by this space manager
   // to the global list of free chunks.
@@ -2204,11 +2151,11 @@
                              chunk_size_name(i));
     }
     Metachunk* chunks = chunks_in_use(i);
-    chunk_manager->return_chunks(i, chunks);
+    chunk_manager()->return_chunks(i, chunks);
     set_chunks_in_use(i, NULL);
     if (TraceMetadataChunkAllocation && Verbose) {
       gclog_or_tty->print_cr("updated freelist count %d %s",
-                             chunk_manager->free_chunks(i)->count(),
+                             chunk_manager()->free_chunks(i)->count(),
                              chunk_size_name(i));
     }
     assert(i != HumongousIndex, "Humongous chunks are handled explicitly later");
@@ -2245,16 +2192,16 @@
                    humongous_chunks->word_size(), HumongousChunkGranularity));
     Metachunk* next_humongous_chunks = humongous_chunks->next();
     humongous_chunks->container()->dec_container_count();
-    chunk_manager->humongous_dictionary()->return_chunk(humongous_chunks);
+    chunk_manager()->humongous_dictionary()->return_chunk(humongous_chunks);
     humongous_chunks = next_humongous_chunks;
   }
   if (TraceMetadataChunkAllocation && Verbose) {
     gclog_or_tty->print_cr("");
     gclog_or_tty->print_cr("updated dictionary count %d %s",
-                     chunk_manager->humongous_dictionary()->total_count(),
+                     chunk_manager()->humongous_dictionary()->total_count(),
                      chunk_size_name(HumongousIndex));
   }
-  chunk_manager->slow_locked_verify();
+  chunk_manager()->slow_locked_verify();
 }
 
 const char* SpaceManager::chunk_size_name(ChunkIndex index) const {
@@ -2343,9 +2290,7 @@
     gclog_or_tty->print("SpaceManager::add_chunk: %d) ",
                         sum_count_in_chunks_in_use());
     new_chunk->print_on(gclog_or_tty);
-    if (vs_list() != NULL) {
-      vs_list()->chunk_manager()->locked_print_free_chunks(gclog_or_tty);
-    }
+    chunk_manager()->locked_print_free_chunks(gclog_or_tty);
   }
 }
 
@@ -2361,10 +2306,14 @@
 
 Metachunk* SpaceManager::get_new_chunk(size_t word_size,
                                        size_t grow_chunks_by_words) {
-
-  Metachunk* next = vs_list()->get_new_chunk(word_size,
-                                             grow_chunks_by_words,
-                                             medium_chunk_bunch());
+  // Get a chunk from the chunk freelist
+  Metachunk* next = chunk_manager()->chunk_freelist_allocate(grow_chunks_by_words);
+
+  if (next == NULL) {
+    next = vs_list()->get_new_chunk(word_size,
+                                    grow_chunks_by_words,
+                                    medium_chunk_bunch());
+  }
 
   if (TraceMetadataHumongousAllocation && next != NULL &&
       SpaceManager::is_humongous(next->word_size())) {
@@ -2644,13 +2593,12 @@
 size_t MetaspaceAux::min_chunk_size_words() { return Metaspace::first_chunk_word_size(); }
 
 size_t MetaspaceAux::free_chunks_total_words(Metaspace::MetadataType mdtype) {
-  VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
-  if (list == NULL) {
+  ChunkManager* chunk_manager = Metaspace::get_chunk_manager(mdtype);
+  if (chunk_manager == NULL) {
     return 0;
   }
-  ChunkManager* chunk = list->chunk_manager();
-  chunk->slow_verify();
-  return chunk->free_chunks_total_words();
+  chunk_manager->slow_verify();
+  return chunk_manager->free_chunks_total_words();
 }
 
 size_t MetaspaceAux::free_chunks_total_bytes(Metaspace::MetadataType mdtype) {
@@ -2801,9 +2749,9 @@
 }
 
 void MetaspaceAux::verify_free_chunks() {
-  Metaspace::space_list()->chunk_manager()->verify();
+  Metaspace::chunk_manager_metadata()->verify();
   if (Metaspace::using_class_space()) {
-    Metaspace::class_space_list()->chunk_manager()->verify();
+    Metaspace::chunk_manager_class()->verify();
   }
 }
 
@@ -2874,6 +2822,9 @@
 VirtualSpaceList* Metaspace::_space_list = NULL;
 VirtualSpaceList* Metaspace::_class_space_list = NULL;
 
+ChunkManager* Metaspace::_chunk_manager_metadata = NULL;
+ChunkManager* Metaspace::_chunk_manager_class = NULL;
+
 #define VIRTUALSPACEMULTIPLIER 2
 
 #ifdef _LP64
@@ -2981,6 +2932,7 @@
          err_msg(SIZE_FORMAT " != " UINTX_FORMAT, rs.size(), CompressedClassSpaceSize));
   assert(using_class_space(), "Must be using class space");
   _class_space_list = new VirtualSpaceList(rs);
+  _chunk_manager_class = new ChunkManager(SpecializedChunk, ClassSmallChunk, ClassMediumChunk);
 }
 
 #endif
@@ -3006,6 +2958,7 @@
     // remainder is the misc code and data chunks.
     cds_total = FileMapInfo::shared_spaces_size();
     _space_list = new VirtualSpaceList(cds_total/wordSize);
+    _chunk_manager_metadata = new ChunkManager(SpecializedChunk, SmallChunk, MediumChunk);
 
 #ifdef _LP64
     // Set the compressed klass pointer base so that decoding of these pointers works
@@ -3073,15 +3026,30 @@
     size_t word_size = VIRTUALSPACEMULTIPLIER * first_chunk_word_size();
     // Initialize the list of virtual spaces.
     _space_list = new VirtualSpaceList(word_size);
+    _chunk_manager_metadata = new ChunkManager(SpecializedChunk, SmallChunk, MediumChunk);
   }
 }
 
+Metachunk* Metaspace::get_initialization_chunk(MetadataType mdtype,
+                                               size_t chunk_word_size,
+                                               size_t chunk_bunch) {
+  // Get a chunk from the chunk freelist
+  Metachunk* chunk = get_chunk_manager(mdtype)->chunk_freelist_allocate(chunk_word_size);
+  if (chunk != NULL) {
+    return chunk;
+  }
+
+  return get_space_list(mdtype)->get_initialization_chunk(chunk_word_size, chunk_bunch);
+}
+
 void Metaspace::initialize(Mutex* lock, MetaspaceType type) {
 
   assert(space_list() != NULL,
     "Metadata VirtualSpaceList has not been initialized");
-
-  _vsm = new SpaceManager(NonClassType, lock, space_list());
+  assert(chunk_manager_metadata() != NULL,
+    "Metadata ChunkManager has not been initialized");
+
+  _vsm = new SpaceManager(NonClassType, lock);
   if (_vsm == NULL) {
     return;
   }
@@ -3090,11 +3058,13 @@
   vsm()->get_initial_chunk_sizes(type, &word_size, &class_word_size);
 
   if (using_class_space()) {
-    assert(class_space_list() != NULL,
-      "Class VirtualSpaceList has not been initialized");
+  assert(class_space_list() != NULL,
+    "Class VirtualSpaceList has not been initialized");
+  assert(chunk_manager_class() != NULL,
+    "Class ChunkManager has not been initialized");
 
     // Allocate SpaceManager for classes.
-    _class_vsm = new SpaceManager(ClassType, lock, class_space_list());
+    _class_vsm = new SpaceManager(ClassType, lock);
     if (_class_vsm == NULL) {
       return;
     }
@@ -3103,9 +3073,9 @@
   MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
 
   // Allocate chunk for metadata objects
-  Metachunk* new_chunk =
-     space_list()->get_initialization_chunk(word_size,
-                                            vsm()->medium_chunk_bunch());
+  Metachunk* new_chunk = get_initialization_chunk(NonClassType,
+                                                  word_size,
+                                                  vsm()->medium_chunk_bunch());
   assert(!DumpSharedSpaces || new_chunk != NULL, "should have enough space for both chunks");
   if (new_chunk != NULL) {
     // Add to this manager's list of chunks in use and current_chunk().
@@ -3114,9 +3084,9 @@
 
   // Allocate chunk for class metadata objects
   if (using_class_space()) {
-    Metachunk* class_chunk =
-       class_space_list()->get_initialization_chunk(class_word_size,
-                                                    class_vsm()->medium_chunk_bunch());
+    Metachunk* class_chunk = get_initialization_chunk(ClassType,
+                                                      class_word_size,
+                                                      class_vsm()->medium_chunk_bunch());
     if (class_chunk != NULL) {
       class_vsm()->add_chunk(class_chunk, true);
     }
@@ -3134,7 +3104,7 @@
 MetaWord* Metaspace::allocate(size_t word_size, MetadataType mdtype) {
   // DumpSharedSpaces doesn't use class metadata area (yet)
   // Also, don't use class_vsm() unless UseCompressedClassPointers is true.
-  if (mdtype == ClassType && using_class_space()) {
+  if (is_class_space_allocation(mdtype)) {
     return  class_vsm()->allocate(word_size);
   } else {
     return  vsm()->allocate(word_size);
@@ -3282,8 +3252,8 @@
         MetaspaceAux::dump(gclog_or_tty);
       }
       // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
-      const char* space_string = (mdtype == ClassType) ? "Compressed class space" :
-                                                         "Metadata space";
+      const char* space_string = is_class_space_allocation(mdtype) ? "Compressed class space" :
+                                                                     "Metadata space";
       report_java_out_of_memory(space_string);
 
       if (JvmtiExport::should_post_resource_exhausted()) {
@@ -3291,7 +3261,7 @@
             JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR,
             space_string);
       }
-      if (mdtype == ClassType) {
+      if (is_class_space_allocation(mdtype)) {
         THROW_OOP_0(Universe::out_of_memory_error_class_metaspace());
       } else {
         THROW_OOP_0(Universe::out_of_memory_error_metaspace());
@@ -3333,12 +3303,16 @@
   }
 }
 
+void Metaspace::purge(MetadataType mdtype) {
+  get_space_list(mdtype)->purge(get_chunk_manager(mdtype));
+}
+
 void Metaspace::purge() {
   MutexLockerEx cl(SpaceManager::expand_lock(),
                    Mutex::_no_safepoint_check_flag);
-  space_list()->purge();
+  purge(NonClassType);
   if (using_class_space()) {
-    class_space_list()->purge();
+    purge(ClassType);
   }
 }
 
@@ -3385,7 +3359,7 @@
 
 #ifndef PRODUCT
 
-class MetaspaceAuxTest : AllStatic {
+class TestMetaspaceAuxTest : AllStatic {
  public:
   static void test_reserved() {
     size_t reserved = MetaspaceAux::reserved_bytes();
@@ -3425,14 +3399,25 @@
     }
   }
 
+  static void test_virtual_space_list_large_chunk() {
+    VirtualSpaceList* vs_list = new VirtualSpaceList(os::vm_allocation_granularity());
+    MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
+    // A size larger than VirtualSpaceSize (256k) and add one page to make it _not_ be
+    // vm_allocation_granularity aligned on Windows.
+    size_t large_size = (size_t)(2*256*K + (os::vm_page_size()/BytesPerWord));
+    large_size += (os::vm_page_size()/BytesPerWord);
+    vs_list->get_new_chunk(large_size, large_size, 0);
+  }
+
   static void test() {
     test_reserved();
     test_committed();
+    test_virtual_space_list_large_chunk();
   }
 };
 
-void MetaspaceAux_test() {
-  MetaspaceAuxTest::test();
+void TestMetaspaceAux_test() {
+  TestMetaspaceAuxTest::test();
 }
 
 #endif
--- a/hotspot/src/share/vm/memory/metaspace.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -56,12 +56,15 @@
 //                       +-------------------+
 //
 
+class ChunkManager;
 class ClassLoaderData;
 class Metablock;
+class Metachunk;
 class MetaWord;
 class Mutex;
 class outputStream;
 class SpaceManager;
+class VirtualSpaceList;
 
 // Metaspaces each have a  SpaceManager and allocations
 // are done by the SpaceManager.  Allocations are done
@@ -76,8 +79,6 @@
 // allocate() method returns a block for use as a
 // quantum of metadata.
 
-class VirtualSpaceList;
-
 class Metaspace : public CHeapObj<mtClass> {
   friend class VMStructs;
   friend class SpaceManager;
@@ -102,6 +103,10 @@
  private:
   void initialize(Mutex* lock, MetaspaceType type);
 
+  Metachunk* get_initialization_chunk(MetadataType mdtype,
+                                      size_t chunk_word_size,
+                                      size_t chunk_bunch);
+
   // Align up the word size to the allocation word size
   static size_t align_word_size_up(size_t);
 
@@ -134,6 +139,10 @@
   static VirtualSpaceList* _space_list;
   static VirtualSpaceList* _class_space_list;
 
+  static ChunkManager* _chunk_manager_metadata;
+  static ChunkManager* _chunk_manager_class;
+
+ public:
   static VirtualSpaceList* space_list()       { return _space_list; }
   static VirtualSpaceList* class_space_list() { return _class_space_list; }
   static VirtualSpaceList* get_space_list(MetadataType mdtype) {
@@ -141,6 +150,14 @@
     return mdtype == ClassType ? class_space_list() : space_list();
   }
 
+  static ChunkManager* chunk_manager_metadata() { return _chunk_manager_metadata; }
+  static ChunkManager* chunk_manager_class()    { return _chunk_manager_class; }
+  static ChunkManager* get_chunk_manager(MetadataType mdtype) {
+    assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype");
+    return mdtype == ClassType ? chunk_manager_class() : chunk_manager_metadata();
+  }
+
+ private:
   // This is used by DumpSharedSpaces only, where only _vsm is used. So we will
   // maintain a single list for now.
   void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size);
@@ -199,6 +216,7 @@
   void dump(outputStream* const out) const;
 
   // Free empty virtualspaces
+  static void purge(MetadataType mdtype);
   static void purge();
 
   void print_on(outputStream* st) const;
@@ -217,6 +235,9 @@
     return NOT_LP64(false) LP64_ONLY(UseCompressedClassPointers && !DumpSharedSpaces);
   }
 
+  static bool is_class_space_allocation(MetadataType mdType) {
+    return mdType == ClassType && using_class_space();
+  }
 };
 
 class MetaspaceAux : AllStatic {
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -103,9 +103,10 @@
     if (k->oop_is_instance()) {
       InstanceKlass* ik = InstanceKlass::cast(k);
       for (int i = 0; i < ik->methods()->length(); i++) {
-        ResourceMark rm;
         Method* m = ik->methods()->at(i);
-        (new Fingerprinter(m))->fingerprint();
+        Fingerprinter fp(m);
+        // The side effect of this call sets method's fingerprint field.
+        fp.fingerprint();
       }
     }
   }
--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -367,7 +367,7 @@
       next_d = java_lang_ref_Reference::discovered(obj);
       if (TraceReferenceGC && PrintGCDetails) {
         gclog_or_tty->print_cr("        obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT,
-                               obj, next_d);
+                               (void *)obj, (void *)next_d);
       }
       assert(java_lang_ref_Reference::next(obj) == NULL,
              "Reference not active; should not be discovered");
@@ -392,7 +392,7 @@
       next_d = java_lang_ref_Reference::discovered(obj);
       if (TraceReferenceGC && PrintGCDetails) {
         gclog_or_tty->print_cr("        obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT,
-                               obj, next_d);
+                               (void *)obj, (void *)next_d);
       }
       assert(java_lang_ref_Reference::next(obj) == NULL,
              "The reference should not be enqueued");
@@ -562,7 +562,7 @@
         !policy->should_clear_reference(iter.obj(), _soft_ref_timestamp_clock)) {
       if (TraceReferenceGC) {
         gclog_or_tty->print_cr("Dropping reference (" INTPTR_FORMAT ": %s"  ") by policy",
-                               iter.obj(), iter.obj()->klass()->internal_name());
+                               (void *)iter.obj(), iter.obj()->klass()->internal_name());
       }
       // Remove Reference object from list
       iter.remove();
@@ -601,7 +601,7 @@
     if (iter.is_referent_alive()) {
       if (TraceReferenceGC) {
         gclog_or_tty->print_cr("Dropping strongly reachable reference (" INTPTR_FORMAT ": %s)",
-                               iter.obj(), iter.obj()->klass()->internal_name());
+                               (void *)iter.obj(), iter.obj()->klass()->internal_name());
       }
       // The referent is reachable after all.
       // Remove Reference object from list.
@@ -687,7 +687,7 @@
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Adding %sreference (" INTPTR_FORMAT ": %s) as pending",
                              clear_referent ? "cleared " : "",
-                             iter.obj(), iter.obj()->klass()->internal_name());
+                             (void *)iter.obj(), iter.obj()->klass()->internal_name());
     }
     assert(iter.obj()->is_oop(UseConcMarkSweepGC), "Adding a bad reference");
     iter.next();
@@ -1003,7 +1003,7 @@
           gclog_or_tty->print_cr("clean_up_discovered_list: Dropping Reference: "
             INTPTR_FORMAT " with next field: " INTPTR_FORMAT
             " and referent: " INTPTR_FORMAT,
-            iter.obj(), next, iter.referent());
+            (void *)iter.obj(), (void *)next, (void *)iter.referent());
         }
       )
       // Remove Reference object from list
@@ -1103,14 +1103,14 @@
 
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Discovered reference (mt) (" INTPTR_FORMAT ": %s)",
-                             obj, obj->klass()->internal_name());
+                             (void *)obj, obj->klass()->internal_name());
     }
   } else {
     // If retest was non NULL, another thread beat us to it:
     // The reference has already been discovered...
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)",
-                             obj, obj->klass()->internal_name());
+                             (void *)obj, obj->klass()->internal_name());
     }
   }
 }
@@ -1125,7 +1125,7 @@
   assert(da ? referent->is_oop() : referent->is_oop_or_null(),
          err_msg("Bad referent " INTPTR_FORMAT " found in Reference "
                  INTPTR_FORMAT " during %satomic discovery ",
-                 (intptr_t)referent, (intptr_t)obj, da ? "" : "non-"));
+                 (void *)referent, (void *)obj, da ? "" : "non-"));
 }
 #endif
 
@@ -1205,7 +1205,7 @@
     // The reference has already been discovered...
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)",
-                             obj, obj->klass()->internal_name());
+                             (void *)obj, obj->klass()->internal_name());
     }
     if (RefDiscoveryPolicy == ReferentBasedDiscovery) {
       // assumes that an object is not processed twice;
@@ -1273,7 +1273,7 @@
 
     if (TraceReferenceGC) {
       gclog_or_tty->print_cr("Discovered reference (" INTPTR_FORMAT ": %s)",
-                                obj, obj->klass()->internal_name());
+                                (void *)obj, obj->klass()->internal_name());
     }
   }
   assert(obj->is_oop(), "Discovered a bad reference");
@@ -1372,7 +1372,7 @@
       // active; we need to trace and mark its cohort.
       if (TraceReferenceGC) {
         gclog_or_tty->print_cr("Precleaning Reference (" INTPTR_FORMAT ": %s)",
-                               iter.obj(), iter.obj()->klass()->internal_name());
+                               (void *)iter.obj(), iter.obj()->klass()->internal_name());
       }
       // Remove Reference object from list
       iter.remove();
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -108,16 +108,16 @@
 void ConstantPool::initialize_resolved_references(ClassLoaderData* loader_data,
                                                   intStack reference_map,
                                                   int constant_pool_map_length,
-                                                   TRAPS) {
+                                                  TRAPS) {
   // Initialized the resolved object cache.
   int map_length = reference_map.length();
   if (map_length > 0) {
     // Only need mapping back to constant pool entries.  The map isn't used for
-    // invokedynamic resolved_reference entries.  The constant pool cache index
-    // has the mapping back to both the constant pool and to the resolved
-    // reference index.
+    // invokedynamic resolved_reference entries.  For invokedynamic entries,
+    // the constant pool cache index has the mapping back to both the constant
+    // pool and to the resolved reference index.
     if (constant_pool_map_length > 0) {
-      Array<u2>* om = MetadataFactory::new_array<u2>(loader_data, map_length, CHECK);
+      Array<u2>* om = MetadataFactory::new_array<u2>(loader_data, constant_pool_map_length, CHECK);
 
       for (int i = 0; i < constant_pool_map_length; i++) {
         int x = reference_map.at(i);
@@ -182,16 +182,9 @@
 
 int ConstantPool::cp_to_object_index(int cp_index) {
   // this is harder don't do this so much.
-  for (int i = 0; i< reference_map()->length(); i++) {
-    if (reference_map()->at(i) == cp_index) return i;
-    // Zero entry is divider between constant pool indices for strings,
-    // method handles and method types. After that the index is a constant
-    // pool cache index for invokedynamic.  Stop when zero (which can never
-    // be a constant pool index)
-    if (reference_map()->at(i) == 0) break;
-  }
-  // We might not find the index.
-  return _no_index_sentinel;
+  int i = reference_map()->find(cp_index);
+  // We might not find the index for jsr292 call.
+  return (i < 0) ? _no_index_sentinel : i;
 }
 
 Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS) {
@@ -840,8 +833,7 @@
   // If the string has already been interned, this entry will be non-null
   oop str = this_oop->resolved_references()->obj_at(obj_index);
   if (str != NULL) return str;
-
-      Symbol* sym = this_oop->unresolved_string_at(which);
+  Symbol* sym = this_oop->unresolved_string_at(which);
   str = StringTable::intern(sym, CHECK_(NULL));
   this_oop->string_at_put(which, obj_index, str);
   assert(java_lang_String::is_instance(str), "must be string");
@@ -1619,9 +1611,11 @@
     case JVM_CONSTANT_UnresolvedClassInError:
     case JVM_CONSTANT_StringIndex:
     case JVM_CONSTANT_MethodType:
+    case JVM_CONSTANT_MethodTypeInError:
       return 3;
 
     case JVM_CONSTANT_MethodHandle:
+    case JVM_CONSTANT_MethodHandleInError:
       return 4; //tag, ref_kind, ref_index
 
     case JVM_CONSTANT_Integer:
@@ -1802,8 +1796,8 @@
       case JVM_CONSTANT_MethodHandle:
       case JVM_CONSTANT_MethodHandleInError: {
         *bytes = JVM_CONSTANT_MethodHandle;
-        int kind = method_handle_ref_kind_at(idx);
-        idx1 = method_handle_index_at(idx);
+        int kind = method_handle_ref_kind_at_error_ok(idx);
+        idx1 = method_handle_index_at_error_ok(idx);
         *(bytes+1) = (unsigned char) kind;
         Bytes::put_Java_u2((address) (bytes+2), idx1);
         DBG(printf("JVM_CONSTANT_MethodHandle: %d %hd", kind, idx1));
@@ -1812,7 +1806,7 @@
       case JVM_CONSTANT_MethodType:
       case JVM_CONSTANT_MethodTypeInError: {
         *bytes = JVM_CONSTANT_MethodType;
-        idx1 = method_type_index_at(idx);
+        idx1 = method_type_index_at_error_ok(idx);
         Bytes::put_Java_u2((address) (bytes+1), idx1);
         DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1));
         break;
@@ -1924,7 +1918,7 @@
     st->print_cr(" - holder: " INTPTR_FORMAT, pool_holder());
   }
   st->print_cr(" - cache: " INTPTR_FORMAT, cache());
-  st->print_cr(" - resolved_references: " INTPTR_FORMAT, resolved_references());
+  st->print_cr(" - resolved_references: " INTPTR_FORMAT, (void *)resolved_references());
   st->print_cr(" - reference_map: " INTPTR_FORMAT, reference_map());
 
   for (int index = 1; index < length(); index++) {      // Index 0 is unused
@@ -2000,12 +1994,12 @@
       break;
     case JVM_CONSTANT_MethodHandle :
     case JVM_CONSTANT_MethodHandleInError :
-      st->print("ref_kind=%d", method_handle_ref_kind_at(index));
-      st->print(" ref_index=%d", method_handle_index_at(index));
+      st->print("ref_kind=%d", method_handle_ref_kind_at_error_ok(index));
+      st->print(" ref_index=%d", method_handle_index_at_error_ok(index));
       break;
     case JVM_CONSTANT_MethodType :
     case JVM_CONSTANT_MethodTypeInError :
-      st->print("signature_index=%d", method_type_index_at(index));
+      st->print("signature_index=%d", method_type_index_at_error_ok(index));
       break;
     case JVM_CONSTANT_InvokeDynamic :
       {
--- a/hotspot/src/share/vm/oops/constantPool.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/constantPool.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -231,7 +231,6 @@
   static int cache_offset_in_bytes()        { return offset_of(ConstantPool, _cache); }
   static int pool_holder_offset_in_bytes()  { return offset_of(ConstantPool, _pool_holder); }
   static int resolved_references_offset_in_bytes() { return offset_of(ConstantPool, _resolved_references); }
-  static int reference_map_offset_in_bytes() { return offset_of(ConstantPool, _reference_map); }
 
   // Storing constants
 
@@ -475,18 +474,42 @@
     return *int_at_addr(which);
   }
 
+ private:
+  int method_handle_ref_kind_at(int which, bool error_ok) {
+    assert(tag_at(which).is_method_handle() ||
+           (error_ok && tag_at(which).is_method_handle_in_error()), "Corrupted constant pool");
+    return extract_low_short_from_int(*int_at_addr(which));  // mask out unwanted ref_index bits
+  }
+  int method_handle_index_at(int which, bool error_ok) {
+    assert(tag_at(which).is_method_handle() ||
+           (error_ok && tag_at(which).is_method_handle_in_error()), "Corrupted constant pool");
+    return extract_high_short_from_int(*int_at_addr(which));  // shift out unwanted ref_kind bits
+  }
+  int method_type_index_at(int which, bool error_ok) {
+    assert(tag_at(which).is_method_type() ||
+           (error_ok && tag_at(which).is_method_type_in_error()), "Corrupted constant pool");
+    return *int_at_addr(which);
+  }
+ public:
   int method_handle_ref_kind_at(int which) {
-    assert(tag_at(which).is_method_handle(), "Corrupted constant pool");
-    return extract_low_short_from_int(*int_at_addr(which));  // mask out unwanted ref_index bits
+    return method_handle_ref_kind_at(which, false);
+  }
+  int method_handle_ref_kind_at_error_ok(int which) {
+    return method_handle_ref_kind_at(which, true);
   }
   int method_handle_index_at(int which) {
-    assert(tag_at(which).is_method_handle(), "Corrupted constant pool");
-    return extract_high_short_from_int(*int_at_addr(which));  // shift out unwanted ref_kind bits
+    return method_handle_index_at(which, false);
+  }
+  int method_handle_index_at_error_ok(int which) {
+    return method_handle_index_at(which, true);
   }
   int method_type_index_at(int which) {
-    assert(tag_at(which).is_method_type(), "Corrupted constant pool");
-    return *int_at_addr(which);
+    return method_type_index_at(which, false);
   }
+  int method_type_index_at_error_ok(int which) {
+    return method_type_index_at(which, true);
+  }
+
   // Derived queries:
   Symbol* method_handle_name_ref_at(int which) {
     int member = method_handle_index_at(which);
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -306,8 +306,8 @@
   if (TraceInvokeDynamic) {
     tty->print_cr("set_method_handle bc=%d appendix="PTR_FORMAT"%s method_type="PTR_FORMAT"%s method="PTR_FORMAT" ",
                   invoke_code,
-                  (intptr_t)appendix(),    (has_appendix    ? "" : " (unused)"),
-                  (intptr_t)method_type(), (has_method_type ? "" : " (unused)"),
+                  (void *)appendix(),    (has_appendix    ? "" : " (unused)"),
+                  (void *)method_type(), (has_method_type ? "" : " (unused)"),
                   (intptr_t)adapter());
     adapter->print();
     if (has_appendix)  appendix()->print();
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -106,7 +106,7 @@
       len = name->utf8_length();                                 \
     }                                                            \
     HS_DTRACE_PROBE4(hotspot, class__initialization__##type,     \
-      data, len, (clss)->class_loader(), thread_type);           \
+      data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), thread_type);           \
   }
 
 #define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \
@@ -119,7 +119,7 @@
       len = name->utf8_length();                                 \
     }                                                            \
     HS_DTRACE_PROBE5(hotspot, class__initialization__##type,     \
-      data, len, (clss)->class_loader(), thread_type, wait);     \
+      data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), thread_type, wait);     \
   }
 #else /* USDT2 */
 
@@ -1419,6 +1419,8 @@
 }
 
 // lookup a method in all the interfaces that this class implements
+// Do NOT return private or static methods, new in JDK8 which are not externally visible
+// They should only be found in the initial InterfaceMethodRef
 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
                                                          Symbol* signature) const {
   Array<Klass*>* all_ifs = transitive_interfaces();
@@ -1427,7 +1429,7 @@
   for (int i = 0; i < num_ifs; i++) {
     ik = InstanceKlass::cast(all_ifs->at(i));
     Method* m = ik->lookup_method(name, signature);
-    if (m != NULL) {
+    if (m != NULL && m->is_public() && !m->is_static()) {
       return m;
     }
   }
@@ -2303,7 +2305,7 @@
 }
 
 address InstanceKlass::static_field_addr(int offset) {
-  return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + (intptr_t)java_mirror());
+  return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + cast_from_oop<intptr_t>(java_mirror()));
 }
 
 
@@ -2769,24 +2771,17 @@
   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
-    // contain a GrowableArray of handles. We have to clean up the
-    // GrowableArray _after_ the PreviousVersionWalker destructor
-    // has destroyed the handles.
-    {
-      bool have_pv = false;
-      PreviousVersionWalker pvw((InstanceKlass*)this);
-      for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
-           pv_info != NULL; pv_info = pvw.next_previous_version()) {
-        if (!have_pv)
-          st->print(BULLET"previous version:  ");
-        have_pv = true;
-        pv_info->prev_constant_pool_handle()()->print_value_on(st);
-      }
-      if (have_pv)  st->cr();
-    } // pvw is cleaned up
-  } // rm is cleaned up
+    bool have_pv = false;
+    PreviousVersionWalker pvw(Thread::current(), (InstanceKlass*)this);
+    for (PreviousVersionNode * pv_node = pvw.next_previous_version();
+         pv_node != NULL; pv_node = pvw.next_previous_version()) {
+      if (!have_pv)
+        st->print(BULLET"previous version:  ");
+      have_pv = true;
+      pv_node->prev_constant_pool()->print_value_on(st);
+    }
+    if (have_pv) st->cr();
+  } // pvw is cleaned up
 
   if (generic_signature() != NULL) {
     st->print(BULLET"generic signature: ");
@@ -3317,34 +3312,34 @@
   Array<Method*>* old_methods = ikh->methods();
 
   if (cp_ref->on_stack()) {
-  PreviousVersionNode * pv_node = NULL;
-  if (emcp_method_count == 0) {
+    PreviousVersionNode * pv_node = NULL;
+    if (emcp_method_count == 0) {
       // non-shared ConstantPool gets a reference
-      pv_node = new PreviousVersionNode(cp_ref, !cp_ref->is_shared(), NULL);
-    RC_TRACE(0x00000400,
-        ("add: all methods are obsolete; flushing any EMCP refs"));
-  } else {
-    int local_count = 0;
+      pv_node = new PreviousVersionNode(cp_ref, NULL);
+      RC_TRACE(0x00000400,
+          ("add: all methods are obsolete; flushing any EMCP refs"));
+    } else {
+      int local_count = 0;
       GrowableArray<Method*>* method_refs = new (ResourceObj::C_HEAP, mtClass)
-        GrowableArray<Method*>(emcp_method_count, true);
-    for (int i = 0; i < old_methods->length(); i++) {
-      if (emcp_methods->at(i)) {
-          // this old method is EMCP. Save it only if it's on the stack
-          Method* old_method = old_methods->at(i);
-          if (old_method->on_stack()) {
-            method_refs->append(old_method);
+          GrowableArray<Method*>(emcp_method_count, true);
+      for (int i = 0; i < old_methods->length(); i++) {
+        if (emcp_methods->at(i)) {
+            // this old method is EMCP. Save it only if it's on the stack
+            Method* old_method = old_methods->at(i);
+            if (old_method->on_stack()) {
+              method_refs->append(old_method);
+            }
+          if (++local_count >= emcp_method_count) {
+            // no more EMCP methods so bail out now
+            break;
           }
-        if (++local_count >= emcp_method_count) {
-          // no more EMCP methods so bail out now
-          break;
         }
       }
-    }
       // non-shared ConstantPool gets a reference
-      pv_node = new PreviousVersionNode(cp_ref, !cp_ref->is_shared(), method_refs);
+      pv_node = new PreviousVersionNode(cp_ref, method_refs);
     }
     // append new previous version.
-  _previous_versions->append(pv_node);
+    _previous_versions->append(pv_node);
   }
 
   // Since the caller is the VMThread and we are at a safepoint, this
@@ -3445,6 +3440,8 @@
         return m;
       }
     }
+    // None found, return null for the caller to handle.
+    return NULL;
   }
   return m;
 }
@@ -3461,10 +3458,9 @@
 // Construct a PreviousVersionNode entry for the array hung off
 // the InstanceKlass.
 PreviousVersionNode::PreviousVersionNode(ConstantPool* prev_constant_pool,
-  bool prev_cp_is_weak, GrowableArray<Method*>* prev_EMCP_methods) {
+  GrowableArray<Method*>* prev_EMCP_methods) {
 
   _prev_constant_pool = prev_constant_pool;
-  _prev_cp_is_weak = prev_cp_is_weak;
   _prev_EMCP_methods = prev_EMCP_methods;
 }
 
@@ -3480,99 +3476,38 @@
   }
 }
 
-
-// Construct a PreviousVersionInfo entry
-PreviousVersionInfo::PreviousVersionInfo(PreviousVersionNode *pv_node) {
-  _prev_constant_pool_handle = constantPoolHandle();  // NULL handle
-  _prev_EMCP_method_handles = NULL;
-
-  ConstantPool* cp = pv_node->prev_constant_pool();
-  assert(cp != NULL, "constant pool ref was unexpectedly cleared");
-  if (cp == NULL) {
-    return;  // robustness
-  }
-
-  // make the ConstantPool* safe to return
-  _prev_constant_pool_handle = constantPoolHandle(cp);
-
-  GrowableArray<Method*>* method_refs = pv_node->prev_EMCP_methods();
-  if (method_refs == NULL) {
-    // the InstanceKlass did not have any EMCP methods
-    return;
-  }
-
-  _prev_EMCP_method_handles = new GrowableArray<methodHandle>(10);
-
-  int n_methods = method_refs->length();
-  for (int i = 0; i < n_methods; i++) {
-    Method* method = method_refs->at(i);
-    assert (method != NULL, "method has been cleared");
-    if (method == NULL) {
-      continue;  // robustness
-    }
-    // make the Method* safe to return
-    _prev_EMCP_method_handles->append(methodHandle(method));
-  }
-}
-
-
-// Destroy a PreviousVersionInfo
-PreviousVersionInfo::~PreviousVersionInfo() {
-  // Since _prev_EMCP_method_handles is not C-heap allocated, we
-  // don't have to delete it.
-}
-
-
 // Construct a helper for walking the previous versions array
-PreviousVersionWalker::PreviousVersionWalker(InstanceKlass *ik) {
+PreviousVersionWalker::PreviousVersionWalker(Thread* thread, InstanceKlass *ik) {
+  _thread = thread;
   _previous_versions = ik->previous_versions();
   _current_index = 0;
-  // _hm needs no initialization
   _current_p = NULL;
-}
-
-
-// Destroy a PreviousVersionWalker
-PreviousVersionWalker::~PreviousVersionWalker() {
-  // Delete the current info just in case the caller didn't walk to
-  // the end of the previous versions list. No harm if _current_p is
-  // already NULL.
-  delete _current_p;
-
-  // When _hm is destroyed, all the Handles returned in
-  // PreviousVersionInfo objects will be destroyed.
-  // Also, after this destructor is finished it will be
-  // safe to delete the GrowableArray allocated in the
-  // PreviousVersionInfo objects.
+  _current_constant_pool_handle = constantPoolHandle(thread, ik->constants());
 }
 
 
 // Return the interesting information for the next previous version
 // of the klass. Returns NULL if there are no more previous versions.
-PreviousVersionInfo* PreviousVersionWalker::next_previous_version() {
+PreviousVersionNode* PreviousVersionWalker::next_previous_version() {
   if (_previous_versions == NULL) {
     // no previous versions so nothing to return
     return NULL;
   }
 
-  delete _current_p;  // cleanup the previous info for the caller
-  _current_p = NULL;  // reset to NULL so we don't delete same object twice
+  _current_p = NULL;  // reset to NULL
+  _current_constant_pool_handle = NULL;
 
   int length = _previous_versions->length();
 
   while (_current_index < length) {
     PreviousVersionNode * pv_node = _previous_versions->at(_current_index++);
-    PreviousVersionInfo * pv_info = new (ResourceObj::C_HEAP, mtClass)
-                                          PreviousVersionInfo(pv_node);
-
-    constantPoolHandle cp_h = pv_info->prev_constant_pool_handle();
-    assert (!cp_h.is_null(), "null cp found in previous version");
-
-    // The caller will need to delete pv_info when they are done with it.
-    _current_p = pv_info;
-    return pv_info;
+
+    // Save a handle to the constant pool for this previous version,
+    // which keeps all the methods from being deallocated.
+    _current_constant_pool_handle = constantPoolHandle(_thread, pv_node->prev_constant_pool());
+    _current_p = pv_node;
+    return pv_node;
   }
 
-  // all of the underlying nodes' info has been deleted
   return NULL;
 } // end next_previous_version()
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1126,21 +1126,11 @@
 
 
 // A collection point for interesting information about the previous
-// version(s) of an InstanceKlass. This class uses weak references to
-// the information so that the information may be collected as needed
-// by the system. If the information is shared, then a regular
-// reference must be used because a weak reference would be seen as
-// collectible. A GrowableArray of PreviousVersionNodes is attached
-// to the InstanceKlass as needed. See PreviousVersionWalker below.
+// version(s) of an InstanceKlass.  A GrowableArray of PreviousVersionNodes
+// is attached to the InstanceKlass as needed. See PreviousVersionWalker below.
 class PreviousVersionNode : public CHeapObj<mtClass> {
  private:
-  // A shared ConstantPool is never collected so we'll always have
-  // a reference to it so we can update items in the cache. We'll
-  // have a weak reference to a non-shared ConstantPool until all
-  // of the methods (EMCP or obsolete) have been collected; the
-  // non-shared ConstantPool becomes collectible at that point.
-  ConstantPool*    _prev_constant_pool;  // regular or weak reference
-  bool    _prev_cp_is_weak;     // true if not a shared ConstantPool
+  ConstantPool*    _prev_constant_pool;
 
   // If the previous version of the InstanceKlass doesn't have any
   // EMCP methods, then _prev_EMCP_methods will be NULL. If all the
@@ -1149,8 +1139,8 @@
   GrowableArray<Method*>* _prev_EMCP_methods;
 
 public:
-  PreviousVersionNode(ConstantPool* prev_constant_pool, bool prev_cp_is_weak,
-    GrowableArray<Method*>* prev_EMCP_methods);
+  PreviousVersionNode(ConstantPool* prev_constant_pool,
+                      GrowableArray<Method*>* prev_EMCP_methods);
   ~PreviousVersionNode();
   ConstantPool* prev_constant_pool() const {
     return _prev_constant_pool;
@@ -1161,59 +1151,26 @@
 };
 
 
-// A Handle-ized version of PreviousVersionNode.
-class PreviousVersionInfo : public ResourceObj {
- private:
-  constantPoolHandle   _prev_constant_pool_handle;
-  // If the previous version of the InstanceKlass doesn't have any
-  // EMCP methods, then _prev_EMCP_methods will be NULL. Since the
-  // methods cannot be collected while we hold a handle,
-  // _prev_EMCP_methods should never have a length of zero.
-  GrowableArray<methodHandle>* _prev_EMCP_method_handles;
-
-public:
-  PreviousVersionInfo(PreviousVersionNode *pv_node);
-  ~PreviousVersionInfo();
-  constantPoolHandle prev_constant_pool_handle() const {
-    return _prev_constant_pool_handle;
-  }
-  GrowableArray<methodHandle>* prev_EMCP_method_handles() const {
-    return _prev_EMCP_method_handles;
-  }
-};
-
-
-// Helper object for walking previous versions. This helper cleans up
-// the Handles that it allocates when the helper object is destroyed.
-// The PreviousVersionInfo object returned by next_previous_version()
-// is only valid until a subsequent call to next_previous_version() or
-// the helper object is destroyed.
+// Helper object for walking previous versions.
 class PreviousVersionWalker : public StackObj {
  private:
+  Thread*                               _thread;
   GrowableArray<PreviousVersionNode *>* _previous_versions;
   int                                   _current_index;
-  // Fields for cleaning up when we are done walking the previous versions:
-  // A HandleMark for the PreviousVersionInfo handles:
-  HandleMark                            _hm;
+
+  // A pointer to the current node object so we can handle the deletes.
+  PreviousVersionNode*                  _current_p;
 
-  // It would be nice to have a ResourceMark field in this helper also,
-  // but the ResourceMark code says to be careful to delete handles held
-  // in GrowableArrays _before_ deleting the GrowableArray. Since we
-  // can't guarantee the order in which the fields are destroyed, we
-  // have to let the creator of the PreviousVersionWalker object do
-  // the right thing. Also, adding a ResourceMark here causes an
-  // include loop.
-
-  // A pointer to the current info object so we can handle the deletes.
-  PreviousVersionInfo *                 _current_p;
+  // The constant pool handle keeps all the methods in this class from being
+  // deallocated from the metaspace during class unloading.
+  constantPoolHandle                    _current_constant_pool_handle;
 
  public:
-  PreviousVersionWalker(InstanceKlass *ik);
-  ~PreviousVersionWalker();
+  PreviousVersionWalker(Thread* thread, InstanceKlass *ik);
 
   // Return the interesting information for the next previous version
   // of the klass. Returns NULL if there are no more previous versions.
-  PreviousVersionInfo* next_previous_version();
+  PreviousVersionNode* next_previous_version();
 };
 
 
--- a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -66,7 +66,7 @@
   // Static field offset is an offset into the Heap, should be converted by
   // based on UseCompressedOop for traversal
   static HeapWord* start_of_static_fields(oop obj) {
-    return (HeapWord*)((intptr_t)obj + offset_of_static_fields());
+    return (HeapWord*)(cast_from_oop<intptr_t>(obj) + offset_of_static_fields());
   }
 
   static void init_offset_of_static_fields() {
--- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -51,7 +51,7 @@
   T heap_oop = oopDesc::load_heap_oop(referent_addr);
   debug_only(
     if(TraceReferenceGC && PrintGCDetails) {
-      gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj);
+      gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, (void *)obj);
     }
   )
   if (!oopDesc::is_null(heap_oop)) {
@@ -62,7 +62,7 @@
       ref->InstanceKlass::oop_follow_contents(obj);
       debug_only(
         if(TraceReferenceGC && PrintGCDetails) {
-          gclog_or_tty->print_cr("       Non NULL enqueued " INTPTR_FORMAT, obj);
+          gclog_or_tty->print_cr("       Non NULL enqueued " INTPTR_FORMAT, (void *)obj);
         }
       )
       return;
@@ -70,7 +70,7 @@
       // treat referent as normal oop
       debug_only(
         if(TraceReferenceGC && PrintGCDetails) {
-          gclog_or_tty->print_cr("       Non NULL normal " INTPTR_FORMAT, obj);
+          gclog_or_tty->print_cr("       Non NULL normal " INTPTR_FORMAT, (void *)obj);
         }
       )
       MarkSweep::mark_and_push(referent_addr);
@@ -130,7 +130,7 @@
   T heap_oop = oopDesc::load_heap_oop(referent_addr);
   debug_only(
     if(TraceReferenceGC && PrintGCDetails) {
-      gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, obj);
+      gclog_or_tty->print_cr("InstanceRefKlass::oop_follow_contents " INTPTR_FORMAT, (void *)obj);
     }
   )
   if (!oopDesc::is_null(heap_oop)) {
@@ -142,7 +142,7 @@
       ref->InstanceKlass::oop_follow_contents(cm, obj);
       debug_only(
         if(TraceReferenceGC && PrintGCDetails) {
-          gclog_or_tty->print_cr("       Non NULL enqueued " INTPTR_FORMAT, obj);
+          gclog_or_tty->print_cr("       Non NULL enqueued " INTPTR_FORMAT, (void *)obj);
         }
       )
       return;
@@ -150,7 +150,7 @@
       // treat referent as normal oop
       debug_only(
         if(TraceReferenceGC && PrintGCDetails) {
-          gclog_or_tty->print_cr("       Non NULL normal " INTPTR_FORMAT, obj);
+          gclog_or_tty->print_cr("       Non NULL normal " INTPTR_FORMAT, (void *)obj);
         }
       )
       PSParallelCompact::mark_and_push(cm, referent_addr);
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -292,9 +292,10 @@
     return allocate_new;
   }
 
-  // private methods always have a new entry in the vtable
+  // private methods in classes always have a new entry in the vtable
   // specification interpretation since classic has
   // private methods not overriding
+  // JDK8 adds private methods in interfaces which require invokespecial
   if (target_method()->is_private()) {
     return allocate_new;
   }
@@ -442,9 +443,10 @@
     return true;
   }
 
-  // private methods always have a new entry in the vtable
+  // private methods in classes always have a new entry in the vtable
   // specification interpretation since classic has
   // private methods not overriding
+  // JDK8 adds private methods in interfaces which require invokespecial
   if (target_method()->is_private()) {
     return true;
   }
@@ -520,7 +522,7 @@
   Klass* method_holder = m->method_holder();
   InstanceKlass *mhk = InstanceKlass::cast(method_holder);
 
-  // miranda methods are interface methods in a class's vtable
+  // miranda methods are public abstract instance interface methods in a class's vtable
   if (mhk->is_interface()) {
     assert(m->is_public(), "should be public");
     assert(ik()->implements_interface(method_holder) , "this class should implement the interface");
@@ -534,6 +536,8 @@
 // "miranda" means not static, not defined by this class, and not defined
 // in super unless it is private and therefore inaccessible to this class.
 // the caller must make sure that the method belongs to an interface implemented by the class
+// Miranda methods only include public interface instance methods
+// Not private methods, not static methods, not default = concrete abstract
 bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods, Klass* super) {
   if (m->is_static()) {
     return false;
--- a/hotspot/src/share/vm/oops/method.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/method.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -901,16 +901,6 @@
 // This function must not hit a safepoint!
 address Method::verified_code_entry() {
   debug_only(No_Safepoint_Verifier nsv;)
-  nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code);
-  if (code == NULL && UseCodeCacheFlushing) {
-    nmethod *saved_code = CodeCache::reanimate_saved_code(this);
-    if (saved_code != NULL) {
-      methodHandle method(this);
-      assert( ! saved_code->is_osr_method(), "should not get here for osr" );
-      set_code( method, saved_code );
-    }
-  }
-
   assert(_from_compiled_entry != NULL, "must be set");
   return _from_compiled_entry;
 }
--- a/hotspot/src/share/vm/oops/methodData.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -333,10 +333,10 @@
     return (int)data()->cell_at(index);
   }
   void set_oop_at(int index, oop value) {
-    set_intptr_at(index, (intptr_t) value);
+    set_intptr_at(index, cast_from_oop<intptr_t>(value));
   }
   oop oop_at(int index) {
-    return (oop)intptr_at(index);
+    return cast_to_oop(intptr_at(index));
   }
 
   void set_flag_at(int flag_number) {
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -183,7 +183,7 @@
 // in inner GC loops so these are separated.
 
 inline bool check_obj_alignment(oop obj) {
-  return (intptr_t)obj % MinObjAlignmentInBytes == 0;
+  return cast_from_oop<intptr_t>(obj) % MinObjAlignmentInBytes == 0;
 }
 
 inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) {
--- a/hotspot/src/share/vm/oops/oopsHierarchy.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/oops/oopsHierarchy.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -55,11 +55,16 @@
 // to and from the underlying oopDesc pointer type.
 //
 // Because oop and its subclasses <type>Oop are class types, arbitrary
-// conversions are not accepted by the compiler, and you may get a message
-// about overloading ambiguity (between long and int is common when converting
-// from a constant in 64 bit mode), or unable to convert from type to 'oop'.
-// Applying a cast to one of these conversion operators first will get to the
-// underlying oopDesc* type if appropriate.
+// conversions are not accepted by the compiler.  Applying a cast to
+// an oop will cause the best matched conversion operator to be
+// invoked returning the underlying oopDesc* type if appropriate.
+// No copy constructors, explicit user conversions or operators of
+// numerical type should be defined within the oop class. Most C++
+// compilers will issue a compile time error concerning the overloading
+// ambiguity between operators of numerical and pointer types. If
+// a conversion to or from an oop to a numerical type is needed,
+// use the inline template methods, cast_*_oop, defined below.
+//
 // Converting NULL to oop to Handle implicit is no longer accepted by the
 // compiler because there are too many steps in the conversion.  Use Handle()
 // instead, which generates less code anyway.
@@ -83,12 +88,9 @@
   void raw_set_obj(const void* p)     { _o = (oopDesc*)p; }
 
   oop()                               { set_obj(NULL); }
+  oop(const oop& o)                   { set_obj(o.obj()); }
   oop(const volatile oop& o)          { set_obj(o.obj()); }
   oop(const void* p)                  { set_obj(p); }
-  oop(intptr_t i)                     { set_obj((void *)i); }
-#ifdef _LP64
-  oop(int i)                          { set_obj((void *)i); }
-#endif
   ~oop()                              {
     if (CheckUnhandledOops) unregister_oop();
   }
@@ -101,8 +103,6 @@
   bool operator==(void *p) const      { return obj() == p; }
   bool operator!=(const volatile oop o) const  { return obj() != o.obj(); }
   bool operator!=(void *p) const      { return obj() != p; }
-  bool operator==(intptr_t p) const   { return obj() == (oopDesc*)p; }
-  bool operator!=(intptr_t p) const   { return obj() != (oopDesc*)p; }
 
   bool operator<(oop o) const         { return obj() < o.obj(); }
   bool operator>(oop o) const         { return obj() > o.obj(); }
@@ -110,8 +110,18 @@
   bool operator>=(oop o) const        { return obj() >= o.obj(); }
   bool operator!() const              { return !obj(); }
 
-  // Cast
+  // Assignment
+  oop& operator=(const oop& o)                            { _o = o.obj(); return *this; }
+#ifndef SOLARIS
+  volatile oop& operator=(const oop& o) volatile          { _o = o.obj(); return *this; }
+#endif
+  volatile oop& operator=(const volatile oop& o) volatile { _o = o.obj(); return *this; }
+
+  // Explict user conversions
   operator void* () const             { return (void *)obj(); }
+#ifndef SOLARIS
+  operator void* () const volatile    { return (void *)obj(); }
+#endif
   operator HeapWord* () const         { return (HeapWord*)obj(); }
   operator oopDesc* () const          { return obj(); }
   operator intptr_t* () const         { return (intptr_t*)obj(); }
@@ -119,7 +129,6 @@
   operator markOop () const           { return markOop(obj()); }
 
   operator address   () const         { return (address)obj(); }
-  operator intptr_t () const volatile { return (intptr_t)obj(); }
 
   // from javaCalls.cpp
   operator jobject () const           { return (jobject)obj(); }
@@ -141,12 +150,26 @@
    class type##Oop : public oop {                                          \
      public:                                                               \
        type##Oop() : oop() {}                                              \
+       type##Oop(const oop& o) : oop(o) {}                                 \
        type##Oop(const volatile oop& o) : oop(o) {}                        \
        type##Oop(const void* p) : oop(p) {}                                \
        operator type##OopDesc* () const { return (type##OopDesc*)obj(); }  \
        type##OopDesc* operator->() const {                                 \
             return (type##OopDesc*)obj();                                  \
        }                                                                   \
+       type##Oop& operator=(const type##Oop& o) {                          \
+            oop::operator=(o);                                             \
+            return *this;                                                  \
+       }                                                                   \
+       NOT_SOLARIS(                                                        \
+       volatile type##Oop& operator=(const type##Oop& o) volatile {        \
+            (void)const_cast<oop&>(oop::operator=(o));                     \
+            return *this;                                                  \
+       })                                                                  \
+       volatile type##Oop& operator=(const volatile type##Oop& o) volatile {\
+            (void)const_cast<oop&>(oop::operator=(o));                     \
+            return *this;                                                  \
+       }                                                                   \
    };
 
 DEF_OOP(instance);
@@ -156,6 +179,16 @@
 
 #endif // CHECK_UNHANDLED_OOPS
 
+// For CHECK_UNHANDLED_OOPS, it is ambiguous C++ behavior to have the oop
+// structure contain explicit user defined conversions of both numerical
+// and pointer type. Define inline methods to provide the numerical conversions.
+template <class T> inline oop cast_to_oop(T value) {
+  return (oop)(CHECK_UNHANDLED_OOPS_ONLY((void *))(value));
+}
+template <class T> inline T cast_from_oop(oop o) {
+  return (T)(CHECK_UNHANDLED_OOPS_ONLY((void*))o);
+}
+
 // The metadata hierarchy is separate from the oop hierarchy
 
 //      class MetaspaceObj
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -123,7 +123,7 @@
   // Allows targeted inlining
   if(callee_method->should_inline()) {
     *wci_result = *(WarmCallInfo::always_hot());
-    if (PrintInlining && Verbose) {
+    if (C->print_inlining() && Verbose) {
       CompileTask::print_inline_indent(inline_level());
       tty->print_cr("Inlined method is hot: ");
     }
@@ -137,7 +137,7 @@
   if(callee_method->interpreter_throwout_count() > InlineThrowCount &&
      size < InlineThrowMaxSize ) {
     wci_result->set_profit(wci_result->profit() * 100);
-    if (PrintInlining && Verbose) {
+    if (C->print_inlining() && Verbose) {
       CompileTask::print_inline_indent(inline_level());
       tty->print_cr("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count());
     }
@@ -491,7 +491,7 @@
       C->log()->inline_fail(inline_msg);
     }
   }
-  if (PrintInlining) {
+  if (C->print_inlining()) {
     C->print_inlining(callee_method, inline_level(), caller_bci, inline_msg);
     if (callee_method == NULL) tty->print(" callee not monotonic or profiled");
     if (Verbose && callee_method) {
@@ -540,7 +540,7 @@
 
 #ifndef PRODUCT
   if (UseOldInlining && InlineWarmCalls
-      && (PrintOpto || PrintOptoInlining || PrintInlining)) {
+      && (PrintOpto || C->print_inlining())) {
     bool cold = wci.is_cold();
     bool hot  = !cold && wci.is_hot();
     bool old_cold = !success;
@@ -617,7 +617,7 @@
              callee_method->is_compiled_lambda_form()) {
       max_inline_level_adjust += 1;  // don't count method handle calls from java.lang.invoke implem
     }
-    if (max_inline_level_adjust != 0 && PrintInlining && (Verbose || WizardMode)) {
+    if (max_inline_level_adjust != 0 && C->print_inlining() && (Verbose || WizardMode)) {
       CompileTask::print_inline_indent(inline_level());
       tty->print_cr(" \\-> discounting inline depth");
     }
--- a/hotspot/src/share/vm/opto/c2_globals.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -636,7 +636,9 @@
                                                                             \
   diagnostic(bool, OptimizeExpensiveOps, true,                              \
           "Find best control for expensive operations")                     \
-
+                                                                            \
+  product(bool, UseMathExactIntrinsics, true,                               \
+          "Enables intrinsification of various java.lang.Math funcitons")
 
 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/callGenerator.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/callGenerator.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -65,6 +65,8 @@
   virtual bool      is_predicted() const        { return false; }
   // is_trap: Does not return to the caller.  (E.g., uncommon trap.)
   virtual bool      is_trap() const             { return false; }
+  // does_virtual_dispatch: Should try inlining as normal method first.
+  virtual bool      does_virtual_dispatch() const     { return false; }
 
   // is_late_inline: supports conversion of call into an inline
   virtual bool      is_late_inline() const      { return false; }
@@ -159,8 +161,9 @@
   virtual void print_inlining_late(const char* msg) { ShouldNotReachHere(); }
 
   static void print_inlining(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) {
-    if (PrintInlining)
+    if (C->print_inlining()) {
       C->print_inlining(callee, inline_level, bci, msg);
+    }
   }
 };
 
--- a/hotspot/src/share/vm/opto/classes.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/classes.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
 #include "opto/loopnode.hpp"
 #include "opto/machnode.hpp"
 #include "opto/memnode.hpp"
+#include "opto/mathexactnode.hpp"
 #include "opto/mulnode.hpp"
 #include "opto/multnode.hpp"
 #include "opto/node.hpp"
--- a/hotspot/src/share/vm/opto/classes.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/classes.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -29,6 +29,7 @@
 macro(AbsF)
 macro(AbsI)
 macro(AddD)
+macro(AddExactI)
 macro(AddF)
 macro(AddI)
 macro(AddL)
@@ -133,6 +134,7 @@
 macro(ExpD)
 macro(FastLock)
 macro(FastUnlock)
+macro(FlagsProj)
 macro(Goto)
 macro(Halt)
 macro(If)
@@ -167,6 +169,7 @@
 macro(LoopLimit)
 macro(Mach)
 macro(MachProj)
+macro(MathExact)
 macro(MaxI)
 macro(MemBarAcquire)
 macro(MemBarAcquireLock)
--- a/hotspot/src/share/vm/opto/compile.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/compile.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -654,7 +654,7 @@
                   _inlining_progress(false),
                   _inlining_incrementally(false),
                   _print_inlining_list(NULL),
-                  _print_inlining(0) {
+                  _print_inlining_idx(0) {
   C = this;
 
   CompileWrapper cw(this);
@@ -679,6 +679,8 @@
   set_print_assembly(print_opto_assembly);
   set_parsed_irreducible_loop(false);
 #endif
+  set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining));
+  set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics"));
 
   if (ProfileTraps) {
     // Make sure the method being compiled gets its own MDO,
@@ -710,7 +712,7 @@
   PhaseGVN gvn(node_arena(), estimated_size);
   set_initial_gvn(&gvn);
 
-  if (PrintInlining  || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) {
+  if (print_inlining() || print_intrinsics()) {
     _print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer>(comp_arena(), 1, 1, PrintInliningBuffer());
   }
   { // Scope for timing the parser
@@ -937,7 +939,7 @@
     _inlining_progress(false),
     _inlining_incrementally(false),
     _print_inlining_list(NULL),
-    _print_inlining(0) {
+    _print_inlining_idx(0) {
   C = this;
 
 #ifndef PRODUCT
@@ -3611,7 +3613,7 @@
 }
 
 void Compile::dump_inlining() {
-  if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) {
+  if (print_inlining() || print_intrinsics()) {
     // Print inlining message for candidates that we couldn't inline
     // for lack of space or non constant receiver
     for (int i = 0; i < _late_inlines.length(); i++) {
@@ -3635,7 +3637,7 @@
       }
     }
     for (int i = 0; i < _print_inlining_list->length(); i++) {
-      tty->print(_print_inlining_list->at(i).ss()->as_string());
+      tty->print(_print_inlining_list->adr_at(i)->ss()->as_string());
     }
   }
 }
--- a/hotspot/src/share/vm/opto/compile.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/compile.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -312,6 +312,8 @@
   bool                  _do_method_data_update; // True if we generate code to update MethodData*s
   int                   _AliasLevel;            // Locally-adjusted version of AliasLevel flag.
   bool                  _print_assembly;        // True if we should dump assembly code for this compilation
+  bool                  _print_inlining;        // True if we should print inlining for this compilation
+  bool                  _print_intrinsics;      // True if we should print intrinsics for this compilation
 #ifndef PRODUCT
   bool                  _trace_opto_output;
   bool                  _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
@@ -414,7 +416,7 @@
   };
 
   GrowableArray<PrintInliningBuffer>* _print_inlining_list;
-  int _print_inlining;
+  int _print_inlining_idx;
 
   // Only keep nodes in the expensive node list that need to be optimized
   void cleanup_expensive_nodes(PhaseIterGVN &igvn);
@@ -426,24 +428,24 @@
  public:
 
   outputStream* print_inlining_stream() const {
-    return _print_inlining_list->at(_print_inlining).ss();
+    return _print_inlining_list->adr_at(_print_inlining_idx)->ss();
   }
 
   void print_inlining_skip(CallGenerator* cg) {
-    if (PrintInlining) {
-      _print_inlining_list->at(_print_inlining).set_cg(cg);
-      _print_inlining++;
-      _print_inlining_list->insert_before(_print_inlining, PrintInliningBuffer());
+    if (_print_inlining) {
+      _print_inlining_list->adr_at(_print_inlining_idx)->set_cg(cg);
+      _print_inlining_idx++;
+      _print_inlining_list->insert_before(_print_inlining_idx, PrintInliningBuffer());
     }
   }
 
   void print_inlining_insert(CallGenerator* cg) {
-    if (PrintInlining) {
+    if (_print_inlining) {
       for (int i = 0; i < _print_inlining_list->length(); i++) {
-        if (_print_inlining_list->at(i).cg() == cg) {
+        if (_print_inlining_list->adr_at(i)->cg() == cg) {
           _print_inlining_list->insert_before(i+1, PrintInliningBuffer());
-          _print_inlining = i+1;
-          _print_inlining_list->at(i).set_cg(NULL);
+          _print_inlining_idx = i+1;
+          _print_inlining_list->adr_at(i)->set_cg(NULL);
           return;
         }
       }
@@ -572,6 +574,10 @@
   int               AliasLevel() const          { return _AliasLevel; }
   bool              print_assembly() const       { return _print_assembly; }
   void          set_print_assembly(bool z)       { _print_assembly = z; }
+  bool              print_inlining() const       { return _print_inlining; }
+  void          set_print_inlining(bool z)       { _print_inlining = z; }
+  bool              print_intrinsics() const     { return _print_intrinsics; }
+  void          set_print_intrinsics(bool z)     { _print_intrinsics = z; }
   // check the CompilerOracle for special behaviours for this compile
   bool          method_has_option(const char * option) {
     return method() != NULL && method()->has_option(option);
--- a/hotspot/src/share/vm/opto/doCall.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/doCall.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -41,9 +41,9 @@
 #include "runtime/sharedRuntime.hpp"
 
 void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) {
-  if (TraceTypeProfile || PrintInlining NOT_PRODUCT(|| PrintOptoInlining)) {
+  if (TraceTypeProfile || C->print_inlining()) {
     outputStream* out = tty;
-    if (!PrintInlining) {
+    if (!C->print_inlining()) {
       if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) {
         method->print_short_name();
         tty->cr();
@@ -110,6 +110,7 @@
   // then we return it as the inlined version of the call.
   // We do this before the strict f.p. check below because the
   // intrinsics handle strict f.p. correctly.
+  CallGenerator* cg_intrinsic = NULL;
   if (allow_inline && allow_intrinsics) {
     CallGenerator* cg = find_intrinsic(callee, call_does_dispatch);
     if (cg != NULL) {
@@ -121,7 +122,16 @@
           cg = CallGenerator::for_predicted_intrinsic(cg, inline_cg);
         }
       }
-      return cg;
+
+      // If intrinsic does the virtual dispatch, we try to use the type profile
+      // first, and hopefully inline it as the regular virtual call below.
+      // We will retry the intrinsic if nothing had claimed it afterwards.
+      if (cg->does_virtual_dispatch()) {
+        cg_intrinsic = cg;
+        cg = NULL;
+      } else {
+        return cg;
+      }
     }
   }
 
@@ -266,6 +276,13 @@
     }
   }
 
+  // Nothing claimed the intrinsic, we go with straight-forward inlining
+  // for already discovered intrinsic.
+  if (allow_inline && allow_intrinsics && cg_intrinsic != NULL) {
+    assert(cg_intrinsic->does_virtual_dispatch(), "sanity");
+    return cg_intrinsic;
+  }
+
   // There was no special inlining tactic, or it bailed out.
   // Use a more generic tactic, like a simple call.
   if (call_does_dispatch) {
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -3849,9 +3849,9 @@
   const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
                                                      false, NULL, 0);
   const TypePtr* value_field_type = string_type->add_offset(value_offset);
-  int value_field_idx = C->get_alias_index(value_field_type);
-  store_to_memory(ctrl, basic_plus_adr(str, value_offset),
-                  value, T_OBJECT, value_field_idx);
+
+  store_oop_to_object(ctrl, str,  basic_plus_adr(str, value_offset), value_field_type,
+      value, TypeAryPtr::CHARS, T_OBJECT);
 }
 
 void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) {
--- a/hotspot/src/share/vm/opto/ifnode.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/ifnode.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -76,6 +76,7 @@
   if( !i1->is_Bool() ) return NULL;
   BoolNode *b = i1->as_Bool();
   Node *cmp = b->in(1);
+  if( cmp->is_FlagsProj() ) return NULL;
   if( !cmp->is_Cmp() ) return NULL;
   i1 = cmp->in(1);
   if( i1 == NULL || !i1->is_Phi() ) return NULL;
--- a/hotspot/src/share/vm/opto/lcm.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/lcm.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -472,6 +472,13 @@
           break;
         }
 
+        // For nodes that produce a FlagsProj, make the node adjacent to the
+        // use of the FlagsProj
+        if (use->is_FlagsProj() && get_block_for_node(use) == block) {
+          found_machif = true;
+          break;
+        }
+
         // More than this instruction pending for successor to be ready,
         // don't choose this if other opportunities are ready
         if (ready_cnt.at(use->_idx) > 1)
--- a/hotspot/src/share/vm/opto/library_call.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
 #include "opto/callGenerator.hpp"
 #include "opto/cfgnode.hpp"
 #include "opto/idealKit.hpp"
+#include "opto/mathexactnode.hpp"
 #include "opto/mulnode.hpp"
 #include "opto/parse.hpp"
 #include "opto/runtime.hpp"
@@ -46,19 +47,22 @@
  private:
   bool             _is_virtual;
   bool             _is_predicted;
+  bool             _does_virtual_dispatch;
   vmIntrinsics::ID _intrinsic_id;
 
  public:
-  LibraryIntrinsic(ciMethod* m, bool is_virtual, bool is_predicted, vmIntrinsics::ID id)
+  LibraryIntrinsic(ciMethod* m, bool is_virtual, bool is_predicted, bool does_virtual_dispatch, vmIntrinsics::ID id)
     : InlineCallGenerator(m),
       _is_virtual(is_virtual),
       _is_predicted(is_predicted),
+      _does_virtual_dispatch(does_virtual_dispatch),
       _intrinsic_id(id)
   {
   }
   virtual bool is_intrinsic() const { return true; }
   virtual bool is_virtual()   const { return _is_virtual; }
   virtual bool is_predicted()   const { return _is_predicted; }
+  virtual bool does_virtual_dispatch()   const { return _does_virtual_dispatch; }
   virtual JVMState* generate(JVMState* jvms);
   virtual Node* generate_predicate(JVMState* jvms);
   vmIntrinsics::ID intrinsic_id() const { return _intrinsic_id; }
@@ -199,6 +203,8 @@
   bool inline_math_native(vmIntrinsics::ID id);
   bool inline_trig(vmIntrinsics::ID id);
   bool inline_math(vmIntrinsics::ID id);
+  bool inline_math_mathExact(Node* math);
+  bool inline_math_addExact();
   bool inline_exp();
   bool inline_pow();
   void finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName);
@@ -352,6 +358,7 @@
   }
 
   bool is_predicted = false;
+  bool does_virtual_dispatch = false;
 
   switch (id) {
   case vmIntrinsics::_compareTo:
@@ -378,8 +385,10 @@
     break;
   case vmIntrinsics::_hashCode:
     if (!InlineObjectHash)  return NULL;
+    does_virtual_dispatch = true;
     break;
   case vmIntrinsics::_clone:
+    does_virtual_dispatch = true;
   case vmIntrinsics::_copyOf:
   case vmIntrinsics::_copyOfRange:
     if (!InlineObjectCopy)  return NULL;
@@ -498,6 +507,15 @@
     if (!UseCRC32Intrinsics) return NULL;
     break;
 
+  case vmIntrinsics::_addExact:
+    if (!Matcher::match_rule_supported(Op_AddExactI)) {
+      return NULL;
+    }
+    if (!UseMathExactIntrinsics) {
+      return NULL;
+    }
+    break;
+
  default:
     assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
     assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
@@ -529,7 +547,7 @@
     if (!InlineUnsafeOps)  return NULL;
   }
 
-  return new LibraryIntrinsic(m, is_virtual, is_predicted, (vmIntrinsics::ID) id);
+  return new LibraryIntrinsic(m, is_virtual, is_predicted, does_virtual_dispatch, (vmIntrinsics::ID) id);
 }
 
 //----------------------register_library_intrinsics-----------------------
@@ -543,7 +561,7 @@
   Compile* C = kit.C;
   int nodes = C->unique();
 #ifndef PRODUCT
-  if ((PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) && Verbose) {
+  if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
     char buf[1000];
     const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf));
     tty->print_cr("Intrinsic %s", str);
@@ -554,7 +572,7 @@
 
   // Try to inline the intrinsic.
   if (kit.try_to_inline()) {
-    if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
+    if (C->print_intrinsics() || C->print_inlining()) {
       C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
     }
     C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
@@ -570,7 +588,7 @@
   }
 
   // The intrinsic bailed out
-  if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
+  if (C->print_intrinsics() || C->print_inlining()) {
     if (jvms->has_method()) {
       // Not a root compile.
       const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
@@ -592,7 +610,7 @@
   int nodes = C->unique();
 #ifndef PRODUCT
   assert(is_predicted(), "sanity");
-  if ((PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) && Verbose) {
+  if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
     char buf[1000];
     const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf));
     tty->print_cr("Predicate for intrinsic %s", str);
@@ -603,7 +621,7 @@
 
   Node* slow_ctl = kit.try_to_predicate();
   if (!kit.failing()) {
-    if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
+    if (C->print_intrinsics() || C->print_inlining()) {
       C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
     }
     C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
@@ -617,7 +635,7 @@
   }
 
   // The intrinsic bailed out
-  if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
+  if (C->print_intrinsics() || C->print_inlining()) {
     if (jvms->has_method()) {
       // Not a root compile.
       const char* msg = "failed to generate predicate for intrinsic";
@@ -668,6 +686,8 @@
   case vmIntrinsics::_min:
   case vmIntrinsics::_max:                      return inline_min_max(intrinsic_id());
 
+  case vmIntrinsics::_addExact:                 return inline_math_addExact();
+
   case vmIntrinsics::_arraycopy:                return inline_arraycopy();
 
   case vmIntrinsics::_compareTo:                return inline_string_compareTo();
@@ -1911,6 +1931,45 @@
   return true;
 }
 
+bool LibraryCallKit::inline_math_mathExact(Node* math) {
+  Node* result = _gvn.transform( new(C) ProjNode(math, MathExactNode::result_proj_node));
+  Node* flags = _gvn.transform( new(C) FlagsProjNode(math, MathExactNode::flags_proj_node));
+
+  Node* bol = _gvn.transform( new (C) BoolNode(flags, BoolTest::overflow) );
+  IfNode* check = create_and_map_if(control(), bol, PROB_UNLIKELY_MAG(3), COUNT_UNKNOWN);
+  Node* fast_path = _gvn.transform( new (C) IfFalseNode(check));
+  Node* slow_path = _gvn.transform( new (C) IfTrueNode(check) );
+
+  {
+    PreserveJVMState pjvms(this);
+    PreserveReexecuteState preexecs(this);
+    jvms()->set_should_reexecute(true);
+
+    set_control(slow_path);
+    set_i_o(i_o());
+
+    uncommon_trap(Deoptimization::Reason_intrinsic,
+                  Deoptimization::Action_none);
+  }
+
+  set_control(fast_path);
+  set_result(result);
+  return true;
+}
+
+bool LibraryCallKit::inline_math_addExact() {
+  Node* arg1 = argument(0);
+  Node* arg2 = argument(1);
+
+  Node* add = _gvn.transform( new(C) AddExactINode(NULL, arg1, arg2) );
+  if (add->Opcode() == Op_AddExactI) {
+    return inline_math_mathExact(add);
+  } else {
+    set_result(add);
+  }
+  return true;
+}
+
 Node*
 LibraryCallKit::generate_min_max(vmIntrinsics::ID id, Node* x0, Node* y0) {
   // These are the candidate return value:
@@ -2299,7 +2358,7 @@
     const TypeOopPtr* tjp = TypeOopPtr::make_from_klass(sharpened_klass);
 
 #ifndef PRODUCT
-    if (PrintIntrinsics || PrintInlining || PrintOptoInlining) {
+    if (C->print_intrinsics() || C->print_inlining()) {
       tty->print("  from base type: ");  adr_type->dump();
       tty->print("  sharpened value: ");  tjp->dump();
     }
@@ -3260,7 +3319,7 @@
   if (mirror_con == NULL)  return false;  // cannot happen?
 
 #ifndef PRODUCT
-  if (PrintIntrinsics || PrintInlining || PrintOptoInlining) {
+  if (C->print_intrinsics() || C->print_inlining()) {
     ciType* k = mirror_con->java_mirror_type();
     if (k) {
       tty->print("Inlining %s on constant Class ", vmIntrinsics::name_at(intrinsic_id()));
@@ -3952,14 +4011,14 @@
 // caller sensitive methods.
 bool LibraryCallKit::inline_native_Reflection_getCallerClass() {
 #ifndef PRODUCT
-  if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) {
+  if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
     tty->print_cr("Attempting to inline sun.reflect.Reflection.getCallerClass");
   }
 #endif
 
   if (!jvms()->has_method()) {
 #ifndef PRODUCT
-    if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) {
+    if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
       tty->print_cr("  Bailing out because intrinsic was inlined at top level");
     }
 #endif
@@ -3983,7 +4042,7 @@
       // Frame 0 and 1 must be caller sensitive (see JVM_GetCallerClass).
       if (!m->caller_sensitive()) {
 #ifndef PRODUCT
-        if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) {
+        if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
           tty->print_cr("  Bailing out: CallerSensitive annotation expected at frame %d", n);
         }
 #endif
@@ -3999,7 +4058,7 @@
         set_result(makecon(TypeInstPtr::make(caller_mirror)));
 
 #ifndef PRODUCT
-        if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) {
+        if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
           tty->print_cr("  Succeeded: caller = %d) %s.%s, JVMS depth = %d", n, caller_klass->name()->as_utf8(), caller_jvms->method()->name()->as_utf8(), jvms()->depth());
           tty->print_cr("  JVM state at this point:");
           for (int i = jvms()->depth(), n = 1; i >= 1; i--, n++) {
@@ -4015,7 +4074,7 @@
   }
 
 #ifndef PRODUCT
-  if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) {
+  if ((C->print_intrinsics() || C->print_inlining()) && Verbose) {
     tty->print_cr("  Bailing out because caller depth exceeded inlining depth = %d", jvms()->depth());
     tty->print_cr("  JVM state at this point:");
     for (int i = jvms()->depth(), n = 1; i >= 1; i--, n++) {
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -776,6 +776,9 @@
         continue; // not RC
 
       Node *cmp = bol->in(1);
+      if (cmp->is_FlagsProj()) {
+        continue;
+      }
 
       Node *rc_exp = cmp->in(1);
       Node *limit = cmp->in(2);
--- a/hotspot/src/share/vm/opto/loopopts.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/loopopts.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -2355,7 +2355,8 @@
         opc == Op_Catch     ||
         opc == Op_CatchProj ||
         opc == Op_Jump      ||
-        opc == Op_JumpProj) {
+        opc == Op_JumpProj  ||
+        opc == Op_FlagsProj) {
 #if !defined(PRODUCT)
       if (TracePartialPeeling) {
         tty->print_cr("\nExit control too complex: lp: %d", head->_idx);
--- a/hotspot/src/share/vm/opto/machnode.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/machnode.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -341,7 +341,7 @@
       return TypePtr::BOTTOM;
     }
     // %%% make offset be intptr_t
-    assert(!Universe::heap()->is_in_reserved((oop)offset), "must be a raw ptr");
+    assert(!Universe::heap()->is_in_reserved(cast_to_oop(offset)), "must be a raw ptr");
     return TypeRawPtr::BOTTOM;
   }
 
--- a/hotspot/src/share/vm/opto/matcher.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/matcher.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1964,6 +1964,7 @@
       case Op_Catch:
       case Op_CatchProj:
       case Op_CProj:
+      case Op_FlagsProj:
       case Op_JumpProj:
       case Op_JProj:
       case Op_NeverBranch:
--- a/hotspot/src/share/vm/opto/matcher.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/matcher.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -337,6 +337,9 @@
   // Register for MODL projection of divmodL
   static RegMask modL_proj_mask();
 
+  static const RegMask mathExactI_result_proj_mask();
+  static const RegMask mathExactI_flags_proj_mask();
+
   // Use hardware DIV instruction when it is faster than
   // a code which use multiply for division by constant.
   static bool use_asm_for_ldiv_by_con( jlong divisor );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/opto/mathexactnode.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "memory/allocation.inline.hpp"
+#include "opto/addnode.hpp"
+#include "opto/machnode.hpp"
+#include "opto/mathexactnode.hpp"
+#include "opto/matcher.hpp"
+#include "opto/subnode.hpp"
+
+MathExactNode::MathExactNode(Node* ctrl, Node* n1, Node* n2) : MultiNode(3) {
+  init_req(0, ctrl);
+  init_req(1, n1);
+  init_req(2, n2);
+}
+
+Node* AddExactINode::match(const ProjNode* proj, const Matcher* m) {
+  uint ideal_reg = proj->ideal_reg();
+  RegMask rm;
+  if (proj->_con == result_proj_node) {
+    rm = m->mathExactI_result_proj_mask();
+  } else {
+    assert(proj->_con == flags_proj_node, "must be result or flags");
+    assert(ideal_reg == Op_RegFlags, "sanity");
+    rm = m->mathExactI_flags_proj_mask();
+  }
+  return new (m->C) MachProjNode(this, proj->_con, rm, ideal_reg);
+}
+
+// If the MathExactNode won't overflow we have to replace the
+// FlagsProjNode and ProjNode that is generated by the MathExactNode
+Node* MathExactNode::no_overflow(PhaseGVN *phase, Node* new_result) {
+  PhaseIterGVN *igvn = phase->is_IterGVN();
+  if (igvn) {
+    ProjNode* result = result_node();
+    ProjNode* flags = flags_node();
+
+    if (result != NULL) {
+      igvn->replace_node(result, new_result);
+    }
+
+    if (flags != NULL) {
+      BoolNode* bolnode = (BoolNode *) flags->unique_out();
+      switch (bolnode->_test._test) {
+        case BoolTest::overflow:
+          // if the check is for overflow - never taken
+          igvn->replace_node(bolnode, phase->intcon(0));
+          break;
+        case BoolTest::no_overflow:
+          // if the check is for no overflow - always taken
+          igvn->replace_node(bolnode, phase->intcon(1));
+          break;
+        default:
+          fatal("Unexpected value of BoolTest");
+          break;
+      }
+      flags->del_req(0);
+    }
+  }
+  return new_result;
+}
+
+Node *AddExactINode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  Node *arg1 = in(1);
+  Node *arg2 = in(2);
+
+  const Type* type1 = phase->type(arg1);
+  const Type* type2 = phase->type(arg2);
+
+  if (type1 != Type::TOP && type1->singleton() &&
+      type2 != Type::TOP && type2->singleton()) {
+    jint val1 = arg1->get_int();
+    jint val2 = arg2->get_int();
+    jint result = val1 + val2;
+    // Hacker's Delight 2-12 Overflow if both arguments have the opposite sign of the result
+    if ( (((val1 ^ result) & (val2 ^ result)) >= 0)) {
+      Node* con_result = ConINode::make(phase->C, result);
+      return no_overflow(phase, con_result);
+    }
+    return NULL;
+  }
+
+  if (type1 == TypeInt::ZERO) { // (Add 0 x) == x
+    Node* add_result = new (phase->C) AddINode(arg1, arg2);
+    return no_overflow(phase, add_result);
+  }
+
+  if (type2 == TypeInt::ZERO) { // (Add x 0) == x
+    Node* add_result = new (phase->C) AddINode(arg1, arg2);
+    return no_overflow(phase, add_result);
+  }
+
+  if (type2->singleton()) {
+    return NULL; // no change - keep constant on the right
+  }
+
+  if (type1->singleton()) {
+    // Make it x + Constant - move constant to the right
+    swap_edges(1, 2);
+    return this;
+  }
+
+  if (arg2->is_Load()) {
+    return NULL; // no change - keep load on the right
+  }
+
+  if (arg1->is_Load()) {
+    // Make it x + Load - move load to the right
+    swap_edges(1, 2);
+    return this;
+  }
+
+  if (arg1->_idx > arg2->_idx) {
+    // Sort the edges
+    swap_edges(1, 2);
+    return this;
+  }
+
+  return NULL;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/opto/mathexactnode.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_OPTO_MATHEXACTNODE_HPP
+#define SHARE_VM_OPTO_MATHEXACTNODE_HPP
+
+#include "opto/multnode.hpp"
+#include "opto/node.hpp"
+#include "opto/type.hpp"
+
+class Node;
+
+class PhaseGVN;
+class PhaseTransform;
+
+class MathExactNode : public MultiNode {
+public:
+  MathExactNode(Node* ctrl, Node* in1, Node* in2);
+  enum {
+    result_proj_node = 0,
+    flags_proj_node = 1
+  };
+  virtual int Opcode() const;
+  virtual Node* Identity(PhaseTransform* phase) { return this; }
+  virtual Node* Ideal(PhaseGVN* phase, bool can_reshape) { return NULL; }
+  virtual const Type* Value(PhaseTransform* phase) const { return bottom_type(); }
+  virtual uint hash() const { return Node::hash(); }
+  virtual bool is_CFG() const { return false; }
+  virtual uint ideal_reg() const { return NotAMachineReg; }
+
+  ProjNode* result_node() { return proj_out(result_proj_node); }
+  ProjNode* flags_node() { return proj_out(flags_proj_node); }
+protected:
+  Node* no_overflow(PhaseGVN *phase, Node* new_result);
+};
+
+class AddExactINode : public MathExactNode {
+public:
+  AddExactINode(Node* ctrl, Node* in1, Node* in2) : MathExactNode(ctrl, in1, in2) {}
+  virtual int Opcode() const;
+  virtual const Type* bottom_type() const { return TypeTuple::INT_CC_PAIR; }
+  virtual Node* match(const ProjNode* proj, const Matcher* m);
+  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
+};
+
+class FlagsProjNode : public ProjNode {
+public:
+  FlagsProjNode(Node* src, uint con) : ProjNode(src, con) {
+    init_class_id(Class_FlagsProj);
+  }
+
+  virtual int Opcode() const;
+  virtual bool is_CFG() const { return false; }
+  virtual const Type* bottom_type() const { return TypeInt::CC; }
+  virtual uint ideal_reg() const { return Op_RegFlags; }
+};
+
+
+#endif
+
--- a/hotspot/src/share/vm/opto/multnode.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/multnode.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "opto/callnode.hpp"
 #include "opto/matcher.hpp"
+#include "opto/mathexactnode.hpp"
 #include "opto/multnode.hpp"
 #include "opto/opcodes.hpp"
 #include "opto/phaseX.hpp"
@@ -46,15 +47,21 @@
   assert(Opcode() != Op_If || outcnt() == 2, "bad if #1");
   for( DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++ ) {
     Node *p = fast_out(i);
-    if( !p->is_Proj() ) {
+    if (p->is_Proj()) {
+      ProjNode *proj = p->as_Proj();
+      if (proj->_con == which_proj) {
+        assert(Opcode() != Op_If || proj->Opcode() == (which_proj?Op_IfTrue:Op_IfFalse), "bad if #2");
+        return proj;
+      }
+    } else if (p->is_FlagsProj()) {
+      FlagsProjNode *proj = p->as_FlagsProj();
+      if (proj->_con == which_proj) {
+        return proj;
+      }
+    } else {
       assert(p == this && this->is_Start(), "else must be proj");
       continue;
     }
-    ProjNode *proj = p->as_Proj();
-    if( proj->_con == which_proj ) {
-      assert(Opcode() != Op_If || proj->Opcode() == (which_proj?Op_IfTrue:Op_IfFalse), "bad if #2");
-      return proj;
-    }
   }
   return NULL;
 }
--- a/hotspot/src/share/vm/opto/node.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/node.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -69,6 +69,7 @@
 class EncodePKlassNode;
 class FastLockNode;
 class FastUnlockNode;
+class FlagsProjNode;
 class IfNode;
 class IfFalseNode;
 class IfTrueNode;
@@ -623,6 +624,7 @@
       DEFINE_CLASS_ID(Cmp,   Sub, 0)
         DEFINE_CLASS_ID(FastLock,   Cmp, 0)
         DEFINE_CLASS_ID(FastUnlock, Cmp, 1)
+        DEFINE_CLASS_ID(FlagsProj, Cmp, 2)
 
     DEFINE_CLASS_ID(MergeMem, Node, 7)
     DEFINE_CLASS_ID(Bool,     Node, 8)
@@ -726,6 +728,7 @@
   DEFINE_CLASS_QUERY(EncodePKlass)
   DEFINE_CLASS_QUERY(FastLock)
   DEFINE_CLASS_QUERY(FastUnlock)
+  DEFINE_CLASS_QUERY(FlagsProj)
   DEFINE_CLASS_QUERY(If)
   DEFINE_CLASS_QUERY(IfFalse)
   DEFINE_CLASS_QUERY(IfTrue)
--- a/hotspot/src/share/vm/opto/subnode.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/subnode.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1064,7 +1064,7 @@
 // Print special per-node info
 #ifndef PRODUCT
 void BoolTest::dump_on(outputStream *st) const {
-  const char *msg[] = {"eq","gt","??","lt","ne","le","??","ge"};
+  const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"};
   st->print(msg[_test]);
 }
 #endif
@@ -1126,7 +1126,7 @@
   Node *cmp = in(1);
   if( !cmp->is_Sub() ) return NULL;
   int cop = cmp->Opcode();
-  if( cop == Op_FastLock || cop == Op_FastUnlock ) return NULL;
+  if( cop == Op_FastLock || cop == Op_FastUnlock || cop == Op_FlagsProj) return NULL;
   Node *cmp1 = cmp->in(1);
   Node *cmp2 = cmp->in(2);
   if( !cmp1 ) return NULL;
--- a/hotspot/src/share/vm/opto/subnode.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/subnode.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -263,16 +263,16 @@
 // We pick the values as 3 bits; the low order 2 bits we compare against the
 // condition codes, the high bit flips the sense of the result.
 struct BoolTest VALUE_OBJ_CLASS_SPEC {
-  enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, illegal = 8 };
+  enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, illegal = 8 };
   mask _test;
   BoolTest( mask btm ) : _test(btm) {}
   const Type *cc2logical( const Type *CC ) const;
   // Commute the test.  I use a small table lookup.  The table is created as
   // a simple char array where each element is the ASCII version of a 'mask'
   // enum from above.
-  mask commute( ) const { return mask("038147858"[_test]-'0'); }
+  mask commute( ) const { return mask("032147658"[_test]-'0'); }
   mask negate( ) const { return mask(_test^4); }
-  bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le); }
+  bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); }
 #ifndef PRODUCT
   void dump_on(outputStream *st) const;
 #endif
--- a/hotspot/src/share/vm/opto/type.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/type.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -430,6 +430,11 @@
   longpair[1] = TypeLong::LONG;
   TypeTuple::LONG_PAIR = TypeTuple::make(2, longpair);
 
+  const Type **intccpair = TypeTuple::fields(2);
+  intccpair[0] = TypeInt::INT;
+  intccpair[1] = TypeInt::CC;
+  TypeTuple::INT_CC_PAIR = TypeTuple::make(2, intccpair);
+
   _const_basic_type[T_NARROWOOP]   = TypeNarrowOop::BOTTOM;
   _const_basic_type[T_NARROWKLASS] = Type::BOTTOM;
   _const_basic_type[T_BOOLEAN]     = TypeInt::BOOL;
@@ -1646,6 +1651,7 @@
 const TypeTuple *TypeTuple::START_I2C;
 const TypeTuple *TypeTuple::INT_PAIR;
 const TypeTuple *TypeTuple::LONG_PAIR;
+const TypeTuple *TypeTuple::INT_CC_PAIR;
 
 
 //------------------------------make-------------------------------------------
--- a/hotspot/src/share/vm/opto/type.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/opto/type.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -584,6 +584,7 @@
   static const TypeTuple *START_I2C;
   static const TypeTuple *INT_PAIR;
   static const TypeTuple *LONG_PAIR;
+  static const TypeTuple *INT_CC_PAIR;
 #ifndef PRODUCT
   virtual void dump2( Dict &d, uint, outputStream *st  ) const; // Specialized per-Type dumping
 #endif
--- a/hotspot/src/share/vm/prims/jni.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/prims/jni.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -5046,7 +5046,10 @@
 void TestReservedSpace_test();
 void TestReserveMemorySpecial_test();
 void TestVirtualSpace_test();
-void MetaspaceAux_test();
+void TestMetaspaceAux_test();
+#if INCLUDE_ALL_GCS
+void TestG1BiasedArray_test();
+#endif
 
 void execute_internal_vm_tests() {
   if (ExecuteInternalVMTests) {
@@ -5054,7 +5057,7 @@
     run_unit_test(TestReservedSpace_test());
     run_unit_test(TestReserveMemorySpecial_test());
     run_unit_test(TestVirtualSpace_test());
-    run_unit_test(MetaspaceAux_test());
+    run_unit_test(TestMetaspaceAux_test());
     run_unit_test(GlobalDefinitions::test_globals());
     run_unit_test(GCTimerAllTest::all());
     run_unit_test(arrayOopDesc::test_max_array_length());
@@ -5066,6 +5069,7 @@
     run_unit_test(VMStructs::test());
 #endif
 #if INCLUDE_ALL_GCS
+    run_unit_test(TestG1BiasedArray_test());
     run_unit_test(HeapRegionRemSet::test_prt());
 #endif
     tty->print_cr("All internal VM tests passed");
--- a/hotspot/src/share/vm/prims/jvm.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1835,16 +1835,27 @@
 }
 JVM_END
 
-JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly))
-{
-  JVMWrapper("JVM_GetClassDeclaredMethods");
+static bool select_method(methodHandle method, bool want_constructor) {
+  if (want_constructor) {
+    return (method->is_initializer() && !method->is_static());
+  } else {
+    return  (!method->is_initializer() && !method->is_overpass());
+  }
+}
+
+static jobjectArray get_class_declared_methods_helper(
+                                  JNIEnv *env,
+                                  jclass ofClass, jboolean publicOnly,
+                                  bool want_constructor,
+                                  Klass* klass, TRAPS) {
+
   JvmtiVMObjectAllocEventCollector oam;
 
   // Exclude primitive types and array types
   if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass))
       || java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
     // Return empty array
-    oop res = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), 0, CHECK_NULL);
+    oop res = oopFactory::new_objArray(klass, 0, CHECK_NULL);
     return (jobjectArray) JNIHandles::make_local(env, res);
   }
 
@@ -1855,87 +1866,67 @@
 
   Array<Method*>* methods = k->methods();
   int methods_length = methods->length();
+
+  // Save original method_idnum in case of redefinition, which can change
+  // the idnum of obsolete methods.  The new method will have the same idnum
+  // but if we refresh the methods array, the counts will be wrong.
+  ResourceMark rm(THREAD);
+  GrowableArray<int>* idnums = new GrowableArray<int>(methods_length);
   int num_methods = 0;
 
-  int i;
-  for (i = 0; i < methods_length; i++) {
+  for (int i = 0; i < methods_length; i++) {
     methodHandle method(THREAD, methods->at(i));
-    if (!method->is_initializer() && !method->is_overpass()) {
+    if (select_method(method, want_constructor)) {
       if (!publicOnly || method->is_public()) {
+        idnums->push(method->method_idnum());
         ++num_methods;
       }
     }
   }
 
   // Allocate result
-  objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), num_methods, CHECK_NULL);
+  objArrayOop r = oopFactory::new_objArray(klass, num_methods, CHECK_NULL);
   objArrayHandle result (THREAD, r);
 
-  int out_idx = 0;
-  for (i = 0; i < methods_length; i++) {
-    methodHandle method(THREAD, methods->at(i));
-    if (!method->is_initializer() && !method->is_overpass()) {
-      if (!publicOnly || method->is_public()) {
-        oop m = Reflection::new_method(method, UseNewReflection, false, CHECK_NULL);
-        result->obj_at_put(out_idx, m);
-        ++out_idx;
+  // Now just put the methods that we selected above, but go by their idnum
+  // in case of redefinition.  The methods can be redefined at any safepoint,
+  // so above when allocating the oop array and below when creating reflect
+  // objects.
+  for (int i = 0; i < num_methods; i++) {
+    methodHandle method(THREAD, k->method_with_idnum(idnums->at(i)));
+    if (method.is_null()) {
+      // Method may have been deleted and seems this API can handle null
+      // Otherwise should probably put a method that throws NSME
+      result->obj_at_put(i, NULL);
+    } else {
+      oop m;
+      if (want_constructor) {
+        m = Reflection::new_constructor(method, CHECK_NULL);
+      } else {
+        m = Reflection::new_method(method, UseNewReflection, false, CHECK_NULL);
       }
+      result->obj_at_put(i, m);
     }
   }
-  assert(out_idx == num_methods, "just checking");
+
   return (jobjectArray) JNIHandles::make_local(env, result());
 }
+
+JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly))
+{
+  JVMWrapper("JVM_GetClassDeclaredMethods");
+  return get_class_declared_methods_helper(env, ofClass, publicOnly,
+                                           /*want_constructor*/ false,
+                                           SystemDictionary::reflect_Method_klass(), THREAD);
+}
 JVM_END
 
 JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly))
 {
   JVMWrapper("JVM_GetClassDeclaredConstructors");
-  JvmtiVMObjectAllocEventCollector oam;
-
-  // Exclude primitive types and array types
-  if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass))
-      || java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->oop_is_array()) {
-    // Return empty array
-    oop res = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), 0 , CHECK_NULL);
-    return (jobjectArray) JNIHandles::make_local(env, res);
-  }
-
-  instanceKlassHandle k(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)));
-
-  // Ensure class is linked
-  k->link_class(CHECK_NULL);
-
-  Array<Method*>* methods = k->methods();
-  int methods_length = methods->length();
-  int num_constructors = 0;
-
-  int i;
-  for (i = 0; i < methods_length; i++) {
-    methodHandle method(THREAD, methods->at(i));
-    if (method->is_initializer() && !method->is_static()) {
-      if (!publicOnly || method->is_public()) {
-        ++num_constructors;
-      }
-    }
-  }
-
-  // Allocate result
-  objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), num_constructors, CHECK_NULL);
-  objArrayHandle result(THREAD, r);
-
-  int out_idx = 0;
-  for (i = 0; i < methods_length; i++) {
-    methodHandle method(THREAD, methods->at(i));
-    if (method->is_initializer() && !method->is_static()) {
-      if (!publicOnly || method->is_public()) {
-        oop m = Reflection::new_constructor(method, CHECK_NULL);
-        result->obj_at_put(out_idx, m);
-        ++out_idx;
-      }
-    }
-  }
-  assert(out_idx == num_constructors, "just checking");
-  return (jobjectArray) JNIHandles::make_local(env, result());
+  return get_class_declared_methods_helper(env, ofClass, publicOnly,
+                                           /*want_constructor*/ true,
+                                           SystemDictionary::reflect_Constructor_klass(), THREAD);
 }
 JVM_END
 
@@ -4235,13 +4226,13 @@
 
 JVM_LEAF(jboolean, JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get))
   JVMWrapper("JVM_AccessBoolVMFlag");
-  return is_get ? CommandLineFlags::boolAt((char*) name, (bool*) value) : CommandLineFlags::boolAtPut((char*) name, (bool*) value, INTERNAL);
+  return is_get ? CommandLineFlags::boolAt((char*) name, (bool*) value) : CommandLineFlags::boolAtPut((char*) name, (bool*) value, Flag::INTERNAL);
 JVM_END
 
 JVM_LEAF(jboolean, JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get))
   JVMWrapper("JVM_AccessVMIntFlag");
   intx v;
-  jboolean result = is_get ? CommandLineFlags::intxAt((char*) name, &v) : CommandLineFlags::intxAtPut((char*) name, &v, INTERNAL);
+  jboolean result = is_get ? CommandLineFlags::intxAt((char*) name, &v) : CommandLineFlags::intxAtPut((char*) name, &v, Flag::INTERNAL);
   *value = (jint)v;
   return result;
 JVM_END
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -406,7 +406,11 @@
   VMOp_Type type() const { return VMOp_GetCurrentContendedMonitor; }
   jvmtiError result() { return _result; }
   void doit() {
-    _result = ((JvmtiEnvBase *)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr);
+    _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
+    if (Threads::includes(_java_thread) && !_java_thread->is_exiting() &&
+        _java_thread->threadObj() != NULL) {
+      _result = ((JvmtiEnvBase *)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr);
+    }
   }
 };
 
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -273,59 +273,49 @@
 
   // add/remove breakpoint to/from versions of the method that
   // are EMCP. Directly or transitively obsolete methods are
-  // not saved in the PreviousVersionInfo.
+  // not saved in the PreviousVersionNodes.
   Thread *thread = Thread::current();
   instanceKlassHandle ikh = instanceKlassHandle(thread, _method->method_holder());
   Symbol* m_name = _method->name();
   Symbol* m_signature = _method->signature();
 
-  {
-    ResourceMark rm(thread);
-    // PreviousVersionInfo objects returned via PreviousVersionWalker
-    // contain a GrowableArray of handles. We have to clean up the
-    // GrowableArray _after_ the PreviousVersionWalker destructor
-    // has destroyed the handles.
-    {
-      // search previous versions if they exist
-      PreviousVersionWalker pvw((InstanceKlass *)ikh());
-      for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
-           pv_info != NULL; pv_info = pvw.next_previous_version()) {
-        GrowableArray<methodHandle>* methods =
-          pv_info->prev_EMCP_method_handles();
+  // search previous versions if they exist
+  PreviousVersionWalker pvw(thread, (InstanceKlass *)ikh());
+  for (PreviousVersionNode * pv_node = pvw.next_previous_version();
+       pv_node != NULL; pv_node = pvw.next_previous_version()) {
+    GrowableArray<Method*>* methods = pv_node->prev_EMCP_methods();
 
-        if (methods == NULL) {
-          // We have run into a PreviousVersion generation where
-          // all methods were made obsolete during that generation's
-          // RedefineClasses() operation. At the time of that
-          // operation, all EMCP methods were flushed so we don't
-          // have to go back any further.
-          //
-          // A NULL methods array is different than an empty methods
-          // array. We cannot infer any optimizations about older
-          // generations from an empty methods array for the current
-          // generation.
-          break;
-        }
+    if (methods == NULL) {
+      // We have run into a PreviousVersion generation where
+      // all methods were made obsolete during that generation's
+      // RedefineClasses() operation. At the time of that
+      // operation, all EMCP methods were flushed so we don't
+      // have to go back any further.
+      //
+      // A NULL methods array is different than an empty methods
+      // array. We cannot infer any optimizations about older
+      // generations from an empty methods array for the current
+      // generation.
+      break;
+    }
 
-        for (int i = methods->length() - 1; i >= 0; i--) {
-          methodHandle method = methods->at(i);
-          // obsolete methods that are running are not deleted from
-          // previous version array, but they are skipped here.
-          if (!method->is_obsolete() &&
-              method->name() == m_name &&
-              method->signature() == m_signature) {
-            RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)",
-              meth_act == &Method::set_breakpoint ? "sett" : "clear",
-              method->name()->as_C_string(),
-              method->signature()->as_C_string()));
+    for (int i = methods->length() - 1; i >= 0; i--) {
+      Method* method = methods->at(i);
+      // obsolete methods that are running are not deleted from
+      // previous version array, but they are skipped here.
+      if (!method->is_obsolete() &&
+          method->name() == m_name &&
+          method->signature() == m_signature) {
+        RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)",
+          meth_act == &Method::set_breakpoint ? "sett" : "clear",
+          method->name()->as_C_string(),
+          method->signature()->as_C_string()));
 
-            ((Method*)method()->*meth_act)(_bci);
-            break;
-          }
-        }
+        (method->*meth_act)(_bci);
+        break;
       }
-    } // pvw is cleaned up
-  } // rm is cleaned up
+    }
+  }
 }
 
 void JvmtiBreakpoint::set() {
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -2807,28 +2807,20 @@
                                         &trace_name_printed);
       }
     }
-    {
-      ResourceMark rm(_thread);
-      // PreviousVersionInfo objects returned via PreviousVersionWalker
-      // contain a GrowableArray of handles. We have to clean up the
-      // GrowableArray _after_ the PreviousVersionWalker destructor
-      // has destroyed the handles.
-      {
-        // the previous versions' constant pool caches may need adjustment
-        PreviousVersionWalker pvw(ik);
-        for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
-             pv_info != NULL; pv_info = pvw.next_previous_version()) {
-          other_cp = pv_info->prev_constant_pool_handle();
-          cp_cache = other_cp->cache();
-          if (cp_cache != NULL) {
-            cp_cache->adjust_method_entries(_matching_old_methods,
-                                            _matching_new_methods,
-                                            _matching_methods_length,
-                                            &trace_name_printed);
-          }
-        }
-      } // pvw is cleaned up
-    } // rm is cleaned up
+
+    // the previous versions' constant pool caches may need adjustment
+    PreviousVersionWalker pvw(_thread, ik);
+    for (PreviousVersionNode * pv_node = pvw.next_previous_version();
+         pv_node != NULL; pv_node = pvw.next_previous_version()) {
+      other_cp = pv_node->prev_constant_pool();
+      cp_cache = other_cp->cache();
+      if (cp_cache != NULL) {
+        cp_cache->adjust_method_entries(_matching_old_methods,
+                                        _matching_new_methods,
+                                        _matching_methods_length,
+                                        &trace_name_printed);
+      }
+    }
   }
 }
 
@@ -2942,10 +2934,9 @@
       // obsolete methods need a unique idnum
       u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum();
       if (num != ConstMethod::UNSET_IDNUM) {
-//      u2 old_num = old_method->method_idnum();
         old_method->set_method_idnum(num);
-// TO DO: attach obsolete annotations to obsolete method's new idnum
       }
+
       // With tracing we try not to "yack" too much. The position of
       // this trace assumes there are fewer obsolete methods than
       // EMCP methods.
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -165,7 +165,7 @@
   static unsigned int hash(oop key, int size) {
     // shift right to get better distribution (as these bits will be zero
     // with aligned addresses)
-    unsigned int addr = (unsigned int)((intptr_t)key);
+    unsigned int addr = (unsigned int)(cast_from_oop<intptr_t>(key));
 #ifdef _LP64
     return (addr >> 3) % size;
 #else
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -292,9 +292,9 @@
   volatile oop v;
   if (UseCompressedOops) {
     volatile narrowOop n = *(volatile narrowOop*) addr;
-    v = oopDesc::decode_heap_oop(n);
+    (void)const_cast<oop&>(v = oopDesc::decode_heap_oop(n));
   } else {
-    v = *(volatile oop*) addr;
+    (void)const_cast<oop&>(v = *(volatile oop*) addr);
   }
   OrderAccess::acquire();
   return JNIHandles::make_local(env, v);
@@ -1222,9 +1222,9 @@
 #endif /* USDT2 */
   if (event.should_commit()) {
     oop obj = thread->current_park_blocker();
-    event.set_klass(obj ? obj->klass() : NULL);
+    event.set_klass((obj != NULL) ? obj->klass() : NULL);
     event.set_timeout(time);
-    event.set_address(obj ? (TYPE_ADDRESS) (uintptr_t) obj : 0);
+    event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop<uintptr_t>(obj) : 0);
     event.commit();
   }
 UNSAFE_END
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -625,11 +625,11 @@
   }
 }
 
-static bool set_bool_flag(char* name, bool value, FlagValueOrigin origin) {
+static bool set_bool_flag(char* name, bool value, Flag::Flags origin) {
   return CommandLineFlags::boolAtPut(name, &value, origin);
 }
 
-static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) {
+static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) {
   double v;
   if (sscanf(value, "%lf", &v) != 1) {
     return false;
@@ -641,7 +641,7 @@
   return false;
 }
 
-static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) {
+static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
   julong v;
   intx intx_v;
   bool is_neg = false;
@@ -674,14 +674,14 @@
   return false;
 }
 
-static bool set_string_flag(char* name, const char* value, FlagValueOrigin origin) {
+static bool set_string_flag(char* name, const char* value, Flag::Flags origin) {
   if (!CommandLineFlags::ccstrAtPut(name, &value, origin))  return false;
   // Contract:  CommandLineFlags always returns a pointer that needs freeing.
   FREE_C_HEAP_ARRAY(char, value, mtInternal);
   return true;
 }
 
-static bool append_to_string_flag(char* name, const char* new_value, FlagValueOrigin origin) {
+static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags origin) {
   const char* old_value = "";
   if (!CommandLineFlags::ccstrAt(name, &old_value))  return false;
   size_t old_len = old_value != NULL ? strlen(old_value) : 0;
@@ -709,7 +709,7 @@
   return true;
 }
 
-bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) {
+bool Arguments::parse_argument(const char* arg, Flag::Flags origin) {
 
   // range of acceptable characters spelled out for portability reasons
 #define NAME_RANGE  "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]"
@@ -850,7 +850,7 @@
 }
 
 bool Arguments::process_argument(const char* arg,
-    jboolean ignore_unrecognized, FlagValueOrigin origin) {
+    jboolean ignore_unrecognized, Flag::Flags origin) {
 
   JDK_Version since = JDK_Version();
 
@@ -904,7 +904,7 @@
       jio_fprintf(defaultStream::error_stream(),
                   "Did you mean '%s%s%s'?\n",
                   (fuzzy_matched->is_bool()) ? "(+/-)" : "",
-                  fuzzy_matched->name,
+                  fuzzy_matched->_name,
                   (fuzzy_matched->is_bool()) ? "" : "=<value>");
     }
   }
@@ -952,7 +952,7 @@
         // this allows a way to include spaces in string-valued options
         token[pos] = '\0';
         logOption(token);
-        result &= process_argument(token, ignore_unrecognized, CONFIG_FILE);
+        result &= process_argument(token, ignore_unrecognized, Flag::CONFIG_FILE);
         build_jvm_flags(token);
         pos = 0;
         in_white_space = true;
@@ -970,7 +970,7 @@
   }
   if (pos > 0) {
     token[pos] = '\0';
-    result &= process_argument(token, ignore_unrecognized, CONFIG_FILE);
+    result &= process_argument(token, ignore_unrecognized, Flag::CONFIG_FILE);
     build_jvm_flags(token);
   }
   fclose(stream);
@@ -1100,6 +1100,7 @@
   }
 }
 
+#if defined(COMPILER2) || defined(_LP64) || !INCLUDE_CDS
 // Conflict: required to use shared spaces (-Xshare:on), but
 // incompatible command line options were chosen.
 
@@ -1112,6 +1113,7 @@
     FLAG_SET_DEFAULT(UseSharedSpaces, false);
   }
 }
+#endif
 
 void Arguments::set_tiered_flags() {
   // With tiered, set default policy to AdvancedThresholdPolicy, which is 3.
@@ -1130,6 +1132,9 @@
     Tier3InvokeNotifyFreqLog = 0;
     Tier4InvocationThreshold = 0;
   }
+  if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
+    FLAG_SET_DEFAULT(NmethodSweepFraction, 1 + ReservedCodeCacheSize / (16 * M));
+  }
 }
 
 #if INCLUDE_ALL_GCS
@@ -1520,16 +1525,18 @@
         FLAG_SET_ERGO(bool, UseParallelGC, true);
       }
     }
-    // Shared spaces work fine with other GCs but causes bytecode rewriting
-    // to be disabled, which hurts interpreter performance and decreases
-    // server performance.   On server class machines, keep the default
-    // off unless it is asked for.  Future work: either add bytecode rewriting
-    // at link time, or rewrite bytecodes in non-shared methods.
-    if (!DumpSharedSpaces && !RequireSharedSpaces &&
-        (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
-      no_shared_spaces();
-    }
   }
+#ifdef COMPILER2
+  // Shared spaces work fine with other GCs but causes bytecode rewriting
+  // to be disabled, which hurts interpreter performance and decreases
+  // server performance.  When -server is specified, keep the default off
+  // unless it is asked for.  Future work: either add bytecode rewriting
+  // at link time, or rewrite bytecodes in non-shared methods.
+  if (!DumpSharedSpaces && !RequireSharedSpaces &&
+      (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
+    no_shared_spaces();
+  }
+#endif
 
   set_conservative_max_heap_alignment();
 
@@ -2333,6 +2340,10 @@
                 (2*G)/M);
     status = false;
   }
+
+  status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction");
+  status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity");
+
   return status;
 }
 
@@ -2434,26 +2445,11 @@
   }
 
   // Parse JavaVMInitArgs structure passed in
-  result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, COMMAND_LINE);
+  result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, Flag::COMMAND_LINE);
   if (result != JNI_OK) {
     return result;
   }
 
-  if (AggressiveOpts) {
-    // Insert alt-rt.jar between user-specified bootclasspath
-    // prefix and the default bootclasspath.  os::set_boot_path()
-    // uses meta_index_dir as the default bootclasspath directory.
-    const char* altclasses_jar = "alt-rt.jar";
-    size_t altclasses_path_len = strlen(get_meta_index_dir()) + 1 +
-                                 strlen(altclasses_jar);
-    char* altclasses_path = NEW_C_HEAP_ARRAY(char, altclasses_path_len, mtInternal);
-    strcpy(altclasses_path, get_meta_index_dir());
-    strcat(altclasses_path, altclasses_jar);
-    scp.add_suffix_to_prefix(altclasses_path);
-    scp_assembly_required = true;
-    FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal);
-  }
-
   // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
   result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
   if (result != JNI_OK) {
@@ -2521,7 +2517,7 @@
 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
                                        SysClassPath* scp_p,
                                        bool* scp_assembly_required_p,
-                                       FlagValueOrigin origin) {
+                                       Flag::Flags origin) {
   // Remaining part of option string
   const char* tail;
 
@@ -3344,7 +3340,7 @@
       }
     }
 
-    return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR));
+    return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, Flag::ENVIRON_VAR));
   }
   return JNI_OK;
 }
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -360,15 +360,15 @@
 
   // Argument parsing
   static void do_pd_flag_adjustments();
-  static bool parse_argument(const char* arg, FlagValueOrigin origin);
-  static bool process_argument(const char* arg, jboolean ignore_unrecognized, FlagValueOrigin origin);
+  static bool parse_argument(const char* arg, Flag::Flags origin);
+  static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin);
   static void process_java_launcher_argument(const char*, void*);
   static void process_java_compiler_argument(char* arg);
   static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p);
   static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
   static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
   static jint parse_vm_init_args(const JavaVMInitArgs* args);
-  static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, FlagValueOrigin origin);
+  static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, Flag::Flags origin);
   static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required);
   static bool is_bad_option(const JavaVMOption* option, jboolean ignore,
     const char* option_type);
--- a/hotspot/src/share/vm/runtime/biasedLocking.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/biasedLocking.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -161,7 +161,7 @@
   if (TraceBiasedLocking && (Verbose || !is_bulk)) {
     ResourceMark rm;
     tty->print_cr("Revoking bias of object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT " , allow rebias %d , requesting thread " INTPTR_FORMAT,
-                  (intptr_t) obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
+                  (void *)obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
   }
 
   JavaThread* biased_thread = mark->biased_locker();
@@ -214,8 +214,8 @@
     if (mon_info->owner() == obj) {
       if (TraceBiasedLocking && Verbose) {
         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
-                      (intptr_t) mon_info->owner(),
-                      (intptr_t) obj);
+                      (void *) mon_info->owner(),
+                      (void *) obj);
       }
       // Assume recursive case and fix up highest lock later
       markOop mark = markOopDesc::encode((BasicLock*) NULL);
@@ -224,8 +224,8 @@
     } else {
       if (TraceBiasedLocking && Verbose) {
         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
-                      (intptr_t) mon_info->owner(),
-                      (intptr_t) obj);
+                      (void *) mon_info->owner(),
+                      (void *) obj);
       }
     }
   }
@@ -326,7 +326,7 @@
     tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
                   INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
                   (bulk_rebias ? "rebias" : "revoke"),
-                  (intptr_t) o, (intptr_t) o->mark(), o->klass()->external_name());
+                  (void *) o, (intptr_t) o->mark(), o->klass()->external_name());
   }
 
   jlong cur_time = os::javaTimeMillis();
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -234,7 +234,7 @@
         assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
         if (TraceDeoptimization) {
           ttyLocker ttyl;
-          tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, result, thread);
+          tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, (void *)result, thread);
         }
       }
       bool reallocated = false;
@@ -278,7 +278,7 @@
                   first = false;
                   tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, thread);
                 }
-                tty->print_cr("     object <" INTPTR_FORMAT "> locked", mi->owner());
+                tty->print_cr("     object <" INTPTR_FORMAT "> locked", (void *)mi->owner());
               }
             }
           }
@@ -977,7 +977,7 @@
     KlassHandle k(java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()()));
     Handle obj = sv->value();
 
-    tty->print("     object <" INTPTR_FORMAT "> of type ", sv->value()());
+    tty->print("     object <" INTPTR_FORMAT "> of type ", (void *)sv->value()());
     k->print_value();
     tty->print(" allocated (%d bytes)", obj->size() * HeapWordSize);
     tty->cr();
--- a/hotspot/src/share/vm/runtime/frame.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -1097,7 +1097,7 @@
     return NULL;
   }
   oop r = *oop_adr;
-  assert(Universe::heap()->is_in_or_null(r), err_msg("bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (intptr_t) r, (intptr_t) r));
+  assert(Universe::heap()->is_in_or_null(r), err_msg("bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", (void *) r, (void *) r));
   return r;
 }
 
@@ -1228,9 +1228,7 @@
 
 void frame::ZapDeadClosure::do_oop(oop* p) {
   if (TraceZapDeadLocals) tty->print_cr("zapping @ " INTPTR_FORMAT " containing " INTPTR_FORMAT, p, (address)*p);
-  // Need cast because on _LP64 the conversion to oop is ambiguous.  Constant
-  // can be either long or int.
-  *p = (oop)(int)0xbabebabe;
+  *p = cast_to_oop<intptr_t>(0xbabebabe);
 }
 frame::ZapDeadClosure frame::_zap_dead;
 
--- a/hotspot/src/share/vm/runtime/globals.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -62,26 +62,174 @@
 MATERIALIZE_FLAGS_EXT
 
 
+void Flag::check_writable() {
+  if (is_constant_in_binary()) {
+    fatal(err_msg("flag is constant: %s", _name));
+  }
+}
+
+bool Flag::is_bool() const {
+  return strcmp(_type, "bool") == 0;
+}
+
+bool Flag::get_bool() const {
+  return *((bool*) _addr);
+}
+
+void Flag::set_bool(bool value) {
+  check_writable();
+  *((bool*) _addr) = value;
+}
+
+bool Flag::is_intx() const {
+  return strcmp(_type, "intx")  == 0;
+}
+
+intx Flag::get_intx() const {
+  return *((intx*) _addr);
+}
+
+void Flag::set_intx(intx value) {
+  check_writable();
+  *((intx*) _addr) = value;
+}
+
+bool Flag::is_uintx() const {
+  return strcmp(_type, "uintx") == 0;
+}
+
+uintx Flag::get_uintx() const {
+  return *((uintx*) _addr);
+}
+
+void Flag::set_uintx(uintx value) {
+  check_writable();
+  *((uintx*) _addr) = value;
+}
+
+bool Flag::is_uint64_t() const {
+  return strcmp(_type, "uint64_t") == 0;
+}
+
+uint64_t Flag::get_uint64_t() const {
+  return *((uint64_t*) _addr);
+}
+
+void Flag::set_uint64_t(uint64_t value) {
+  check_writable();
+  *((uint64_t*) _addr) = value;
+}
+
+bool Flag::is_double() const {
+  return strcmp(_type, "double") == 0;
+}
+
+double Flag::get_double() const {
+  return *((double*) _addr);
+}
+
+void Flag::set_double(double value) {
+  check_writable();
+  *((double*) _addr) = value;
+}
+
+bool Flag::is_ccstr() const {
+  return strcmp(_type, "ccstr") == 0 || strcmp(_type, "ccstrlist") == 0;
+}
+
+bool Flag::ccstr_accumulates() const {
+  return strcmp(_type, "ccstrlist") == 0;
+}
+
+ccstr Flag::get_ccstr() const {
+  return *((ccstr*) _addr);
+}
+
+void Flag::set_ccstr(ccstr value) {
+  check_writable();
+  *((ccstr*) _addr) = value;
+}
+
+
+Flag::Flags Flag::get_origin() {
+  return Flags(_flags & VALUE_ORIGIN_MASK);
+}
+
+void Flag::set_origin(Flags origin) {
+  assert((origin & VALUE_ORIGIN_MASK) == origin, "sanity");
+  _flags = Flags((_flags & ~VALUE_ORIGIN_MASK) | origin);
+}
+
+bool Flag::is_default() {
+  return (get_origin() == DEFAULT);
+}
+
+bool Flag::is_ergonomic() {
+  return (get_origin() == ERGONOMIC);
+}
+
+bool Flag::is_command_line() {
+  return (get_origin() == COMMAND_LINE);
+}
+
+bool Flag::is_product() const {
+  return (_flags & KIND_PRODUCT) != 0;
+}
+
+bool Flag::is_manageable() const {
+  return (_flags & KIND_MANAGEABLE) != 0;
+}
+
+bool Flag::is_diagnostic() const {
+  return (_flags & KIND_DIAGNOSTIC) != 0;
+}
+
+bool Flag::is_experimental() const {
+  return (_flags & KIND_EXPERIMENTAL) != 0;
+}
+
+bool Flag::is_notproduct() const {
+  return (_flags & KIND_NOT_PRODUCT) != 0;
+}
+
+bool Flag::is_develop() const {
+  return (_flags & KIND_DEVELOP) != 0;
+}
+
+bool Flag::is_read_write() const {
+  return (_flags & KIND_READ_WRITE) != 0;
+}
+
+bool Flag::is_commercial() const {
+  return (_flags & KIND_COMMERCIAL) != 0;
+}
+
+/**
+ * Returns if this flag is a constant in the binary.  Right now this is
+ * true for notproduct and develop flags in product builds.
+ */
+bool Flag::is_constant_in_binary() const {
+#ifdef PRODUCT
+    return is_notproduct() || is_develop();
+#else
+    return false;
+#endif
+}
+
 bool Flag::is_unlocker() const {
-  return strcmp(name, "UnlockDiagnosticVMOptions") == 0     ||
-         strcmp(name, "UnlockExperimentalVMOptions") == 0   ||
+  return strcmp(_name, "UnlockDiagnosticVMOptions") == 0     ||
+         strcmp(_name, "UnlockExperimentalVMOptions") == 0   ||
          is_unlocker_ext();
 }
 
 bool Flag::is_unlocked() const {
-  if (strcmp(kind, "{diagnostic}") == 0 ||
-      strcmp(kind, "{C2 diagnostic}") == 0 ||
-      strcmp(kind, "{ARCH diagnostic}") == 0 ||
-      strcmp(kind, "{Shark diagnostic}") == 0) {
+  if (is_diagnostic()) {
     return UnlockDiagnosticVMOptions;
-  } else if (strcmp(kind, "{experimental}") == 0 ||
-             strcmp(kind, "{C2 experimental}") == 0 ||
-             strcmp(kind, "{ARCH experimental}") == 0 ||
-             strcmp(kind, "{Shark experimental}") == 0) {
+  }
+  if (is_experimental()) {
     return UnlockExperimentalVMOptions;
-  } else {
-    return is_unlocked_ext();
   }
+  return is_unlocked_ext();
 }
 
 // Get custom message for this locked flag, or return NULL if
@@ -91,16 +239,14 @@
 }
 
 bool Flag::is_writeable() const {
-  return strcmp(kind, "{manageable}") == 0 ||
-         strcmp(kind, "{product rw}") == 0 ||
-         is_writeable_ext();
+  return is_manageable() || (is_product() && is_read_write()) || is_writeable_ext();
 }
 
 // All flags except "manageable" are assumed to be internal flags.
 // Long term, we need to define a mechanism to specify which flags
 // are external/stable and change this function accordingly.
 bool Flag::is_external() const {
-  return strcmp(kind, "{manageable}") == 0 || is_external_ext();
+  return is_manageable() || is_external_ext();
 }
 
 
@@ -108,53 +254,113 @@
 #define FORMAT_BUFFER_LEN 16
 
 void Flag::print_on(outputStream* st, bool withComments) {
-  st->print("%9s %-40s %c= ", type, name, (origin != DEFAULT ? ':' : ' '));
-  if (is_bool())     st->print("%-16s", get_bool() ? "true" : "false");
-  if (is_intx())     st->print("%-16ld", get_intx());
-  if (is_uintx())    st->print("%-16lu", get_uintx());
-  if (is_uint64_t()) st->print("%-16lu", get_uint64_t());
-  if (is_double())   st->print("%-16f", get_double());
+  // Don't print notproduct and develop flags in a product build.
+  if (is_constant_in_binary()) {
+    return;
+  }
+
+  st->print("%9s %-40s %c= ", _type, _name, (!is_default() ? ':' : ' '));
 
+  if (is_bool()) {
+    st->print("%-16s", get_bool() ? "true" : "false");
+  }
+  if (is_intx()) {
+    st->print("%-16ld", get_intx());
+  }
+  if (is_uintx()) {
+    st->print("%-16lu", get_uintx());
+  }
+  if (is_uint64_t()) {
+    st->print("%-16lu", get_uint64_t());
+  }
+  if (is_double()) {
+    st->print("%-16f", get_double());
+  }
   if (is_ccstr()) {
-     const char* cp = get_ccstr();
-     if (cp != NULL) {
-       const char* eol;
-       while ((eol = strchr(cp, '\n')) != NULL) {
-         char format_buffer[FORMAT_BUFFER_LEN];
-         size_t llen = pointer_delta(eol, cp, sizeof(char));
-         jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
-                     "%%." SIZE_FORMAT "s", llen);
-         st->print(format_buffer, cp);
-         st->cr();
-         cp = eol+1;
-         st->print("%5s %-35s += ", "", name);
-       }
-       st->print("%-16s", cp);
-     }
-     else st->print("%-16s", "");
+    const char* cp = get_ccstr();
+    if (cp != NULL) {
+      const char* eol;
+      while ((eol = strchr(cp, '\n')) != NULL) {
+        char format_buffer[FORMAT_BUFFER_LEN];
+        size_t llen = pointer_delta(eol, cp, sizeof(char));
+        jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
+            "%%." SIZE_FORMAT "s", llen);
+        st->print(format_buffer, cp);
+        st->cr();
+        cp = eol+1;
+        st->print("%5s %-35s += ", "", _name);
+      }
+      st->print("%-16s", cp);
+    }
+    else st->print("%-16s", "");
   }
-  st->print("%-20s", kind);
+
+  st->print("%-20");
+  print_kind(st);
+
   if (withComments) {
 #ifndef PRODUCT
-    st->print("%s", doc );
+    st->print("%s", _doc);
 #endif
   }
   st->cr();
 }
 
+void Flag::print_kind(outputStream* st) {
+  struct Data {
+    int flag;
+    const char* name;
+  };
+
+  Data data[] = {
+      { KIND_C1, "C1" },
+      { KIND_C2, "C2" },
+      { KIND_ARCH, "ARCH" },
+      { KIND_SHARK, "SHARK" },
+      { KIND_PLATFORM_DEPENDENT, "pd" },
+      { KIND_PRODUCT, "product" },
+      { KIND_MANAGEABLE, "manageable" },
+      { KIND_DIAGNOSTIC, "diagnostic" },
+      { KIND_NOT_PRODUCT, "notproduct" },
+      { KIND_DEVELOP, "develop" },
+      { KIND_LP64_PRODUCT, "lp64_product" },
+      { KIND_READ_WRITE, "rw" },
+      { -1, "" }
+  };
+
+  if ((_flags & KIND_MASK) != 0) {
+    st->print("{");
+    bool is_first = true;
+
+    for (int i = 0; data[i].flag != -1; i++) {
+      Data d = data[i];
+      if ((_flags & d.flag) != 0) {
+        if (is_first) {
+          is_first = false;
+        } else {
+          st->print(" ");
+        }
+        st->print(d.name);
+      }
+    }
+
+    st->print("}");
+  }
+}
+
 void Flag::print_as_flag(outputStream* st) {
   if (is_bool()) {
-    st->print("-XX:%s%s", get_bool() ? "+" : "-", name);
+    st->print("-XX:%s%s", get_bool() ? "+" : "-", _name);
   } else if (is_intx()) {
-    st->print("-XX:%s=" INTX_FORMAT, name, get_intx());
+    st->print("-XX:%s=" INTX_FORMAT, _name, get_intx());
   } else if (is_uintx()) {
-    st->print("-XX:%s=" UINTX_FORMAT, name, get_uintx());
+    st->print("-XX:%s=" UINTX_FORMAT, _name, get_uintx());
   } else if (is_uint64_t()) {
-    st->print("-XX:%s=" UINT64_FORMAT, name, get_uint64_t());
+    st->print("-XX:%s=" UINT64_FORMAT, _name, get_uint64_t());
   } else if (is_double()) {
-    st->print("-XX:%s=%f", name, get_double());
+    st->print("-XX:%s=%f", _name, get_double());
   } else if (is_ccstr()) {
-    st->print("-XX:%s=", name);
+    st->print("-XX:%s=", _name);
     const char* cp = get_ccstr();
     if (cp != NULL) {
       // Need to turn embedded '\n's back into separate arguments
@@ -167,7 +373,7 @@
             st->print("%c", *cp);
             break;
           case '\n':
-            st->print(" -XX:%s=", name);
+            st->print(" -XX:%s=", _name);
             break;
         }
       }
@@ -180,79 +386,51 @@
 // 4991491 do not "optimize out" the was_set false values: omitting them
 // tickles a Microsoft compiler bug causing flagTable to be malformed
 
-#define RUNTIME_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{product}", DEFAULT },
-#define RUNTIME_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{pd product}", DEFAULT },
-#define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{diagnostic}", DEFAULT },
-#define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{experimental}", DEFAULT },
-#define RUNTIME_MANAGEABLE_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{manageable}", DEFAULT },
-#define RUNTIME_PRODUCT_RW_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{product rw}", DEFAULT },
+#define NAME(name) NOT_PRODUCT(&name) PRODUCT_ONLY(&CONST_##name)
 
-#ifdef PRODUCT
-  #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
-  #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
-  #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
-#else
-  #define RUNTIME_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "", DEFAULT },
-  #define RUNTIME_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, doc, "{pd}", DEFAULT },
-  #define RUNTIME_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{notproduct}", DEFAULT },
-#endif
+#define RUNTIME_PRODUCT_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT) },
+#define RUNTIME_PD_PRODUCT_FLAG_STRUCT(  type, name,        doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
+#define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_DIAGNOSTIC) },
+#define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_EXPERIMENTAL) },
+#define RUNTIME_MANAGEABLE_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_MANAGEABLE) },
+#define RUNTIME_PRODUCT_RW_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT | Flag::KIND_READ_WRITE) },
+#define RUNTIME_DEVELOP_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_DEVELOP) },
+#define RUNTIME_PD_DEVELOP_FLAG_STRUCT(  type, name,        doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
+#define RUNTIME_NOTPRODUCT_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_NOT_PRODUCT) },
 
 #ifdef _LP64
-  #define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{lp64_product}", DEFAULT },
+#define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_LP64_PRODUCT) },
 #else
-  #define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
+#define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
 #endif // _LP64
 
-#define C1_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C1 product}", DEFAULT },
-#define C1_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C1 pd product}", DEFAULT },
-#define C1_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C1 diagnostic}", DEFAULT },
-#ifdef PRODUCT
-  #define C1_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
-  #define C1_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
-  #define C1_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
-#else
-  #define C1_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C1}", DEFAULT },
-  #define C1_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, doc, "{C1 pd}", DEFAULT },
-  #define C1_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C1 notproduct}", DEFAULT },
-#endif
+#define C1_PRODUCT_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_PRODUCT) },
+#define C1_PD_PRODUCT_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
+#define C1_DIAGNOSTIC_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DIAGNOSTIC) },
+#define C1_DEVELOP_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DEVELOP) },
+#define C1_PD_DEVELOP_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
+#define C1_NOTPRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_NOT_PRODUCT) },
 
-#define C2_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 product}", DEFAULT },
-#define C2_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 pd product}", DEFAULT },
-#define C2_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 diagnostic}", DEFAULT },
-#define C2_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{C2 experimental}", DEFAULT },
-#ifdef PRODUCT
-  #define C2_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
-  #define C2_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
-  #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
-#else
-  #define C2_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C2}", DEFAULT },
-  #define C2_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, doc, "{C2 pd}", DEFAULT },
-  #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{C2 notproduct}", DEFAULT },
-#endif
+#define C2_PRODUCT_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_PRODUCT) },
+#define C2_PD_PRODUCT_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
+#define C2_DIAGNOSTIC_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DIAGNOSTIC) },
+#define C2_EXPERIMENTAL_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_EXPERIMENTAL) },
+#define C2_DEVELOP_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DEVELOP) },
+#define C2_PD_DEVELOP_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
+#define C2_NOTPRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_NOT_PRODUCT) },
 
-#define ARCH_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{ARCH product}", DEFAULT },
-#define ARCH_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{ARCH diagnostic}", DEFAULT },
-#define ARCH_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{ARCH experimental}", DEFAULT },
-#ifdef PRODUCT
-  #define ARCH_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
-  #define ARCH_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
-#else
-  #define ARCH_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{ARCH}", DEFAULT },
-  #define ARCH_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{ARCH notproduct}", DEFAULT },
-#endif
+#define ARCH_PRODUCT_FLAG_STRUCT(        type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_PRODUCT) },
+#define ARCH_DIAGNOSTIC_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_DIAGNOSTIC) },
+#define ARCH_EXPERIMENTAL_FLAG_STRUCT(   type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_EXPERIMENTAL) },
+#define ARCH_DEVELOP_FLAG_STRUCT(        type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_DEVELOP) },
+#define ARCH_NOTPRODUCT_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_ARCH | Flag::KIND_NOT_PRODUCT) },
 
-#define SHARK_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark product}", DEFAULT },
-#define SHARK_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark pd product}", DEFAULT },
-#define SHARK_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) "{Shark diagnostic}", DEFAULT },
-#ifdef PRODUCT
-  #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
-  #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
-  #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
-#else
-  #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{Shark}", DEFAULT },
-  #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, doc, "{Shark pd}", DEFAULT },
-  #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, doc, "{Shark notproduct}", DEFAULT },
-#endif
+#define SHARK_PRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_PRODUCT) },
+#define SHARK_PD_PRODUCT_FLAG_STRUCT(    type, name,        doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
+#define SHARK_DIAGNOSTIC_FLAG_STRUCT(    type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DIAGNOSTIC) },
+#define SHARK_DEVELOP_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DEVELOP) },
+#define SHARK_PD_DEVELOP_FLAG_STRUCT(    type, name,        doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
+#define SHARK_NOTPRODUCT_FLAG_STRUCT(    type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_NOT_PRODUCT) },
 
 static Flag flagTable[] = {
  RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT)
@@ -285,9 +463,14 @@
 
 // Search the flag table for a named flag
 Flag* Flag::find_flag(const char* name, size_t length, bool allow_locked) {
-  for (Flag* current = &flagTable[0]; current->name != NULL; current++) {
-    if (str_equal(current->name, name, length)) {
-      // Found a matching entry.  Report locked flags only if allowed.
+  for (Flag* current = &flagTable[0]; current->_name != NULL; current++) {
+    if (str_equal(current->_name, name, length)) {
+      // Found a matching entry.
+      // Don't report notproduct and develop flags in product builds.
+      if (current->is_constant_in_binary()) {
+        return NULL;
+      }
+      // Report locked flags only if allowed.
       if (!(current->is_unlocked() || current->is_unlocker())) {
         if (!allow_locked) {
           // disable use of locked flags, e.g. diagnostic, experimental,
@@ -327,8 +510,8 @@
   float score;
   float max_score = -1;
 
-  for (Flag* current = &flagTable[0]; current->name != NULL; current++) {
-    score = str_similar(current->name, name, length);
+  for (Flag* current = &flagTable[0]; current->_name != NULL; current++) {
+    score = str_similar(current->_name, name, length);
     if (score > max_score) {
       max_score = score;
       match = current;
@@ -357,25 +540,25 @@
 bool CommandLineFlagsEx::is_default(CommandLineFlag flag) {
   assert((size_t)flag < Flag::numFlags, "bad command line flag index");
   Flag* f = &Flag::flags[flag];
-  return (f->origin == DEFAULT);
+  return f->is_default();
 }
 
 bool CommandLineFlagsEx::is_ergo(CommandLineFlag flag) {
   assert((size_t)flag < Flag::numFlags, "bad command line flag index");
   Flag* f = &Flag::flags[flag];
-  return (f->origin == ERGONOMIC);
+  return f->is_ergonomic();
 }
 
 bool CommandLineFlagsEx::is_cmdline(CommandLineFlag flag) {
   assert((size_t)flag < Flag::numFlags, "bad command line flag index");
   Flag* f = &Flag::flags[flag];
-  return (f->origin == COMMAND_LINE);
+  return f->is_command_line();
 }
 
 bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) {
   Flag* result = Flag::find_flag((char*)name, strlen(name));
   if (result == NULL) return false;
-  *value = (result->origin == COMMAND_LINE);
+  *value = result->is_command_line();
   return true;
 }
 
@@ -387,22 +570,22 @@
   return true;
 }
 
-bool CommandLineFlags::boolAtPut(char* name, size_t len, bool* value, FlagValueOrigin origin) {
+bool CommandLineFlags::boolAtPut(char* name, size_t len, bool* value, Flag::Flags origin) {
   Flag* result = Flag::find_flag(name, len);
   if (result == NULL) return false;
   if (!result->is_bool()) return false;
   bool old_value = result->get_bool();
   result->set_bool(*value);
   *value = old_value;
-  result->origin = origin;
+  result->set_origin(origin);
   return true;
 }
 
-void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, FlagValueOrigin origin) {
+void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin) {
   Flag* faddr = address_of_flag(flag);
   guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type");
   faddr->set_bool(value);
-  faddr->origin = origin;
+  faddr->set_origin(origin);
 }
 
 bool CommandLineFlags::intxAt(char* name, size_t len, intx* value) {
@@ -413,22 +596,22 @@
   return true;
 }
 
-bool CommandLineFlags::intxAtPut(char* name, size_t len, intx* value, FlagValueOrigin origin) {
+bool CommandLineFlags::intxAtPut(char* name, size_t len, intx* value, Flag::Flags origin) {
   Flag* result = Flag::find_flag(name, len);
   if (result == NULL) return false;
   if (!result->is_intx()) return false;
   intx old_value = result->get_intx();
   result->set_intx(*value);
   *value = old_value;
-  result->origin = origin;
+  result->set_origin(origin);
   return true;
 }
 
-void CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, FlagValueOrigin origin) {
+void CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin) {
   Flag* faddr = address_of_flag(flag);
   guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type");
   faddr->set_intx(value);
-  faddr->origin = origin;
+  faddr->set_origin(origin);
 }
 
 bool CommandLineFlags::uintxAt(char* name, size_t len, uintx* value) {
@@ -439,22 +622,22 @@
   return true;
 }
 
-bool CommandLineFlags::uintxAtPut(char* name, size_t len, uintx* value, FlagValueOrigin origin) {
+bool CommandLineFlags::uintxAtPut(char* name, size_t len, uintx* value, Flag::Flags origin) {
   Flag* result = Flag::find_flag(name, len);
   if (result == NULL) return false;
   if (!result->is_uintx()) return false;
   uintx old_value = result->get_uintx();
   result->set_uintx(*value);
   *value = old_value;
-  result->origin = origin;
+  result->set_origin(origin);
   return true;
 }
 
-void CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, FlagValueOrigin origin) {
+void CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin) {
   Flag* faddr = address_of_flag(flag);
   guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type");
   faddr->set_uintx(value);
-  faddr->origin = origin;
+  faddr->set_origin(origin);
 }
 
 bool CommandLineFlags::uint64_tAt(char* name, size_t len, uint64_t* value) {
@@ -465,22 +648,22 @@
   return true;
 }
 
-bool CommandLineFlags::uint64_tAtPut(char* name, size_t len, uint64_t* value, FlagValueOrigin origin) {
+bool CommandLineFlags::uint64_tAtPut(char* name, size_t len, uint64_t* value, Flag::Flags origin) {
   Flag* result = Flag::find_flag(name, len);
   if (result == NULL) return false;
   if (!result->is_uint64_t()) return false;
   uint64_t old_value = result->get_uint64_t();
   result->set_uint64_t(*value);
   *value = old_value;
-  result->origin = origin;
+  result->set_origin(origin);
   return true;
 }
 
-void CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, FlagValueOrigin origin) {
+void CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin) {
   Flag* faddr = address_of_flag(flag);
   guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type");
   faddr->set_uint64_t(value);
-  faddr->origin = origin;
+  faddr->set_origin(origin);
 }
 
 bool CommandLineFlags::doubleAt(char* name, size_t len, double* value) {
@@ -491,22 +674,22 @@
   return true;
 }
 
-bool CommandLineFlags::doubleAtPut(char* name, size_t len, double* value, FlagValueOrigin origin) {
+bool CommandLineFlags::doubleAtPut(char* name, size_t len, double* value, Flag::Flags origin) {
   Flag* result = Flag::find_flag(name, len);
   if (result == NULL) return false;
   if (!result->is_double()) return false;
   double old_value = result->get_double();
   result->set_double(*value);
   *value = old_value;
-  result->origin = origin;
+  result->set_origin(origin);
   return true;
 }
 
-void CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, FlagValueOrigin origin) {
+void CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin) {
   Flag* faddr = address_of_flag(flag);
   guarantee(faddr != NULL && faddr->is_double(), "wrong flag type");
   faddr->set_double(value);
-  faddr->origin = origin;
+  faddr->set_origin(origin);
 }
 
 bool CommandLineFlags::ccstrAt(char* name, size_t len, ccstr* value) {
@@ -519,7 +702,7 @@
 
 // Contract:  Flag will make private copy of the incoming value.
 // Outgoing value is always malloc-ed, and caller MUST call free.
-bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, FlagValueOrigin origin) {
+bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin) {
   Flag* result = Flag::find_flag(name, len);
   if (result == NULL) return false;
   if (!result->is_ccstr()) return false;
@@ -530,35 +713,35 @@
     strcpy(new_value, *value);
   }
   result->set_ccstr(new_value);
-  if (result->origin == DEFAULT && old_value != NULL) {
+  if (result->is_default() && old_value != NULL) {
     // Prior value is NOT heap allocated, but was a literal constant.
     char* old_value_to_free = NEW_C_HEAP_ARRAY(char, strlen(old_value)+1, mtInternal);
     strcpy(old_value_to_free, old_value);
     old_value = old_value_to_free;
   }
   *value = old_value;
-  result->origin = origin;
+  result->set_origin(origin);
   return true;
 }
 
 // Contract:  Flag will make private copy of the incoming value.
-void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, FlagValueOrigin origin) {
+void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin) {
   Flag* faddr = address_of_flag(flag);
   guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type");
   ccstr old_value = faddr->get_ccstr();
   char* new_value = NEW_C_HEAP_ARRAY(char, strlen(value)+1, mtInternal);
   strcpy(new_value, value);
   faddr->set_ccstr(new_value);
-  if (faddr->origin != DEFAULT && old_value != NULL) {
+  if (!faddr->is_default() && old_value != NULL) {
     // Prior value is heap allocated so free it.
     FREE_C_HEAP_ARRAY(char, old_value, mtInternal);
   }
-  faddr->origin = origin;
+  faddr->set_origin(origin);
 }
 
 extern "C" {
   static int compare_flags(const void* void_a, const void* void_b) {
-    return strcmp((*((Flag**) void_a))->name, (*((Flag**) void_b))->name);
+    return strcmp((*((Flag**) void_a))->_name, (*((Flag**) void_b))->_name);
   }
 }
 
@@ -567,20 +750,19 @@
   // note: this method is called before the thread structure is in place
   //       which means resource allocation cannot be used.
 
-  // Compute size
-  int length= 0;
-  while (flagTable[length].name != NULL) length++;
+  // The last entry is the null entry.
+  const size_t length = Flag::numFlags - 1;
 
   // Sort
   Flag** array = NEW_C_HEAP_ARRAY(Flag*, length, mtInternal);
-  for (int index = 0; index < length; index++) {
-    array[index] = &flagTable[index];
+  for (size_t i = 0; i < length; i++) {
+    array[i] = &flagTable[i];
   }
   qsort(array, length, sizeof(Flag*), compare_flags);
 
   // Print
-  for (int i = 0; i < length; i++) {
-    if (array[i]->origin /* naked field! */) {
+  for (size_t i = 0; i < length; i++) {
+    if (array[i]->get_origin() /* naked field! */) {
       array[i]->print_as_flag(out);
       out->print(" ");
     }
@@ -603,20 +785,19 @@
   // note: this method is called before the thread structure is in place
   //       which means resource allocation cannot be used.
 
-  // Compute size
-  int length= 0;
-  while (flagTable[length].name != NULL) length++;
+  // The last entry is the null entry.
+  const size_t length = Flag::numFlags - 1;
 
   // Sort
   Flag** array = NEW_C_HEAP_ARRAY(Flag*, length, mtInternal);
-  for (int index = 0; index < length; index++) {
-    array[index] = &flagTable[index];
+  for (size_t i = 0; i < length; i++) {
+    array[i] = &flagTable[i];
   }
   qsort(array, length, sizeof(Flag*), compare_flags);
 
   // Print
   out->print_cr("[Global flags]");
-  for (int i = 0; i < length; i++) {
+  for (size_t i = 0; i < length; i++) {
     if (array[i]->is_unlocked()) {
       array[i]->print_on(out, withComments);
     }
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -194,29 +194,49 @@
 typedef const char* ccstr;
 typedef const char* ccstrlist;   // represents string arguments which accumulate
 
-enum FlagValueOrigin {
-  DEFAULT          = 0,
-  COMMAND_LINE     = 1,
-  ENVIRON_VAR      = 2,
-  CONFIG_FILE      = 3,
-  MANAGEMENT       = 4,
-  ERGONOMIC        = 5,
-  ATTACH_ON_DEMAND = 6,
-  INTERNAL         = 99
-};
+struct Flag {
+  enum Flags {
+    // value origin
+    DEFAULT          = 0,
+    COMMAND_LINE     = 1,
+    ENVIRON_VAR      = 2,
+    CONFIG_FILE      = 3,
+    MANAGEMENT       = 4,
+    ERGONOMIC        = 5,
+    ATTACH_ON_DEMAND = 6,
+    INTERNAL         = 7,
+
+    LAST_VALUE_ORIGIN = INTERNAL,
+    VALUE_ORIGIN_BITS = 4,
+    VALUE_ORIGIN_MASK = right_n_bits(VALUE_ORIGIN_BITS),
 
-struct Flag {
-  const char *type;
-  const char *name;
-  void*       addr;
+    // flag kind
+    KIND_PRODUCT            = 1 << 4,
+    KIND_MANAGEABLE         = 1 << 5,
+    KIND_DIAGNOSTIC         = 1 << 6,
+    KIND_EXPERIMENTAL       = 1 << 7,
+    KIND_NOT_PRODUCT        = 1 << 8,
+    KIND_DEVELOP            = 1 << 9,
+    KIND_PLATFORM_DEPENDENT = 1 << 10,
+    KIND_READ_WRITE         = 1 << 11,
+    KIND_C1                 = 1 << 12,
+    KIND_C2                 = 1 << 13,
+    KIND_ARCH               = 1 << 14,
+    KIND_SHARK              = 1 << 15,
+    KIND_LP64_PRODUCT       = 1 << 16,
+    KIND_COMMERCIAL         = 1 << 17,
 
-  NOT_PRODUCT(const char *doc;)
+    KIND_MASK = ~VALUE_ORIGIN_MASK
+  };
 
-  const char *kind;
-  FlagValueOrigin origin;
+  const char* _type;
+  const char* _name;
+  void* _addr;
+  NOT_PRODUCT(const char* _doc;)
+  Flags _flags;
 
   // points to all Flags static array
-  static Flag *flags;
+  static Flag* flags;
 
   // number of flags
   static size_t numFlags;
@@ -224,30 +244,50 @@
   static Flag* find_flag(const char* name, size_t length, bool allow_locked = false);
   static Flag* fuzzy_match(const char* name, size_t length, bool allow_locked = false);
 
-  bool is_bool() const        { return strcmp(type, "bool") == 0; }
-  bool get_bool() const       { return *((bool*) addr); }
-  void set_bool(bool value)   { *((bool*) addr) = value; }
+  void check_writable();
+
+  bool is_bool() const;
+  bool get_bool() const;
+  void set_bool(bool value);
+
+  bool is_intx() const;
+  intx get_intx() const;
+  void set_intx(intx value);
 
-  bool is_intx()  const       { return strcmp(type, "intx")  == 0; }
-  intx get_intx() const       { return *((intx*) addr); }
-  void set_intx(intx value)   { *((intx*) addr) = value; }
+  bool is_uintx() const;
+  uintx get_uintx() const;
+  void set_uintx(uintx value);
 
-  bool is_uintx() const       { return strcmp(type, "uintx") == 0; }
-  uintx get_uintx() const     { return *((uintx*) addr); }
-  void set_uintx(uintx value) { *((uintx*) addr) = value; }
+  bool is_uint64_t() const;
+  uint64_t get_uint64_t() const;
+  void set_uint64_t(uint64_t value);
+
+  bool is_double() const;
+  double get_double() const;
+  void set_double(double value);
 
-  bool is_uint64_t() const          { return strcmp(type, "uint64_t") == 0; }
-  uint64_t get_uint64_t() const     { return *((uint64_t*) addr); }
-  void set_uint64_t(uint64_t value) { *((uint64_t*) addr) = value; }
+  bool is_ccstr() const;
+  bool ccstr_accumulates() const;
+  ccstr get_ccstr() const;
+  void set_ccstr(ccstr value);
+
+  Flags get_origin();
+  void set_origin(Flags origin);
 
-  bool is_double() const        { return strcmp(type, "double") == 0; }
-  double get_double() const     { return *((double*) addr); }
-  void set_double(double value) { *((double*) addr) = value; }
+  bool is_default();
+  bool is_ergonomic();
+  bool is_command_line();
 
-  bool is_ccstr() const          { return strcmp(type, "ccstr") == 0 || strcmp(type, "ccstrlist") == 0; }
-  bool ccstr_accumulates() const { return strcmp(type, "ccstrlist") == 0; }
-  ccstr get_ccstr() const     { return *((ccstr*) addr); }
-  void set_ccstr(ccstr value) { *((ccstr*) addr) = value; }
+  bool is_product() const;
+  bool is_manageable() const;
+  bool is_diagnostic() const;
+  bool is_experimental() const;
+  bool is_notproduct() const;
+  bool is_develop() const;
+  bool is_read_write() const;
+  bool is_commercial() const;
+
+  bool is_constant_in_binary() const;
 
   bool is_unlocker() const;
   bool is_unlocked() const;
@@ -263,6 +303,7 @@
   void get_locked_message_ext(char*, int) const;
 
   void print_on(outputStream* st, bool withComments = false );
+  void print_kind(outputStream* st);
   void print_as_flag(outputStream* st);
 };
 
@@ -310,33 +351,33 @@
  public:
   static bool boolAt(char* name, size_t len, bool* value);
   static bool boolAt(char* name, bool* value)      { return boolAt(name, strlen(name), value); }
-  static bool boolAtPut(char* name, size_t len, bool* value, FlagValueOrigin origin);
-  static bool boolAtPut(char* name, bool* value, FlagValueOrigin origin)   { return boolAtPut(name, strlen(name), value, origin); }
+  static bool boolAtPut(char* name, size_t len, bool* value, Flag::Flags origin);
+  static bool boolAtPut(char* name, bool* value, Flag::Flags origin)   { return boolAtPut(name, strlen(name), value, origin); }
 
   static bool intxAt(char* name, size_t len, intx* value);
   static bool intxAt(char* name, intx* value)      { return intxAt(name, strlen(name), value); }
-  static bool intxAtPut(char* name, size_t len, intx* value, FlagValueOrigin origin);
-  static bool intxAtPut(char* name, intx* value, FlagValueOrigin origin)   { return intxAtPut(name, strlen(name), value, origin); }
+  static bool intxAtPut(char* name, size_t len, intx* value, Flag::Flags origin);
+  static bool intxAtPut(char* name, intx* value, Flag::Flags origin)   { return intxAtPut(name, strlen(name), value, origin); }
 
   static bool uintxAt(char* name, size_t len, uintx* value);
   static bool uintxAt(char* name, uintx* value)    { return uintxAt(name, strlen(name), value); }
-  static bool uintxAtPut(char* name, size_t len, uintx* value, FlagValueOrigin origin);
-  static bool uintxAtPut(char* name, uintx* value, FlagValueOrigin origin) { return uintxAtPut(name, strlen(name), value, origin); }
+  static bool uintxAtPut(char* name, size_t len, uintx* value, Flag::Flags origin);
+  static bool uintxAtPut(char* name, uintx* value, Flag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); }
 
   static bool uint64_tAt(char* name, size_t len, uint64_t* value);
   static bool uint64_tAt(char* name, uint64_t* value) { return uint64_tAt(name, strlen(name), value); }
-  static bool uint64_tAtPut(char* name, size_t len, uint64_t* value, FlagValueOrigin origin);
-  static bool uint64_tAtPut(char* name, uint64_t* value, FlagValueOrigin origin) { return uint64_tAtPut(name, strlen(name), value, origin); }
+  static bool uint64_tAtPut(char* name, size_t len, uint64_t* value, Flag::Flags origin);
+  static bool uint64_tAtPut(char* name, uint64_t* value, Flag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); }
 
   static bool doubleAt(char* name, size_t len, double* value);
   static bool doubleAt(char* name, double* value)    { return doubleAt(name, strlen(name), value); }
-  static bool doubleAtPut(char* name, size_t len, double* value, FlagValueOrigin origin);
-  static bool doubleAtPut(char* name, double* value, FlagValueOrigin origin) { return doubleAtPut(name, strlen(name), value, origin); }
+  static bool doubleAtPut(char* name, size_t len, double* value, Flag::Flags origin);
+  static bool doubleAtPut(char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); }
 
   static bool ccstrAt(char* name, size_t len, ccstr* value);
   static bool ccstrAt(char* name, ccstr* value)    { return ccstrAt(name, strlen(name), value); }
-  static bool ccstrAtPut(char* name, size_t len, ccstr* value, FlagValueOrigin origin);
-  static bool ccstrAtPut(char* name, ccstr* value, FlagValueOrigin origin) { return ccstrAtPut(name, strlen(name), value, origin); }
+  static bool ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin);
+  static bool ccstrAtPut(char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); }
 
   // Returns false if name is not a command line flag.
   static bool wasSetOnCmdline(const char* name, bool* value);
@@ -2526,6 +2567,9 @@
   product(bool, PrintStringTableStatistics, false,                          \
           "print statistics about the StringTable and SymbolTable")         \
                                                                             \
+  diagnostic(bool, VerifyStringTableAtExit, false,                          \
+          "verify StringTable contents at exit")                            \
+                                                                            \
   notproduct(bool, PrintSymbolTableSizeHistogram, false,                    \
           "print histogram of the symbol table")                            \
                                                                             \
@@ -2827,6 +2871,10 @@
   product(intx, NmethodSweepCheckInterval, 5,                               \
           "Compilers wake up every n seconds to possibly sweep nmethods")   \
                                                                             \
+  product(intx, NmethodSweepActivity, 10,                                   \
+          "Removes cold nmethods from code cache if > 0. Higher values "    \
+          "result in more aggressive sweeping")                             \
+                                                                            \
   notproduct(bool, LogSweeper, false,                                       \
             "Keep a ring buffer of sweeper activity")                       \
                                                                             \
@@ -3198,15 +3246,6 @@
   product(bool, UseCodeCacheFlushing, true,                                 \
           "Attempt to clean the code cache before shutting off compiler")   \
                                                                             \
-  product(intx,  MinCodeCacheFlushingInterval, 30,                          \
-          "Min number of seconds between code cache cleaning sessions")     \
-                                                                            \
-  product(uintx,  CodeCacheFlushingMinimumFreeSpace, 1500*K,                \
-          "When less than X space left, start code cache cleaning")         \
-                                                                            \
-  product(uintx, CodeCacheFlushingFraction, 2,                              \
-          "Fraction of the code cache that is flushed when full")           \
-                                                                            \
   /* interpreter debugging */                                               \
   develop(intx, BinarySwitchThreshold, 5,                                   \
           "Minimal number of lookupswitch entries for rewriting to binary " \
@@ -3727,20 +3766,20 @@
  */
 
 // Interface macros
-#define DECLARE_PRODUCT_FLAG(type, name, value, doc)    extern "C" type name;
-#define DECLARE_PD_PRODUCT_FLAG(type, name, doc)        extern "C" type name;
-#define DECLARE_DIAGNOSTIC_FLAG(type, name, value, doc) extern "C" type name;
+#define DECLARE_PRODUCT_FLAG(type, name, value, doc)      extern "C" type name;
+#define DECLARE_PD_PRODUCT_FLAG(type, name, doc)          extern "C" type name;
+#define DECLARE_DIAGNOSTIC_FLAG(type, name, value, doc)   extern "C" type name;
 #define DECLARE_EXPERIMENTAL_FLAG(type, name, value, doc) extern "C" type name;
-#define DECLARE_MANAGEABLE_FLAG(type, name, value, doc) extern "C" type name;
-#define DECLARE_PRODUCT_RW_FLAG(type, name, value, doc) extern "C" type name;
+#define DECLARE_MANAGEABLE_FLAG(type, name, value, doc)   extern "C" type name;
+#define DECLARE_PRODUCT_RW_FLAG(type, name, value, doc)   extern "C" type name;
 #ifdef PRODUCT
-#define DECLARE_DEVELOPER_FLAG(type, name, value, doc)  const type name = value;
-#define DECLARE_PD_DEVELOPER_FLAG(type, name, doc)      const type name = pd_##name;
-#define DECLARE_NOTPRODUCT_FLAG(type, name, value, doc)
+#define DECLARE_DEVELOPER_FLAG(type, name, value, doc)    extern "C" type CONST_##name; const type name = value;
+#define DECLARE_PD_DEVELOPER_FLAG(type, name, doc)        extern "C" type CONST_##name; const type name = pd_##name;
+#define DECLARE_NOTPRODUCT_FLAG(type, name, value, doc)   extern "C" type CONST_##name;
 #else
-#define DECLARE_DEVELOPER_FLAG(type, name, value, doc)  extern "C" type name;
-#define DECLARE_PD_DEVELOPER_FLAG(type, name, doc)      extern "C" type name;
-#define DECLARE_NOTPRODUCT_FLAG(type, name, value, doc)  extern "C" type name;
+#define DECLARE_DEVELOPER_FLAG(type, name, value, doc)    extern "C" type name;
+#define DECLARE_PD_DEVELOPER_FLAG(type, name, doc)        extern "C" type name;
+#define DECLARE_NOTPRODUCT_FLAG(type, name, value, doc)   extern "C" type name;
 #endif
 // Special LP64 flags, product only needed for now.
 #ifdef _LP64
@@ -3750,23 +3789,23 @@
 #endif // _LP64
 
 // Implementation macros
-#define MATERIALIZE_PRODUCT_FLAG(type, name, value, doc)   type name = value;
-#define MATERIALIZE_PD_PRODUCT_FLAG(type, name, doc)       type name = pd_##name;
-#define MATERIALIZE_DIAGNOSTIC_FLAG(type, name, value, doc) type name = value;
+#define MATERIALIZE_PRODUCT_FLAG(type, name, value, doc)      type name = value;
+#define MATERIALIZE_PD_PRODUCT_FLAG(type, name, doc)          type name = pd_##name;
+#define MATERIALIZE_DIAGNOSTIC_FLAG(type, name, value, doc)   type name = value;
 #define MATERIALIZE_EXPERIMENTAL_FLAG(type, name, value, doc) type name = value;
-#define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc) type name = value;
-#define MATERIALIZE_PRODUCT_RW_FLAG(type, name, value, doc) type name = value;
+#define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc)   type name = value;
+#define MATERIALIZE_PRODUCT_RW_FLAG(type, name, value, doc)   type name = value;
 #ifdef PRODUCT
-#define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc) /* flag name is constant */
-#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc)     /* flag name is constant */
-#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc)
+#define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc)    type CONST_##name = value;
+#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc)        type CONST_##name = pd_##name;
+#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc)   type CONST_##name = value;
 #else
-#define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc) type name = value;
-#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc)     type name = pd_##name;
-#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc) type name = value;
+#define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc)    type name = value;
+#define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc)        type name = pd_##name;
+#define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc)   type name = value;
 #endif
 #ifdef _LP64
-#define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc)   type name = value;
+#define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) type name = value;
 #else
 #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) /* flag is constant */
 #endif // _LP64
--- a/hotspot/src/share/vm/runtime/globals_extension.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/globals_extension.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -34,64 +34,42 @@
 // Parens left off in the following for the enum decl below.
 #define FLAG_MEMBER(flag) Flag_##flag
 
-#define RUNTIME_PRODUCT_FLAG_MEMBER(type, name, value, doc)    FLAG_MEMBER(name),
-#define RUNTIME_PD_PRODUCT_FLAG_MEMBER(type, name, doc)        FLAG_MEMBER(name),
-#define RUNTIME_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
+#define RUNTIME_PRODUCT_FLAG_MEMBER(type, name, value, doc)      FLAG_MEMBER(name),
+#define RUNTIME_PD_PRODUCT_FLAG_MEMBER(type, name, doc)          FLAG_MEMBER(name),
+#define RUNTIME_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc)   FLAG_MEMBER(name),
 #define RUNTIME_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
-#define RUNTIME_MANAGEABLE_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
-#define RUNTIME_PRODUCT_RW_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
-#ifdef PRODUCT
-  #define RUNTIME_DEVELOP_FLAG_MEMBER(type, name, value, doc)  /* flag is constant */
-  #define RUNTIME_PD_DEVELOP_FLAG_MEMBER(type, name, doc)      /* flag is constant */
-  #define RUNTIME_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)
+#define RUNTIME_MANAGEABLE_FLAG_MEMBER(type, name, value, doc)   FLAG_MEMBER(name),
+#define RUNTIME_PRODUCT_RW_FLAG_MEMBER(type, name, value, doc)   FLAG_MEMBER(name),
+#define RUNTIME_DEVELOP_FLAG_MEMBER(type, name, value, doc)      FLAG_MEMBER(name),
+#define RUNTIME_PD_DEVELOP_FLAG_MEMBER(type, name, doc)          FLAG_MEMBER(name),
+#define RUNTIME_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)   FLAG_MEMBER(name),
+
+#ifdef _LP64
+#define RUNTIME_LP64_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
 #else
-  #define RUNTIME_DEVELOP_FLAG_MEMBER(type, name, value, doc)  FLAG_MEMBER(name),
-  #define RUNTIME_PD_DEVELOP_FLAG_MEMBER(type, name, doc)      FLAG_MEMBER(name),
-  #define RUNTIME_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
-#endif
-#ifdef _LP64
-#define RUNTIME_LP64_PRODUCT_FLAG_MEMBER(type, name, value, doc)    FLAG_MEMBER(name),
-#else
-#define RUNTIME_LP64_PRODUCT_FLAG_MEMBER(type, name, value, doc)    /* flag is constant */
+#define RUNTIME_LP64_PRODUCT_FLAG_MEMBER(type, name, value, doc) /* flag is constant */
 #endif // _LP64
 
-#define C1_PRODUCT_FLAG_MEMBER(type, name, value, doc)         FLAG_MEMBER(name),
-#define C1_PD_PRODUCT_FLAG_MEMBER(type, name, doc)             FLAG_MEMBER(name),
-#define C1_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc)      FLAG_MEMBER(name),
-#ifdef PRODUCT
-  #define C1_DEVELOP_FLAG_MEMBER(type, name, value, doc)       /* flag is constant */
-  #define C1_PD_DEVELOP_FLAG_MEMBER(type, name, doc)           /* flag is constant */
-  #define C1_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)
-#else
-  #define C1_DEVELOP_FLAG_MEMBER(type, name, value, doc)       FLAG_MEMBER(name),
-  #define C1_PD_DEVELOP_FLAG_MEMBER(type, name, doc)           FLAG_MEMBER(name),
-  #define C1_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)    FLAG_MEMBER(name),
-#endif
+#define C1_PRODUCT_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
+#define C1_PD_PRODUCT_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
+#define C1_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc)        FLAG_MEMBER(name),
+#define C1_DEVELOP_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
+#define C1_PD_DEVELOP_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
+#define C1_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)        FLAG_MEMBER(name),
 
-#define C2_PRODUCT_FLAG_MEMBER(type, name, value, doc)         FLAG_MEMBER(name),
-#define C2_PD_PRODUCT_FLAG_MEMBER(type, name, doc)             FLAG_MEMBER(name),
-#define C2_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc)      FLAG_MEMBER(name),
-#define C2_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc)    FLAG_MEMBER(name),
-#ifdef PRODUCT
-  #define C2_DEVELOP_FLAG_MEMBER(type, name, value, doc)       /* flag is constant */
-  #define C2_PD_DEVELOP_FLAG_MEMBER(type, name, doc)           /* flag is constant */
-  #define C2_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)
-#else
-  #define C2_DEVELOP_FLAG_MEMBER(type, name, value, doc)       FLAG_MEMBER(name),
-  #define C2_PD_DEVELOP_FLAG_MEMBER(type, name, doc)           FLAG_MEMBER(name),
-  #define C2_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)    FLAG_MEMBER(name),
-#endif
+#define C2_PRODUCT_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
+#define C2_PD_PRODUCT_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
+#define C2_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc)        FLAG_MEMBER(name),
+#define C2_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc)      FLAG_MEMBER(name),
+#define C2_DEVELOP_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
+#define C2_PD_DEVELOP_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
+#define C2_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)        FLAG_MEMBER(name),
 
 #define ARCH_PRODUCT_FLAG_MEMBER(type, name, value, doc)         FLAG_MEMBER(name),
 #define ARCH_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc)      FLAG_MEMBER(name),
 #define ARCH_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc)    FLAG_MEMBER(name),
-#ifdef PRODUCT
-  #define ARCH_DEVELOP_FLAG_MEMBER(type, name, value, doc)       /* flag is constant */
-  #define ARCH_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)
-#else
-  #define ARCH_DEVELOP_FLAG_MEMBER(type, name, value, doc)       FLAG_MEMBER(name),
-  #define ARCH_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)    FLAG_MEMBER(name),
-#endif
+#define ARCH_DEVELOP_FLAG_MEMBER(type, name, value, doc)         FLAG_MEMBER(name),
+#define ARCH_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)      FLAG_MEMBER(name),
 
 typedef enum {
  RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_EXPERIMENTAL_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER, RUNTIME_LP64_PRODUCT_FLAG_MEMBER)
@@ -114,64 +92,42 @@
 
 #define FLAG_MEMBER_WITH_TYPE(flag,type) Flag_##flag##_##type
 
-#define RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)    FLAG_MEMBER_WITH_TYPE(name,type),
-#define RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc)        FLAG_MEMBER_WITH_TYPE(name,type),
-#define RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
+#define RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)      FLAG_MEMBER_WITH_TYPE(name,type),
+#define RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc)          FLAG_MEMBER_WITH_TYPE(name,type),
+#define RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)   FLAG_MEMBER_WITH_TYPE(name,type),
 #define RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
-#define RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
-#define RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
-#ifdef PRODUCT
-  #define RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)     /* flag is constant */
-  #define RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)         /* flag is constant */
-  #define RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)
-#else
-  #define RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)     FLAG_MEMBER_WITH_TYPE(name,type),
-  #define RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)         FLAG_MEMBER_WITH_TYPE(name,type),
-  #define RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)  FLAG_MEMBER_WITH_TYPE(name,type),
-#endif
+#define RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)   FLAG_MEMBER_WITH_TYPE(name,type),
+#define RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)   FLAG_MEMBER_WITH_TYPE(name,type),
+#define RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)      FLAG_MEMBER_WITH_TYPE(name,type),
+#define RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)          FLAG_MEMBER_WITH_TYPE(name,type),
+#define RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)   FLAG_MEMBER_WITH_TYPE(name,type),
 
-#define C1_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)         FLAG_MEMBER_WITH_TYPE(name,type),
-#define C1_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc)             FLAG_MEMBER_WITH_TYPE(name,type),
-#define C1_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)      FLAG_MEMBER_WITH_TYPE(name,type),
-#ifdef PRODUCT
-  #define C1_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)       /* flag is constant */
-  #define C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)           /* flag is constant */
-  #define C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)
+#define C1_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
+#define C1_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
+#define C1_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)        FLAG_MEMBER_WITH_TYPE(name,type),
+#define C1_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
+#define C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
+#define C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)        FLAG_MEMBER_WITH_TYPE(name,type),
+
+#ifdef _LP64
+#define RUNTIME_LP64_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
 #else
-  #define C1_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)       FLAG_MEMBER_WITH_TYPE(name,type),
-  #define C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
-  #define C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)    FLAG_MEMBER_WITH_TYPE(name,type),
-#endif
-#ifdef _LP64
-#define RUNTIME_LP64_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)    FLAG_MEMBER_WITH_TYPE(name,type),
-#else
-#define RUNTIME_LP64_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)    /* flag is constant */
+#define RUNTIME_LP64_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) /* flag is constant */
 #endif // _LP64
 
-#define C2_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)         FLAG_MEMBER_WITH_TYPE(name,type),
-#define C2_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc)             FLAG_MEMBER_WITH_TYPE(name,type),
-#define C2_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)      FLAG_MEMBER_WITH_TYPE(name,type),
+#define C2_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
+#define C2_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
+#define C2_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)        FLAG_MEMBER_WITH_TYPE(name,type),
 #define C2_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)      FLAG_MEMBER_WITH_TYPE(name,type),
-#ifdef PRODUCT
-  #define C2_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)       /* flag is constant */
-  #define C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)           /* flag is constant */
-  #define C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)
-#else
-  #define C2_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)       FLAG_MEMBER_WITH_TYPE(name,type),
-  #define C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
-  #define C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)    FLAG_MEMBER_WITH_TYPE(name,type),
-#endif
+#define C2_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
+#define C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
+#define C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)        FLAG_MEMBER_WITH_TYPE(name,type),
 
 #define ARCH_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)         FLAG_MEMBER_WITH_TYPE(name,type),
 #define ARCH_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)      FLAG_MEMBER_WITH_TYPE(name,type),
-#define ARCH_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)      FLAG_MEMBER_WITH_TYPE(name,type),
-#ifdef PRODUCT
-  #define ARCH_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)       /* flag is constant */
-  #define ARCH_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)
-#else
-  #define ARCH_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)       FLAG_MEMBER_WITH_TYPE(name,type),
-  #define ARCH_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)    FLAG_MEMBER_WITH_TYPE(name,type),
-#endif
+#define ARCH_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)    FLAG_MEMBER_WITH_TYPE(name,type),
+#define ARCH_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)         FLAG_MEMBER_WITH_TYPE(name,type),
+#define ARCH_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)      FLAG_MEMBER_WITH_TYPE(name,type),
 
 typedef enum {
  RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE,
@@ -233,19 +189,19 @@
 
 #define FLAG_SET_DEFAULT(name, value) ((name) = (value))
 
-#define FLAG_SET_CMDLINE(type, name, value) (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), COMMAND_LINE))
-#define FLAG_SET_ERGO(type, name, value)    (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), ERGONOMIC))
+#define FLAG_SET_CMDLINE(type, name, value) (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), Flag::COMMAND_LINE))
+#define FLAG_SET_ERGO(type, name, value)    (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), Flag::ERGONOMIC))
 
 // Can't put the following in CommandLineFlags because
 // of a circular dependency on the enum definition.
 class CommandLineFlagsEx : CommandLineFlags {
  public:
-  static void boolAtPut(CommandLineFlagWithType flag, bool value, FlagValueOrigin origin);
-  static void intxAtPut(CommandLineFlagWithType flag, intx value, FlagValueOrigin origin);
-  static void uintxAtPut(CommandLineFlagWithType flag, uintx value, FlagValueOrigin origin);
-  static void uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, FlagValueOrigin origin);
-  static void doubleAtPut(CommandLineFlagWithType flag, double value, FlagValueOrigin origin);
-  static void ccstrAtPut(CommandLineFlagWithType flag, ccstr value, FlagValueOrigin origin);
+  static void boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin);
+  static void intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin);
+  static void uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin);
+  static void uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin);
+  static void doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin);
+  static void ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin);
 
   static bool is_default(CommandLineFlag flag);
   static bool is_ergo(CommandLineFlag flag);
--- a/hotspot/src/share/vm/runtime/handles.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/handles.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -136,7 +136,7 @@
 // Specific Handles for different oop types
 #define DEF_METADATA_HANDLE(name, type)          \
   class name##Handle;                            \
-  class name##Handle {                           \
+  class name##Handle : public StackObj {         \
     type*     _value;                            \
     Thread*   _thread;                           \
    protected:                                    \
@@ -175,7 +175,7 @@
 // Writing this class explicitly, since DEF_METADATA_HANDLE(klass) doesn't
 // provide the necessary Klass* <-> Klass* conversions. This Klass
 // could be removed when we don't have the Klass* typedef anymore.
-class KlassHandle {
+class KlassHandle : public StackObj {
   Klass* _value;
  protected:
    Klass* obj() const          { return _value; }
--- a/hotspot/src/share/vm/runtime/handles.inline.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/handles.inline.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -79,6 +79,7 @@
     } else {                                                           \
       _thread = Thread::current();                                     \
     }                                                                  \
+    assert (_thread->is_in_stack((address)this), "not on stack?");     \
     _thread->metadata_handles()->push((Metadata*)_value);              \
   } else {                                                             \
     _thread = NULL;                                                    \
@@ -95,6 +96,7 @@
     } else {                                                           \
       _thread = Thread::current();                                     \
     }                                                                  \
+    assert (_thread->is_in_stack((address)this), "not on stack?");     \
     _thread->metadata_handles()->push((Metadata*)_value);              \
   } else {                                                             \
     _thread = NULL;                                                    \
--- a/hotspot/src/share/vm/runtime/java.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/java.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -544,6 +544,19 @@
   // it will run into trouble when system destroys static variables.
   MemTracker::shutdown(MemTracker::NMT_normal);
 
+  if (VerifyStringTableAtExit) {
+    int fail_cnt = 0;
+    {
+      MutexLocker ml(StringTable_lock);
+      fail_cnt = StringTable::verify_and_compare_entries();
+    }
+
+    if (fail_cnt != 0) {
+      tty->print_cr("ERROR: fail_cnt=%d", fail_cnt);
+      guarantee(fail_cnt == 0, "unexpected StringTable verification failures");
+    }
+  }
+
   #undef BEFORE_EXIT_NOT_RUN
   #undef BEFORE_EXIT_RUNNING
   #undef BEFORE_EXIT_DONE
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -430,7 +430,7 @@
   for(int i = 0; i < _size; i++) {
     if (_is_oop[i]) {
       // Handle conversion
-      _value[i] = (intptr_t)Handle::raw_resolve((oop *)_value[i]);
+      _value[i] = cast_from_oop<intptr_t>(Handle::raw_resolve((oop *)_value[i]));
     }
   }
   // Return argument vector
--- a/hotspot/src/share/vm/runtime/safepoint.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -519,8 +519,8 @@
   }
 
   {
-    TraceTime t4("sweeping nmethods", TraceSafepointCleanupTime);
-    NMethodSweeper::scan_stacks();
+    TraceTime t4("mark nmethods", TraceSafepointCleanupTime);
+    NMethodSweeper::mark_active_nmethods();
   }
 
   if (SymbolTable::needs_rehashing()) {
@@ -745,14 +745,14 @@
 #endif
 
 static void print_ptrs(intptr_t oldptr, intptr_t newptr, bool wasoop) {
-  bool is_oop = newptr ? ((oop)newptr)->is_oop() : false;
+  bool is_oop = newptr ? (cast_to_oop(newptr))->is_oop() : false;
   tty->print_cr(PTR_FORMAT PTR_PAD " %s %c " PTR_FORMAT PTR_PAD " %s %s",
                 oldptr, wasoop?"oop":"   ", oldptr == newptr ? ' ' : '!',
                 newptr, is_oop?"oop":"   ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":"     "));
 }
 
 static void print_longs(jlong oldptr, jlong newptr, bool wasoop) {
-  bool is_oop = newptr ? ((oop)(intptr_t)newptr)->is_oop() : false;
+  bool is_oop = newptr ? (cast_to_oop(newptr))->is_oop() : false;
   tty->print_cr(PTR64_FORMAT " %s %c " PTR64_FORMAT " %s %s",
                 oldptr, wasoop?"oop":"   ", oldptr == newptr ? ' ' : '!',
                 newptr, is_oop?"oop":"   ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":"     "));
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -577,7 +577,7 @@
   assert(caller.is_interpreted_frame(), "");
   int args_size = ArgumentSizeComputer(sig).size() + 1;
   assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack");
-  oop result = (oop) *caller.interpreter_frame_tos_at(args_size - 1);
+  oop result = cast_to_oop(*caller.interpreter_frame_tos_at(args_size - 1));
   assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop");
   return result;
 }
@@ -1506,8 +1506,11 @@
                                                 info, CHECK_(methodHandle()));
         inline_cache->set_to_monomorphic(info);
       } else if (!inline_cache->is_megamorphic() && !inline_cache->is_clean()) {
-        // Change to megamorphic
-        inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle()));
+        // Potential change to megamorphic
+        bool successful = inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle()));
+        if (!successful) {
+          inline_cache->set_to_clean();
+        }
       } else {
         // Either clean or megamorphic
       }
@@ -2872,7 +2875,7 @@
         ObjectSynchronizer::inflate_helper(kptr2->obj());
       // Now the displaced header is free to move
       buf[i++] = (intptr_t)lock->displaced_header();
-      buf[i++] = (intptr_t)kptr2->obj();
+      buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
     }
   }
   assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" );
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -127,64 +127,79 @@
 #define SWEEP(nm)
 #endif
 
+nmethod*  NMethodSweeper::_current         = NULL; // Current nmethod
+long      NMethodSweeper::_traversals      = 0;    // Nof. stack traversals performed
+int       NMethodSweeper::_seen            = 0;    // Nof. nmethods we have currently processed in current pass of CodeCache
+int       NMethodSweeper::_flushed_count   = 0;    // Nof. nmethods flushed in current sweep
+int       NMethodSweeper::_zombified_count = 0;    // Nof. nmethods made zombie in current sweep
+int       NMethodSweeper::_marked_count    = 0;    // Nof. nmethods marked for reclaim in current sweep
 
-long      NMethodSweeper::_traversals = 0;   // No. of stack traversals performed
-nmethod*  NMethodSweeper::_current = NULL;   // Current nmethod
-int       NMethodSweeper::_seen = 0 ;        // No. of nmethods we have currently processed in current pass of CodeCache
-int       NMethodSweeper::_flushed_count = 0;   // Nof. nmethods flushed in current sweep
-int       NMethodSweeper::_zombified_count = 0; // Nof. nmethods made zombie in current sweep
-int       NMethodSweeper::_marked_count = 0;    // Nof. nmethods marked for reclaim in current sweep
-
-volatile int NMethodSweeper::_invocations = 0;   // No. of invocations left until we are completed with this pass
+volatile int NMethodSweeper::_invocations   = 0; // Nof. invocations left until we are completed with this pass
 volatile int NMethodSweeper::_sweep_started = 0; // Whether a sweep is in progress.
 
-jint      NMethodSweeper::_locked_seen = 0;
+jint      NMethodSweeper::_locked_seen               = 0;
 jint      NMethodSweeper::_not_entrant_seen_on_stack = 0;
-bool      NMethodSweeper::_resweep = false;
-jint      NMethodSweeper::_flush_token = 0;
-jlong     NMethodSweeper::_last_full_flush_time = 0;
-int       NMethodSweeper::_highest_marked = 0;
-int       NMethodSweeper::_dead_compile_ids = 0;
-long      NMethodSweeper::_last_flush_traversal_id = 0;
+bool      NMethodSweeper::_request_mark_phase        = false;
 
-int       NMethodSweeper::_number_of_flushes = 0; // Total of full traversals caused by full cache
 int       NMethodSweeper::_total_nof_methods_reclaimed = 0;
-jlong     NMethodSweeper::_total_time_sweeping = 0;
-jlong     NMethodSweeper::_total_time_this_sweep = 0;
-jlong     NMethodSweeper::_peak_sweep_time = 0;
-jlong     NMethodSweeper::_peak_sweep_fraction_time = 0;
-jlong     NMethodSweeper::_total_disconnect_time = 0;
-jlong     NMethodSweeper::_peak_disconnect_time = 0;
+jlong     NMethodSweeper::_total_time_sweeping         = 0;
+jlong     NMethodSweeper::_total_time_this_sweep       = 0;
+jlong     NMethodSweeper::_peak_sweep_time             = 0;
+jlong     NMethodSweeper::_peak_sweep_fraction_time    = 0;
+int       NMethodSweeper::_hotness_counter_reset_val   = 0;
+
 
 class MarkActivationClosure: public CodeBlobClosure {
 public:
   virtual void do_code_blob(CodeBlob* cb) {
-    // If we see an activation belonging to a non_entrant nmethod, we mark it.
-    if (cb->is_nmethod() && ((nmethod*)cb)->is_not_entrant()) {
-      ((nmethod*)cb)->mark_as_seen_on_stack();
+    if (cb->is_nmethod()) {
+      nmethod* nm = (nmethod*)cb;
+      nm->set_hotness_counter(NMethodSweeper::hotness_counter_reset_val());
+      // If we see an activation belonging to a non_entrant nmethod, we mark it.
+      if (nm->is_not_entrant()) {
+        nm->mark_as_seen_on_stack();
+      }
     }
   }
 };
 static MarkActivationClosure mark_activation_closure;
 
+class SetHotnessClosure: public CodeBlobClosure {
+public:
+  virtual void do_code_blob(CodeBlob* cb) {
+    if (cb->is_nmethod()) {
+      nmethod* nm = (nmethod*)cb;
+      nm->set_hotness_counter(NMethodSweeper::hotness_counter_reset_val());
+    }
+  }
+};
+static SetHotnessClosure set_hotness_closure;
+
+
+int NMethodSweeper::hotness_counter_reset_val() {
+  if (_hotness_counter_reset_val == 0) {
+    _hotness_counter_reset_val = (ReservedCodeCacheSize < M) ? 1 : (ReservedCodeCacheSize / M) * 2;
+  }
+  return _hotness_counter_reset_val;
+}
 bool NMethodSweeper::sweep_in_progress() {
   return (_current != NULL);
 }
 
-void NMethodSweeper::scan_stacks() {
+// Scans the stacks of all Java threads and marks activations of not-entrant methods.
+// No need to synchronize access, since 'mark_active_nmethods' is always executed at a
+// safepoint.
+void NMethodSweeper::mark_active_nmethods() {
   assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
-  if (!MethodFlushing) return;
-
-  // No need to synchronize access, since this is always executed at a
-  // safepoint.
-
-  // Make sure CompiledIC_lock in unlocked, since we might update some
-  // inline caches. If it is, we just bail-out and try later.
-  if (CompiledIC_lock->is_locked() || Patching_lock->is_locked()) return;
+  // If we do not want to reclaim not-entrant or zombie methods there is no need
+  // to scan stacks
+  if (!MethodFlushing) {
+    return;
+  }
 
   // Check for restart
   assert(CodeCache::find_blob_unsafe(_current) == _current, "Sweeper nmethod cached state invalid");
-  if (!sweep_in_progress() && _resweep) {
+  if (!sweep_in_progress() && need_marking_phase()) {
     _seen        = 0;
     _invocations = NmethodSweepFraction;
     _current     = CodeCache::first_nmethod();
@@ -197,30 +212,22 @@
     Threads::nmethods_do(&mark_activation_closure);
 
     // reset the flags since we started a scan from the beginning.
-    _resweep = false;
+    reset_nmethod_marking();
     _locked_seen = 0;
     _not_entrant_seen_on_stack = 0;
+  } else {
+    // Only set hotness counter
+    Threads::nmethods_do(&set_hotness_closure);
   }
 
-  if (UseCodeCacheFlushing) {
-    // only allow new flushes after the interval is complete.
-    jlong now           = os::javaTimeMillis();
-    jlong max_interval  = (jlong)MinCodeCacheFlushingInterval * (jlong)1000;
-    jlong curr_interval = now - _last_full_flush_time;
-    if (curr_interval > max_interval) {
-      _flush_token = 0;
-    }
-
-    if (!CodeCache::needs_flushing() && !CompileBroker::should_compile_new_jobs()) {
-      CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
-      log_sweep("restart_compiler");
-    }
-  }
+  OrderAccess::storestore();
 }
 
 void NMethodSweeper::possibly_sweep() {
   assert(JavaThread::current()->thread_state() == _thread_in_vm, "must run in vm mode");
-  if (!MethodFlushing || !sweep_in_progress()) return;
+  if (!MethodFlushing || !sweep_in_progress()) {
+    return;
+  }
 
   if (_invocations > 0) {
     // Only one thread at a time will sweep
@@ -258,8 +265,7 @@
   if (!CompileBroker::should_compile_new_jobs()) {
     // If we have turned off compilations we might as well do full sweeps
     // in order to reach the clean state faster. Otherwise the sleeping compiler
-    // threads will slow down sweeping. After a few iterations the cache
-    // will be clean and sweeping stops (_resweep will not be set)
+    // threads will slow down sweeping.
     _invocations = 1;
   }
 
@@ -271,9 +277,11 @@
   int todo = (CodeCache::nof_nmethods() - _seen) / _invocations;
   int swept_count = 0;
 
+
   assert(!SafepointSynchronize::is_at_safepoint(), "should not be in safepoint when we get here");
   assert(!CodeCache_lock->owned_by_self(), "just checking");
 
+  int freed_memory = 0;
   {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
@@ -299,7 +307,7 @@
       // Now ready to process nmethod and give up CodeCache_lock
       {
         MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-        process_nmethod(_current);
+        freed_memory += process_nmethod(_current);
       }
       _seen++;
       _current = next;
@@ -308,11 +316,11 @@
 
   assert(_invocations > 1 || _current == NULL, "must have scanned the whole cache");
 
-  if (!sweep_in_progress() && !_resweep && (_locked_seen || _not_entrant_seen_on_stack)) {
+  if (!sweep_in_progress() && !need_marking_phase() && (_locked_seen || _not_entrant_seen_on_stack)) {
     // we've completed a scan without making progress but there were
     // nmethods we were unable to process either because they were
-    // locked or were still on stack.  We don't have to aggresively
-    // clean them up so just stop scanning.  We could scan once more
+    // locked or were still on stack. We don't have to aggressively
+    // clean them up so just stop scanning. We could scan once more
     // but that complicates the control logic and it's unlikely to
     // matter much.
     if (PrintMethodFlushing) {
@@ -351,9 +359,16 @@
     log_sweep("finished");
   }
 
-  // Sweeper is the only case where memory is released,
-  // check here if it is time to restart the compiler.
-  if (UseCodeCacheFlushing && !CompileBroker::should_compile_new_jobs() && !CodeCache::needs_flushing()) {
+  // Sweeper is the only case where memory is released, check here if it
+  // is time to restart the compiler. Only checking if there is a certain
+  // amount of free memory in the code cache might lead to re-enabling
+  // compilation although no memory has been released. For example, there are
+  // cases when compilation was disabled although there is 4MB (or more) free
+  // memory in the code cache. The reason is code cache fragmentation. Therefore,
+  // it only makes sense to re-enable compilation if we have actually freed memory.
+  // Note that typically several kB are released for sweeping 16MB of the code
+  // cache. As a result, 'freed_memory' > 0 to restart the compiler.
+  if (UseCodeCacheFlushing && (!CompileBroker::should_compile_new_jobs() && (freed_memory > 0))) {
     CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
     log_sweep("restart_compiler");
   }
@@ -367,8 +382,8 @@
     _thread = CompilerThread::current();
     if (!nm->is_zombie() && !nm->is_unloaded()) {
       // Only expose live nmethods for scanning
-    _thread->set_scanned_nmethod(nm);
-  }
+      _thread->set_scanned_nmethod(nm);
+    }
   }
   ~NMethodMarker() {
     _thread->set_scanned_nmethod(NULL);
@@ -392,20 +407,20 @@
   nm->flush();
 }
 
-void NMethodSweeper::process_nmethod(nmethod *nm) {
+int NMethodSweeper::process_nmethod(nmethod *nm) {
   assert(!CodeCache_lock->owned_by_self(), "just checking");
 
+  int freed_memory = 0;
   // Make sure this nmethod doesn't get unloaded during the scan,
-  // since the locks acquired below might safepoint.
+  // since safepoints may happen during acquired below locks.
   NMethodMarker nmm(nm);
-
   SWEEP(nm);
 
   // Skip methods that are currently referenced by the VM
   if (nm->is_locked_by_vm()) {
     // But still remember to clean-up inline caches for alive nmethods
     if (nm->is_alive()) {
-      // Clean-up all inline caches that points to zombie/non-reentrant methods
+      // Clean inline caches that point to zombie/non-entrant methods
       MutexLocker cl(CompiledIC_lock);
       nm->cleanup_inline_caches();
       SWEEP(nm);
@@ -413,18 +428,19 @@
       _locked_seen++;
       SWEEP(nm);
     }
-    return;
+    return freed_memory;
   }
 
   if (nm->is_zombie()) {
-    // If it is first time, we see nmethod then we mark it. Otherwise,
-    // we reclame it. When we have seen a zombie method twice, we know that
+    // If it is the first time we see nmethod then we mark it. Otherwise,
+    // we reclaim it. When we have seen a zombie method twice, we know that
     // there are no inline caches that refer to it.
     if (nm->is_marked_for_reclamation()) {
       assert(!nm->is_locked_by_vm(), "must not flush locked nmethods");
       if (PrintMethodFlushing && Verbose) {
         tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (marked for reclamation) being flushed", nm->compile_id(), nm);
       }
+      freed_memory = nm->total_size();
       release_nmethod(nm);
       _flushed_count++;
     } else {
@@ -432,19 +448,19 @@
         tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), nm);
       }
       nm->mark_for_reclamation();
-      _resweep = true;
+      request_nmethod_marking();
       _marked_count++;
       SWEEP(nm);
     }
   } else if (nm->is_not_entrant()) {
-    // If there is no current activations of this method on the
+    // If there are no current activations of this method on the
     // stack we can safely convert it to a zombie method
     if (nm->can_not_entrant_be_converted()) {
       if (PrintMethodFlushing && Verbose) {
         tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm);
       }
       nm->make_zombie();
-      _resweep = true;
+      request_nmethod_marking();
       _zombified_count++;
       SWEEP(nm);
     } else {
@@ -459,159 +475,57 @@
     }
   } else if (nm->is_unloaded()) {
     // Unloaded code, just make it a zombie
-    if (PrintMethodFlushing && Verbose)
+    if (PrintMethodFlushing && Verbose) {
       tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (unloaded) being made zombie", nm->compile_id(), nm);
-
+    }
     if (nm->is_osr_method()) {
       SWEEP(nm);
       // No inline caches will ever point to osr methods, so we can just remove it
+      freed_memory = nm->total_size();
       release_nmethod(nm);
       _flushed_count++;
     } else {
       nm->make_zombie();
-      _resweep = true;
+      request_nmethod_marking();
       _zombified_count++;
       SWEEP(nm);
     }
   } else {
-    assert(nm->is_alive(), "should be alive");
-
     if (UseCodeCacheFlushing) {
-      if (nm->is_speculatively_disconnected() && !nm->is_locked_by_vm() && !nm->is_osr_method() &&
-          (_traversals > _last_flush_traversal_id + 2) && (nm->compile_id() < _highest_marked)) {
-        // This method has not been called since the forced cleanup happened
-        nm->make_not_entrant();
+      if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) {
+        // Do not make native methods and OSR-methods not-entrant
+        nm->dec_hotness_counter();
+        // Get the initial value of the hotness counter. This value depends on the
+        // ReservedCodeCacheSize
+        int reset_val = hotness_counter_reset_val();
+        int time_since_reset = reset_val - nm->hotness_counter();
+        double threshold = -reset_val + (CodeCache::reverse_free_ratio() * NmethodSweepActivity);
+        // The less free space in the code cache we have - the bigger reverse_free_ratio() is.
+        // I.e., 'threshold' increases with lower available space in the code cache and a higher
+        // NmethodSweepActivity. If the current hotness counter - which decreases from its initial
+        // value until it is reset by stack walking - is smaller than the computed threshold, the
+        // corresponding nmethod is considered for removal.
+        if ((NmethodSweepActivity > 0) && (nm->hotness_counter() < threshold) && (time_since_reset > 10)) {
+          // A method is marked as not-entrant if the method is
+          // 1) 'old enough': nm->hotness_counter() < threshold
+          // 2) The method was in_use for a minimum amount of time: (time_since_reset > 10)
+          //    The second condition is necessary if we are dealing with very small code cache
+          //    sizes (e.g., <10m) and the code cache size is too small to hold all hot methods.
+          //    The second condition ensures that methods are not immediately made not-entrant
+          //    after compilation.
+          nm->make_not_entrant();
+          request_nmethod_marking();
+        }
       }
     }
-
-    // Clean-up all inline caches that points to zombie/non-reentrant methods
+    // Clean-up all inline caches that point to zombie/non-reentrant methods
     MutexLocker cl(CompiledIC_lock);
     nm->cleanup_inline_caches();
     SWEEP(nm);
   }
-}
-
-// Code cache unloading: when compilers notice the code cache is getting full,
-// they will call a vm op that comes here. This code attempts to speculatively
-// unload the oldest half of the nmethods (based on the compile job id) by
-// saving the old code in a list in the CodeCache. Then
-// execution resumes. If a method so marked is not called by the second sweeper
-// stack traversal after the current one, the nmethod will be marked non-entrant and
-// got rid of by normal sweeping. If the method is called, the Method*'s
-// _code field is restored and the Method*/nmethod
-// go back to their normal state.
-void NMethodSweeper::handle_full_code_cache(bool is_full) {
-
-  if (is_full) {
-    // Since code cache is full, immediately stop new compiles
-    if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) {
-      log_sweep("disable_compiler");
-    }
-  }
-
-  // Make sure only one thread can flush
-  // The token is reset after CodeCacheMinimumFlushInterval in scan stacks,
-  // no need to check the timeout here.
-  jint old = Atomic::cmpxchg( 1, &_flush_token, 0 );
-  if (old != 0) {
-    return;
-  }
-
-  VM_HandleFullCodeCache op(is_full);
-  VMThread::execute(&op);
-
-  // resweep again as soon as possible
-  _resweep = true;
+  return freed_memory;
 }
 
-void NMethodSweeper::speculative_disconnect_nmethods(bool is_full) {
-  // If there was a race in detecting full code cache, only run
-  // one vm op for it or keep the compiler shut off
-
-  jlong disconnect_start_counter = os::elapsed_counter();
-
-  // Traverse the code cache trying to dump the oldest nmethods
-  int curr_max_comp_id = CompileBroker::get_compilation_id();
-  int flush_target = ((curr_max_comp_id - _dead_compile_ids) / CodeCacheFlushingFraction) + _dead_compile_ids;
-
-  log_sweep("start_cleaning");
-
-  nmethod* nm = CodeCache::alive_nmethod(CodeCache::first());
-  jint disconnected = 0;
-  jint made_not_entrant  = 0;
-  jint nmethod_count = 0;
-
-  while ((nm != NULL)){
-    int curr_comp_id = nm->compile_id();
-
-    // OSR methods cannot be flushed like this. Also, don't flush native methods
-    // since they are part of the JDK in most cases
-    if (!nm->is_osr_method() && !nm->is_locked_by_vm() && !nm->is_native_method()) {
-
-      // only count methods that can be speculatively disconnected
-      nmethod_count++;
-
-      if (nm->is_in_use() && (curr_comp_id < flush_target)) {
-        if ((nm->method()->code() == nm)) {
-          // This method has not been previously considered for
-          // unloading or it was restored already
-          CodeCache::speculatively_disconnect(nm);
-          disconnected++;
-        } else if (nm->is_speculatively_disconnected()) {
-          // This method was previously considered for preemptive unloading and was not called since then
-          CompilationPolicy::policy()->delay_compilation(nm->method());
-          nm->make_not_entrant();
-          made_not_entrant++;
-        }
-
-        if (curr_comp_id > _highest_marked) {
-          _highest_marked = curr_comp_id;
-        }
-      }
-    }
-    nm = CodeCache::alive_nmethod(CodeCache::next(nm));
-  }
-
-  // remember how many compile_ids wheren't seen last flush.
-  _dead_compile_ids = curr_max_comp_id - nmethod_count;
-
-  log_sweep("stop_cleaning",
-                       "disconnected='" UINT32_FORMAT "' made_not_entrant='" UINT32_FORMAT "'",
-                       disconnected, made_not_entrant);
-
-  // Shut off compiler. Sweeper will start over with a new stack scan and
-  // traversal cycle and turn it back on if it clears enough space.
-  if (is_full) {
-    _last_full_flush_time = os::javaTimeMillis();
-  }
-
-  jlong disconnect_end_counter = os::elapsed_counter();
-  jlong disconnect_time = disconnect_end_counter - disconnect_start_counter;
-  _total_disconnect_time += disconnect_time;
-  _peak_disconnect_time = MAX2(disconnect_time, _peak_disconnect_time);
-
-  EventCleanCodeCache event(UNTIMED);
-  if (event.should_commit()) {
-    event.set_starttime(disconnect_start_counter);
-    event.set_endtime(disconnect_end_counter);
-    event.set_disconnectedCount(disconnected);
-    event.set_madeNonEntrantCount(made_not_entrant);
-    event.commit();
-  }
-  _number_of_flushes++;
-
-  // After two more traversals the sweeper will get rid of unrestored nmethods
-  _last_flush_traversal_id = _traversals;
-  _resweep = true;
-#ifdef ASSERT
-
-  if(PrintMethodFlushing && Verbose) {
-    tty->print_cr("### sweeper: unload time: " INT64_FORMAT, (jlong)disconnect_time);
-  }
-#endif
-}
-
-
 // Print out some state information about the current sweep and the
 // state of the code cache if it's requested.
 void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
--- a/hotspot/src/share/vm/runtime/sweeper.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -27,8 +27,30 @@
 
 // An NmethodSweeper is an incremental cleaner for:
 //    - cleanup inline caches
-//    - reclamation of unreferences zombie nmethods
-//
+//    - reclamation of nmethods
+// Removing nmethods from the code cache includes two operations
+//  1) mark active nmethods
+//     Is done in 'mark_active_nmethods()'. This function is called at a
+//     safepoint and marks all nmethods that are active on a thread's stack.
+//  2) sweep nmethods
+//     Is done in sweep_code_cache(). This function is the only place in the
+//     sweeper where memory is reclaimed. Note that sweep_code_cache() is not
+//     called at a safepoint. However, sweep_code_cache() stops executing if
+//     another thread requests a safepoint. Consequently, 'mark_active_nmethods()'
+//     and sweep_code_cache() cannot execute at the same time.
+//     To reclaim memory, nmethods are first marked as 'not-entrant'. Methods can
+//     be made not-entrant by (i) the sweeper, (ii) deoptimization, (iii) dependency
+//     invalidation, and (iv) being replaced be a different method version (tiered
+//     compilation). Not-entrant nmethod cannot be called by Java threads, but they
+//     can still be active on the stack. To ensure that active nmethod are not reclaimed,
+//     we have to wait until the next marking phase has completed. If a not-entrant
+//     nmethod was NOT marked as active, it can be converted to 'zombie' state. To safely
+//     remove the nmethod, all inline caches (IC) that point to the the nmethod must be
+//     cleared. After that, the nmethod can be evicted from the code cache. Each nmethod's
+//     state change happens during separate sweeps. It may take at least 3 sweeps before an
+//     nmethod's space is freed. Sweeping is currently done by compiler threads between
+//     compilations or at least each 5 sec (NmethodSweepCheckInterval) when the code cache
+//     is full.
 
 class NMethodSweeper : public AllStatic {
   static long      _traversals;      // Stack scan count, also sweep ID.
@@ -41,46 +63,38 @@
   static volatile int  _invocations;   // No. of invocations left until we are completed with this pass
   static volatile int  _sweep_started; // Flag to control conc sweeper
 
-  //The following are reset in scan_stacks and synchronized by the safepoint
-  static bool      _resweep;           // Indicates that a change has happend and we want another sweep,
-                                       // always checked and reset at a safepoint so memory will be in sync.
-  static int       _locked_seen;       // Number of locked nmethods encountered during the scan
+  //The following are reset in mark_active_nmethods and synchronized by the safepoint
+  static bool      _request_mark_phase;        // Indicates that a change has happend and we need another mark pahse,
+                                               // always checked and reset at a safepoint so memory will be in sync.
+  static int       _locked_seen;               // Number of locked nmethods encountered during the scan
   static int       _not_entrant_seen_on_stack; // Number of not entrant nmethod were are still on stack
-  static jint      _flush_token;       // token that guards method flushing, making sure it is executed only once.
-
-  // These are set during a flush, a VM-operation
-  static long      _last_flush_traversal_id; // trav number at last flush unloading
-  static jlong     _last_full_flush_time;    // timestamp of last emergency unloading
-
-  // These are synchronized by the _sweep_started token
-  static int       _highest_marked;   // highest compile id dumped at last emergency unloading
-  static int       _dead_compile_ids; // number of compile ids that where not in the cache last flush
 
   // Stat counters
-  static int       _number_of_flushes;            // Total of full traversals caused by full cache
   static int       _total_nof_methods_reclaimed;  // Accumulated nof methods flushed
   static jlong     _total_time_sweeping;          // Accumulated time sweeping
   static jlong     _total_time_this_sweep;        // Total time this sweep
   static jlong     _peak_sweep_time;              // Peak time for a full sweep
   static jlong     _peak_sweep_fraction_time;     // Peak time sweeping one fraction
-  static jlong     _total_disconnect_time;        // Total time cleaning code mem
-  static jlong     _peak_disconnect_time;         // Peak time cleaning code mem
 
-  static void process_nmethod(nmethod *nm);
+  static int  process_nmethod(nmethod *nm);
   static void release_nmethod(nmethod* nm);
 
-  static void log_sweep(const char* msg, const char* format = NULL, ...);
   static bool sweep_in_progress();
+  static void sweep_code_cache();
+  static void request_nmethod_marking() { _request_mark_phase = true; }
+  static void reset_nmethod_marking()   { _request_mark_phase = false; }
+  static bool need_marking_phase()      { return _request_mark_phase; }
+
+  static int _hotness_counter_reset_val;
 
  public:
   static long traversal_count()              { return _traversals; }
-  static int  number_of_flushes()            { return _number_of_flushes; }
   static int  total_nof_methods_reclaimed()  { return _total_nof_methods_reclaimed; }
   static jlong total_time_sweeping()         { return _total_time_sweeping; }
   static jlong peak_sweep_time()             { return _peak_sweep_time; }
   static jlong peak_sweep_fraction_time()    { return _peak_sweep_fraction_time; }
-  static jlong total_disconnect_time()       { return _total_disconnect_time; }
-  static jlong peak_disconnect_time()        { return _peak_disconnect_time; }
+  static void log_sweep(const char* msg, const char* format = NULL, ...);
+
 
 #ifdef ASSERT
   static bool is_sweeping(nmethod* which) { return _current == which; }
@@ -90,19 +104,18 @@
   static void report_events();
 #endif
 
-  static void scan_stacks();      // Invoked at the end of each safepoint
-  static void sweep_code_cache(); // Concurrent part of sweep job
-  static void possibly_sweep();   // Compiler threads call this to sweep
+  static void mark_active_nmethods();      // Invoked at the end of each safepoint
+  static void possibly_sweep();            // Compiler threads call this to sweep
 
-  static void notify(nmethod* nm) {
+  static int sort_nmethods_by_hotness(nmethod** nm1, nmethod** nm2);
+  static int hotness_counter_reset_val();
+
+  static void notify() {
     // Request a new sweep of the code cache from the beginning. No
     // need to synchronize the setting of this flag since it only
     // changes to false at safepoint so we can never overwrite it with false.
-     _resweep = true;
+     request_nmethod_marking();
   }
-
-  static void handle_full_code_cache(bool is_full); // Called by compilers who fail to allocate
-  static void speculative_disconnect_nmethods(bool was_full);   // Called by vm op to deal with alloc failure
 };
 
 #endif // SHARE_VM_RUNTIME_SWEEPER_HPP
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -154,7 +154,7 @@
 static volatile intptr_t ListLock = 0 ;      // protects global monitor free-list cache
 static volatile int MonitorFreeCount  = 0 ;      // # on gFreeList
 static volatile int MonitorPopulation = 0 ;      // # Extant -- in circulation
-#define CHAINMARKER ((oop)-1)
+#define CHAINMARKER (cast_to_oop<intptr_t>(-1))
 
 // -----------------------------------------------------------------------------
 //  Fast Monitor Enter/Exit
@@ -510,7 +510,7 @@
          // then for each thread on the list, set the flag and unpark() the thread.
          // This is conceptually similar to muxAcquire-muxRelease, except that muxRelease
          // wakes at most one thread whereas we need to wake the entire list.
-         int ix = (intptr_t(obj) >> 5) & (NINFLATIONLOCKS-1) ;
+         int ix = (cast_from_oop<intptr_t>(obj) >> 5) & (NINFLATIONLOCKS-1) ;
          int YieldThenBlock = 0 ;
          assert (ix >= 0 && ix < NINFLATIONLOCKS, "invariant") ;
          assert ((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant") ;
@@ -565,7 +565,7 @@
      // This variation has the property of being stable (idempotent)
      // between STW operations.  This can be useful in some of the 1-0
      // synchronization schemes.
-     intptr_t addrBits = intptr_t(obj) >> 3 ;
+     intptr_t addrBits = cast_from_oop<intptr_t>(obj) >> 3 ;
      value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom ;
   } else
   if (hashCode == 2) {
@@ -575,7 +575,7 @@
      value = ++GVars.hcSequence ;
   } else
   if (hashCode == 4) {
-     value = intptr_t(obj) ;
+     value = cast_from_oop<intptr_t>(obj) ;
   } else {
      // Marsaglia's xor-shift scheme with thread-specific state
      // This is probably the best overall implementation -- we'll
@@ -1321,7 +1321,7 @@
             if (object->is_instance()) {
               ResourceMark rm;
               tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
-                (intptr_t) object, (intptr_t) object->mark(),
+                (void *) object, (intptr_t) object->mark(),
                 object->klass()->external_name());
             }
           }
@@ -1371,7 +1371,7 @@
         if (object->is_instance()) {
           ResourceMark rm;
           tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
-            (intptr_t) object, (intptr_t) object->mark(),
+            (void *) object, (intptr_t) object->mark(),
             object->klass()->external_name());
         }
       }
@@ -1439,7 +1439,7 @@
        if (obj->is_instance()) {
          ResourceMark rm;
            tty->print_cr("Deflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
-                (intptr_t) obj, (intptr_t) obj->mark(), obj->klass()->external_name());
+                (void *) obj, (intptr_t) obj->mark(), obj->klass()->external_name());
        }
      }
 
--- a/hotspot/src/share/vm/runtime/thread.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1444,7 +1444,7 @@
   _in_deopt_handler = 0;
   _doing_unsafe_access = false;
   _stack_guard_state = stack_guard_unused;
-  _exception_oop = NULL;
+  (void)const_cast<oop&>(_exception_oop = NULL);
   _exception_pc  = 0;
   _exception_handler_pc = 0;
   _is_method_handle_return = 0;
--- a/hotspot/src/share/vm/runtime/thread.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1278,7 +1278,7 @@
   address  exception_handler_pc() const          { return _exception_handler_pc; }
   bool     is_method_handle_return() const       { return _is_method_handle_return == 1; }
 
-  void set_exception_oop(oop o)                  { _exception_oop = o; }
+  void set_exception_oop(oop o)                  { (void)const_cast<oop&>(_exception_oop = o); }
   void set_exception_pc(address a)               { _exception_pc = a; }
   void set_exception_handler_pc(address a)       { _exception_handler_pc = a; }
   void set_is_method_handle_return(bool value)   { _is_method_handle_return = value ? 1 : 0; }
--- a/hotspot/src/share/vm/runtime/vframeArray.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/vframeArray.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -111,7 +111,7 @@
       case T_OBJECT:
         assert(!value->obj_is_scalar_replaced(), "object should be reallocated already");
         // preserve object type
-        _locals->add( new StackValue((intptr_t) (value->get_obj()()), T_OBJECT ));
+        _locals->add( new StackValue(cast_from_oop<intptr_t>((value->get_obj()())), T_OBJECT ));
         break;
       case T_CONFLICT:
         // A dead local.  Will be initialized to null/zero.
@@ -136,7 +136,7 @@
       case T_OBJECT:
         assert(!value->obj_is_scalar_replaced(), "object should be reallocated already");
         // preserve object type
-        _expressions->add( new StackValue((intptr_t) (value->get_obj()()), T_OBJECT ));
+        _expressions->add( new StackValue(cast_from_oop<intptr_t>((value->get_obj()())), T_OBJECT ));
         break;
       case T_CONFLICT:
         // A dead stack element.  Will be initialized to null/zero.
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -176,6 +176,7 @@
 #include "opto/loopnode.hpp"
 #include "opto/machnode.hpp"
 #include "opto/matcher.hpp"
+#include "opto/mathexactnode.hpp"
 #include "opto/mulnode.hpp"
 #include "opto/phaseX.hpp"
 #include "opto/parse.hpp"
@@ -841,7 +842,7 @@
   nonstatic_field(nmethod,             _osr_link,                                     nmethod*)                              \
   nonstatic_field(nmethod,             _scavenge_root_link,                           nmethod*)                              \
   nonstatic_field(nmethod,             _scavenge_root_state,                          jbyte)                                 \
-  nonstatic_field(nmethod,             _state,                                        unsigned char)                         \
+  nonstatic_field(nmethod,             _state,                                        volatile unsigned char)                \
   nonstatic_field(nmethod,             _exception_offset,                             int)                                   \
   nonstatic_field(nmethod,             _deoptimize_offset,                            int)                                   \
   nonstatic_field(nmethod,             _deoptimize_mh_offset,                         int)                                   \
@@ -1185,11 +1186,10 @@
   /* -XX flags         */                                                                                                            \
   /*********************/                                                                                                            \
                                                                                                                                      \
-  nonstatic_field(Flag,                        type,                                          const char*)                           \
-  nonstatic_field(Flag,                        name,                                          const char*)                           \
-  unchecked_nonstatic_field(Flag,              addr,                                          sizeof(void*)) /* NOTE: no type */     \
-  nonstatic_field(Flag,                        kind,                                          const char*)                           \
-  nonstatic_field(Flag,                        origin,                                        FlagValueOrigin)                       \
+  nonstatic_field(Flag,                        _type,                                         const char*)                           \
+  nonstatic_field(Flag,                        _name,                                         const char*)                           \
+  unchecked_nonstatic_field(Flag,              _addr,                                         sizeof(void*)) /* NOTE: no type */     \
+  nonstatic_field(Flag,                        _flags,                                        Flag::Flags)                           \
   static_field(Flag,                           flags,                                         Flag*)                                 \
   static_field(Flag,                           numFlags,                                      size_t)                                \
                                                                                                                                      \
@@ -1360,6 +1360,7 @@
   declare_integer_type(long)                                              \
   declare_integer_type(char)                                              \
   declare_unsigned_integer_type(unsigned char)                            \
+  declare_unsigned_integer_type(volatile unsigned char)                   \
   declare_unsigned_integer_type(u_char)                                   \
   declare_unsigned_integer_type(unsigned int)                             \
   declare_unsigned_integer_type(uint)                                     \
@@ -1382,6 +1383,7 @@
   declare_toplevel_type(char**)                                           \
   declare_toplevel_type(u_char*)                                          \
   declare_toplevel_type(unsigned char*)                                   \
+  declare_toplevel_type(volatile unsigned char*)                          \
                                                                           \
   /*******************************************************************/   \
   /* Types which it will be handy to have available over in the SA   */   \
@@ -1928,6 +1930,9 @@
   declare_c2_type(CmpF3Node, CmpFNode)                                    \
   declare_c2_type(CmpDNode, CmpNode)                                      \
   declare_c2_type(CmpD3Node, CmpDNode)                                    \
+  declare_c2_type(MathExactNode, MultiNode)                               \
+  declare_c2_type(AddExactINode, MathExactNode)                           \
+  declare_c2_type(FlagsProjNode, ProjNode)                                \
   declare_c2_type(BoolNode, Node)                                         \
   declare_c2_type(AbsNode, Node)                                          \
   declare_c2_type(AbsINode, AbsNode)                                      \
@@ -2074,7 +2079,7 @@
    declare_integer_type(JavaThreadState)                                  \
    declare_integer_type(Location::Type)                                   \
    declare_integer_type(Location::Where)                                  \
-   declare_integer_type(FlagValueOrigin)                                  \
+   declare_integer_type(Flag::Flags)                                      \
    COMPILER2_PRESENT(declare_integer_type(OptoReg::Name))                 \
                                                                           \
    declare_toplevel_type(CHeapObj<mtInternal>)                            \
@@ -2082,7 +2087,7 @@
             declare_type(Array<u1>, MetaspaceObj)                         \
             declare_type(Array<u2>, MetaspaceObj)                         \
             declare_type(Array<Klass*>, MetaspaceObj)                     \
-            declare_type(Array<Method*>, MetaspaceObj)             \
+            declare_type(Array<Method*>, MetaspaceObj)                    \
                                                                           \
    declare_integer_type(AccessFlags)  /* FIXME: wrong type (not integer) */\
   declare_toplevel_type(address)      /* FIXME: should this be an integer type? */\
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -173,10 +173,6 @@
   SymbolTable::unlink();
 }
 
-void VM_HandleFullCodeCache::doit() {
-  NMethodSweeper::speculative_disconnect_nmethods(_is_full);
-}
-
 void VM_Verify::doit() {
   Universe::heap()->prepare_for_verify();
   Universe::verify(_silent);
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -51,7 +51,6 @@
   template(DeoptimizeAll)                         \
   template(ZombieAll)                             \
   template(UnlinkSymbols)                         \
-  template(HandleFullCodeCache)                   \
   template(Verify)                                \
   template(PrintJNI)                              \
   template(HeapDumper)                            \
@@ -261,16 +260,6 @@
   bool allow_nested_vm_operations() const        { return true;  }
 };
 
-class VM_HandleFullCodeCache: public VM_Operation {
- private:
-  bool  _is_full;
- public:
-  VM_HandleFullCodeCache(bool is_full)           { _is_full = is_full; }
-  VMOp_Type type() const                         { return VMOp_HandleFullCodeCache; }
-  void doit();
-  bool allow_nested_vm_operations() const        { return true; }
-};
-
 #ifndef PRODUCT
 class VM_DeoptimizeAll: public VM_Operation {
  private:
--- a/hotspot/src/share/vm/runtime/vm_version.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/runtime/vm_version.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -78,7 +78,13 @@
   static const char* jre_release_version();
 
   // does HW support an 8-byte compare-exchange operation?
-  static bool supports_cx8()  {return _supports_cx8;}
+  static bool supports_cx8()  {
+#ifdef SUPPORTS_NATIVE_CX8
+    return true;
+#else
+    return _supports_cx8;
+#endif
+  }
   // does HW support atomic get-and-set or atomic get-and-add?  Used
   // to guide intrinsification decisions for Unsafe atomic ops
   static bool supports_atomic_getset4()  {return _supports_atomic_getset4;}
--- a/hotspot/src/share/vm/services/attachListener.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/attachListener.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -245,7 +245,7 @@
     }
     value = (tmp != 0);
   }
-  bool res = CommandLineFlags::boolAtPut((char*)name, &value, ATTACH_ON_DEMAND);
+  bool res = CommandLineFlags::boolAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
   if (! res) {
     out->print_cr("setting flag %s failed", name);
   }
@@ -263,7 +263,7 @@
       return JNI_ERR;
     }
   }
-  bool res = CommandLineFlags::intxAtPut((char*)name, &value, ATTACH_ON_DEMAND);
+  bool res = CommandLineFlags::intxAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
   if (! res) {
     out->print_cr("setting flag %s failed", name);
   }
@@ -282,7 +282,7 @@
       return JNI_ERR;
     }
   }
-  bool res = CommandLineFlags::uintxAtPut((char*)name, &value, ATTACH_ON_DEMAND);
+  bool res = CommandLineFlags::uintxAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
   if (! res) {
     out->print_cr("setting flag %s failed", name);
   }
@@ -301,7 +301,7 @@
       return JNI_ERR;
     }
   }
-  bool res = CommandLineFlags::uint64_tAtPut((char*)name, &value, ATTACH_ON_DEMAND);
+  bool res = CommandLineFlags::uint64_tAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
   if (! res) {
     out->print_cr("setting flag %s failed", name);
   }
@@ -316,7 +316,7 @@
     out->print_cr("flag value must be a string");
     return JNI_ERR;
   }
-  bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, ATTACH_ON_DEMAND);
+  bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
   if (res) {
     FREE_C_HEAP_ARRAY(char, value, mtInternal);
   } else {
@@ -470,7 +470,17 @@
                        vmSymbols::threadgroup_string_void_signature(),
                        thread_group,
                        string,
-                       CHECK);
+                       THREAD);
+
+  if (HAS_PENDING_EXCEPTION) {
+    tty->print_cr("Exception in VM (AttachListener::init) : ");
+    java_lang_Throwable::print(PENDING_EXCEPTION, tty);
+    tty->cr();
+
+    CLEAR_PENDING_EXCEPTION;
+
+    return;
+  }
 
   KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass());
   JavaCalls::call_special(&result,
@@ -479,7 +489,17 @@
                         vmSymbols::add_method_name(),
                         vmSymbols::thread_void_signature(),
                         thread_oop,             // ARG 1
-                        CHECK);
+                        THREAD);
+
+  if (HAS_PENDING_EXCEPTION) {
+    tty->print_cr("Exception in VM (AttachListener::init) : ");
+    java_lang_Throwable::print(PENDING_EXCEPTION, tty);
+    tty->cr();
+
+    CLEAR_PENDING_EXCEPTION;
+
+    return;
+  }
 
   { MutexLocker mu(Threads_lock);
     JavaThread* listener_thread = new JavaThread(&attach_listener_thread_entry);
--- a/hotspot/src/share/vm/services/classLoadingService.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/classLoadingService.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -52,7 +52,7 @@
       len = name->utf8_length();                    \
     }                                               \
     HS_DTRACE_PROBE4(hotspot, class__##type,        \
-      data, len, (clss)->class_loader(), (shared)); \
+      data, len, SOLARIS_ONLY((void *))(clss)->class_loader(), (shared)); \
   }
 
 #else /* USDT2 */
@@ -202,7 +202,7 @@
   MutexLocker m(Management_lock);
 
   // verbose will be set to the previous value
-  bool succeed = CommandLineFlags::boolAtPut((char*)"TraceClassLoading", &verbose, MANAGEMENT);
+  bool succeed = CommandLineFlags::boolAtPut((char*)"TraceClassLoading", &verbose, Flag::MANAGEMENT);
   assert(succeed, "Setting TraceClassLoading flag fails");
   reset_trace_class_unloading();
 
@@ -213,7 +213,7 @@
 void ClassLoadingService::reset_trace_class_unloading() {
   assert(Management_lock->owned_by_self(), "Must own the Management_lock");
   bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose();
-  bool succeed = CommandLineFlags::boolAtPut((char*)"TraceClassUnloading", &value, MANAGEMENT);
+  bool succeed = CommandLineFlags::boolAtPut((char*)"TraceClassUnloading", &value, Flag::MANAGEMENT);
   assert(succeed, "Setting TraceClassUnLoading flag fails");
 }
 
--- a/hotspot/src/share/vm/services/diagnosticArgument.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -61,7 +61,7 @@
 }
 
 void GenDCmdArgument::to_string(char* c, char* buf, size_t len) {
-  jio_snprintf(buf, len, "%s", c);
+  jio_snprintf(buf, len, "%s", (c != NULL) ? c : "");
 }
 
 void GenDCmdArgument::to_string(StringArrayArgument* f, char* buf, size_t len) {
--- a/hotspot/src/share/vm/services/dtraceAttacher.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/dtraceAttacher.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -51,7 +51,7 @@
 
 static void set_bool_flag(const char* flag, bool value) {
   CommandLineFlags::boolAtPut((char*)flag, strlen(flag), &value,
-                              ATTACH_ON_DEMAND);
+                              Flag::ATTACH_ON_DEMAND);
 }
 
 // Enable only the "fine grained" flags. Do *not* touch
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -563,7 +563,7 @@
 }
 
 void DumpWriter::write_objectID(oop o) {
-  address a = (address)((uintptr_t)o);
+  address a = (address)o;
 #ifdef _LP64
   write_u8((u8)a);
 #else
--- a/hotspot/src/share/vm/services/management.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/management.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1643,9 +1643,13 @@
   int num_entries = 0;
   for (int i = 0; i < nFlags; i++) {
     Flag* flag = &Flag::flags[i];
+    // Exclude notproduct and develop flags in product builds.
+    if (flag->is_constant_in_binary()) {
+      continue;
+    }
     // Exclude the locked (experimental, diagnostic) flags
     if (flag->is_unlocked() || flag->is_unlocker()) {
-      Handle s = java_lang_String::create_from_str(flag->name, CHECK_0);
+      Handle s = java_lang_String::create_from_str(flag->_name, CHECK_0);
       flags_ah->obj_at_put(num_entries, s());
       num_entries++;
     }
@@ -1669,7 +1673,7 @@
 bool add_global_entry(JNIEnv* env, Handle name, jmmVMGlobal *global, Flag *flag, TRAPS) {
   Handle flag_name;
   if (name() == NULL) {
-    flag_name = java_lang_String::create_from_str(flag->name, CHECK_false);
+    flag_name = java_lang_String::create_from_str(flag->_name, CHECK_false);
   } else {
     flag_name = name;
   }
@@ -1698,23 +1702,23 @@
 
   global->writeable = flag->is_writeable();
   global->external = flag->is_external();
-  switch (flag->origin) {
-    case DEFAULT:
+  switch (flag->get_origin()) {
+    case Flag::DEFAULT:
       global->origin = JMM_VMGLOBAL_ORIGIN_DEFAULT;
       break;
-    case COMMAND_LINE:
+    case Flag::COMMAND_LINE:
       global->origin = JMM_VMGLOBAL_ORIGIN_COMMAND_LINE;
       break;
-    case ENVIRON_VAR:
+    case Flag::ENVIRON_VAR:
       global->origin = JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR;
       break;
-    case CONFIG_FILE:
+    case Flag::CONFIG_FILE:
       global->origin = JMM_VMGLOBAL_ORIGIN_CONFIG_FILE;
       break;
-    case MANAGEMENT:
+    case Flag::MANAGEMENT:
       global->origin = JMM_VMGLOBAL_ORIGIN_MANAGEMENT;
       break;
-    case ERGONOMIC:
+    case Flag::ERGONOMIC:
       global->origin = JMM_VMGLOBAL_ORIGIN_ERGONOMIC;
       break;
     default:
@@ -1781,6 +1785,10 @@
     int num_entries = 0;
     for (int i = 0; i < nFlags && num_entries < count;  i++) {
       Flag* flag = &Flag::flags[i];
+      // Exclude notproduct and develop flags in product builds.
+      if (flag->is_constant_in_binary()) {
+        continue;
+      }
       // Exclude the locked (diagnostic, experimental) flags
       if ((flag->is_unlocked() || flag->is_unlocker()) &&
           add_global_entry(env, null_h, &globals[num_entries], flag, THREAD)) {
@@ -1813,23 +1821,23 @@
   bool succeed;
   if (flag->is_bool()) {
     bool bvalue = (new_value.z == JNI_TRUE ? true : false);
-    succeed = CommandLineFlags::boolAtPut(name, &bvalue, MANAGEMENT);
+    succeed = CommandLineFlags::boolAtPut(name, &bvalue, Flag::MANAGEMENT);
   } else if (flag->is_intx()) {
     intx ivalue = (intx)new_value.j;
-    succeed = CommandLineFlags::intxAtPut(name, &ivalue, MANAGEMENT);
+    succeed = CommandLineFlags::intxAtPut(name, &ivalue, Flag::MANAGEMENT);
   } else if (flag->is_uintx()) {
     uintx uvalue = (uintx)new_value.j;
-    succeed = CommandLineFlags::uintxAtPut(name, &uvalue, MANAGEMENT);
+    succeed = CommandLineFlags::uintxAtPut(name, &uvalue, Flag::MANAGEMENT);
   } else if (flag->is_uint64_t()) {
     uint64_t uvalue = (uint64_t)new_value.j;
-    succeed = CommandLineFlags::uint64_tAtPut(name, &uvalue, MANAGEMENT);
+    succeed = CommandLineFlags::uint64_tAtPut(name, &uvalue, Flag::MANAGEMENT);
   } else if (flag->is_ccstr()) {
     oop str = JNIHandles::resolve_external_guard(new_value.l);
     if (str == NULL) {
       THROW(vmSymbols::java_lang_NullPointerException());
     }
     ccstr svalue = java_lang_String::as_utf8_string(str);
-    succeed = CommandLineFlags::ccstrAtPut(name, &svalue, MANAGEMENT);
+    succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT);
   }
   assert(succeed, "Setting flag should succeed");
 JVM_END
--- a/hotspot/src/share/vm/services/memoryManager.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/memoryManager.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -45,7 +45,7 @@
 
 MemoryManager::MemoryManager() {
   _num_pools = 0;
-  _memory_mgr_obj = NULL;
+  (void)const_cast<instanceOop&>(_memory_mgr_obj = NULL);
 }
 
 void MemoryManager::add_pool(MemoryPool* pool) {
--- a/hotspot/src/share/vm/services/memoryPool.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/memoryPool.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -45,7 +45,7 @@
   _name = name;
   _initial_size = init_size;
   _max_size = max_size;
-  _memory_pool_obj = NULL;
+  (void)const_cast<instanceOop&>(_memory_pool_obj = NULL);
   _available_for_allocation = true;
   _num_managers = 0;
   _type = type;
--- a/hotspot/src/share/vm/services/memoryService.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/services/memoryService.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -515,7 +515,7 @@
 bool MemoryService::set_verbose(bool verbose) {
   MutexLocker m(Management_lock);
   // verbose will be set to the previous value
-  bool succeed = CommandLineFlags::boolAtPut((char*)"PrintGC", &verbose, MANAGEMENT);
+  bool succeed = CommandLineFlags::boolAtPut((char*)"PrintGC", &verbose, Flag::MANAGEMENT);
   assert(succeed, "Setting PrintGC flag fails");
   ClassLoadingService::reset_trace_class_unloading();
 
@@ -618,4 +618,3 @@
   MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime,
                         _recordGCEndTime, _countCollection, _cause);
 }
-
--- a/hotspot/src/share/vm/trace/trace.xml	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/trace/trace.xml	Fri Oct 11 09:17:18 2013 -0400
@@ -313,13 +313,6 @@
       <value type="UINT" field="zombifiedCount" label="Methods Zombified"/>
     </event>
 
-    <event id="CleanCodeCache" path="vm/code_sweeper/clean" label="Clean Code Cache"
-             description="Clean code cache from oldest methods"
-             has_thread="true" is_requestable="false" is_constant="false">
-      <value type="UINT" field="disconnectedCount" label="Methods Disconnected"/>
-      <value type="UINT" field="madeNonEntrantCount" label="Methods Made Non-Entrant"/>
-    </event>
-
     <!-- Code cache events -->
 
     <event id="CodeCacheFull" path="vm/code_cache/full" label="Code Cache Full"
--- a/hotspot/src/share/vm/utilities/array.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/utilities/array.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -353,9 +353,9 @@
   // sort the array.
   bool contains(const T& x) const      { return index_of(x) >= 0; }
 
-  T    at(int i) const                 { assert(i >= 0 && i< _length, err_msg_res("oob: 0 <= %d < %d", i, _length)); return _data[i]; }
-  void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, err_msg_res("oob: 0 <= %d < %d", i, _length)); _data[i] = x; }
-  T*   adr_at(const int i)             { assert(i >= 0 && i< _length, err_msg_res("oob: 0 <= %d < %d", i, _length)); return &_data[i]; }
+  T    at(int i) const                 { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); return _data[i]; }
+  void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); _data[i] = x; }
+  T*   adr_at(const int i)             { assert(i >= 0 && i< _length, err_msg("oob: 0 <= %d < %d", i, _length)); return &_data[i]; }
   int  find(const T& x)                { return index_of(x); }
 
   T at_acquire(const int which)              { return OrderAccess::load_acquire(adr_at(which)); }
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -967,9 +967,9 @@
 // (These must be implemented as #defines because C++ compilers are
 // not obligated to inline non-integral constants!)
 #define       badAddress        ((address)::badAddressVal)
-#define       badOop            ((oop)::badOopVal)
+#define       badOop            (cast_to_oop(::badOopVal))
 #define       badHeapWord       (::badHeapWordVal)
-#define       badJNIHandle      ((oop)::badJNIHandleVal)
+#define       badJNIHandle      (cast_to_oop(::badJNIHandleVal))
 
 // Default TaskQueue size is 16K (32-bit) or 128K (64-bit)
 #define TASKQUEUE_SIZE (NOT_LP64(1<<14) LP64_ONLY(1<<17))
--- a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -189,6 +189,10 @@
 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union (needed in windows.h)
 #pragma warning( disable : 4511 ) // copy constructor could not be generated
 #pragma warning( disable : 4291 ) // no matching operator delete found; memory will not be freed if initialization thows an exception
+#ifdef CHECK_UNHANDLED_OOPS
+#pragma warning( disable : 4521 ) // class has multiple copy ctors of a single type
+#pragma warning( disable : 4522 ) // class has multiple assignment operators of a single type
+#endif // CHECK_UNHANDLED_OOPS
 #if _MSC_VER >= 1400
 #pragma warning( disable : 4996 ) // unsafe string functions. Same as define _CRT_SECURE_NO_WARNINGS/_CRT_SECURE_NO_DEPRICATE
 #endif
--- a/hotspot/src/share/vm/utilities/hashtable.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -356,9 +356,9 @@
 template class Hashtable<Symbol*, mtSymbol>;
 template class Hashtable<Klass*, mtClass>;
 template class Hashtable<oop, mtClass>;
-#ifdef SOLARIS
+#if defined(SOLARIS) || defined(CHECK_UNHANDLED_OOPS)
 template class Hashtable<oop, mtSymbol>;
-#endif
+#endif // SOLARIS || CHECK_UNHANDLED_OOPS
 template class Hashtable<oopDesc*, mtSymbol>;
 template class Hashtable<Symbol*, mtClass>;
 template class HashtableEntry<Symbol*, mtSymbol>;
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp	Fri Oct 11 09:17:18 2013 -0400
@@ -322,11 +322,11 @@
   // Attempts to claim a task from the "local" end of the queue (the most
   // recently pushed).  If successful, returns true and sets t to the task;
   // otherwise, returns false (the queue is empty).
-  inline bool pop_local(E& t);
+  inline bool pop_local(volatile E& t);
 
   // Like pop_local(), but uses the "global" end of the queue (the least
   // recently pushed).
-  bool pop_global(E& t);
+  bool pop_global(volatile E& t);
 
   // Delete any resource associated with the queue.
   ~GenericTaskQueue();
@@ -424,7 +424,7 @@
 }
 
 template<class E, MEMFLAGS F, unsigned int N>
-bool GenericTaskQueue<E, F, N>::pop_global(E& t) {
+bool GenericTaskQueue<E, F, N>::pop_global(volatile E& t) {
   Age oldAge = _age.get();
   // Architectures with weak memory model require a barrier here
   // to guarantee that bottom is not older than age,
@@ -701,7 +701,7 @@
 }
 
 template<class E, MEMFLAGS F, unsigned int N> inline bool
-GenericTaskQueue<E, F, N>::pop_local(E& t) {
+GenericTaskQueue<E, F, N>::pop_local(volatile E& t) {
   uint localBot = _bottom;
   // This value cannot be N-1.  That can only occur as a result of
   // the assignment to bottom in this method.  If it does, this method
@@ -799,7 +799,7 @@
   }
   volatile ObjArrayTask&
   operator =(const volatile ObjArrayTask& t) volatile {
-    _obj = t._obj;
+    (void)const_cast<oop&>(_obj = t._obj);
     _index = t._index;
     return *this;
   }
--- a/hotspot/test/TEST.groups	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/TEST.groups	Fri Oct 11 09:17:18 2013 -0400
@@ -193,6 +193,7 @@
   serviceability/ \
   compiler/ \
   testlibrary/ \
+  testlibrary_tests/ \
   sanity/ \
   runtime/ \
   gc/ \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/CondTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 8024924
+ * @summary Test non constant addExact
+ * @compile CondTest.java Verify.java
+ * @run main CondTest
+ *
+ */
+
+import java.lang.ArithmeticException;
+
+public class CondTest {
+  public static int result = 0;
+
+  public static void main(String[] args) {
+    for (int i = 0; i < 50000; ++i) {
+      runTest();
+    }
+  }
+
+  public static void runTest() {
+    int i = 7;
+    while (java.lang.Math.addExact(i, result) < 89361) {
+        if ((java.lang.Math.addExact(i, i) & 1) == 1) {
+            i += 3;
+        } else if ((i & 5) == 4) {
+            i += 7;
+        } else if ((i & 0xf) == 6) {
+            i += 2;
+        } else {
+            i += 1;
+        }
+        result += 2;
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/ConstantTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 8024924
+ * @summary Test constant addExact
+ * @compile ConstantTest.java Verify.java
+ * @run main ConstantTest
+ *
+ */
+
+import java.lang.ArithmeticException;
+
+public class ConstantTest {
+  public static void main(String[] args) {
+    for (int i = 0; i < 50000; ++i) {
+      Verify.verify(5, 7);
+      Verify.verify(Integer.MAX_VALUE, 1);
+      Verify.verify(Integer.MIN_VALUE, -1);
+      Verify.verify(Integer.MAX_VALUE, -1);
+      Verify.verify(Integer.MIN_VALUE, 1);
+      Verify.verify(Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2);
+      Verify.verify(Integer.MAX_VALUE / 2, (Integer.MAX_VALUE / 2) + 3);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/LoadTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 8024924
+ * @summary Test non constant addExact
+ * @compile LoadTest.java Verify.java
+ * @run main LoadTest
+ *
+ */
+
+import java.lang.ArithmeticException;
+
+public class LoadTest {
+  public static java.util.Random rnd = new java.util.Random();
+  public static int[] values = new int[256];
+
+  public static void main(String[] args) {
+    for (int i = 0; i < values.length; ++i) {
+        values[i] = rnd.nextInt();
+    }
+
+    for (int i = 0; i < 50000; ++i) {
+      Verify.verify(values[i & 255], values[i & 255] - i);
+      Verify.verify(values[i & 255] + i, values[i & 255] - i);
+      Verify.verify(values[i & 255], values[i & 255]);
+      if ((i & 1) == 1 && i > 5) {
+          Verify.verify(values[i & 255] + i, values[i & 255] - i);
+      } else {
+          Verify.verify(values[i & 255] - i, values[i & 255] + i);
+      }
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/LoopDependentTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8024924
+ * @summary Test non constant addExact
+ * @compile LoopDependentTest.java Verify.java
+ * @run main LoopDependentTest
+ *
+ */
+
+import java.lang.ArithmeticException;
+
+public class LoopDependentTest {
+  public static java.util.Random rnd = new java.util.Random();
+
+  public static void main(String[] args) {
+    int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt();
+    for (int i = 0; i < 50000; ++i) {
+      Verify.verify(rnd1 + i, rnd2 + i);
+      Verify.verify(rnd1 + i, rnd2 + (i & 0xff));
+      Verify.verify(rnd1 - i, rnd2 - (i & 0xff));
+      Verify.verify(rnd1 + i + 1, rnd2 + i + 2);
+      Verify.verify(rnd1 + i * 2, rnd2 + i);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/NonConstantTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8024924
+ * @summary Test non constant addExact
+ * @compile NonConstantTest.java Verify.java
+ * @run main NonConstantTest
+ *
+ */
+
+import java.lang.ArithmeticException;
+
+public class NonConstantTest {
+  public static java.util.Random rnd = new java.util.Random();
+
+  public static void main(String[] args) {
+    for (int i = 0; i < 50000; ++i) {
+      int rnd1 = rnd.nextInt(), rnd2 = rnd.nextInt();
+      Verify.verify(rnd1, rnd2);
+      Verify.verify(rnd1, rnd2 + 1);
+      Verify.verify(rnd1 + 1, rnd2);
+      Verify.verify(rnd1 - 1, rnd2);
+      Verify.verify(rnd1, rnd2 - 1);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/Verify.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+public class Verify {
+  public static String throwWord(boolean threw) {
+    return (threw ? "threw" : "didn't throw");
+  }
+
+  public static void verify(int a, int b) {
+    boolean exception1 = false, exception2 = false;
+    int result1 = 0, result2 = 0;
+    try {
+      result1 = testIntrinsic(a, b);
+    } catch (ArithmeticException e) {
+      exception1 = true;
+    }
+    try {
+      result2 = testNonIntrinsic(a, b);
+    } catch (ArithmeticException e) {
+      exception2 = true;
+    }
+
+    if (exception1 != exception2) {
+      throw new RuntimeException("Intrinsic version " + throwWord(exception1) + " exception, NonIntrinsic version " + throwWord(exception2) + " for: " + a + " + " + b);
+    }
+    if (result1 != result2) {
+      throw new RuntimeException("Intrinsic version returned: " + a + " while NonIntrinsic version returned: " + b);
+    }
+  }
+
+  public static int testIntrinsic(int a, int b) {
+    return java.lang.Math.addExact(a, b);
+  }
+
+  public static int testNonIntrinsic(int a, int b) {
+    return safeAddExact(a, b);
+  }
+
+  // Copied java.lang.Math.addExact to avoid intrinsification
+  public static int safeAddExact(int x, int y) {
+    int r = x + y;
+    // HD 2-12 Overflow iff both arguments have the opposite sign of the result
+    if (((x ^ r) & (y ^ r)) < 0) {
+      throw new ArithmeticException("integer overflow");
+    }
+    return r;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ *
+ */
+
+/**
+ * A minimal classloader for loading bytecodes that could not result from
+ * properly compiled Java.
+ *
+ * @author dr2chase
+ */
+public class ByteClassLoader extends ClassLoader {
+    /**
+     * (pre)load class name using classData for the definition.
+     *
+     * @param name
+     * @param classData
+     * @return
+     */
+    public Class<?> loadBytes(String name, byte[] classData) {
+         Class<?> clazz = defineClass(name, classData, 0, classData.length);
+                     resolveClass(clazz);
+         return clazz;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/C.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ *
+ */
+
+/**
+ * Test class -- implements I, which provides default for m, but this class
+ * declares it abstract which (should) hide the interface default, and throw
+ * an abstract method error if it is called (calling it requires bytecode hacking
+ * or inconsistent compilation).
+ */
+public abstract class C implements I {
+       public abstract int m();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/I.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+public interface I {
+    default public int m() { return 1; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Handle;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+
+/**
+ * @test
+ * @bug 8025260
+ * @summary Ensure that AbstractMethodError is thrown, not NullPointerException, through MethodHandles::jump_from_method_handle code path
+ *
+ * @compile -XDignore.symbol.file ByteClassLoader.java I.java C.java TestAMEnotNPE.java
+ * @run main/othervm TestAMEnotNPE
+ */
+
+public class TestAMEnotNPE implements Opcodes {
+
+    /**
+     * The bytes for D, a NOT abstract class extending abstract class C
+     * without supplying an implementation for abstract method m.
+     * There is a default method in the interface I, but it should lose to
+     * the abstract class.
+
+     class D extends C {
+        D() { super(); }
+        // does not define m
+     }
+
+     * @return
+     * @throws Exception
+     */
+    public static byte[] bytesForD() throws Exception {
+
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
+        MethodVisitor mv;
+
+        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "D", null, "C", null);
+
+        {
+            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "C", "<init>", "()V");
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(0, 0);
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+
+        return cw.toByteArray();
+    }
+
+
+    /**
+     * The bytecodes for an invokeExact of a particular methodHandle, I.m, invoked on a D
+
+        class T {
+           T() { super(); } // boring constructor
+           int test() {
+              MethodHandle mh = `I.m():int`;
+              D d = new D();
+              return mh.invokeExact(d); // Should explode here, AbstractMethodError
+           }
+        }
+
+     * @return
+     * @throws Exception
+     */
+    public static byte[] bytesForT() throws Exception {
+
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
+        MethodVisitor mv;
+
+        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "T", null, "java/lang/Object", null);
+        {
+            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(0,0);
+            mv.visitEnd();
+        }
+        {
+            mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "test", "()I", null, null);
+            mv.visitCode();
+            mv.visitLdcInsn(new Handle(Opcodes.H_INVOKEINTERFACE, "I", "m", "()I"));
+            mv.visitTypeInsn(NEW, "D");
+            mv.visitInsn(DUP);
+            mv.visitMethodInsn(INVOKESPECIAL, "D", "<init>", "()V");
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invokeExact", "(LI;)I");
+            mv.visitInsn(IRETURN);
+            mv.visitMaxs(0,0);
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    public static void main(String args[] ) throws Throwable {
+        ByteClassLoader bcl = new ByteClassLoader();
+        Class<?> d = bcl.loadBytes("D", bytesForD());
+        Class<?> t = bcl.loadBytes("T", bytesForT());
+        try {
+          Object result = t.getMethod("test").invoke(null);
+          System.out.println("Expected AbstractMethodError wrapped in InvocationTargetException, saw no exception");
+          throw new Error("Missing expected exception");
+        } catch (InvocationTargetException e) {
+            Throwable th = e.getCause();
+            if (th instanceof AbstractMethodError) {
+                th.printStackTrace(System.out);
+                System.out.println("PASS, saw expected exception (AbstractMethodError, wrapped in InvocationTargetException).");
+            } else {
+                System.out.println("Expected AbstractMethodError wrapped in InvocationTargetException, saw " + th);
+                throw th;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/print/PrintInlining.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8022585
+ * @summary VM crashes when ran with -XX:+PrintInlining
+ * @run main/othervm -Xcomp -XX:+PrintInlining PrintInlining
+ *
+ */
+
+public class PrintInlining {
+  public static void main(String[] args) {
+    System.out.println("Passed");
+  }
+}
--- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -74,6 +74,9 @@
     protected static final int THRESHOLD;
     /** count of invocation to triger OSR compilation */
     protected static final long BACKEDGE_THRESHOLD;
+    /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
+    protected static final String MODE
+            = System.getProperty("java.vm.info");
 
     static {
         if (TIERED_COMPILATION) {
@@ -202,7 +205,7 @@
         if (WHITE_BOX.getMethodCompilationLevel(method, true) != 0) {
             throw new RuntimeException(method + " osr_comp_level must be == 0");
         }
-    }
+   }
 
     /**
      * Checks, that {@linkplain #method} is compiled.
--- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -53,6 +53,12 @@
      */
     @Override
     protected void test() throws Exception {
+        if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith(
+                "compiled ")) {
+          System.err.printf("Warning: %s is not applicable in %s%n",
+                testCase.name(), CompilerWhiteBoxTest.MODE);
+          return;
+        }
         compile();
         checkCompiled();
         WHITE_BOX.deoptimizeAll();
--- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -53,6 +53,12 @@
      */
     @Override
     protected void test() throws Exception {
+        if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith(
+                "compiled ")) {
+          System.err.printf("Warning: %s is not applicable in %s%n",
+                testCase.name(), CompilerWhiteBoxTest.MODE);
+          return;
+        }
         compile();
         checkCompiled();
         deoptimize();
--- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -70,12 +70,10 @@
 
         int compLevel = getCompLevel();
         int bci = WHITE_BOX.getMethodEntryBci(method);
-        System.out.println("bci = " + bci);
-        printInfo();
         deoptimize();
-        printInfo();
         checkNotCompiled();
-        printInfo();
+        WHITE_BOX.clearMethodState(method);
+
         WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci);
         checkCompiled();
         deoptimize();
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -68,6 +68,12 @@
      */
     @Override
     protected void test() throws Exception {
+        if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith(
+                "compiled ")) {
+          System.err.printf("Warning: %s is not applicable in %s%n",
+                testCase.name(), CompilerWhiteBoxTest.MODE);
+          return;
+        }
         if (!isCompilable()) {
             throw new RuntimeException(method + " must be compilable");
         }
--- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -62,6 +62,12 @@
      */
     @Override
     protected void test() throws Exception {
+        if (testCase.isOsr && CompilerWhiteBoxTest.MODE.startsWith(
+                "compiled ")) {
+          System.err.printf("Warning: %s is not applicable in %s%n",
+                testCase.name(), CompilerWhiteBoxTest.MODE);
+          return;
+        }
         checkNotCompiled();
         if (!isCompilable()) {
             throw new RuntimeException(method + " must be compilable");
--- a/hotspot/test/gc/g1/TestSummarizeRSetStats.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStats.java	Fri Oct 11 09:17:18 2013 -0400
@@ -25,140 +25,61 @@
  * @test TestSummarizeRSetStats.java
  * @bug 8013895
  * @library /testlibrary
- * @build TestSummarizeRSetStats
+ * @build TestSummarizeRSetStatsTools TestSummarizeRSetStats
  * @summary Verify output of -XX:+G1SummarizeRSetStats
  * @run main TestSummarizeRSetStats
  *
  * Test the output of G1SummarizeRSetStats in conjunction with G1SummarizeRSetStatsPeriod.
  */
 
-import com.oracle.java.testlibrary.*;
-import java.lang.Thread;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-class RunSystemGCs {
-    // 4M size, both are directly allocated into the old gen
-    static Object[] largeObject1 = new Object[1024 * 1024];
-    static Object[] largeObject2 = new Object[1024 * 1024];
-
-    static int[] temp;
-
-    public static void main(String[] args) {
-        // create some cross-references between these objects
-        for (int i = 0; i < largeObject1.length; i++) {
-            largeObject1[i] = largeObject2;
-        }
-
-        for (int i = 0; i < largeObject2.length; i++) {
-            largeObject2[i] = largeObject1;
-        }
-
-        int numGCs = Integer.parseInt(args[0]);
-
-        if (numGCs > 0) {
-            // try to force a minor collection: the young gen is 4M, the
-            // amount of data allocated below is roughly that (4*1024*1024 +
-            // some header data)
-            for (int i = 0; i < 1024 ; i++) {
-                temp = new int[1024];
-            }
-        }
-
-        for (int i = 0; i < numGCs - 1; i++) {
-            System.gc();
-        }
-    }
-}
-
 public class TestSummarizeRSetStats {
 
-    public static String runTest(String[] additionalArgs, int numGCs) throws Exception {
-        ArrayList<String> finalargs = new ArrayList<String>();
-        String[] defaultArgs = new String[] {
-            "-XX:+UseG1GC",
-            "-Xmn4m",
-            "-Xmx20m",
-            "-XX:InitiatingHeapOccupancyPercent=100", // we don't want the additional GCs due to initial marking
-            "-XX:+PrintGC",
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:G1HeapRegionSize=1M",
-        };
-
-        finalargs.addAll(Arrays.asList(defaultArgs));
-
-        if (additionalArgs != null) {
-            finalargs.addAll(Arrays.asList(additionalArgs));
-        }
-
-        finalargs.add(RunSystemGCs.class.getName());
-        finalargs.add(String.valueOf(numGCs));
-
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            finalargs.toArray(new String[0]));
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-        output.shouldHaveExitValue(0);
-
-        String result = output.getStdout();
-        return result;
-    }
-
-    private static void expectStatistics(String result, int expectedCumulative, int expectedPeriodic) throws Exception {
-        int actualTotal = result.split("Concurrent RS processed").length - 1;
-        int actualCumulative = result.split("Cumulative RS summary").length - 1;
-
-        if (expectedCumulative != actualCumulative) {
-            throw new Exception("Incorrect amount of RSet summaries at the end. Expected " + expectedCumulative + ", got " + actualCumulative);
-        }
-
-        if (expectedPeriodic != (actualTotal - actualCumulative)) {
-            throw new Exception("Incorrect amount of per-period RSet summaries at the end. Expected " + expectedPeriodic + ", got " + (actualTotal - actualCumulative));
-        }
-    }
-
     public static void main(String[] args) throws Exception {
         String result;
 
-        // no RSet statistics output
-        result = runTest(null, 0);
-        expectStatistics(result, 0, 0);
+        if (!TestSummarizeRSetStatsTools.testingG1GC()) {
+            return;
+        }
 
-        // no RSet statistics output
-        result = runTest(null, 2);
-        expectStatistics(result, 0, 0);
+        // no remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(null, 0);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 0, 0);
 
-        // no RSet statistics output
-        result = runTest(new String[] { "-XX:G1SummarizeRSetStatsPeriod=1" }, 3);
-        expectStatistics(result, 0, 0);
+        // no remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(null, 2);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 0, 0);
 
-        // single RSet statistics output at the end
-        result = runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 0);
-        expectStatistics(result, 1, 0);
+        // no remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:G1SummarizeRSetStatsPeriod=1" }, 3);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 0, 0);
 
-        // single RSet statistics output at the end
-        result = runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 2);
-        expectStatistics(result, 1, 0);
+        // single remembered set summary output at the end
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 0);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 0);
 
-        // single RSet statistics output
-        result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 0);
-        expectStatistics(result, 1, 0);
+        // single remembered set summary output at the end
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 2);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 0);
 
-        // two times RSet statistics output
-        result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 1);
-        expectStatistics(result, 1, 1);
+        // single remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 0);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 0);
+
+        // two times remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 1);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 2);
 
-        // four times RSet statistics output
-        result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 3);
-        expectStatistics(result, 1, 3);
+        // four times remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 3);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 6);
 
-        // three times RSet statistics output
-        result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=2" }, 3);
-        expectStatistics(result, 1, 2);
+        // three times remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=2" }, 3);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 4);
 
-        // single RSet statistics output
-        result = runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=100" }, 3);
-        expectStatistics(result, 1, 1);
+        // single remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=100" }, 3);
+        TestSummarizeRSetStatsTools.expectRSetSummaries(result, 1, 2);
     }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 TestSummarizeRSetStatsPerRegion.java
+ * @bug 8014078
+ * @library /testlibrary
+ * @build TestSummarizeRSetStatsTools TestSummarizeRSetStatsPerRegion
+ * @summary Verify output of -XX:+G1SummarizeRSetStats in regards to per-region type output
+ * @run main TestSummarizeRSetStatsPerRegion
+ */
+
+import com.oracle.java.testlibrary.*;
+import java.lang.Thread;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class TestSummarizeRSetStatsPerRegion {
+
+    public static void main(String[] args) throws Exception {
+        String result;
+
+        if (!TestSummarizeRSetStatsTools.testingG1GC()) {
+            return;
+        }
+
+        // single remembered set summary output at the end
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats" }, 0);
+        TestSummarizeRSetStatsTools.expectPerRegionRSetSummaries(result, 1, 0);
+
+        // two times remembered set summary output
+        result = TestSummarizeRSetStatsTools.runTest(new String[] { "-XX:+G1SummarizeRSetStats", "-XX:G1SummarizeRSetStatsPeriod=1" }, 1);
+        TestSummarizeRSetStatsTools.expectPerRegionRSetSummaries(result, 1, 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestSummarizeRSetStatsThreads
+ * @bug 8025441
+ * @summary Ensure that various values of worker threads/concurrent
+ * refinement threads do not crash the VM.
+ * @key gc
+ * @library /testlibrary
+ */
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.oracle.java.testlibrary.ProcessTools;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+public class TestSummarizeRSetStatsThreads {
+
+  private static void runTest(int refinementThreads, int workerThreads) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                                              "-XX:+UnlockDiagnosticVMOptions",
+                                                              "-XX:+G1SummarizeRSetStats",
+                                                              "-XX:G1ConcRefinementThreads=" + refinementThreads,
+                                                              "-XX:ParallelGCThreads=" + workerThreads,
+                                                              "-version");
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+    // check output to contain the string "Concurrent RS threads times (s)" followed by
+    // the correct number of values in the next line.
+
+    // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
+    // Additionally use at least one thread.
+    int expectedNumRefinementThreads = refinementThreads == 0 ? workerThreads : refinementThreads;
+    expectedNumRefinementThreads = Math.max(1, expectedNumRefinementThreads);
+    // create the pattern made up of n copies of a floating point number pattern
+    String numberPattern = String.format("%0" + expectedNumRefinementThreads + "d", 0)
+      .replace("0", "\\s+\\d+\\.\\d+");
+    String pattern = "Concurrent RS threads times \\(s\\)$" + numberPattern + "$";
+    Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
+
+    if (!m.find()) {
+      throw new Exception("Could not find correct output for concurrent RS threads times in stdout," +
+        " should match the pattern \"" + pattern + "\", but stdout is \n" + output.getStdout());
+    }
+    output.shouldHaveExitValue(0);
+  }
+
+  public static void main(String[] args) throws Exception {
+    if (!TestSummarizeRSetStatsTools.testingG1GC()) {
+      return;
+    }
+    // different valid combinations of number of refinement and gc worker threads
+    runTest(0, 0);
+    runTest(0, 5);
+    runTest(5, 0);
+    runTest(10, 10);
+    runTest(1, 2);
+    runTest(4, 3);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+
+/*
+ * Common helpers for TestSummarizeRSetStats* tests
+ */
+
+import sun.management.ManagementFactoryHelper;
+import com.sun.management.HotSpotDiagnosticMXBean;
+import com.sun.management.VMOption;
+
+import com.oracle.java.testlibrary.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.lang.Thread;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+class VerifySummaryOutput {
+    // 4M size, both are directly allocated into the old gen
+    static Object[] largeObject1 = new Object[1024 * 1024];
+    static Object[] largeObject2 = new Object[1024 * 1024];
+
+    static int[] temp;
+
+    public static void main(String[] args) {
+        // create some cross-references between these objects
+        for (int i = 0; i < largeObject1.length; i++) {
+            largeObject1[i] = largeObject2;
+        }
+
+        for (int i = 0; i < largeObject2.length; i++) {
+            largeObject2[i] = largeObject1;
+        }
+
+        int numGCs = Integer.parseInt(args[0]);
+
+        if (numGCs > 0) {
+            // try to force a minor collection: the young gen is 4M, the
+            // amount of data allocated below is roughly that (4*1024*1024 +
+            // some header data)
+            for (int i = 0; i < 1024 ; i++) {
+                temp = new int[1024];
+            }
+        }
+
+        for (int i = 0; i < numGCs - 1; i++) {
+            System.gc();
+        }
+    }
+}
+
+public class TestSummarizeRSetStatsTools {
+
+    // the VM is currently run using G1GC, i.e. trying to test G1 functionality.
+    public static boolean testingG1GC() {
+        HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+
+        VMOption option = diagnostic.getVMOption("UseG1GC");
+        if (option.getValue().equals("false")) {
+          System.out.println("Skipping this test. It is only a G1 test.");
+          return false;
+        }
+        return true;
+    }
+
+    public static String runTest(String[] additionalArgs, int numGCs) throws Exception {
+        ArrayList<String> finalargs = new ArrayList<String>();
+        String[] defaultArgs = new String[] {
+            "-XX:+UseG1GC",
+            "-XX:+UseCompressedOops",
+            "-Xmn4m",
+            "-Xmx20m",
+            "-XX:InitiatingHeapOccupancyPercent=100", // we don't want the additional GCs due to initial marking
+            "-XX:+PrintGC",
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:G1HeapRegionSize=1M",
+        };
+
+        finalargs.addAll(Arrays.asList(defaultArgs));
+
+        if (additionalArgs != null) {
+            finalargs.addAll(Arrays.asList(additionalArgs));
+        }
+
+        finalargs.add(VerifySummaryOutput.class.getName());
+        finalargs.add(String.valueOf(numGCs));
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            finalargs.toArray(new String[0]));
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+        output.shouldHaveExitValue(0);
+
+        String result = output.getStdout();
+        return result;
+    }
+
+    private static void checkCounts(int expected, int actual, String which) throws Exception {
+        if (expected != actual) {
+            throw new Exception("RSet summaries mention " + which + " regions an incorrect number of times. Expected " + expected + ", got " + actual);
+        }
+    }
+
+    public static void expectPerRegionRSetSummaries(String result, int expectedCumulative, int expectedPeriodic) throws Exception {
+        expectRSetSummaries(result, expectedCumulative, expectedPeriodic);
+        int actualYoung = result.split("Young regions").length - 1;
+        int actualHumonguous = result.split("Humonguous regions").length - 1;
+        int actualFree = result.split("Free regions").length - 1;
+        int actualOther = result.split("Old regions").length - 1;
+
+        // the strings we check for above are printed four times per summary
+        int expectedPerRegionTypeInfo = (expectedCumulative + expectedPeriodic) * 4;
+
+        checkCounts(expectedPerRegionTypeInfo, actualYoung, "Young");
+        checkCounts(expectedPerRegionTypeInfo, actualHumonguous, "Humonguous");
+        checkCounts(expectedPerRegionTypeInfo, actualFree, "Free");
+        checkCounts(expectedPerRegionTypeInfo, actualOther, "Old");
+    }
+
+    public static void expectRSetSummaries(String result, int expectedCumulative, int expectedPeriodic) throws Exception {
+        int actualTotal = result.split("concurrent refinement").length - 1;
+        int actualCumulative = result.split("Cumulative RS summary").length - 1;
+
+        if (expectedCumulative != actualCumulative) {
+            throw new Exception("Incorrect amount of RSet summaries at the end. Expected " + expectedCumulative + ", got " + actualCumulative);
+        }
+
+        if (expectedPeriodic != (actualTotal - actualCumulative)) {
+            throw new Exception("Incorrect amount of per-period RSet summaries at the end. Expected " + expectedPeriodic + ", got " + (actualTotal - actualCumulative));
+        }
+    }
+}
+
--- a/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java	Fri Oct 11 09:17:18 2013 -0400
@@ -107,7 +107,6 @@
     Loader f_loader = new Loader(b_name, b_bytes, a_name, a_loader);
     Loader g_loader = new Loader(b_name, b_bytes, a_name, a_loader);
 
-    byte[] b = new byte[20 * 2 << 20];
     Class<?> c;
     c = b_loader.loadClass(b_name);
     c = c_loader.loadClass(b_name);
--- a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java	Fri Oct 11 09:17:18 2013 -0400
@@ -29,10 +29,11 @@
 
 /* @test TestPerfCountersAndMemoryPools
  * @bug 8023476
+ * @library /testlibrary
  * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
  *          report the same data.
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData TestPerfCountersAndMemoryPools
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData TestPerfCountersAndMemoryPools
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools
  */
 public class TestPerfCountersAndMemoryPools {
     public static void main(String[] args) throws Exception {
@@ -43,11 +44,11 @@
         }
     }
 
-    private static MemoryUsage getMemoryUsage(String memoryPoolName) {
+    private static MemoryPoolMXBean getMemoryPool(String memoryPoolName) {
         List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
         for (MemoryPoolMXBean pool : pools) {
             if (pool.getName().equals(memoryPoolName)) {
-                return pool.getUsage();
+                return pool;
             }
         }
 
@@ -57,19 +58,18 @@
 
     private static void checkMemoryUsage(String memoryPoolName, String perfNS)
         throws Exception {
-        // Need to do a gc before each comparison to update the perf counters
+        MemoryPoolMXBean pool = getMemoryPool(memoryPoolName);
 
-        System.gc();
-        MemoryUsage mu = getMemoryUsage(memoryPoolName);
-        assertEQ(getMinCapacity(perfNS), mu.getInit());
-
+        // Must do a GC to update performance counters
         System.gc();
-        mu = getMemoryUsage(memoryPoolName);
-        assertEQ(getUsed(perfNS), mu.getUsed());
+        assertEQ(getMinCapacity(perfNS), pool.getUsage().getInit());
 
+        // Must do a second GC to update the perfomance counters again, since
+        // the call pool.getUsage().getInit() could have allocated some
+        // metadata.
         System.gc();
-        mu = getMemoryUsage(memoryPoolName);
-        assertEQ(getCapacity(perfNS), mu.getCommitted());
+        assertEQ(getUsed(perfNS), pool.getUsage().getUsed());
+        assertEQ(getCapacity(perfNS), pool.getUsage().getCommitted());
     }
 
     private static long getMinCapacity(String ns) throws Exception {
--- a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,16 +33,9 @@
 
 public class XShareAuto {
     public static void main(String[] args) throws Exception {
-        if (!Platform.is64bit()) {
-            System.out.println("ObjectAlignmentInBytes for CDS is only " +
-                "supported on 64bit platforms; this plaform is " +
-                System.getProperty("sun.arch.data.model"));
-            System.out.println("Skipping the test");
-            return;
-        }
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa",
-            "-Xshare:dump");
+            "-server", "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump");
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
         output.shouldContain("Loading classes to share");
         output.shouldHaveExitValue(0);
--- a/hotspot/test/testlibrary/AssertsTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import static com.oracle.java.testlibrary.Asserts.*;
-
-/* @test
- * @summary Tests the different assertions in the Assert class
- * @library /testlibrary
- */
-public class AssertsTest {
-    private static class Foo implements Comparable<Foo> {
-        final int id;
-        public Foo(int id) {
-            this.id = id;
-        }
-
-        public int compareTo(Foo f) {
-            return new Integer(id).compareTo(new Integer(f.id));
-        }
-    }
-
-    public static void main(String[] args) throws Exception {
-        testLessThan();
-        testLessThanOrEqual();
-        testEquals();
-        testGreaterThanOrEqual();
-        testGreaterThan();
-        testNotEquals();
-        testNull();
-        testNotNull();
-        testTrue();
-        testFalse();
-    }
-
-    private static void testLessThan() throws Exception {
-        expectPass(Assertion.LT, 1, 2);
-
-        expectFail(Assertion.LT, 2, 2);
-        expectFail(Assertion.LT, 2, 1);
-        expectFail(Assertion.LT, null, 2);
-        expectFail(Assertion.LT, 2, null);
-    }
-
-    private static void testLessThanOrEqual() throws Exception {
-        expectPass(Assertion.LTE, 1, 2);
-        expectPass(Assertion.LTE, 2, 2);
-
-        expectFail(Assertion.LTE, 3, 2);
-        expectFail(Assertion.LTE, null, 2);
-        expectFail(Assertion.LTE, 2, null);
-    }
-
-    private static void testEquals() throws Exception {
-        expectPass(Assertion.EQ, 1, 1);
-        expectPass(Assertion.EQ, null, null);
-
-        Foo f1 = new Foo(1);
-        expectPass(Assertion.EQ, f1, f1);
-
-        Foo f2 = new Foo(1);
-        expectFail(Assertion.EQ, f1, f2);
-        expectFail(Assertion.LTE, null, 2);
-        expectFail(Assertion.LTE, 2, null);
-    }
-
-    private static void testGreaterThanOrEqual() throws Exception {
-        expectPass(Assertion.GTE, 1, 1);
-        expectPass(Assertion.GTE, 2, 1);
-
-        expectFail(Assertion.GTE, 1, 2);
-        expectFail(Assertion.GTE, null, 2);
-        expectFail(Assertion.GTE, 2, null);
-    }
-
-    private static void testGreaterThan() throws Exception {
-        expectPass(Assertion.GT, 2, 1);
-
-        expectFail(Assertion.GT, 1, 1);
-        expectFail(Assertion.GT, 1, 2);
-        expectFail(Assertion.GT, null, 2);
-        expectFail(Assertion.GT, 2, null);
-    }
-
-    private static void testNotEquals() throws Exception {
-        expectPass(Assertion.NE, null, 1);
-        expectPass(Assertion.NE, 1, null);
-
-        Foo f1 = new Foo(1);
-        Foo f2 = new Foo(1);
-        expectPass(Assertion.NE, f1, f2);
-
-        expectFail(Assertion.NE, null, null);
-        expectFail(Assertion.NE, f1, f1);
-        expectFail(Assertion.NE, 1, 1);
-    }
-
-    private static void testNull() throws Exception {
-        expectPass(Assertion.NULL, null);
-
-        expectFail(Assertion.NULL, 1);
-    }
-
-    private static void testNotNull() throws Exception {
-        expectPass(Assertion.NOTNULL, 1);
-
-        expectFail(Assertion.NOTNULL, null);
-    }
-
-    private static void testTrue() throws Exception {
-        expectPass(Assertion.TRUE, true);
-
-        expectFail(Assertion.TRUE, false);
-    }
-
-    private static void testFalse() throws Exception {
-        expectPass(Assertion.FALSE, false);
-
-        expectFail(Assertion.FALSE, true);
-    }
-
-    private static <T extends Comparable<T>> void expectPass(Assertion assertion, T ... args)
-        throws Exception {
-        Assertion.run(assertion, args);
-    }
-
-    private static <T extends Comparable<T>> void expectFail(Assertion assertion, T ... args)
-        throws Exception {
-        try {
-            Assertion.run(assertion, args);
-        } catch (RuntimeException e) {
-            return;
-        }
-        throw new Exception("Expected " + Assertion.format(assertion, (Object[]) args) +
-                            " to throw a RuntimeException");
-    }
-
-}
-
-enum Assertion {
-    LT, LTE, EQ, GTE, GT, NE, NULL, NOTNULL, FALSE, TRUE;
-
-    public static <T extends Comparable<T>> void run(Assertion assertion, T ... args) {
-        String msg = "Expected " + format(assertion, args) + " to pass";
-        switch (assertion) {
-            case LT:
-                assertLessThan(args[0], args[1], msg);
-                break;
-            case LTE:
-                assertLessThanOrEqual(args[0], args[1], msg);
-                break;
-            case EQ:
-                assertEquals(args[0], args[1], msg);
-                break;
-            case GTE:
-                assertGreaterThanOrEqual(args[0], args[1], msg);
-                break;
-            case GT:
-                assertGreaterThan(args[0], args[1], msg);
-                break;
-            case NE:
-                assertNotEquals(args[0], args[1], msg);
-                break;
-            case NULL:
-                assertNull(args == null ? args : args[0], msg);
-                break;
-            case NOTNULL:
-                assertNotNull(args == null ? args : args[0], msg);
-                break;
-            case FALSE:
-                assertFalse((Boolean) args[0], msg);
-                break;
-            case TRUE:
-                assertTrue((Boolean) args[0], msg);
-                break;
-            default:
-                // do nothing
-        }
-    }
-
-    public static String format(Assertion assertion, Object ... args) {
-        switch (assertion) {
-            case LT:
-                return asString("assertLessThan", args);
-            case LTE:
-                return asString("assertLessThanOrEqual", args);
-            case EQ:
-                return asString("assertEquals", args);
-            case GTE:
-                return asString("assertGreaterThanOrEquals", args);
-            case GT:
-                return asString("assertGreaterThan", args);
-            case NE:
-                return asString("assertNotEquals", args);
-            case NULL:
-                return asString("assertNull", args);
-            case NOTNULL:
-                return asString("assertNotNull", args);
-            case FALSE:
-                return asString("assertFalse", args);
-            case TRUE:
-                return asString("assertTrue", args);
-            default:
-                return "";
-        }
-    }
-
-    private static String asString(String assertion, Object ... args) {
-        if (args == null) {
-            return String.format("%s(null)", assertion);
-        }
-        if (args.length == 1) {
-            return String.format("%s(%s)", assertion, args[0]);
-        } else {
-            return String.format("%s(%s, %s)", assertion, args[0], args[1]);
-        }
-    }
-}
--- a/hotspot/test/testlibrary/OutputAnalyzerReportingTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
- * @test
- * @summary Test the OutputAnalyzer reporting functionality,
- *     such as printing additional diagnostic info
- *     (exit code, stdout, stderr, command line, etc.)
- * @library /testlibrary
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-
-public class OutputAnalyzerReportingTest {
-
-    public static void main(String[] args) throws Exception {
-        // Create the output analyzer under test
-        String stdout = "aaaaaa";
-        String stderr = "bbbbbb";
-        OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
-
-        // Expected summary values should be the same for all cases,
-        // since the outputAnalyzer object is the same
-        String expectedExitValue = "-1";
-        String expectedSummary =
-                " stdout: [" + stdout + "];\n" +
-                " stderr: [" + stderr + "]\n" +
-                " exitValue = " + expectedExitValue + "\n";
-
-
-        DiagnosticSummaryTestRunner testRunner =
-                new DiagnosticSummaryTestRunner();
-
-        // should have exit value
-        testRunner.init(expectedSummary);
-        int unexpectedExitValue = 2;
-        try {
-            output.shouldHaveExitValue(unexpectedExitValue);
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should not contain
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldNotContain(stdout);
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should contain
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldContain("unexpected-stuff");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should not match
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldNotMatch("[a]");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-        // should match
-        testRunner.init(expectedSummary);
-        try {
-            output.shouldMatch("[qwerty]");
-        } catch (RuntimeException e) { }
-        testRunner.closeAndCheckResults();
-
-    }
-
-    private static class DiagnosticSummaryTestRunner {
-        private ByteArrayOutputStream byteStream =
-                new ByteArrayOutputStream(10000);
-
-        private String expectedSummary = "";
-        private PrintStream errStream;
-
-
-        public void init(String expectedSummary) {
-            this.expectedSummary = expectedSummary;
-            byteStream.reset();
-            errStream = new PrintStream(byteStream);
-            System.setErr(errStream);
-        }
-
-        public void closeAndCheckResults() {
-            // check results
-            errStream.close();
-            String stdErrStr = byteStream.toString();
-            if (!stdErrStr.contains(expectedSummary)) {
-                throw new RuntimeException("The output does not contain "
-                    + "the diagnostic message, or the message is incorrect");
-            }
-        }
-    }
-
-}
--- a/hotspot/test/testlibrary/OutputAnalyzerTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary Test the OutputAnalyzer utility class
- * @library /testlibrary
- */
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-
-public class OutputAnalyzerTest {
-
-  public static void main(String args[]) throws Exception {
-
-    String stdout = "aaaaaa";
-    String stderr = "bbbbbb";
-
-    // Regexps used for testing pattern matching of the test input
-    String stdoutPattern = "[a]";
-    String stderrPattern = "[b]";
-    String nonExistingPattern = "[c]";
-
-    OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
-
-    if (!stdout.equals(output.getStdout())) {
-      throw new Exception("getStdout() returned '" + output.getStdout() + "', expected '" + stdout + "'");
-    }
-
-    if (!stderr.equals(output.getStderr())) {
-      throw new Exception("getStderr() returned '" + output.getStderr() + "', expected '" + stderr + "'");
-    }
-
-    try {
-      output.shouldContain(stdout);
-      output.stdoutShouldContain(stdout);
-      output.shouldContain(stderr);
-      output.stderrShouldContain(stderr);
-    } catch (RuntimeException e) {
-      throw new Exception("shouldContain() failed", e);
-    }
-
-    try {
-      output.shouldContain("cccc");
-      throw new Exception("shouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-      output.stdoutShouldContain(stderr);
-      throw new Exception("stdoutShouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-      output.stderrShouldContain(stdout);
-      throw new Exception("stdoutShouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-      output.shouldNotContain("cccc");
-      output.stdoutShouldNotContain("cccc");
-      output.stderrShouldNotContain("cccc");
-    } catch (RuntimeException e) {
-      throw new Exception("shouldNotContain() failed", e);
-    }
-
-    try {
-      output.shouldNotContain(stdout);
-      throw new Exception("shouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-      output.stdoutShouldNotContain(stdout);
-      throw new Exception("shouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-      // expected
-    }
-
-    try {
-        output.stderrShouldNotContain(stderr);
-        throw new Exception("shouldContain() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    // Should match
-    try {
-        output.shouldMatch(stdoutPattern);
-        output.stdoutShouldMatch(stdoutPattern);
-        output.shouldMatch(stderrPattern);
-        output.stderrShouldMatch(stderrPattern);
-    } catch (RuntimeException e) {
-        throw new Exception("shouldMatch() failed", e);
-    }
-
-    try {
-        output.shouldMatch(nonExistingPattern);
-        throw new Exception("shouldMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    try {
-        output.stdoutShouldMatch(stderrPattern);
-        throw new Exception(
-                "stdoutShouldMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    try {
-        output.stderrShouldMatch(stdoutPattern);
-        throw new Exception(
-                "stderrShouldMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    // Should not match
-    try {
-        output.shouldNotMatch(nonExistingPattern);
-        output.stdoutShouldNotMatch(nonExistingPattern);
-        output.stderrShouldNotMatch(nonExistingPattern);
-    } catch (RuntimeException e) {
-        throw new Exception("shouldNotMatch() failed", e);
-    }
-
-    try {
-        output.shouldNotMatch(stdoutPattern);
-        throw new Exception("shouldNotMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    try {
-        output.stdoutShouldNotMatch(stdoutPattern);
-        throw new Exception("shouldNotMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    try {
-        output.stderrShouldNotMatch(stderrPattern);
-        throw new Exception("shouldNotMatch() failed to throw exception");
-    } catch (RuntimeException e) {
-        // expected
-    }
-
-    {
-      String aaaa = "aaaa";
-      String result = output.firstMatch(aaaa);
-      if (!aaaa.equals(result)) {
-        throw new Exception("firstMatch(String) faild to match. Expected: " + aaaa + " got: " + result);
-      }
-    }
-
-    {
-      String aa = "aa";
-      String aa_grouped_aa = aa + "(" + aa + ")";
-      String result = output.firstMatch(aa_grouped_aa, 1);
-      if (!aa.equals(result)) {
-        throw new Exception("firstMatch(String, int) failed to match. Expected: " + aa + " got: " + result);
-      }
-    }
-  }
-}
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java	Fri Oct 11 09:17:18 2013 -0400
@@ -24,50 +24,80 @@
 package com.oracle.java.testlibrary;
 
 public class Platform {
-  private static final String osName = System.getProperty("os.name");
-  private static final String dataModel = System.getProperty("sun.arch.data.model");
-  private static final String vmVersion = System.getProperty("java.vm.version");
-  private static final String osArch = System.getProperty("os.arch");
+    private static final String osName      = System.getProperty("os.name");
+    private static final String dataModel   = System.getProperty("sun.arch.data.model");
+    private static final String vmVersion   = System.getProperty("java.vm.version");
+    private static final String osArch      = System.getProperty("os.arch");
 
-  public static boolean is64bit() {
-    return dataModel.equals("64");
-  }
+    public static boolean is32bit() {
+        return dataModel.equals("32");
+    }
+
+    public static boolean is64bit() {
+        return dataModel.equals("64");
+    }
+
+    public static boolean isSolaris() {
+        return isOs("sunos");
+    }
 
-  public static boolean isSolaris() {
-    return osName.toLowerCase().startsWith("sunos");
-  }
+    public static boolean isWindows() {
+        return isOs("win");
+    }
+
+    public static boolean isOSX() {
+        return isOs("mac");
+    }
 
-  public static boolean isWindows() {
-    return osName.toLowerCase().startsWith("win");
-  }
+    public static boolean isLinux() {
+        return isOs("linux");
+    }
 
-  public static boolean isOSX() {
-    return osName.toLowerCase().startsWith("mac");
-  }
+    private static boolean isOs(String osname) {
+        return osName.toLowerCase().startsWith(osname.toLowerCase());
+    }
+
+    public static String getOsName() {
+        return osName;
+    }
 
-  public static boolean isLinux() {
-    return osName.toLowerCase().startsWith("linux");
-  }
+    public static boolean isDebugBuild() {
+        return vmVersion.toLowerCase().contains("debug");
+    }
+
+    public static String getVMVersion() {
+        return vmVersion;
+    }
 
-  public static String getOsName() {
-    return osName;
-  }
+    // Returns true for sparc and sparcv9.
+    public static boolean isSparc() {
+        return isArch("sparc");
+    }
 
-  public static boolean isDebugBuild() {
-    return vmVersion.toLowerCase().contains("debug");
-  }
+    public static boolean isARM() {
+        return isArch("arm");
+    }
 
-  public static String getVMVersion() {
-    return vmVersion;
-  }
+    public static boolean isPPC() {
+        return isArch("ppc");
+    }
+
+    public static boolean isX86() {
+        // On Linux it's 'i386', Windows 'x86'
+        return (isArch("i386") || isArch("x86"));
+    }
 
-  // Returns true for sparc and sparcv9.
-  public static boolean isSparc() {
-    return osArch.toLowerCase().startsWith("sparc");
-  }
+    public static boolean isX64() {
+        // On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64'
+        return (isArch("amd64") || isArch("x86_64"));
+    }
 
-  public static String getOsArch() {
-    return osArch;
-  }
+    private static boolean isArch(String archname) {
+        return osArch.toLowerCase().startsWith(archname.toLowerCase());
+    }
+
+    public static String getOsArch() {
+        return osArch;
+    }
 
 }
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,8 +36,7 @@
 import java.nio.file.attribute.*;
 
 /**
- * * Handler for dirs containing classes to compile.
- * @author igor.ignatyev@oracle.com
+ * Handler for dirs containing classes to compile.
  */
 public class ClassPathDirEntry extends PathHandler {
 
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,7 +35,6 @@
 
 /**
  * Handler for jar-files containing classes to compile.
- * @author igor.ignatyev@oracle.com
  */
 public class ClassPathJarEntry extends PathHandler {
 
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,8 +31,6 @@
 
 /**
  * Handler for dirs containing jar-files with classes to compile.
- *
- * @author igor.ignatyev@oracle.com
  */
 public class ClassPathJarInDirEntry extends PathHandler {
 
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,8 +32,6 @@
 
 /**
  * Handler for files containing a list of classes to compile.
- *
- * @author igor.ignatyev@oracle.com
  */
 public class ClassesListInFile extends PathHandler {
     public ClassesListInFile(Path root, Executor executor) {
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,9 +32,6 @@
 import java.util.List;
 import java.util.concurrent.*;
 
-/**
- * @author igor.ignatyev@oracle.com
- */
 public class CompileTheWorld {
     /**
      * Entry point. Compiles classes in {@code args}, or all classes in
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,8 +36,6 @@
 /**
  * Provide method to compile whole class.
  * Also contains compiled methods and classes counters.
- *
- * @author igor.ignatyev@oracle.com
  */
 public class Compiler {
     private Compiler() { }
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,10 +35,7 @@
 
 /**
  * Abstract handler for path.
- * <p/>
  * Concrete subclasses should implement method {@link #process()}.
- *
- * @author igor.ignatyev@oracle.com
  */
 public abstract class PathHandler {
     private static final Pattern JAR_IN_DIR_PATTERN
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,8 +31,6 @@
 
 /**
  * Auxiliary methods.
- *
- * @author igor.ignatyev@oracle.com
  */
 public class Utils {
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary_tests/AssertsTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,237 @@
+/*
+ * 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 static com.oracle.java.testlibrary.Asserts.*;
+
+/* @test
+ * @summary Tests the different assertions in the Assert class
+ * @library /testlibrary
+ */
+public class AssertsTest {
+    private static class Foo implements Comparable<Foo> {
+        final int id;
+        public Foo(int id) {
+            this.id = id;
+        }
+
+        public int compareTo(Foo f) {
+            return new Integer(id).compareTo(new Integer(f.id));
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        testLessThan();
+        testLessThanOrEqual();
+        testEquals();
+        testGreaterThanOrEqual();
+        testGreaterThan();
+        testNotEquals();
+        testNull();
+        testNotNull();
+        testTrue();
+        testFalse();
+    }
+
+    private static void testLessThan() throws Exception {
+        expectPass(Assertion.LT, 1, 2);
+
+        expectFail(Assertion.LT, 2, 2);
+        expectFail(Assertion.LT, 2, 1);
+        expectFail(Assertion.LT, null, 2);
+        expectFail(Assertion.LT, 2, null);
+    }
+
+    private static void testLessThanOrEqual() throws Exception {
+        expectPass(Assertion.LTE, 1, 2);
+        expectPass(Assertion.LTE, 2, 2);
+
+        expectFail(Assertion.LTE, 3, 2);
+        expectFail(Assertion.LTE, null, 2);
+        expectFail(Assertion.LTE, 2, null);
+    }
+
+    private static void testEquals() throws Exception {
+        expectPass(Assertion.EQ, 1, 1);
+        expectPass(Assertion.EQ, null, null);
+
+        Foo f1 = new Foo(1);
+        expectPass(Assertion.EQ, f1, f1);
+
+        Foo f2 = new Foo(1);
+        expectFail(Assertion.EQ, f1, f2);
+        expectFail(Assertion.LTE, null, 2);
+        expectFail(Assertion.LTE, 2, null);
+    }
+
+    private static void testGreaterThanOrEqual() throws Exception {
+        expectPass(Assertion.GTE, 1, 1);
+        expectPass(Assertion.GTE, 2, 1);
+
+        expectFail(Assertion.GTE, 1, 2);
+        expectFail(Assertion.GTE, null, 2);
+        expectFail(Assertion.GTE, 2, null);
+    }
+
+    private static void testGreaterThan() throws Exception {
+        expectPass(Assertion.GT, 2, 1);
+
+        expectFail(Assertion.GT, 1, 1);
+        expectFail(Assertion.GT, 1, 2);
+        expectFail(Assertion.GT, null, 2);
+        expectFail(Assertion.GT, 2, null);
+    }
+
+    private static void testNotEquals() throws Exception {
+        expectPass(Assertion.NE, null, 1);
+        expectPass(Assertion.NE, 1, null);
+
+        Foo f1 = new Foo(1);
+        Foo f2 = new Foo(1);
+        expectPass(Assertion.NE, f1, f2);
+
+        expectFail(Assertion.NE, null, null);
+        expectFail(Assertion.NE, f1, f1);
+        expectFail(Assertion.NE, 1, 1);
+    }
+
+    private static void testNull() throws Exception {
+        expectPass(Assertion.NULL, null);
+
+        expectFail(Assertion.NULL, 1);
+    }
+
+    private static void testNotNull() throws Exception {
+        expectPass(Assertion.NOTNULL, 1);
+
+        expectFail(Assertion.NOTNULL, null);
+    }
+
+    private static void testTrue() throws Exception {
+        expectPass(Assertion.TRUE, true);
+
+        expectFail(Assertion.TRUE, false);
+    }
+
+    private static void testFalse() throws Exception {
+        expectPass(Assertion.FALSE, false);
+
+        expectFail(Assertion.FALSE, true);
+    }
+
+    private static <T extends Comparable<T>> void expectPass(Assertion assertion, T ... args)
+        throws Exception {
+        Assertion.run(assertion, args);
+    }
+
+    private static <T extends Comparable<T>> void expectFail(Assertion assertion, T ... args)
+        throws Exception {
+        try {
+            Assertion.run(assertion, args);
+        } catch (RuntimeException e) {
+            return;
+        }
+        throw new Exception("Expected " + Assertion.format(assertion, (Object[]) args) +
+                            " to throw a RuntimeException");
+    }
+
+}
+
+enum Assertion {
+    LT, LTE, EQ, GTE, GT, NE, NULL, NOTNULL, FALSE, TRUE;
+
+    public static <T extends Comparable<T>> void run(Assertion assertion, T ... args) {
+        String msg = "Expected " + format(assertion, args) + " to pass";
+        switch (assertion) {
+            case LT:
+                assertLessThan(args[0], args[1], msg);
+                break;
+            case LTE:
+                assertLessThanOrEqual(args[0], args[1], msg);
+                break;
+            case EQ:
+                assertEquals(args[0], args[1], msg);
+                break;
+            case GTE:
+                assertGreaterThanOrEqual(args[0], args[1], msg);
+                break;
+            case GT:
+                assertGreaterThan(args[0], args[1], msg);
+                break;
+            case NE:
+                assertNotEquals(args[0], args[1], msg);
+                break;
+            case NULL:
+                assertNull(args == null ? args : args[0], msg);
+                break;
+            case NOTNULL:
+                assertNotNull(args == null ? args : args[0], msg);
+                break;
+            case FALSE:
+                assertFalse((Boolean) args[0], msg);
+                break;
+            case TRUE:
+                assertTrue((Boolean) args[0], msg);
+                break;
+            default:
+                // do nothing
+        }
+    }
+
+    public static String format(Assertion assertion, Object ... args) {
+        switch (assertion) {
+            case LT:
+                return asString("assertLessThan", args);
+            case LTE:
+                return asString("assertLessThanOrEqual", args);
+            case EQ:
+                return asString("assertEquals", args);
+            case GTE:
+                return asString("assertGreaterThanOrEquals", args);
+            case GT:
+                return asString("assertGreaterThan", args);
+            case NE:
+                return asString("assertNotEquals", args);
+            case NULL:
+                return asString("assertNull", args);
+            case NOTNULL:
+                return asString("assertNotNull", args);
+            case FALSE:
+                return asString("assertFalse", args);
+            case TRUE:
+                return asString("assertTrue", args);
+            default:
+                return "";
+        }
+    }
+
+    private static String asString(String assertion, Object ... args) {
+        if (args == null) {
+            return String.format("%s(null)", assertion);
+        }
+        if (args.length == 1) {
+            return String.format("%s(%s)", assertion, args[0]);
+        } else {
+            return String.format("%s(%s, %s)", assertion, args[0], args[1]);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @summary Test the OutputAnalyzer reporting functionality,
+ *     such as printing additional diagnostic info
+ *     (exit code, stdout, stderr, command line, etc.)
+ * @library /testlibrary
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+
+public class OutputAnalyzerReportingTest {
+
+    public static void main(String[] args) throws Exception {
+        // Create the output analyzer under test
+        String stdout = "aaaaaa";
+        String stderr = "bbbbbb";
+        OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
+
+        // Expected summary values should be the same for all cases,
+        // since the outputAnalyzer object is the same
+        String expectedExitValue = "-1";
+        String expectedSummary =
+                " stdout: [" + stdout + "];\n" +
+                " stderr: [" + stderr + "]\n" +
+                " exitValue = " + expectedExitValue + "\n";
+
+
+        DiagnosticSummaryTestRunner testRunner =
+                new DiagnosticSummaryTestRunner();
+
+        // should have exit value
+        testRunner.init(expectedSummary);
+        int unexpectedExitValue = 2;
+        try {
+            output.shouldHaveExitValue(unexpectedExitValue);
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+        // should not contain
+        testRunner.init(expectedSummary);
+        try {
+            output.shouldNotContain(stdout);
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+        // should contain
+        testRunner.init(expectedSummary);
+        try {
+            output.shouldContain("unexpected-stuff");
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+        // should not match
+        testRunner.init(expectedSummary);
+        try {
+            output.shouldNotMatch("[a]");
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+        // should match
+        testRunner.init(expectedSummary);
+        try {
+            output.shouldMatch("[qwerty]");
+        } catch (RuntimeException e) { }
+        testRunner.closeAndCheckResults();
+
+    }
+
+    private static class DiagnosticSummaryTestRunner {
+        private ByteArrayOutputStream byteStream =
+                new ByteArrayOutputStream(10000);
+
+        private String expectedSummary = "";
+        private PrintStream errStream;
+
+
+        public void init(String expectedSummary) {
+            this.expectedSummary = expectedSummary;
+            byteStream.reset();
+            errStream = new PrintStream(byteStream);
+            System.setErr(errStream);
+        }
+
+        public void closeAndCheckResults() {
+            // check results
+            errStream.close();
+            String stdErrStr = byteStream.toString();
+            if (!stdErrStr.contains(expectedSummary)) {
+                throw new RuntimeException("The output does not contain "
+                    + "the diagnostic message, or the message is incorrect");
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Test the OutputAnalyzer utility class
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+public class OutputAnalyzerTest {
+
+  public static void main(String args[]) throws Exception {
+
+    String stdout = "aaaaaa";
+    String stderr = "bbbbbb";
+
+    // Regexps used for testing pattern matching of the test input
+    String stdoutPattern = "[a]";
+    String stderrPattern = "[b]";
+    String nonExistingPattern = "[c]";
+
+    OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
+
+    if (!stdout.equals(output.getStdout())) {
+      throw new Exception("getStdout() returned '" + output.getStdout() + "', expected '" + stdout + "'");
+    }
+
+    if (!stderr.equals(output.getStderr())) {
+      throw new Exception("getStderr() returned '" + output.getStderr() + "', expected '" + stderr + "'");
+    }
+
+    try {
+      output.shouldContain(stdout);
+      output.stdoutShouldContain(stdout);
+      output.shouldContain(stderr);
+      output.stderrShouldContain(stderr);
+    } catch (RuntimeException e) {
+      throw new Exception("shouldContain() failed", e);
+    }
+
+    try {
+      output.shouldContain("cccc");
+      throw new Exception("shouldContain() failed to throw exception");
+    } catch (RuntimeException e) {
+      // expected
+    }
+
+    try {
+      output.stdoutShouldContain(stderr);
+      throw new Exception("stdoutShouldContain() failed to throw exception");
+    } catch (RuntimeException e) {
+      // expected
+    }
+
+    try {
+      output.stderrShouldContain(stdout);
+      throw new Exception("stdoutShouldContain() failed to throw exception");
+    } catch (RuntimeException e) {
+      // expected
+    }
+
+    try {
+      output.shouldNotContain("cccc");
+      output.stdoutShouldNotContain("cccc");
+      output.stderrShouldNotContain("cccc");
+    } catch (RuntimeException e) {
+      throw new Exception("shouldNotContain() failed", e);
+    }
+
+    try {
+      output.shouldNotContain(stdout);
+      throw new Exception("shouldContain() failed to throw exception");
+    } catch (RuntimeException e) {
+      // expected
+    }
+
+    try {
+      output.stdoutShouldNotContain(stdout);
+      throw new Exception("shouldContain() failed to throw exception");
+    } catch (RuntimeException e) {
+      // expected
+    }
+
+    try {
+        output.stderrShouldNotContain(stderr);
+        throw new Exception("shouldContain() failed to throw exception");
+    } catch (RuntimeException e) {
+        // expected
+    }
+
+    // Should match
+    try {
+        output.shouldMatch(stdoutPattern);
+        output.stdoutShouldMatch(stdoutPattern);
+        output.shouldMatch(stderrPattern);
+        output.stderrShouldMatch(stderrPattern);
+    } catch (RuntimeException e) {
+        throw new Exception("shouldMatch() failed", e);
+    }
+
+    try {
+        output.shouldMatch(nonExistingPattern);
+        throw new Exception("shouldMatch() failed to throw exception");
+    } catch (RuntimeException e) {
+        // expected
+    }
+
+    try {
+        output.stdoutShouldMatch(stderrPattern);
+        throw new Exception(
+                "stdoutShouldMatch() failed to throw exception");
+    } catch (RuntimeException e) {
+        // expected
+    }
+
+    try {
+        output.stderrShouldMatch(stdoutPattern);
+        throw new Exception(
+                "stderrShouldMatch() failed to throw exception");
+    } catch (RuntimeException e) {
+        // expected
+    }
+
+    // Should not match
+    try {
+        output.shouldNotMatch(nonExistingPattern);
+        output.stdoutShouldNotMatch(nonExistingPattern);
+        output.stderrShouldNotMatch(nonExistingPattern);
+    } catch (RuntimeException e) {
+        throw new Exception("shouldNotMatch() failed", e);
+    }
+
+    try {
+        output.shouldNotMatch(stdoutPattern);
+        throw new Exception("shouldNotMatch() failed to throw exception");
+    } catch (RuntimeException e) {
+        // expected
+    }
+
+    try {
+        output.stdoutShouldNotMatch(stdoutPattern);
+        throw new Exception("shouldNotMatch() failed to throw exception");
+    } catch (RuntimeException e) {
+        // expected
+    }
+
+    try {
+        output.stderrShouldNotMatch(stderrPattern);
+        throw new Exception("shouldNotMatch() failed to throw exception");
+    } catch (RuntimeException e) {
+        // expected
+    }
+
+    {
+      String aaaa = "aaaa";
+      String result = output.firstMatch(aaaa);
+      if (!aaaa.equals(result)) {
+        throw new Exception("firstMatch(String) faild to match. Expected: " + aaaa + " got: " + result);
+      }
+    }
+
+    {
+      String aa = "aa";
+      String aa_grouped_aa = aa + "(" + aa + ")";
+      String result = output.firstMatch(aa_grouped_aa, 1);
+      if (!aa.equals(result)) {
+        throw new Exception("firstMatch(String, int) failed to match. Expected: " + aa + " got: " + result);
+      }
+    }
+  }
+}
--- a/jaxp/.hgtags	Fri Oct 11 08:43:07 2013 -0400
+++ b/jaxp/.hgtags	Fri Oct 11 09:17:18 2013 -0400
@@ -230,3 +230,5 @@
 d3be8e3b429df917e72c1c23e7920c651219b587 jdk8-b106
 d6a32e3831aab20a9a3bc78cdc0a60aaad725c6c jdk8-b107
 8ade3eed63da87067a7137c111f684a821e9e531 jdk8-b108
+02bfab2aa93899e0f02584f1e85537485a196553 jdk8-b109
+4c84c5b447b09aff27f3b72667ab3a5401e85968 jdk8-b110
--- a/jaxws/.hgtags	Fri Oct 11 08:43:07 2013 -0400
+++ b/jaxws/.hgtags	Fri Oct 11 09:17:18 2013 -0400
@@ -230,3 +230,5 @@
 6908370afe834ff01739e8ec992d4246c74b7e6e jdk8-b106
 e3c9328f75638289a342ce15fbe532f05078946e jdk8-b107
 d1ea68556fd7925a3c7078dd9f77c6ca73d5aa9e jdk8-b108
+df5d4d01642572e77fd3c01e4c8703ed3f6eec87 jdk8-b109
+cc682329886be2fc26220fc30597ee4e5bba43ed jdk8-b110
--- a/jdk/.hgtags	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/.hgtags	Fri Oct 11 09:17:18 2013 -0400
@@ -231,3 +231,5 @@
 eea685b9ccaa1980e0a7e07d6a3a84bcc7e9ab82 jdk8-b107
 006aaa5f069e7dd98fccdc696866c9f8582c087c jdk8-b108
 946f3fd5f8bf0ccd180c258d25e5837fa1bf004c jdk8-b109
+54e099776f08430d3a7f4feabd9f2ba886b55320 jdk8-b110
+719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111
--- a/jdk/make/bridge/AccessBridgeJava/Makefile	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/make/bridge/AccessBridgeJava/Makefile	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -51,7 +51,7 @@
 #
 # Java files to compile.
 #
-FILES_java = com/sun/java/accessibility/AccessBridge.java
+FILES_java = com/sun/java/accessibility/AccessBridgeLoader.java com/sun/java/accessibility/AccessBridge.java
 
 #
 # Location for the newly built classfiles.
@@ -61,14 +61,13 @@
 #
 # Rules
 #
-CLASSDESTDIR = $(TEMPDIR)/classes
 
 FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class)
 
 build: prebuild
 
 prebuild:
-	$(CP) $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility/$(ABPLATFORM)/AccessBridge.java \
+	$(CP) $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility/$(ABPLATFORM)/AccessBridgeLoader.java \
 		$(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility
 
 all : build $(JARFILE) 
--- a/jdk/make/docs/Makefile	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/make/docs/Makefile	Fri Oct 11 09:17:18 2013 -0400
@@ -50,6 +50,7 @@
 DEV_DOCS_URL-5 = http://java.sun.com/j2se/1.5.0/docs/index.html
 DEV_DOCS_URL-6 = http://download.oracle.com/javase/6/docs/index.html
 DEV_DOCS_URL-7 = http://download.oracle.com/javase/7/docs/index.html
+DEV_DOCS_URL-8 = http://download.oracle.com/javase/8/docs/index.html
 DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
 DOCS_BASE_URL = http://download.oracle.com/javase/7/docs
 
--- a/jdk/make/sun/lwawt/FILES_export_macosx.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/make/sun/lwawt/FILES_export_macosx.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -110,7 +110,6 @@
         sun/lwawt/LWWindowPeer.java \
         sun/lwawt/PlatformWindow.java \
         sun/lwawt/SecurityWarningWindow.java \
-        sun/lwawt/SelectionClearListener.java \
         sun/lwawt/macosx/CPrinterDevice.java \
         sun/lwawt/macosx/CPrinterDialog.java \
         sun/lwawt/macosx/CPrinterDialogPeer.java \
@@ -141,7 +140,6 @@
         sun/lwawt/macosx/CMenuBar.java \
         sun/lwawt/macosx/CMenuComponent.java \
         sun/lwawt/macosx/CMenuItem.java \
-        sun/lwawt/macosx/CMouseInfoPeer.java \
         sun/lwawt/macosx/CPlatformView.java \
         sun/lwawt/macosx/CPlatformWindow.java \
         sun/lwawt/macosx/CWarningWindow.java \
--- a/jdk/make/sun/xawt/mapfile-vers	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/make/sun/xawt/mapfile-vers	Fri Oct 11 09:17:18 2013 -0400
@@ -305,6 +305,7 @@
         Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap;
         Java_sun_awt_X11_XlibWrapper_XkbFreeKeyboard;
         Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode;
+        Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat;
         Java_sun_awt_X11_XlibWrapper_XGetModifierMapping;
         Java_sun_awt_X11_XlibWrapper_XFreeModifiermap;
         Java_sun_awt_X11_XlibWrapper_XRefreshKeyboardMapping;
--- a/jdk/makefiles/CompileDemos.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/CompileDemos.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -65,14 +65,10 @@
 $(eval $(call SetupAppletDemo,DrawTest))
 $(eval $(call SetupAppletDemo,Fractal))
 $(eval $(call SetupAppletDemo,GraphicsTest))
-$(eval $(call SetupAppletDemo,MoleculeViewer))
 $(eval $(call SetupAppletDemo,NervousText))
 $(eval $(call SetupAppletDemo,SimpleGraph))
 $(eval $(call SetupAppletDemo,SortDemo))
 $(eval $(call SetupAppletDemo,SpreadSheet))
-# Build WireFrame without a server since it
-# has a class Matrix3D that also exists in MoleculeViewer.
-$(eval $(call SetupAppletDemo,WireFrame,true))
 
 ifndef OPENJDK
     $(eval $(call SetupAppletDemo,Animator,,closed/))
@@ -83,7 +79,7 @@
 
 ##################################################################################################
 
-PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf
+PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf .xyz .obj
 
 define SetupDemo
     # Param 1 = Name of the demo
@@ -161,6 +157,8 @@
 
 BUILD_DEMOS+=$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
 
+$(eval $(call SetupDemo,MoleculeViewer,applets,,XYZChemModel,,,example*.html XYZApp.java))
+$(eval $(call SetupDemo,WireFrame,applets,,ThreeD,,,example*.html ThreeD.java))
 $(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*))
 $(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt))
 $(eval $(call SetupDemo,Metalworks,jfc,,Metalworks,,,README*))
--- a/jdk/makefiles/CompileJavaClasses.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/CompileJavaClasses.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -62,6 +62,7 @@
 
       # AccessBridge is compiled separately below.
       EXFILES += AccessBridge.java \
+		 AccessBridgeLoader.java \
 		 com/sun/java/accessibility/util/java/awt/ChoiceTranslator.java
       # This seems to never be built
       EXCLUDES += com/sun/java/accessibility/extensions
@@ -268,7 +269,10 @@
                $(JDK_TOPDIR)/src/solaris/classes/java/net/DefaultInterface.java \
                $(JDK_TOPDIR)/src/solaris/classes/java/lang/ClassLoaderHelper.java \
                $(JDK_TOPDIR)/src/solaris/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
-               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java
+               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java \
+               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
+               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
+               $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
 
      # JObjC.jar contains 1.5 byte-code...so skip it here :-(
      # MACOSX_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/jobjc/src
--- a/jdk/makefiles/CompileLaunchers.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/CompileLaunchers.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 # questions.
 #
 
-defalt: all
+default: all
 
 include $(SPEC)
 include MakeBase.gmk
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 # questions.
 #
 
-defalt: all
+default: all
 
 include $(SPEC)
 include MakeBase.gmk
--- a/jdk/makefiles/CreateJars.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/CreateJars.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -216,11 +216,6 @@
 	oracle/jrockit/jfr \
 	jdk/jfr
 
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-        RT_JAR_EXCLUDES += com/sun/nio/sctp \
-                           sun/nio/ch/sctp
-endif
-
 # Find all files in the classes dir to use as dependencies. This could be more fine granular.
 ALL_FILES_IN_CLASSES := $(call not-containing,_the.,$(filter-out %javac_state,\
                         $(call CacheFind,$(JDK_OUTPUTDIR)/classes)))
@@ -863,26 +858,13 @@
 	com/sun/java_cup		\
 	com/sun/javadoc			\
 	com/sun/java/swing		\
-	com/sun/jlex	        	\
 	com/sun/jmx			\
 	com/sun/naming			\
 	com/sun/org/apache		\
 	com/sun/security/auth		\
 	com/sun/security/jgss		\
 	com/sun/source			\
-	java/applet			\
-	java/awt			\
-	java/beans			\
-	java/io				\
-	java/lang			\
-	java/math			\
-	java/net			\
-	java/nio			\
-	java/rmi			\
-	java/security			\
-	java/sql			\
-	java/text			\
-	java/util			\
+	java				\
 	javax/accessibility		\
 	javax/annotation		\
 	javax/imageio			\
@@ -902,7 +884,7 @@
 	org/omg				\
 	org/w3c/dom			\
 	org/xml/sax			\
-	sunw
+        #
 
 SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes
 SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gensrc
@@ -953,13 +935,13 @@
 
     ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
         $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_32_JAR,,\
-		SRCS:=$(JDK_OUTPUTDIR)/classes_ab/32bit $(JDK_OUTPUTDIR)/classes,\
+		SRCS:=$(JDK_OUTPUTDIR)/classes_ab/32bit,\
 		INCLUDES:=com/sun/java/accessibility,\
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-32.jar,\
 		SKIP_METAINF:=true))
 
         $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_LEGACY_JAR,,\
-		SRCS:=$(JDK_OUTPUTDIR)/classes_ab/legacy $(JDK_OUTPUTDIR)/classes,\
+		SRCS:=$(JDK_OUTPUTDIR)/classes_ab/legacy,\
 		INCLUDES:=com/sun/java/accessibility,\
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/access-bridge.jar,\
 		SKIP_METAINF:=true))
@@ -968,9 +950,8 @@
 		$(IMAGES_OUTPUTDIR)/lib/ext/access-bridge.jar
     else
         $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_64_JAR,,\
-		SRCS:=$(JDK_OUTPUTDIR)/classes_ab/64bit $(JDK_OUTPUTDIR)/classes,\
+		SRCS:=$(JDK_OUTPUTDIR)/classes_ab/64bit,\
 		INCLUDES:=com/sun/java/accessibility,\
-		EXCLUDES:=com/sun/java/accessibility/util/java,\
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-64.jar,\
 		SKIP_METAINF:=true))
 
--- a/jdk/makefiles/GensrcMisc.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/GensrcMisc.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -200,26 +200,42 @@
     AB_SRC_DIR := $(JDK_TOPDIR)/src/closed/windows/classes/com/sun/java/accessibility
 
     ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+         $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridgeLoader.java: \
+			$(AB_SRC_DIR)/32bit/AccessBridgeLoader.java
+		$(install-file)
+
          $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java: \
-			$(AB_SRC_DIR)/32bit/AccessBridge.java
+			$(AB_SRC_DIR)/AccessBridge.java
+		$(install-file)
+
+         $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridgeLoader.java: \
+			$(AB_SRC_DIR)/legacy/AccessBridgeLoader.java
 		$(install-file)
 
          $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java: \
-			$(AB_SRC_DIR)/legacy/AccessBridge.java
+			$(AB_SRC_DIR)/AccessBridge.java
 		$(install-file)
 
-        GENSRC_MISC += $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java \
-		       $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java
+        GENSRC_MISC += $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridgeLoader.java \
+		       $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridgeLoader.java \
+			   $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java \
+			   $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java
 
     else
-         $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java: \
-			$(AB_SRC_DIR)/64bit/AccessBridge.java
+         $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridgeLoader.java: \
+			$(AB_SRC_DIR)/64bit/AccessBridgeLoader.java
 		$(install-file)
 
-         GENSRC_MISC += $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java
+         $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java: \
+			$(AB_SRC_DIR)/AccessBridge.java
+		$(install-file)
+
+         GENSRC_MISC += $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridgeLoader.java \
+			$(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java
 
     endif
+
 endif
 endif
 
-##########################################################################################
\ No newline at end of file
+##########################################################################################
--- a/jdk/makefiles/GensrcProperties.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/GensrcProperties.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -253,6 +253,13 @@
 	$(call CacheFind,$(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)),\
 	ListResourceBundle,%zh_TW,%zh_HK))
 endif
+# os x specific awt properties
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+$(eval $(call add_properties_to_compile,SUN_AWT,\
+	$(filter $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources/%.properties,\
+	$(call CacheFind,$(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)),\
+	ListResourceBundle))
+endif
 
 #sun/launcher/resources
 $(eval $(call add_properties_to_compile,SUN_LAUNCHER,\
--- a/jdk/makefiles/Images.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/Images.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -190,6 +190,26 @@
 $(foreach f,$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)),\
     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
 
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
+  define AddIsadirLink
+    # Param 1 - src file
+    # Param 2 - variable to add targets to
+
+    $1_LINK := $$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1)
+
+    $$($1_LINK):
+	$(ECHO) $(LOG_INFO) Creating link $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
+	$(MKDIR) -p $$(@D)
+	$(LN) -s ../$$(@F) $$@
+
+    $2 += $$($1_LINK)
+  endef
+
+  $(foreach f,$(JRE_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JRE_BIN_ISADIR_LINK_TARGETS)))
+  $(foreach f,$(JDK_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JDK_BIN_ISADIR_LINK_TARGETS)))
+  $(foreach f,$(JDKJRE_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JDKJRE_BIN_ISADIR_LINK_TARGETS)))
+endif
+
 ################################################################################
 # /lib dir
 ifneq ($(OPENJDK_TARGET_OS), macosx)
@@ -730,7 +750,8 @@
 
 jre-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) $(JRE_IMAGE_DIR)/lib/applet \
 	$(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
-	$(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST)
+	$(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST) \
+	$(JRE_BIN_ISADIR_LINK_TARGETS)
 
 jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \
 	$(JDK_LIB_TARGETS) $(JDKJRE_LIB_TARGETS) \
@@ -741,7 +762,8 @@
 	$(JDK_DB_TARGETS) $(JDK_INCLUDE_TARGETS) \
 	$(JDKJRE_DOC_TARGETS) $(JDK_DOC_TARGETS) \
 	$(JDK_INFO_FILE) $(JDKJRE_STRIP_LIST) $(JDK_BIN_STRIP_LIST) \
-        $(JDK_IMAGE_DIR)/src.zip
+        $(JDK_IMAGE_DIR)/src.zip \
+	$(JDK_BIN_ISADIR_LINK_TARGETS) $(JDKJRE_BIN_ISADIR_LINK_TARGETS)
 
 jre-overlay-image: $(JRE_OVERLAY_BIN_TARGETS) $(JRE_OVERLAY_LIB_TARGETS) \
 	 $(JRE_OVERLAY_INFO_FILE) $(JRE_OVERLAY_STRIP_LIST)
--- a/jdk/makefiles/Tools.gmk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/Tools.gmk	Fri Oct 11 09:17:18 2013 -0400
@@ -25,7 +25,6 @@
 
 # Cache all finds needed for this file. Only used on windows.
 $(eval $(call FillCacheFind,$(JDK_TOPDIR)/make/tools \
-    $(JDK_TOPDIR)/src/solaris/classes \
     $(JDK_TOPDIR)/makefiles/sun))
 
 TOOLS_SRC:=$(JDK_TOPDIR)/make/tools/src \
--- a/jdk/makefiles/mapfiles/libawt_xawt/mapfile-vers	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/mapfiles/libawt_xawt/mapfile-vers	Fri Oct 11 09:17:18 2013 -0400
@@ -305,6 +305,7 @@
         Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap;
         Java_sun_awt_X11_XlibWrapper_XkbFreeKeyboard;
         Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode;
+        Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat;
         Java_sun_awt_X11_XlibWrapper_XGetModifierMapping;
         Java_sun_awt_X11_XlibWrapper_XFreeModifiermap;
         Java_sun_awt_X11_XlibWrapper_XRefreshKeyboardMapping;
--- a/jdk/makefiles/profile-includes.txt	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/makefiles/profile-includes.txt	Fri Oct 11 09:17:18 2013 -0400
@@ -33,8 +33,6 @@
     $(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)sunec$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify.diz \
@@ -130,6 +128,8 @@
     $(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)npt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
     jvm.hprof.txt \
     management-agent.jar \
--- a/jdk/src/macosx/classes/apple/applescript/AppleScriptEngineFactory.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/apple/applescript/AppleScriptEngineFactory.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -30,14 +30,9 @@
 import javax.script.*;
 
 public class AppleScriptEngineFactory implements ScriptEngineFactory {
-    private static native void initNative();
+    private static volatile boolean initialized = false;
 
-    static {
-        java.awt.Toolkit.getDefaultToolkit();
-        System.loadLibrary("AppleScriptEngine");
-        initNative();
-        TRACE("<static-init>");
-    }
+    private static native void initNative();
 
     static void TRACE(final String str) {
 //        System.out.println(AppleScriptEngineFactory.class.getName() + "." + str);
@@ -80,6 +75,7 @@
      *
      * @return full name of the ScriptEngine
      */
+    @Override
     public String getEngineName() {
         TRACE("getEngineName()");
         return ENGINE_NAME;
@@ -90,6 +86,7 @@
      *
      * @return version of the ScriptEngine
      */
+    @Override
     public String getEngineVersion() {
         TRACE("getEngineVersion()");
         return ENGINE_VERSION;
@@ -100,6 +97,7 @@
      *
      * @return name of the language supported by the ScriptEngine(Factory)
      */
+    @Override
     public String getLanguageName() {
         TRACE("getLanguageName()");
         return LANGUAGE;
@@ -110,11 +108,12 @@
      *
      * @return language version supported by the ScriptEngine(Factory)
      */
+    @Override
     public String getLanguageVersion() {
         TRACE("getLanguageVersion()");
         return AccessController.doPrivileged(new PrivilegedAction<String>() {
             public String run() {
-                final AppleScriptEngine engine = new AppleScriptEngine(AppleScriptEngineFactory.this);
+                final AppleScriptEngine engine = getScriptEngine();
                 return engine.getLanguageVersion();
             }
         });
@@ -126,6 +125,7 @@
      *
      * @return ArrayList of file extensions AppleScript associates with
      */
+    @Override
     public List<String> getExtensions() {
         TRACE("getExtensions()");
         return Arrays.asList("scpt", "applescript", "app");
@@ -137,6 +137,7 @@
      *
      * @return ArrayList of mimetypes that AppleScript associates with
      */
+    @Override
     public List<String> getMimeTypes() {
         TRACE("getMimeTypes()");
         return Arrays.asList("application/x-applescript", "text/plain", "text/applescript");
@@ -148,6 +149,7 @@
      *
      * @return
      */
+    @Override
     public List<String> getNames() {
         TRACE("getNames()");
         return Arrays.asList("AppleScriptEngine", "AppleScript", "OSA");
@@ -165,6 +167,7 @@
      *            arguments to the function
      * @return the AppleScript string calling the method
      */
+    @Override
     public String getMethodCallSyntax(final String obj, final String fname, final String ... args) {
 //        StringBuilder builder = new StringBuilder();
 //        builder.append("my " + fname + "(");
@@ -181,6 +184,7 @@
      * @param toDisplay
      * @return
      */
+    @Override
     public String getOutputStatement(final String toDisplay) {
         // TODO -- this might even be good enough? XD
         return getMethodCallSyntax(null, "print", toDisplay);
@@ -193,8 +197,9 @@
      *            the key to look up
      * @return the static preseeded value for the key in the ScriptEngine, if it exists, otherwise <code>null</code>
      */
+    @Override
     public Object getParameter(final String key) {
-        final AppleScriptEngine engine = new AppleScriptEngine(this);
+        final AppleScriptEngine engine = getScriptEngine();
         if (!engine.getBindings(ScriptContext.ENGINE_SCOPE).containsKey(key)) return null;
         return engine.getBindings(ScriptContext.ENGINE_SCOPE).get(key);
     }
@@ -205,6 +210,7 @@
      * @param statements
      * @return
      */
+    @Override
     public String getProgram(final String ... statements) {
         final StringBuilder program = new StringBuilder();
         for (final String statement : statements) {
@@ -218,8 +224,21 @@
      *
      * @return new AppleScriptEngine with this factory as it's parent
      */
-    public ScriptEngine getScriptEngine() {
+    @Override
+    public AppleScriptEngine getScriptEngine() {
         AppleScriptEngine.checkSecurity();
+        ensureInitialized();
+
         return new AppleScriptEngine(this);
     }
+
+    private static synchronized void ensureInitialized() {
+        if (!initialized) {
+            initialized = true;
+
+            java.awt.Toolkit.getDefaultToolkit();
+            System.loadLibrary("AppleScriptEngine");
+            initNative();
+        }
+    }
 }
--- a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,6 +42,7 @@
 import javax.swing.plaf.*;
 import javax.swing.table.*;
 
+import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 public class AquaFileChooserUI extends FileChooserUI {
@@ -1266,64 +1267,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends DefaultListModel implements ComboBoxModel, PropertyChangeListener {
-        int selectedIndex = -1;
-
-        protected FilterComboBoxModel() {
-            super();
-            final FileFilter filters[] = getFileChooser().getChoosableFileFilters();
-            for (int i = 0; i < filters.length; i++) {
-                this.add(i, filters[i]);
-            }
-        }
-
-        public void propertyChange(final PropertyChangeEvent e) {
-            final String prop = e.getPropertyName();
-            if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                this.clear();
-                final FileFilter filters[] = (FileFilter[])e.getNewValue();
-
-                for (int i = 0; i < filters.length; i++) {
-                    this.add(i, filters[i]);
-                }
-
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                final FileFilter currentFilter = (FileFilter)e.getNewValue();
-                FileFilter filters[] = getFileChooser().getChoosableFileFilters();
-
-                boolean found = false;
-                if (currentFilter != null) {
-                    for (final FileFilter element : filters) {
-                        if (element == currentFilter) {
-                            found = true;
-                        }
-                    }
-                    if (found == false) {
-                        getFileChooser().addChoosableFileFilter(currentFilter);
-                    }
-                }
-
-                filters = getFileChooser().getChoosableFileFilters();
-                setSelectedItem(e.getNewValue());
-            }
-        }
-
-        public void setSelectedItem(final Object filter) {
-            if (filter != null) {
-                selectedIndex = this.indexOf(filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            final Object returnValue = null;
-
-            if (this.size() > 0) {
-                if ((selectedIndex != -1) && (selectedIndex < size())) { return this.get(selectedIndex); }
-            }
-
-            return returnValue;
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return AquaFileChooserUI.this.getFileChooser();
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/awt/resources/awtosx.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,71 @@
+#
+# OS X specific AWT properties
+#
+
+# Modifier names
+AWT.shift=\u21e7
+AWT.control=\u2303
+AWT.alt=\u2325
+AWT.meta=\u2318
+AWT.altGraph=\u2325
+
+# Key names
+AWT.enter=\u23ce
+AWT.backSpace=\u232b
+AWT.tab=\u21e5
+AWT.cancel=\u238b
+AWT.clear=\u2327
+AWT.capsLock=\u21ea
+AWT.escape=\u238b
+AWT.space=\u2423
+AWT.pgup=\u21de
+AWT.pgdn=\u21df
+AWT.end=\u2198
+AWT.home=\u2196
+AWT.left=\u2190
+AWT.up=\u2191
+AWT.right=\u2192
+AWT.down=\u2193
+AWT.comma=,
+AWT.period=.
+AWT.slash=/
+AWT.semicolon=;
+AWT.equals=\u003d
+AWT.openBracket=[
+AWT.backSlash=\\
+AWT.closeBracket=]
+AWT.multiply=\u2328 *
+AWT.add=\u2328 +
+AWT.separator=\u2328 ,
+AWT.separater=\u2328 ,
+AWT.subtract=\u2328 -
+AWT.decimal=\u2328 .
+AWT.divide=\u2328 /
+AWT.delete=\u2326
+AWT.printScreen=\u2399
+AWT.backQuote=`
+AWT.quote='
+AWT.ampersand=&
+AWT.asterisk=*
+AWT.quoteDbl="
+AWT.Less=<
+AWT.greater=>
+AWT.braceLeft=[
+AWT.braceRight=]
+AWT.at=@
+AWT.colon=:
+AWT.circumflex=^
+AWT.dollar=$
+AWT.euro=\u20ac
+AWT.exclamationMark=!
+AWT.invertedExclamationMark=\u00a1
+AWT.leftParenthesis=(
+AWT.numberSign=#
+AWT.plus=+
+AWT.minus=-
+AWT.rightParenthesis=)
+AWT.underscore=_
+
+# Numeric Keypad
+AWT.numpad=\u2328
+
--- a/jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -33,6 +33,10 @@
 
 import javax.swing.JButton;
 
+/**
+ * Lightweight implementation of {@link ButtonPeer}. Delegates most of the work
+ * to the {@link JButton}.
+ */
 final class LWButtonPeer extends LWComponentPeer<Button, JButton>
         implements ButtonPeer, ActionListener {
 
@@ -42,7 +46,7 @@
     }
 
     @Override
-    protected JButton createDelegate() {
+    JButton createDelegate() {
         return new JButtonDelegate();
     }
 
@@ -74,6 +78,7 @@
         return true;
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JButtonDelegate extends JButton {
 
         // Empty non private constructor was added because access to this
--- a/jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -33,6 +33,10 @@
 
 import javax.swing.JComponent;
 
+/**
+ * Lightweight implementation of {@link CanvasPeer}. This peer is empty, because
+ * all the components in lwawt use graphic object from the top level window.
+ */
 class LWCanvasPeer<T extends Component, D extends JComponent>
         extends LWComponentPeer<T, D> implements CanvasPeer {
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -41,6 +41,11 @@
 import javax.swing.JToggleButton;
 import javax.swing.SwingUtilities;
 
+/**
+ * Lightweight implementation of {@link CheckboxPeer}. Delegates most of the
+ * work to the {@link JCheckBox} and {@link JRadioButton}, which are placed
+ * inside an empty {@link JComponent}.
+ */
 final class LWCheckboxPeer
         extends LWComponentPeer<Checkbox, LWCheckboxPeer.CheckboxDelegate>
         implements CheckboxPeer, ItemListener {
@@ -51,12 +56,12 @@
     }
 
     @Override
-    protected CheckboxDelegate createDelegate() {
+    CheckboxDelegate createDelegate() {
         return new CheckboxDelegate();
     }
 
     @Override
-    protected Component getDelegateFocusOwner() {
+    Component getDelegateFocusOwner() {
         return getDelegate().getCurrentButton();
     }
 
@@ -137,6 +142,7 @@
         return true;
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     final class CheckboxDelegate extends JComponent {
 
         private final JCheckBox cb;
--- a/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -26,14 +26,18 @@
 
 package sun.lwawt;
 
-import java.awt.Choice;
-import java.awt.Point;
+import java.awt.*;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.awt.peer.ChoicePeer;
 
-import javax.swing.JComboBox;
+import javax.accessibility.Accessible;
+import javax.swing.*;
 
+/**
+ * Lightweight implementation of {@link ChoicePeer}. Delegates most of the work
+ * to the {@link JComboBox}.
+ */
 final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
         implements ChoicePeer, ItemListener {
 
@@ -50,7 +54,7 @@
     }
 
     @Override
-    protected JComboBox<String> createDelegate() {
+    JComboBox<String> createDelegate() {
         return new JComboBoxDelegate();
     }
 
@@ -128,6 +132,7 @@
         return true;
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JComboBoxDelegate extends JComboBox<String> {
 
         // Empty non private constructor was added because access to this
@@ -159,5 +164,32 @@
             }
             super.setSelectedItem(anObject);
         }
+
+        @Override
+        public void firePopupMenuWillBecomeVisible() {
+            super.firePopupMenuWillBecomeVisible();
+            SwingUtilities.invokeLater(new Runnable() {
+                @Override
+                public void run() {
+                    JPopupMenu popupMenu = getPopupMenu();
+                    if (popupMenu != null) {
+                        if (popupMenu.getInvoker() != LWChoicePeer.this.getTarget()) {
+                            popupMenu.setVisible(false);
+                            popupMenu.show(LWChoicePeer.this.getTarget(), 0, 0);
+                        }
+                    }
+                }
+            });
+        }
+
+        private JPopupMenu getPopupMenu() {
+            for (int i = 0; i < getAccessibleContext().getAccessibleChildrenCount(); i++) {
+                Accessible child = getAccessibleContext().getAccessibleChild(i);
+                if (child instanceof JPopupMenu) {
+                    return  (JPopupMenu) child;
+                }
+            }
+            return null;
+        }
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -72,19 +72,23 @@
 {
     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer");
 
-    // State lock is to be used for modifications to this
-    // peer's fields (e.g. bounds, background, font, etc.)
-    // It should be the last lock in the lock chain
-    private final Object stateLock =
-            new StringBuilder("LWComponentPeer.stateLock");
+    /**
+     * State lock is to be used for modifications to this peer's fields (e.g.
+     * bounds, background, font, etc.) It should be the last lock in the lock
+     * chain
+     */
+    private final Object stateLock = new Object();
 
-    // The lock to operate with the peers hierarchy. AWT tree
-    // lock is not used as there are many peers related ops
-    // to be done on the toolkit thread, and we don't want to
-    // depend on a public lock on this thread
-    private static final Object peerTreeLock =
-            new StringBuilder("LWComponentPeer.peerTreeLock");
+    /**
+     * The lock to operate with the peers hierarchy. AWT tree lock is not used
+     * as there are many peers related ops to be done on the toolkit thread, and
+     * we don't want to depend on a public lock on this thread
+     */
+    private static final Object peerTreeLock = new Object();
 
+    /**
+     * The associated AWT object.
+     */
     private final T target;
 
     /**
@@ -95,7 +99,7 @@
      * the hierarchy. The exception is LWWindowPeers: their containers are
      * always null
      */
-    private final LWContainerPeer containerPeer;
+    private final LWContainerPeer<?, ?> containerPeer;
 
     /**
      * Handy reference to the top-level window peer. Window peer is borrowed
@@ -147,11 +151,18 @@
      */
     private Image backBuffer;
 
+    /**
+     * All Swing delegates use delegateContainer as a parent. This container
+     * intentionally do not use parent of the peer.
+     */
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class DelegateContainer extends Container {
         {
             enableEvents(0xFFFFFFFF);
         }
 
+        // Empty non private constructor was added because access to this
+        // class shouldn't be emulated by a synthetic accessor method.
         DelegateContainer() {
             super();
         }
@@ -182,7 +193,7 @@
         }
     }
 
-    public LWComponentPeer(T target, PlatformComponent platformComponent) {
+    LWComponentPeer(final T target, final PlatformComponent platformComponent) {
         targetPaintArea = new LWRepaintArea();
         this.target = target;
         this.platformComponent = platformComponent;
@@ -276,15 +287,18 @@
      * This method is called under getDelegateLock().
      * Overridden in subclasses.
      */
-    protected D createDelegate() {
+    D createDelegate() {
         return null;
     }
 
-    protected final D getDelegate() {
+    final D getDelegate() {
         return delegate;
     }
 
-    protected Component getDelegateFocusOwner() {
+    /**
+     * This method should be called under getDelegateLock().
+     */
+    Component getDelegateFocusOwner() {
         return getDelegate();
     }
 
@@ -356,7 +370,7 @@
     }
 
     // Just a helper method
-    protected final LWContainerPeer getContainerPeer() {
+    protected final LWContainerPeer<?, ?> getContainerPeer() {
         return containerPeer;
     }
 
@@ -390,7 +404,7 @@
 
     protected void disposeImpl() {
         destroyBuffers();
-        LWContainerPeer cp = getContainerPeer();
+        LWContainerPeer<?, ?> cp = getContainerPeer();
         if (cp != null) {
             cp.removeChildPeer(this);
         }
@@ -462,12 +476,13 @@
         sg2d.constrain(size.x, size.y, size.width, size.height, getVisibleRegion());
     }
 
-    public Region getVisibleRegion() {
+    Region getVisibleRegion() {
         return computeVisibleRect(this, getRegion());
     }
 
-    static final Region computeVisibleRect(LWComponentPeer c, Region region) {
-        final LWContainerPeer p = c.getContainerPeer();
+    static final Region computeVisibleRect(final LWComponentPeer<?, ?> c,
+                                           Region region) {
+        final LWContainerPeer<?, ?> p = c.getContainerPeer();
         if (p != null) {
             final Rectangle r = c.getBounds();
             region = region.getTranslatedRegion(r.x, r.y);
@@ -612,7 +627,7 @@
      * @param p Point relative to the peer.
      * @return Cursor of the peer or null if default cursor should be used.
      */
-    protected Cursor getCursor(final Point p) {
+    Cursor getCursor(final Point p) {
         return getTarget().getCursor();
     }
 
@@ -717,7 +732,7 @@
     @Override
     public void setEnabled(final boolean e) {
         boolean status = e;
-        final LWComponentPeer cp = getContainerPeer();
+        final LWComponentPeer<?, ?> cp = getContainerPeer();
         if (cp != null) {
             status &= cp.isEnabled();
         }
@@ -802,12 +817,12 @@
     }
 
     @Override
-    public void setZOrder(ComponentPeer above) {
-        LWContainerPeer cp = getContainerPeer();
+    public void setZOrder(final ComponentPeer above) {
+        LWContainerPeer<?, ?> cp = getContainerPeer();
         // Don't check containerPeer for null as it can only happen
         // for windows, but this method is overridden in
         // LWWindowPeer and doesn't call super()
-        cp.setChildPeerZOrder(this, (LWComponentPeer) above);
+        cp.setChildPeerZOrder(this, (LWComponentPeer<?, ?>) above);
     }
 
     @Override
@@ -923,7 +938,9 @@
                     LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
                     return false;
                 }
-                LWWindowPeer parentPeer = (LWWindowPeer) parentWindow.getPeer();
+                final LWWindowPeer parentPeer =
+                        (LWWindowPeer) AWTAccessor.getComponentAccessor()
+                                                  .getPeer(parentWindow);
                 if (parentPeer == null) {
                     focusLog.fine("request rejected, parentPeer is null");
                     LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
@@ -1138,7 +1155,7 @@
     }
 
     protected final void repaintParent(final Rectangle oldB) {
-        final LWContainerPeer cp = getContainerPeer();
+        final LWContainerPeer<?, ?> cp = getContainerPeer();
         if (cp != null) {
             // Repaint unobscured part of the parent
             cp.repaintPeer(cp.getContentSize().intersection(oldB));
@@ -1254,6 +1271,8 @@
             KeyEvent ke = (KeyEvent) e;
             delegateEvent = new KeyEvent(getDelegateFocusOwner(), ke.getID(), ke.getWhen(),
                     ke.getModifiers(), ke.getKeyCode(), ke.getKeyChar(), ke.getKeyLocation());
+            AWTAccessor.getKeyEventAccessor().setExtendedKeyCode((KeyEvent) delegateEvent,
+                    ke.getExtendedKeyCode());
         } else if (e instanceof FocusEvent) {
             FocusEvent fe = (FocusEvent) e;
             delegateEvent = new FocusEvent(getDelegateFocusOwner(), fe.getID(), fe.isTemporary());
@@ -1273,7 +1292,7 @@
     /**
      * Handler for FocusEvents.
      */
-    protected void handleJavaFocusEvent(FocusEvent e) {
+    void handleJavaFocusEvent(final FocusEvent e) {
         // Note that the peer receives all the FocusEvents from
         // its lightweight children as well
         KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
@@ -1309,7 +1328,7 @@
      * Finds a top-most visible component for the given point. The location is
      * specified relative to the peer's parent.
      */
-    public LWComponentPeer findPeerAt(final int x, final int y) {
+    LWComponentPeer<?, ?> findPeerAt(final int x, final int y) {
         final Rectangle r = getBounds();
         final Region sh = getRegion();
         final boolean found = isVisible() && sh.contains(x - r.x, y - r.y);
@@ -1326,7 +1345,7 @@
     }
 
     public Point windowToLocal(Point p, LWWindowPeer wp) {
-        LWComponentPeer cp = this;
+        LWComponentPeer<?, ?> cp = this;
         while (cp != wp) {
             Rectangle cpb = cp.getBounds();
             p.x -= cpb.x;
@@ -1347,7 +1366,7 @@
     }
 
     public Point localToWindow(Point p) {
-        LWComponentPeer cp = getContainerPeer();
+        LWComponentPeer<?, ?> cp = getContainerPeer();
         Rectangle r = getBounds();
         while (cp != null) {
             p.x += r.x;
@@ -1368,7 +1387,7 @@
         repaintPeer(getSize());
     }
 
-    public void repaintPeer(final Rectangle r) {
+    void repaintPeer(final Rectangle r) {
         final Rectangle toPaint = getSize().intersection(r);
         if (!isShowing() || toPaint.isEmpty()) {
             return;
@@ -1387,7 +1406,7 @@
     protected final boolean isShowing() {
         synchronized (getPeerTreeLock()) {
             if (isVisible()) {
-                final LWContainerPeer container = getContainerPeer();
+                final LWContainerPeer<?, ?> container = getContainerPeer();
                 return (container == null) || container.isShowing();
             }
         }
@@ -1395,8 +1414,7 @@
     }
 
     /**
-     * Paints the peer. Overridden in subclasses to delegate the actual painting
-     * to Swing components.
+     * Paints the peer. Delegate the actual painting to Swing components.
      */
     protected final void paintPeer(final Graphics g) {
         final D delegate = getDelegate();
--- a/jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -41,32 +41,25 @@
 import javax.swing.JComponent;
 
 abstract class LWContainerPeer<T extends Container, D extends JComponent>
-    extends LWCanvasPeer<T, D>
-    implements ContainerPeer
-{
-    // List of child peers sorted by z-order from bottom-most
-    // to top-most
-    private List<LWComponentPeer> childPeers =
-        new LinkedList<LWComponentPeer>();
+        extends LWCanvasPeer<T, D> implements ContainerPeer {
 
-    LWContainerPeer(T target, PlatformComponent platformComponent) {
+    /**
+     * List of child peers sorted by z-order from bottom-most to top-most.
+     */
+    private final List<LWComponentPeer<?, ?>> childPeers = new LinkedList<>();
+
+    LWContainerPeer(final T target, final PlatformComponent platformComponent) {
         super(target, platformComponent);
     }
 
-    void addChildPeer(LWComponentPeer child) {
+    final void addChildPeer(final LWComponentPeer<?, ?> child) {
         synchronized (getPeerTreeLock()) {
-            addChildPeer(child, childPeers.size());
+            childPeers.add(childPeers.size(), child);
+            // TODO: repaint
         }
     }
 
-    void addChildPeer(LWComponentPeer child, int index) {
-        synchronized (getPeerTreeLock()) {
-            childPeers.add(index, child);
-        }
-        // TODO: repaint
-    }
-
-    void removeChildPeer(LWComponentPeer child) {
+    final void removeChildPeer(final LWComponentPeer<?, ?> child) {
         synchronized (getPeerTreeLock()) {
             childPeers.remove(child);
         }
@@ -74,7 +67,8 @@
     }
 
     // Used by LWComponentPeer.setZOrder()
-    void setChildPeerZOrder(LWComponentPeer peer, LWComponentPeer above) {
+    final void setChildPeerZOrder(final LWComponentPeer<?, ?> peer,
+                                  final LWComponentPeer<?, ?> above) {
         synchronized (getPeerTreeLock()) {
             childPeers.remove(peer);
             int index = (above != null) ? childPeers.indexOf(above) : childPeers.size();
@@ -98,25 +92,27 @@
     }
 
     @Override
-    public void beginValidate() {
-        // TODO: it seems that begin/endValidate() is only useful
-        // for heavyweight windows, when a batch movement for
-        // child windows  occurs. That's why no-op
-    }
-    @Override
-    public void endValidate() {
+    public final void beginValidate() {
         // TODO: it seems that begin/endValidate() is only useful
         // for heavyweight windows, when a batch movement for
         // child windows  occurs. That's why no-op
     }
 
     @Override
-    public void beginLayout() {
+    public final void endValidate() {
+        // TODO: it seems that begin/endValidate() is only useful
+        // for heavyweight windows, when a batch movement for
+        // child windows  occurs. That's why no-op
+    }
+
+    @Override
+    public final void beginLayout() {
         // Skip all painting till endLayout()
         setLayouting(true);
     }
+
     @Override
-    public void endLayout() {
+    public final void endLayout() {
         setLayouting(false);
 
         // Post an empty event to flush all the pending target paints
@@ -125,18 +121,19 @@
 
     // ---- PEER NOTIFICATIONS ---- //
 
-    /*
+    /**
      * Returns a copy of the childPeer collection.
      */
-    protected List<LWComponentPeer> getChildren() {
+    @SuppressWarnings("unchecked")
+    final List<LWComponentPeer<?, ?>> getChildren() {
         synchronized (getPeerTreeLock()) {
-            Object copy = ((LinkedList)childPeers).clone();
-            return (List<LWComponentPeer>)copy;
+            Object copy = ((LinkedList<?>) childPeers).clone();
+            return (List<LWComponentPeer<?, ?>>) copy;
         }
     }
 
     @Override
-    public final Region getVisibleRegion() {
+    final Region getVisibleRegion() {
         return cutChildren(super.getVisibleRegion(), null);
     }
 
@@ -144,9 +141,9 @@
      * Removes bounds of children above specific child from the region. If above
      * is null removes all bounds of children.
      */
-    protected final Region cutChildren(Region r, final LWComponentPeer above) {
+    final Region cutChildren(Region r, final LWComponentPeer<?, ?> above) {
         boolean aboveFound = above == null;
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             if (!aboveFound && child == above) {
                 aboveFound = true;
                 continue;
@@ -170,8 +167,8 @@
      * specified relative to the peer's parent.
      */
     @Override
-    public final LWComponentPeer findPeerAt(int x, int y) {
-        LWComponentPeer peer = super.findPeerAt(x, y);
+    final LWComponentPeer<?, ?> findPeerAt(int x, int y) {
+        LWComponentPeer<?, ?> peer = super.findPeerAt(x, y);
         final Rectangle r = getBounds();
         // Translate to this container's coordinates to pass to children
         x -= r.x;
@@ -179,7 +176,7 @@
         if (peer != null && getContentSize().contains(x, y)) {
             synchronized (getPeerTreeLock()) {
                 for (int i = childPeers.size() - 1; i >= 0; --i) {
-                    LWComponentPeer p = childPeers.get(i).findPeerAt(x, y);
+                    LWComponentPeer<?, ?> p = childPeers.get(i).findPeerAt(x, y);
                     if (p != null) {
                         peer = p;
                         break;
@@ -195,7 +192,7 @@
     * peers should be repainted
     */
     @Override
-    public final void repaintPeer(final Rectangle r) {
+    final void repaintPeer(final Rectangle r) {
         final Rectangle toPaint = getSize().intersection(r);
         if (!isShowing() || toPaint.isEmpty()) {
             return;
@@ -208,13 +205,13 @@
         repaintChildren(toPaint);
     }
 
-    /*
-    * Paints all the child peers in the straight z-order, so the
-    * bottom-most ones are painted first.
-    */
+    /**
+     * Paints all the child peers in the straight z-order, so the
+     * bottom-most ones are painted first.
+     */
     private void repaintChildren(final Rectangle r) {
         final Rectangle content = getContentSize();
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             final Rectangle childBounds = child.getBounds();
             Rectangle toPaint = r.intersection(childBounds);
             toPaint = toPaint.intersection(content);
@@ -223,21 +220,21 @@
         }
     }
 
-    protected Rectangle getContentSize() {
+    Rectangle getContentSize() {
         return getSize();
     }
 
     @Override
     public void setEnabled(final boolean e) {
         super.setEnabled(e);
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             child.setEnabled(e && child.getTarget().isEnabled());
         }
     }
 
     @Override
     public void setBackground(final Color c) {
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             if (!child.getTarget().isBackgroundSet()) {
                 child.setBackground(c);
             }
@@ -247,7 +244,7 @@
 
     @Override
     public void setForeground(final Color c) {
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             if (!child.getTarget().isForegroundSet()) {
                 child.setForeground(c);
             }
@@ -257,7 +254,7 @@
 
     @Override
     public void setFont(final Font f) {
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             if (!child.getTarget().isFontSet()) {
                 child.setFont(f);
             }
--- a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -32,6 +32,7 @@
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 
 public abstract class LWCursorManager {
@@ -105,11 +106,13 @@
             c = peer.getTarget();
             if (c instanceof Container) {
                 final Point p = peer.getLocationOnScreen();
-                c = ((Container) c).findComponentAt(cursorPos.x - p.x,
-                                                    cursorPos.y - p.y);
+                c = AWTAccessor.getContainerAccessor().findComponentAt(
+                    (Container) c, cursorPos.x - p.x, cursorPos.y - p.y, false);
+
             }
             while (c != null) {
-                if (c.isVisible() && c.isEnabled() && (c.getPeer() != null)) {
+                final Object p = AWTAccessor.getComponentAccessor().getPeer(c);
+                if (c.isVisible() && c.isEnabled() && p != null) {
                     break;
                 }
                 c = c.getParent();
--- a/jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -44,7 +44,7 @@
     }
 
     @Override
-    protected JLabel createDelegate() {
+    JLabel createDelegate() {
         return new JLabel();
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,6 +34,8 @@
 
 import sun.awt.CausedFocusEvent;
 import sun.awt.LightweightFrame;
+import sun.swing.JLightweightFrame;
+import sun.swing.SwingAccessor;
 
 public class LWLightweightFramePeer extends LWWindowPeer {
 
@@ -91,11 +93,6 @@
     }
 
     @Override
-    public void updateCursorImmediately() {
-        // TODO: tries to switch to the awt/fx toolkit thread and causes a deadlock on macosx
-    }
-
-    @Override
     public void addDropTarget(DropTarget dt) {
     }
 
@@ -112,4 +109,9 @@
     public void ungrab() {
         getLwTarget().ungrabFocus();
     }
+
+    @Override
+    public void updateCursorImmediately() {
+        SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
+    }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/LWListPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWListPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -33,7 +33,8 @@
 import java.util.Arrays;
 
 /**
- * Lightweight implementation of {@link ListPeer}.
+ * Lightweight implementation of {@link ListPeer}. Delegates most of the work to
+ * the {@link JList}, which is placed inside {@link JScrollPane}.
  */
 final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
         implements ListPeer {
@@ -56,7 +57,7 @@
     }
 
     @Override
-    protected ScrollableJList createDelegate() {
+    ScrollableJList createDelegate() {
         return new ScrollableJList();
     }
 
@@ -78,7 +79,7 @@
     }
 
     @Override
-    protected Component getDelegateFocusOwner() {
+    Component getDelegateFocusOwner() {
         return getDelegate().getView();
     }
 
@@ -193,6 +194,7 @@
         }
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     final class ScrollableJList extends JScrollPane implements ListSelectionListener {
 
         private boolean skipStateChangedEvent;
@@ -234,9 +236,10 @@
         }
 
         @Override
+        @SuppressWarnings("unchecked")
         public void valueChanged(final ListSelectionEvent e) {
             if (!e.getValueIsAdjusting() && !isSkipStateChangedEvent()) {
-                final JList source = (JList) e.getSource();
+                final JList<?> source = (JList<?>) e.getSource();
                 for(int i = 0 ; i < source.getModel().getSize(); i++) {
 
                     final boolean wasSelected = Arrays.binarySearch(oldSelectedIndices, i) >= 0;
@@ -255,6 +258,7 @@
             }
         }
 
+        @SuppressWarnings("unchecked")
         public JList<String> getView() {
             return (JList<String>) getViewport().getView();
         }
@@ -289,7 +293,7 @@
         private final class JListDelegate extends JList<String> {
 
             JListDelegate() {
-                super(ScrollableJList.this.model);
+                super(model);
             }
 
             @Override
--- a/jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -30,10 +30,9 @@
 
 import java.awt.peer.MouseInfoPeer;
 
-public class LWMouseInfoPeer implements MouseInfoPeer {
+import sun.awt.AWTAccessor;
 
-    public LWMouseInfoPeer() {
-    }
+public class LWMouseInfoPeer implements MouseInfoPeer {
 
     @Override
     public int fillPointWithCoords(Point point) {
@@ -52,7 +51,7 @@
             return false;
         }
 
-        LWWindowPeer windowPeer = (LWWindowPeer)w.getPeer();
+        final Object windowPeer = AWTAccessor.getComponentAccessor().getPeer(w);
         return LWWindowPeer.getWindowUnderCursor() == windowPeer;
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,10 @@
 
 import javax.swing.JPanel;
 
+/**
+ * Lightweight implementation of {@link PanelPeer}. Delegates most of the work
+ * to the {@link JPanel}.
+ */
 final class LWPanelPeer extends LWContainerPeer<Panel, JPanel>
         implements PanelPeer {
 
@@ -39,7 +43,7 @@
     }
 
     @Override
-    public JPanel createDelegate() {
+    JPanel createDelegate() {
         return new JPanel();
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -26,39 +26,38 @@
 
 package sun.lwawt;
 
-import sun.awt.RepaintArea;
-
 import java.awt.Component;
 import java.awt.Graphics;
 
+import sun.awt.AWTAccessor;
+import sun.awt.RepaintArea;
+
 /**
+ * Emulates appearance of heavyweight components before call of the user code.
+ *
  * @author Sergey Bylokhov
  */
 final class LWRepaintArea extends RepaintArea {
 
     @Override
     protected void updateComponent(final Component comp, final Graphics g) {
+        // We shouldn't paint native component as a result of UPDATE events,
+        // just flush onscreen back-buffer.
         if (comp != null) {
             super.updateComponent(comp, g);
-            flushBuffers((LWComponentPeer) comp.getPeer());
+            LWComponentPeer.flushOnscreenGraphics();
         }
     }
 
     @Override
     protected void paintComponent(final Component comp, final Graphics g) {
         if (comp != null) {
-            final LWComponentPeer peer = (LWComponentPeer) comp.getPeer();
+            Object peer = AWTAccessor.getComponentAccessor().getPeer(comp);
             if (peer != null) {
-                peer.paintPeer(g);
+                ((LWComponentPeer<?, ?>) peer).paintPeer(g);
             }
             super.paintComponent(comp, g);
-            flushBuffers(peer);
-        }
-    }
-
-    private static void flushBuffers(final LWComponentPeer peer) {
-        if (peer != null) {
-            peer.flushOnscreenGraphics();
+            LWComponentPeer.flushOnscreenGraphics();
         }
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,10 +34,14 @@
 
 import javax.swing.JScrollBar;
 
+/**
+ * Lightweight implementation of {@link ScrollbarPeer}. Delegates most of the
+ * work to the {@link JScrollBar}.
+ */
 final class LWScrollBarPeer extends LWComponentPeer<Scrollbar, JScrollBar>
         implements ScrollbarPeer, AdjustmentListener {
 
-    //JScrollBar fires two changes with firePropertyChange (one for old value
+    // JScrollBar fires two changes with firePropertyChange (one for old value
     // and one for new one.
     // We save the last value and don't fire event if not changed.
     private int currentValue;
@@ -48,7 +52,7 @@
     }
 
     @Override
-    protected JScrollBar createDelegate() {
+    JScrollBar createDelegate() {
         return new JScrollBar();
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -33,6 +33,10 @@
 import java.awt.peer.ScrollPanePeer;
 import java.util.List;
 
+/**
+ * Lightweight implementation of {@link ScrollPanePeer}. Delegates most of the
+ * work to the {@link JScrollPane}.
+ */
 final class LWScrollPanePeer extends LWContainerPeer<ScrollPane, JScrollPane>
         implements ScrollPanePeer, ChangeListener {
 
@@ -41,7 +45,8 @@
         super(target, platformComponent);
     }
 
-    protected JScrollPane createDelegate() {
+    @Override
+    JScrollPane createDelegate() {
         final JScrollPane sp = new JScrollPane();
         final JPanel panel = new JPanel();
         panel.setOpaque(false);
@@ -72,7 +77,7 @@
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
-                final LWComponentPeer viewPeer = getViewPeer();
+                final LWComponentPeer<?, ?> viewPeer = getViewPeer();
                 if (viewPeer != null) {
                     final Rectangle r;
                     synchronized (getDelegateLock()) {
@@ -96,14 +101,13 @@
         }
     }
 
-    LWComponentPeer getViewPeer() {
-        List<LWComponentPeer> peerList = getChildren();
+    LWComponentPeer<?, ?> getViewPeer() {
+        final List<LWComponentPeer<?, ?>> peerList = getChildren();
         return peerList.isEmpty() ? null : peerList.get(0);
     }
 
-
     @Override
-    protected Rectangle getContentSize() {
+    Rectangle getContentSize() {
         Rectangle viewRect = getDelegate().getViewport().getViewRect();
         return new Rectangle(viewRect.width, viewRect.height);
     }
@@ -112,7 +116,7 @@
     public void layout() {
         super.layout();
         synchronized (getDelegateLock()) {
-            LWComponentPeer viewPeer = getViewPeer();
+            final LWComponentPeer<?, ?> viewPeer = getViewPeer();
             if (viewPeer != null) {
                 Component view = getDelegate().getViewport().getView();
                 view.setBounds(viewPeer.getBounds());
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -44,7 +44,7 @@
 
 /**
  * Lightweight implementation of {@link TextAreaPeer}. Delegates most of the
- * work to the {@link JTextArea} inside JScrollPane.
+ * work to the {@link JTextArea} inside {@link JScrollPane}.
  */
 final class LWTextAreaPeer
         extends LWTextComponentPeer<TextArea, LWTextAreaPeer.ScrollableJTextArea>
@@ -66,7 +66,7 @@
     }
 
     @Override
-    protected ScrollableJTextArea createDelegate() {
+    ScrollableJTextArea createDelegate() {
         return new ScrollableJTextArea();
     }
 
@@ -85,7 +85,7 @@
     }
 
     @Override
-    protected Cursor getCursor(final Point p) {
+    Cursor getCursor(final Point p) {
         final boolean isContains;
         synchronized (getDelegateLock()) {
             isContains = getDelegate().getViewport().getBounds().contains(p);
@@ -94,7 +94,7 @@
     }
 
     @Override
-    protected Component getDelegateFocusOwner() {
+    Component getDelegateFocusOwner() {
         return getTextComponent();
     }
 
@@ -200,7 +200,7 @@
         }
     }
 
-    @SuppressWarnings("serial")
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     final class ScrollableJTextArea extends JScrollPane {
 
         ScrollableJTextArea() {
@@ -218,7 +218,6 @@
             super.setEnabled(enabled);
         }
 
-        @SuppressWarnings("serial")
         private final class JTextAreaDelegate extends JTextArea {
 
             // Empty non private constructor was added because access to this
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -44,11 +44,14 @@
 import javax.swing.text.Document;
 import javax.swing.text.JTextComponent;
 
+/**
+ * Lightweight implementation of {@link TextComponentPeer}. Provides useful
+ * methods for {@link LWTextAreaPeer} and {@link LWTextFieldPeer}
+ */
 abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent>
         extends LWComponentPeer<T, D>
         implements DocumentListener, TextComponentPeer, InputMethodListener {
 
-
     private volatile boolean firstChangeSkipped;
 
     LWTextComponentPeer(final T target,
@@ -218,14 +221,14 @@
     }
 
     @Override
-    public void inputMethodTextChanged(InputMethodEvent event) {
+    public void inputMethodTextChanged(final InputMethodEvent event) {
         synchronized (getDelegateLock()) {
             AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event);
         }
     }
 
     @Override
-    public void caretPositionChanged(InputMethodEvent event) {
+    public void caretPositionChanged(final InputMethodEvent event) {
         synchronized (getDelegateLock()) {
             AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event);
         }
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -37,6 +37,10 @@
 import javax.swing.*;
 import javax.swing.text.JTextComponent;
 
+/**
+ * Lightweight implementation of {@link TextFieldPeer}. Delegates most of the
+ * work to the {@link JPasswordField}.
+ */
 final class LWTextFieldPeer
         extends LWTextComponentPeer<TextField, JPasswordField>
         implements TextFieldPeer, ActionListener {
@@ -47,7 +51,7 @@
     }
 
     @Override
-    protected JPasswordField createDelegate() {
+    JPasswordField createDelegate() {
         return new JPasswordFieldDelegate();
     }
 
@@ -107,7 +111,7 @@
      * @param e the focus event
      */
     @Override
-    protected void handleJavaFocusEvent(final FocusEvent e) {
+    void handleJavaFocusEvent(final FocusEvent e) {
         if (e.getID() == FocusEvent.FOCUS_LOST) {
             // In order to de-select the selection
             setCaretPosition(0);
@@ -115,6 +119,7 @@
         super.handleJavaFocusEvent(e);
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JPasswordFieldDelegate extends JPasswordField {
 
         // Empty non private constructor was added because access to this
--- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -557,16 +557,18 @@
     }
 
     @Override
-    public void grab(Window w) {
-        if (w.getPeer() != null) {
-            ((LWWindowPeer)w.getPeer()).grab();
+    public void grab(final Window w) {
+        final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
+        if (peer != null) {
+            ((LWWindowPeer) peer).grab();
         }
     }
 
     @Override
-    public void ungrab(Window w) {
-        if (w.getPeer() != null) {
-            ((LWWindowPeer)w.getPeer()).ungrab(false);
+    public void ungrab(final Window w) {
+        final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
+        if (peer != null) {
+            ((LWWindowPeer) peer).ungrab(false);
         }
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,7 +43,7 @@
     extends LWContainerPeer<Window, JComponent>
     implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener, PlatformEventNotifier
 {
-    public static enum PeerType {
+    public enum PeerType {
         SIMPLEWINDOW,
         FRAME,
         DIALOG,
@@ -83,15 +83,15 @@
 
     // A peer where the last mouse event came to. Used by cursor manager to
     // find the component under cursor
-    private static volatile LWComponentPeer lastCommonMouseEventPeer = null;
+    private static volatile LWComponentPeer<?, ?> lastCommonMouseEventPeer;
 
     // A peer where the last mouse event came to. Used to generate
     // MOUSE_ENTERED/EXITED notifications
-    private volatile LWComponentPeer lastMouseEventPeer;
+    private volatile LWComponentPeer<?, ?> lastMouseEventPeer;
 
     // Peers where all dragged/released events should come to,
     // depending on what mouse button is being dragged according to Cocoa
-    private static LWComponentPeer mouseDownTarget[] = new LWComponentPeer[3];
+    private static final LWComponentPeer<?, ?>[] mouseDownTarget = new LWComponentPeer<?, ?>[3];
 
     // A bitmask that indicates what mouse buttons produce MOUSE_CLICKED events
     // on MOUSE_RELEASE. Click events are only generated if there were no drag
@@ -129,7 +129,8 @@
         this.peerType = peerType;
 
         Window owner = target.getOwner();
-        LWWindowPeer ownerPeer = (owner != null) ? (LWWindowPeer)owner.getPeer() : null;
+        LWWindowPeer ownerPeer = owner == null ? null :
+             (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner);
         PlatformWindow ownerDelegate = (ownerPeer != null) ? ownerPeer.getPlatformWindow() : null;
 
         // The delegate.initialize() needs a non-null GC on X11.
@@ -163,10 +164,10 @@
 
         // Init warning window(for applets)
         SecurityWarningWindow warn = null;
-        if (((Window)target).getWarningString() != null) {
+        if (target.getWarningString() != null) {
             // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
             // and TrayIcon balloon windows without a warning window.
-            if (!AWTAccessor.getWindowAccessor().isTrayIconWindow((Window)target)) {
+            if (!AWTAccessor.getWindowAccessor().isTrayIconWindow(target)) {
                 LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
                 warn = toolkit.createSecurityWarning(target, this);
             }
@@ -210,6 +211,7 @@
     }
 
     // Just a helper method
+    @Override
     public PlatformWindow getPlatformWindow() {
         return platformWindow;
     }
@@ -391,7 +393,8 @@
     @Override
     public void setModalBlocked(Dialog blocker, boolean blocked) {
         synchronized (getPeerTreeLock()) {
-            this.blocker = blocked ? (LWWindowPeer)blocker.getPeer() : null;
+            this.blocker = !blocked ? null :
+            (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(blocker);
         }
 
         platformWindow.setModalBlocked(blocked);
@@ -458,6 +461,7 @@
         textured = isTextured;
     }
 
+    @Override
     public final boolean isTranslucent() {
         synchronized (getStateLock()) {
             /*
@@ -537,7 +541,8 @@
     public void blockWindows(List<Window> windows) {
         //TODO: LWX will probably need some collectJavaToplevels to speed this up
         for (Window w : windows) {
-            WindowPeer wp = (WindowPeer)w.getPeer();
+            WindowPeer wp =
+                    (WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
             if (wp != null) {
                 wp.setModalBlocked((Dialog)getTarget(), true);
             }
@@ -694,7 +699,7 @@
         // TODO: fill "bdata" member of AWTEvent
         Rectangle r = getBounds();
         // findPeerAt() expects parent coordinates
-        LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y);
+        LWComponentPeer<?, ?> targetPeer = findPeerAt(r.x + x, r.y + y);
 
         if (id == MouseEvent.MOUSE_EXITED) {
             isMouseOver = false;
@@ -743,7 +748,7 @@
                         screenX, screenY, modifiers, clickCount, popupTrigger,
                         targetPeer);
             } else {
-                LWComponentPeer topmostTargetPeer =
+                LWComponentPeer<?, ?> topmostTargetPeer =
                         topmostWindowPeer != null ? topmostWindowPeer.findPeerAt(r.x + x, r.y + y) : null;
                 topmostWindowPeer.generateMouseEnterExitEventsForComponents(when, button, x, y,
                         screenX, screenY, modifiers, clickCount, popupTrigger,
@@ -840,7 +845,7 @@
     private void generateMouseEnterExitEventsForComponents(long when,
             int button, int x, int y, int screenX, int screenY,
             int modifiers, int clickCount, boolean popupTrigger,
-            LWComponentPeer targetPeer) {
+            final LWComponentPeer<?, ?> targetPeer) {
 
         if (!isMouseOver || targetPeer == lastMouseEventPeer) {
             return;
@@ -899,7 +904,7 @@
         // TODO: could we just use the last mouse event target here?
         Rectangle r = getBounds();
         // findPeerAt() expects parent coordinates
-        final LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y);
+        final LWComponentPeer<?, ?> targetPeer = findPeerAt(r.x + x, r.y + y);
         if (targetPeer == null || !targetPeer.isEnabled()) {
             return;
         }
@@ -933,7 +938,12 @@
                 focusOwner = this.getTarget();
             }
         }
-        postEvent(new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation));
+
+        KeyEvent keyEvent = new KeyEvent(focusOwner, id, when, modifiers,
+            keyCode, keyChar, keyLocation);
+        AWTAccessor.getKeyEventAccessor().setExtendedKeyCode(keyEvent,
+            ExtendedKeyCodes.getExtendedKeyCodeForChar(keyChar));
+        postEvent(keyEvent);
     }
 
     // ---- UTILITY METHODS ---- //
@@ -1152,8 +1162,9 @@
                 if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
                     focusLog.fine("requesting native focus to the owner " + owner);
                 }
-                LWWindowPeer currentActivePeer = (currentActive != null ?
-                    (LWWindowPeer)currentActive.getPeer() : null);
+                LWWindowPeer currentActivePeer = currentActive == null ? null :
+                (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(
+                        currentActive);
 
                 // Ensure the opposite is natively active and suppress sending events.
                 if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) {
@@ -1265,7 +1276,8 @@
         while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
             owner = owner.getOwner();
         }
-        return owner != null ? (LWWindowPeer)owner.getPeer() : null;
+        return owner == null ? null :
+               (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner);
     }
 
     /**
@@ -1284,11 +1296,13 @@
         }
     }
 
+    @Override
     public void enterFullScreenMode() {
         platformWindow.enterFullScreenMode();
         updateSecurityWarningVisibility();
     }
 
+    @Override
     public void exitFullScreenMode() {
         platformWindow.exitFullScreenMode();
         updateSecurityWarningVisibility();
--- a/jdk/src/macosx/classes/sun/lwawt/SelectionClearListener.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.lwawt;
-
-/*
- * Every time the TextField (or TextArea) change selection, every other text components
- * must immediately clear their selections.
- */
-interface SelectionClearListener {
-   void clearSelection();
-}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenu.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenu.java	Fri Oct 11 09:17:18 2013 -0400
@@ -26,9 +26,11 @@
 package sun.lwawt.macosx;
 
 import java.awt.*;
+import java.awt.peer.MenuItemPeer;
 import java.awt.peer.MenuPeer;
 
 public class CMenu extends CMenuItem implements MenuPeer {
+
     public CMenu(Menu target) {
         super(target);
     }
@@ -41,6 +43,20 @@
     }
 
     @Override
+    public final void setEnabled(final boolean b) {
+        super.setEnabled(b);
+        final Menu target = (Menu) getTarget();
+        final int count = target.getItemCount();
+        for (int i = 0; i < count; ++i) {
+            MenuItem item = target.getItem(i);
+            MenuItemPeer p = (MenuItemPeer) LWCToolkit.targetToPeer(item);
+            if (p != null) {
+                p.setEnabled(b && item.isEnabled());
+            }
+        }
+    }
+
+    @Override
     protected long createModel() {
         CMenuComponent parent = (CMenuComponent)
             LWCToolkit.targetToPeer(getTarget().getParent());
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java	Fri Oct 11 09:17:18 2013 -0400
@@ -28,17 +28,20 @@
 import sun.awt.SunToolkit;
 import sun.lwawt.LWToolkit;
 
+import java.awt.MenuContainer;
 import java.awt.MenuItem;
 import java.awt.MenuShortcut;
 import java.awt.event.*;
 import java.awt.peer.MenuItemPeer;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 public class CMenuItem extends CMenuComponent implements MenuItemPeer {
 
+    private final AtomicBoolean enabled = new AtomicBoolean(true);
+
     public CMenuItem(MenuItem target) {
         super(target);
         initialize(target);
-
     }
 
     // This way we avoiding invocation of the setters twice
@@ -124,9 +127,19 @@
         setEnabled(false);
     }
 
+    public final boolean isEnabled() {
+        return enabled.get();
+    }
+
     @Override
     public void setEnabled(boolean b) {
-        nativeSetEnabled(getModel(), b);
+        final Object parent = LWToolkit.targetToPeer(getTarget().getParent());
+        if (parent instanceof CMenuItem) {
+            b &= ((CMenuItem) parent).isEnabled();
+        }
+        if (enabled.compareAndSet(!b, b)) {
+            nativeSetEnabled(getModel(), b);
+        }
     }
 
     private native long nativeCreate(long parentMenu, boolean isSeparator);
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.lwawt.macosx;
-
-import java.awt.Window;
-import sun.lwawt.LWMouseInfoPeer;
-import sun.lwawt.LWWindowPeer;
-
-public class CMouseInfoPeer extends LWMouseInfoPeer
-{
-    //If a new window is to appear under the cursor,
-    //we get wrong window.
-    //This is a workaround for macosx.
-    @Override
-    public boolean isWindowUnderMouse(Window w) {
-        if (w == null) {
-            return false;
-        }
-
-        return ((LWWindowPeer)w.getPeer()).getPlatformWindow().isUnderMouse();
-    }
-}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Oct 11 09:17:18 2013 -0400
@@ -820,6 +820,7 @@
         }
 
         nativeSetEnabled(getNSWindowPtr(), !blocked);
+        checkBlockingAndOrder();
     }
 
     public final void invalidateShadow(){
@@ -984,7 +985,7 @@
         setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN, isFocusable); // set both bits at once
     }
 
-    private boolean checkBlocking() {
+    private boolean checkBlockingAndOrder() {
         LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
         if (blocker == null) {
             return false;
@@ -1040,7 +1041,7 @@
     private void windowDidBecomeMain() {
         assert CThreading.assertAppKit();
 
-        if (checkBlocking()) return;
+        if (checkBlockingAndOrder()) return;
         // If it's not blocked, make sure it's above its siblings
         orderAboveSiblings();
     }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,8 @@
 import sun.lwawt.LWWindowPeer.PeerType;
 import sun.security.action.GetBooleanAction;
 
+import sun.util.CoreResourceBundleControl;
+
 class NamedCursor extends Cursor {
     NamedCursor(String name) {
         super(name);
@@ -67,13 +69,28 @@
 
     static {
         System.err.flush();
-        java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() {
-            public Object run() {
+
+        ResourceBundle platformResources = java.security.AccessController.doPrivileged(
+                new java.security.PrivilegedAction<ResourceBundle>() {
+            public ResourceBundle run() {
+                ResourceBundle platformResources = null;
+                try {
+                    platformResources =
+                            ResourceBundle.getBundle("sun.awt.resources.awtosx",
+                                    CoreResourceBundleControl.getRBControlInstance());
+                } catch (MissingResourceException e) {
+                    // No resource file; defaults will be used.
+                }
+
                 System.loadLibrary("awt");
                 System.loadLibrary("fontmanager");
-                return null;
+
+                return platformResources;
             }
         });
+
+        AWTAccessor.getToolkitAccessor().setPlatformResources(platformResources);
+
         if (!GraphicsEnvironment.isHeadless()) {
             initIDs();
         }
@@ -207,9 +224,9 @@
 
     @Override
     public MenuBarPeer createMenuBar(MenuBar target) {
-         MenuBarPeer peer = new CMenuBar(target);
-         targetCreatedPeer(target, peer);
-             return peer;
+        MenuBarPeer peer = new CMenuBar(target);
+        targetCreatedPeer(target, peer);
+        return peer;
     }
 
     @Override
@@ -303,11 +320,6 @@
     }
 
     @Override
-    protected MouseInfoPeer createMouseInfoPeerImpl() {
-        return new CMouseInfoPeer();
-    }
-
-    @Override
     protected int getScreenHeight() {
         return GraphicsEnvironment.getLocalGraphicsEnvironment()
                 .getDefaultScreenDevice().getDefaultConfiguration().getBounds().height;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/nio/ch/sctp/SctpChannelImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.SocketAddress;
+import java.net.InetAddress;
+import java.io.IOException;
+import java.util.Set;
+import java.nio.ByteBuffer;
+import java.nio.channels.spi.SelectorProvider;
+import com.sun.nio.sctp.Association;
+import com.sun.nio.sctp.MessageInfo;
+import com.sun.nio.sctp.NotificationHandler;
+import com.sun.nio.sctp.SctpChannel;
+import com.sun.nio.sctp.SctpSocketOption;
+
+/**
+ * Unimplemented.
+ */
+public class SctpChannelImpl extends SctpChannel
+{
+    private static final String message = "SCTP not supported on this platform";
+
+    public SctpChannelImpl(SelectorProvider provider) {
+        super(provider);
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Association association() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel bind(SocketAddress local)
+                            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel bindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel unbindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public boolean connect(SocketAddress remote) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public boolean connect(SocketAddress remote, int maxOutStreams,
+       int maxInStreams) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public boolean isConnectionPending() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public boolean finishConnect() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getAllLocalAddresses()
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getRemoteAddresses()
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel shutdown() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> T getOption(SctpSocketOption<T> name)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> SctpChannel setOption(SctpSocketOption<T> name, T value)
+        throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SctpSocketOption<?>> supportedOptions() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> MessageInfo receive(ByteBuffer dst, T attachment,
+            NotificationHandler<T> handler) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public int send(ByteBuffer src, MessageInfo messageInfo)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    protected void implConfigureBlocking(boolean block) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public void implCloseSelectableChannel() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.SocketAddress;
+import java.net.InetAddress;
+import java.io.IOException;
+import java.util.Set;
+import java.nio.ByteBuffer;
+import java.nio.channels.spi.SelectorProvider;
+import com.sun.nio.sctp.Association;
+import com.sun.nio.sctp.SctpChannel;
+import com.sun.nio.sctp.MessageInfo;
+import com.sun.nio.sctp.NotificationHandler;
+import com.sun.nio.sctp.SctpMultiChannel;
+import com.sun.nio.sctp.SctpSocketOption;
+
+/**
+ * Unimplemented.
+ */
+public class SctpMultiChannelImpl extends SctpMultiChannel
+{
+    private static final String message = "SCTP not supported on this platform";
+
+    public SctpMultiChannelImpl(SelectorProvider provider) {
+        super(provider);
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<Association> associations() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpMultiChannel bind(SocketAddress local,
+            int backlog) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpMultiChannel bindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpMultiChannel unbindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getAllLocalAddresses()
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getRemoteAddresses
+            (Association association) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpMultiChannel shutdown(Association association)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> T getOption(SctpSocketOption<T> name,
+            Association association) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
+            T value, Association association) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SctpSocketOption<?>> supportedOptions() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> MessageInfo receive(ByteBuffer buffer, T attachment,
+            NotificationHandler<T> handler) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public int send(ByteBuffer buffer, MessageInfo messageInfo)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel branch(Association association)
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    protected void implConfigureBlocking(boolean block) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public void implCloseSelectableChannel() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.nio.ch.sctp;
+
+import java.net.SocketAddress;
+import java.net.InetAddress;
+import java.io.IOException;
+import java.util.Set;
+import java.nio.channels.spi.SelectorProvider;
+import com.sun.nio.sctp.SctpChannel;
+import com.sun.nio.sctp.SctpServerChannel;
+import com.sun.nio.sctp.SctpSocketOption;
+
+/**
+ * Unimplemented.
+ */
+public class SctpServerChannelImpl extends SctpServerChannel
+{
+    private static final String message = "SCTP not supported on this platform";
+
+    public SctpServerChannelImpl(SelectorProvider provider) {
+        super(provider);
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpChannel accept() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpServerChannel bind(SocketAddress local,
+            int backlog) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpServerChannel bindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public SctpServerChannel unbindAddress(InetAddress address)
+         throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SocketAddress> getAllLocalAddresses()
+            throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> T getOption(SctpSocketOption<T> name) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public <T> SctpServerChannel setOption(SctpSocketOption<T> name,
+            T value) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public Set<SctpSocketOption<?>> supportedOptions() {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    protected void implConfigureBlocking(boolean block) throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+
+    @Override
+    public void implCloseSelectableChannel() throws IOException {
+        throw new UnsupportedOperationException(message);
+    }
+}
--- a/jdk/src/macosx/native/sun/awt/AWTEvent.m	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/native/sun/awt/AWTEvent.m	Fri Oct 11 09:17:18 2013 -0400
@@ -759,7 +759,7 @@
  */
 JNIEXPORT jint JNICALL
 Java_sun_lwawt_macosx_event_NSEvent_nsToJavaChar
-(JNIEnv *env, jclass cls, char nsChar, jint modifierFlags)
+(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
 {
     jchar javaChar = 0;
 
--- a/jdk/src/macosx/native/sun/awt/AWTView.m	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m	Fri Oct 11 09:17:18 2013 -0400
@@ -126,7 +126,7 @@
 
     self.cglLayer = nil;
 
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
     (*env)->DeleteGlobalRef(env, m_cPlatformView);
     m_cPlatformView = NULL;
 
@@ -387,7 +387,7 @@
         [rolloverTrackingArea release];
     }
 
-    int options = (NSTrackingActiveInActiveApp | NSTrackingMouseEnteredAndExited |
+    int options = (NSTrackingActiveAlways | NSTrackingMouseEnteredAndExited |
                    NSTrackingMouseMoved | NSTrackingEnabledDuringMouseDrag);
 
     rolloverTrackingArea = [[NSTrackingArea alloc] initWithRect:[self visibleRect]
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m	Fri Oct 11 09:17:18 2013 -0400
@@ -350,7 +350,7 @@
 - (void) dealloc {
 AWT_ASSERT_APPKIT_THREAD;
 
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
     [self.javaPlatformWindow setJObject:nil withEnv:env];
 
     self.nsWindow = nil;
@@ -366,6 +366,22 @@
 
 - (BOOL) canBecomeMainWindow {
 AWT_ASSERT_APPKIT_THREAD;
+    if(!self.isEnabled){
+        // Native system can bring up the NSWindow to
+        // the top even if the window is not main.
+        // We should bring up the modal dialog manually
+        [AWTToolkit eventCountPlusPlus];
+
+        JNIEnv *env = [ThreadUtilities getJNIEnv];
+        jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
+        if (platformWindow != NULL) {
+            static JNF_MEMBER_CACHE(jm_checkBlockingAndOrder, jc_CPlatformWindow,
+                                    "checkBlockingAndOrder", "()Z");
+            JNFCallVoidMethod(env, platformWindow, jm_checkBlockingAndOrder);
+            (*env)->DeleteLocalRef(env, platformWindow);
+        }
+    }
+
     return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_MAIN);
 }
 
--- a/jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,9 +135,10 @@
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
+     * @return the length of the encrypted data
      */
-    void encrypt(byte[] plain, int plainOffset, int plainLen,
-                 byte[] cipher, int cipherOffset)
+    int encrypt(byte[] plain, int plainOffset, int plainLen,
+                byte[] cipher, int cipherOffset)
     {
         int i;
         int endIndex = plainOffset + plainLen;
@@ -150,6 +151,7 @@
             embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
             System.arraycopy(cipher, cipherOffset, r, 0, blockSize);
         }
+        return plainLen;
     }
 
     /**
@@ -174,13 +176,14 @@
      * @param cipherLen the length of the input data
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
+     * @return the length of the decrypted data
      *
      * @exception IllegalBlockSizeException if input data whose length does
      * not correspond to the embedded cipher's block size is passed to the
      * embedded cipher
      */
-    void decrypt(byte[] cipher, int cipherOffset, int cipherLen,
-                 byte[] plain, int plainOffset)
+    int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
+                byte[] plain, int plainOffset)
     {
         int i;
         byte[] cipherOrig=null;
@@ -195,7 +198,6 @@
             // the plaintext result.
             cipherOrig = cipher.clone();
         }
-
         for (; cipherOffset < endIndex;
              cipherOffset += blockSize, plainOffset += blockSize) {
             embeddedCipher.decryptBlock(cipher, cipherOffset, k, 0);
@@ -208,5 +210,6 @@
                 System.arraycopy(cipherOrig, cipherOffset, r, 0, blockSize);
             }
         }
+        return cipherLen;
     }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CipherCore.java	Fri Oct 11 09:17:18 2013 -0400
@@ -310,49 +310,20 @@
      * @return the required output buffer size (in bytes)
      */
     int getOutputSize(int inputLen) {
-        int totalLen = buffered + inputLen;
-
-        // GCM: this call may be for either update() or doFinal(), so have to
-        // return the larger value of both
-        // Encryption: based on doFinal value: inputLen + tag
-        // Decryption: based on update value: inputLen
-        if (!decrypting && (cipherMode == GCM_MODE)) {
-            return (totalLen + ((GaloisCounterMode) cipher).getTagLen());
-        }
-
-        if (padding == null) {
-            return totalLen;
-        }
-
-        if (decrypting) {
-            return totalLen;
-        }
-
-        if (unitBytes != blockSize) {
-            if (totalLen < diffBlocksize) {
-                return diffBlocksize;
-            } else {
-                return (totalLen + blockSize -
-                        ((totalLen - diffBlocksize) % blockSize));
-            }
-        } else {
-            return totalLen + padding.padLength(totalLen);
-        }
+        // estimate based on the maximum
+        return getOutputSizeByOperation(inputLen, true);
     }
 
     private int getOutputSizeByOperation(int inputLen, boolean isDoFinal) {
-        int totalLen = 0;
+        int totalLen = buffered + inputLen + cipher.getBufferedLength();
         switch (cipherMode) {
         case GCM_MODE:
-            totalLen = buffered + inputLen;
             if (isDoFinal) {
                 int tagLen = ((GaloisCounterMode) cipher).getTagLen();
-                if (decrypting) {
-                    // need to get the actual value from cipher??
-                    // deduct tagLen
+                if (!decrypting) {
+                    totalLen += tagLen;
+                } else {
                     totalLen -= tagLen;
-                } else {
-                    totalLen += tagLen;
                 }
             }
             if (totalLen < 0) {
@@ -360,8 +331,19 @@
             }
             break;
         default:
-             totalLen  = getOutputSize(inputLen);
-             break;
+            if (padding != null && !decrypting) {
+                if (unitBytes != blockSize) {
+                    if (totalLen < diffBlocksize) {
+                        totalLen = diffBlocksize;
+                    } else {
+                        int residue = (totalLen - diffBlocksize) % blockSize;
+                        totalLen += (blockSize - residue);
+                    }
+                } else {
+                    totalLen += padding.padLength(totalLen);
+                }
+            }
+            break;
         }
         return totalLen;
     }
@@ -729,36 +711,52 @@
         len = (len > 0 ? (len - (len%unitBytes)) : 0);
 
         // check output buffer capacity
-        if ((output == null) || ((output.length - outputOffset) < len)) {
+        if ((output == null) ||
+            ((output.length - outputOffset) < len)) {
             throw new ShortBufferException("Output buffer must be "
                                            + "(at least) " + len
                                            + " bytes long");
         }
 
-        if (len != 0) {
-            // there is some work to do
-            byte[] in = new byte[len];
-
-            int inputConsumed = len - buffered;
-            int bufferedConsumed = buffered;
-            if (inputConsumed < 0) {
-                inputConsumed = 0;
-                bufferedConsumed = len;
+        int outLen = 0;
+        if (len != 0) { // there is some work to do
+            if (len <= buffered) {
+                // all to-be-processed data are from 'buffer'
+                if (decrypting) {
+                    outLen = cipher.decrypt(buffer, 0, len, output, outputOffset);
+                } else {
+                    outLen = cipher.encrypt(buffer, 0, len, output, outputOffset);
+                }
+                buffered -= len;
+                if (buffered != 0) {
+                    System.arraycopy(buffer, len, buffer, 0, buffered);
+                }
+            } else { // len > buffered
+                if (buffered == 0) {
+                    // all to-be-processed data are from 'input'
+                    if (decrypting) {
+                        outLen = cipher.decrypt(input, inputOffset, len, output, outputOffset);
+                    } else {
+                        outLen = cipher.encrypt(input, inputOffset, len, output, outputOffset);
+                    }
+                    inputOffset += len;
+                    inputLen -= len;
+                } else {
+                    // assemble the data using both 'buffer' and 'input'
+                    byte[] in = new byte[len];
+                    System.arraycopy(buffer, 0, in, 0, buffered);
+                    int inConsumed = len - buffered;
+                    System.arraycopy(input, inputOffset, in, buffered, inConsumed);
+                    buffered = 0;
+                    inputOffset += inConsumed;
+                    inputLen -= inConsumed;
+                    if (decrypting) {
+                        outLen = cipher.decrypt(in, 0, len, output, outputOffset);
+                    } else {
+                        outLen = cipher.encrypt(in, 0, len, output, outputOffset);
+                    }
+                }
             }
-
-            if (buffered != 0) {
-                System.arraycopy(buffer, 0, in, 0, bufferedConsumed);
-            }
-            if (inputConsumed > 0) {
-                System.arraycopy(input, inputOffset, in,
-                                 bufferedConsumed, inputConsumed);
-            }
-            if (decrypting) {
-                cipher.decrypt(in, 0, len, output, outputOffset);
-            } else {
-                cipher.encrypt(in, 0, len, output, outputOffset);
-            }
-
             // Let's keep track of how many bytes are needed to make
             // the total input length a multiple of blocksize when
             // padding is applied
@@ -770,23 +768,14 @@
                         ((len - diffBlocksize) % blockSize);
                 }
             }
-
-            inputLen -= inputConsumed;
-            inputOffset += inputConsumed;
-            outputOffset += len;
-            buffered -= bufferedConsumed;
-            if (buffered > 0) {
-                System.arraycopy(buffer, bufferedConsumed, buffer, 0,
-                                 buffered);
-            }
         }
-        // left over again
+        // Store remaining input into 'buffer' again
         if (inputLen > 0) {
             System.arraycopy(input, inputOffset, buffer, buffered,
                              inputLen);
+            buffered += inputLen;
         }
-        buffered += inputLen;
-        return len;
+        return outLen;
     }
 
     /**
@@ -881,11 +870,24 @@
                 ("Must use either different key or iv for GCM encryption");
         }
 
-        // calculate the total input length
-        int totalLen = buffered + inputLen;
-        int paddedLen = totalLen;
+        int estOutSize = getOutputSizeByOperation(inputLen, true);
+        // check output buffer capacity.
+        // if we are decrypting with padding applied, we can perform this
+        // check only after we have determined how many padding bytes there
+        // are.
+        int outputCapacity = output.length - outputOffset;
+        int minOutSize = (decrypting? (estOutSize - blockSize):estOutSize);
+        if ((output == null) || (outputCapacity < minOutSize)) {
+            throw new ShortBufferException("Output buffer must be "
+                + "(at least) " + minOutSize + " bytes long");
+        }
+
+        // calculate total input length
+        int len = buffered + inputLen;
+
+        // calculate padding length
+        int totalLen = len + cipher.getBufferedLength();
         int paddingLen = 0;
-
         // will the total input length be a multiple of blockSize?
         if (unitBytes != blockSize) {
             if (totalLen < diffBlocksize) {
@@ -898,40 +900,23 @@
             paddingLen = padding.padLength(totalLen);
         }
 
-        if ((paddingLen > 0) && (paddingLen != blockSize) &&
-            (padding != null) && decrypting) {
+        if (decrypting && (padding != null) &&
+            (paddingLen > 0) && (paddingLen != blockSize)) {
             throw new IllegalBlockSizeException
                 ("Input length must be multiple of " + blockSize +
                  " when decrypting with padded cipher");
         }
 
-        // if encrypting and padding not null, add padding
-        if (!decrypting && padding != null) {
-            paddedLen += paddingLen;
-        }
-
-        // check output buffer capacity.
-        // if we are decrypting with padding applied, we can perform this
-        // check only after we have determined how many padding bytes there
-        // are.
-        if (output == null) {
-            throw new ShortBufferException("Output buffer is null");
-        }
-        int outputCapacity = output.length - outputOffset;
-
-        if (((!decrypting) && (outputCapacity < paddedLen)) ||
-            (decrypting && (outputCapacity < (paddedLen - blockSize)))) {
-            throw new ShortBufferException("Output buffer too short: "
-                                           + outputCapacity + " bytes given, "
-                                           + paddedLen + " bytes needed");
-        }
-
         // prepare the final input avoiding copying if possible
         byte[] finalBuf = input;
         int finalOffset = inputOffset;
+        int finalBufLen = inputLen;
         if ((buffered != 0) || (!decrypting && padding != null)) {
+            if (decrypting || padding == null) {
+                paddingLen = 0;
+            }
+            finalBuf = new byte[len + paddingLen];
             finalOffset = 0;
-            finalBuf = new byte[paddedLen];
             if (buffered != 0) {
                 System.arraycopy(buffer, 0, finalBuf, 0, buffered);
             }
@@ -939,50 +924,50 @@
                 System.arraycopy(input, inputOffset, finalBuf,
                                  buffered, inputLen);
             }
-            if (!decrypting && padding != null) {
-                padding.padWithLen(finalBuf, totalLen, paddingLen);
+            if (paddingLen != 0) {
+                padding.padWithLen(finalBuf, (buffered+inputLen), paddingLen);
             }
+            finalBufLen = finalBuf.length;
         }
-
+        int outLen = 0;
         if (decrypting) {
             // if the size of specified output buffer is less than
             // the length of the cipher text, then the current
             // content of cipher has to be preserved in order for
             // users to retry the call with a larger buffer in the
             // case of ShortBufferException.
-            if (outputCapacity < paddedLen) {
+            if (outputCapacity < estOutSize) {
                 cipher.save();
             }
             // create temporary output buffer so that only "real"
             // data bytes are passed to user's output buffer.
-            byte[] outWithPadding = new byte[totalLen];
-            totalLen = finalNoPadding(finalBuf, finalOffset, outWithPadding,
-                                      0, totalLen);
+            byte[] outWithPadding = new byte[estOutSize];
+            outLen = finalNoPadding(finalBuf, finalOffset, outWithPadding,
+                                    0, finalBufLen);
 
             if (padding != null) {
-                int padStart = padding.unpad(outWithPadding, 0, totalLen);
+                int padStart = padding.unpad(outWithPadding, 0, outLen);
                 if (padStart < 0) {
                     throw new BadPaddingException("Given final block not "
                                                   + "properly padded");
                 }
-                totalLen = padStart;
+                outLen = padStart;
             }
 
-            if ((output.length - outputOffset) < totalLen) {
+            if (outputCapacity < outLen) {
                 // restore so users can retry with a larger buffer
                 cipher.restore();
                 throw new ShortBufferException("Output buffer too short: "
-                                               + (output.length-outputOffset)
-                                               + " bytes given, " + totalLen
+                                               + (outputCapacity)
+                                               + " bytes given, " + outLen
                                                + " bytes needed");
             }
-            for (int i = 0; i < totalLen; i++) {
-                output[outputOffset + i] = outWithPadding[i];
-            }
+            // copy the result into user-supplied output buffer
+            System.arraycopy(outWithPadding, 0, output, outputOffset, outLen);
         } else { // encrypting
             try {
-                totalLen = finalNoPadding(finalBuf, finalOffset, output,
-                                          outputOffset, paddedLen);
+                outLen = finalNoPadding(finalBuf, finalOffset, output,
+                                        outputOffset, finalBufLen);
             } finally {
                 // reset after doFinal() for GCM encryption
                 requireReinit = (cipherMode == GCM_MODE);
@@ -994,12 +979,13 @@
         if (cipherMode != ECB_MODE) {
             cipher.reset();
         }
-        return totalLen;
+        return outLen;
     }
 
     private int finalNoPadding(byte[] in, int inOfs, byte[] out, int outOfs,
                                int len)
-        throws IllegalBlockSizeException, AEADBadTagException {
+        throws IllegalBlockSizeException, AEADBadTagException,
+        ShortBufferException {
 
         if ((cipherMode != GCM_MODE) && (in == null || len == 0)) {
             return 0;
--- a/jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -150,9 +150,10 @@
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
+     * @return the length of the encrypted data
      */
-    void encrypt(byte[] plain, int plainOffset, int plainLen,
-                        byte[] cipher, int cipherOffset)
+    int encrypt(byte[] plain, int plainOffset, int plainLen,
+                byte[] cipher, int cipherOffset)
     {
         int i, len;
         len = blockSize - numBytes;
@@ -194,6 +195,7 @@
                 }
             }
         }
+        return plainLen;
     }
 
     /**
@@ -218,9 +220,10 @@
      * @param cipherLen the length of the input data
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
+     * @return the length of the decrypted data
      */
-    void decrypt(byte[] cipher, int cipherOffset, int cipherLen,
-                        byte[] plain, int plainOffset)
+    int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
+                byte[] plain, int plainOffset)
     {
         int i, len;
         len = blockSize - numBytes;
@@ -268,5 +271,6 @@
                 }
             }
         }
+        return cipherLen;
     }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 201313, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -149,9 +149,10 @@
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>cipher</code>
+     * @return the length of the encrypted data
      */
-    void encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
-        crypt(in, inOff, len, out, outOff);
+    int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+        return crypt(in, inOff, len, out, outOff);
     }
 
     /**
@@ -176,9 +177,10 @@
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>plain</code>
+     * @return the length of the decrypted data
      */
-    void decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
-        crypt(in, inOff, len, out, outOff);
+    int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+        return crypt(in, inOff, len, out, outOff);
     }
 
     /**
@@ -197,7 +199,8 @@
      * keystream generated by encrypting the counter values. Counter values
      * are encrypted on demand.
      */
-    private void crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+    private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+        int result = len;
         while (len-- > 0) {
             if (used >= blockSize) {
                 embeddedCipher.encryptBlock(counter, 0, encryptedCounter, 0);
@@ -206,5 +209,6 @@
             }
             out[outOff++] = (byte)(in[inOff++] ^ encryptedCounter[used++]);
         }
+        return result;
     }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -58,6 +58,16 @@
     // The source of randomness
     private SecureRandom random = null;
 
+    private static void checkKeySize(int keysize)
+        throws InvalidAlgorithmParameterException {
+        if ((keysize != 2048) &&
+            ((keysize < 512) || (keysize > 1024) || (keysize % 64 != 0))) {
+            throw new InvalidAlgorithmParameterException(
+                "Keysize must be multiple of 64 ranging from "
+                + "512 to 1024 (inclusive), or 2048");
+        }
+    }
+
     /**
      * Initializes this parameter generator for a certain keysize
      * and source of randomness.
@@ -67,11 +77,11 @@
      * @param random the source of randomness
      */
     protected void engineInit(int keysize, SecureRandom random) {
-        if ((keysize < 512) || (keysize > 2048) || (keysize % 64 != 0)) {
-            throw new InvalidParameterException("Keysize must be multiple "
-                                                + "of 64, and can only range "
-                                                + "from 512 to 2048 "
-                                                + "(inclusive)");
+        // Re-uses DSA parameters and thus have the same range
+        try {
+            checkKeySize(keysize);
+        } catch (InvalidAlgorithmParameterException ex) {
+            throw new InvalidParameterException(ex.getMessage());
         }
         this.primeSize = keysize;
         this.random = random;
@@ -91,31 +101,29 @@
     protected void engineInit(AlgorithmParameterSpec genParamSpec,
                               SecureRandom random)
         throws InvalidAlgorithmParameterException {
-            if (!(genParamSpec instanceof DHGenParameterSpec)) {
-                throw new InvalidAlgorithmParameterException
-                    ("Inappropriate parameter type");
-            }
+        if (!(genParamSpec instanceof DHGenParameterSpec)) {
+            throw new InvalidAlgorithmParameterException
+                ("Inappropriate parameter type");
+        }
 
-            DHGenParameterSpec dhParamSpec = (DHGenParameterSpec)genParamSpec;
+        DHGenParameterSpec dhParamSpec = (DHGenParameterSpec)genParamSpec;
+
+        primeSize = dhParamSpec.getPrimeSize();
+
+        // Re-uses DSA parameters and thus have the same range
+        checkKeySize(primeSize);
 
-            primeSize = dhParamSpec.getPrimeSize();
-            if ((primeSize<512) || (primeSize>2048) || (primeSize%64 != 0)) {
-                throw new InvalidAlgorithmParameterException
-                    ("Modulus size must be multiple of 64, and can only range "
-                     + "from 512 to 2048 (inclusive)");
-            }
+        exponentSize = dhParamSpec.getExponentSize();
+        if (exponentSize <= 0) {
+            throw new InvalidAlgorithmParameterException
+                ("Exponent size must be greater than zero");
+        }
 
-            exponentSize = dhParamSpec.getExponentSize();
-            if (exponentSize <= 0) {
-                throw new InvalidAlgorithmParameterException
-                    ("Exponent size must be greater than zero");
-            }
-
-            // Require exponentSize < primeSize
-            if (exponentSize >= primeSize) {
-                throw new InvalidAlgorithmParameterException
-                    ("Exponent size must be less than modulus size");
-            }
+        // Require exponentSize < primeSize
+        if (exponentSize >= primeSize) {
+            throw new InvalidAlgorithmParameterException
+                ("Exponent size must be less than modulus size");
+        }
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -115,14 +115,15 @@
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>cipher</code>
+     * @return the length of the encrypted data
      */
-    void encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
-        while (len >= blockSize) {
+    int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+        for (int i = len; i >= blockSize; i -= blockSize) {
             embeddedCipher.encryptBlock(in, inOff, out, outOff);
-            len -= blockSize;
             inOff += blockSize;
             outOff += blockSize;
         }
+        return len;
     }
 
     /**
@@ -147,14 +148,14 @@
      * @param len the length of the input data
      * @param out the buffer for the result
      * @param outOff the offset in <code>plain</code>
+     * @return the length of the decrypted data
      */
-    void decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
-        while (len >= blockSize) {
+    int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+        for (int i = len; i >= blockSize; i -= blockSize) {
             embeddedCipher.decryptBlock(in, inOff, out, outOff);
-            len -= blockSize;
             inOff += blockSize;
             outOff += blockSize;
         }
+        return len;
     }
-
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/FeedbackCipher.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/FeedbackCipher.java	Fri Oct 11 09:17:18 2013 -0400
@@ -133,9 +133,10 @@
      * @param plainLen the length of the input data
      * @param cipher the buffer for the encryption result
      * @param cipherOffset the offset in <code>cipher</code>
+     * @return the number of bytes placed into <code>cipher</code>
      */
-    abstract void encrypt(byte[] plain, int plainOffset, int plainLen,
-                          byte[] cipher, int cipherOffset);
+    abstract int encrypt(byte[] plain, int plainOffset, int plainLen,
+                         byte[] cipher, int cipherOffset);
     /**
      * Performs encryption operation for the last time.
      *
@@ -154,10 +155,9 @@
      */
      int encryptFinal(byte[] plain, int plainOffset, int plainLen,
                       byte[] cipher, int cipherOffset)
-         throws IllegalBlockSizeException {
-         encrypt(plain, plainOffset, plainLen, cipher, cipherOffset);
-         return plainLen;
-     }
+         throws IllegalBlockSizeException, ShortBufferException {
+         return encrypt(plain, plainOffset, plainLen, cipher, cipherOffset);
+    }
     /**
      * Performs decryption operation.
      *
@@ -174,9 +174,10 @@
      * @param cipherLen the length of the input data
      * @param plain the buffer for the decryption result
      * @param plainOffset the offset in <code>plain</code>
+     * @return the number of bytes placed into <code>plain</code>
      */
-    abstract void decrypt(byte[] cipher, int cipherOffset, int cipherLen,
-                          byte[] plain, int plainOffset);
+    abstract int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
+                         byte[] plain, int plainOffset);
 
     /**
      * Performs decryption operation for the last time.
@@ -196,9 +197,9 @@
      */
      int decryptFinal(byte[] cipher, int cipherOffset, int cipherLen,
                       byte[] plain, int plainOffset)
-         throws IllegalBlockSizeException, AEADBadTagException {
-         decrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
-         return cipherLen;
+         throws IllegalBlockSizeException, AEADBadTagException,
+         ShortBufferException {
+         return decrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
      }
 
     /**
@@ -228,4 +229,15 @@
     void updateAAD(byte[] src, int offset, int len) {
         throw new IllegalStateException("No AAD accepted");
     }
+
+    /**
+     * @return the number of bytes that are buffered internally inside
+     * this FeedbackCipher instance.
+     * @since 1.8
+     */
+    int getBufferedLength() {
+        // Currently only AEAD cipher impl, e.g. GCM, buffers data
+        // internally during decryption mode
+        return 0;
+    }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/GCTR.java	Fri Oct 11 09:17:18 2013 -0400
@@ -54,7 +54,7 @@
     private byte[] counter;
 
     // needed for save/restore calls
-    private byte[] counterSave;
+    private byte[] counterSave = null;
 
     // NOTE: cipher should already be initialized
     GCTR(SymmetricCipher cipher, byte[] initialCounterBlk) {
@@ -98,17 +98,16 @@
                 throw new IllegalBlockSizeException("Negative input size!");
             } else if (inLen > 0) {
                 int lastBlockSize = inLen % AES_BLOCK_SIZE;
+                int completeBlkLen = inLen - lastBlockSize;
                 // process the complete blocks first
-                update(in, inOfs, inLen - lastBlockSize, out, outOfs);
+                update(in, inOfs, completeBlkLen, out, outOfs);
                 if (lastBlockSize != 0) {
                     // do the last partial block
                     byte[] encryptedCntr = new byte[AES_BLOCK_SIZE];
                     aes.encryptBlock(counter, 0, encryptedCntr, 0);
-
-                    int processed = inLen - lastBlockSize;
                     for (int n = 0; n < lastBlockSize; n++) {
-                        out[outOfs + processed + n] =
-                            (byte) ((in[inOfs + processed + n] ^
+                        out[outOfs + completeBlkLen + n] =
+                            (byte) ((in[inOfs + completeBlkLen + n] ^
                                      encryptedCntr[n]));
                     }
                 }
@@ -120,12 +119,11 @@
     }
 
     /**
-     * Resets the current counter to its initial value.
-     * This is used after the doFinal() is called so this object can be
-     * reused w/o explicit re-initialization.
+     * Resets the content of this object to when it's first constructed.
      */
     void reset() {
         System.arraycopy(icb, 0, counter, 0, icb.length);
+        counterSave = null;
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,10 +35,12 @@
  * This class represents ciphers in GaloisCounter (GCM) mode.
  *
  * <p>This mode currently should only be used w/ AES cipher.
- * Although no checking is done here, caller should only
- * pass AES Cipher to the constructor.
+ * Although no checking is done, caller should only pass AES
+ * Cipher to the constructor.
  *
- * <p>NOTE: This class does not deal with buffering or padding.
+ * <p>NOTE: Unlike other modes, when used for decryption, this class
+ * will buffer all processed outputs internally and won't return them
+ * until the tag has been successfully verified.
  *
  * @since 1.8
  */
@@ -51,6 +53,9 @@
     private ByteArrayOutputStream aadBuffer = new ByteArrayOutputStream();
     private int sizeOfAAD = 0;
 
+    // buffer for storing input in decryption, not used for encryption
+    private ByteArrayOutputStream ibuffer = null;
+
     // in bytes; need to convert to bits (default value 128) when needed
     private int tagLenBytes = DEFAULT_TAG_LEN;
 
@@ -68,12 +73,14 @@
     // additional variables for save/restore calls
     private byte[] aadBufferSave = null;
     private int sizeOfAADSave = 0;
+    private byte[] ibufferSave = null;
     private int processedSave = 0;
 
     // value must be 16-byte long; used by GCTR and GHASH as well
     static void increment32(byte[] value) {
         if (value.length != AES_BLOCK_SIZE) {
-            throw new RuntimeException("Unexpected counter block length");
+            // should never happen
+            throw new ProviderException("Illegal counter block length");
         }
         // start from last byte and only go over 4 bytes, i.e. total 32 bits
         int n = value.length - 1;
@@ -171,6 +178,9 @@
         if (ghashAllToS != null) ghashAllToS.reset();
         processed = 0;
         sizeOfAAD = 0;
+        if (ibuffer != null) {
+            ibuffer.reset();
+        }
     }
 
     /**
@@ -184,6 +194,9 @@
              null : aadBuffer.toByteArray());
         if (gctrPAndC != null) gctrPAndC.save();
         if (ghashAllToS != null) ghashAllToS.save();
+        if (ibuffer != null) {
+            ibufferSave = ibuffer.toByteArray();
+        }
     }
 
     /**
@@ -198,8 +211,12 @@
                 aadBuffer.write(aadBufferSave, 0, aadBufferSave.length);
             }
         }
-       if (gctrPAndC != null) gctrPAndC.restore();
-       if (ghashAllToS != null) ghashAllToS.restore();
+        if (gctrPAndC != null) gctrPAndC.restore();
+        if (ghashAllToS != null) ghashAllToS.restore();
+        if (ibuffer != null) {
+            ibuffer.reset();
+            ibuffer.write(ibufferSave, 0, ibufferSave.length);
+        }
     }
 
     /**
@@ -261,6 +278,9 @@
         }
         processed = 0;
         sizeOfAAD = 0;
+        if (decrypting) {
+            ibuffer = new ByteArrayOutputStream();
+        }
     }
 
     /**
@@ -299,7 +319,7 @@
 
     // Feed the AAD data to GHASH, pad if necessary
     void processAAD() {
-        if (aadBuffer != null) {
+        if (aadBuffer != null && aadBuffer.size() > 0) {
             byte[] aad = aadBuffer.toByteArray();
             sizeOfAAD = aad.length;
             aadBuffer = null;
@@ -365,13 +385,14 @@
      * @param out the buffer for the result
      * @param outOfs the offset in <code>out</code>
      */
-    void encrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) {
+    int encrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) {
         processAAD();
         if (len > 0) {
             gctrPAndC.update(in, inOfs, len, out, outOfs);
             processed += len;
             ghashAllToS.update(out, outOfs, len);
         }
+        return len;
     }
 
     /**
@@ -387,28 +408,28 @@
      * @param outOfs the offset in <code>out</code>
      * @return the number of bytes placed into the <code>out</code> buffer
      */
-     int encryptFinal(byte[] in, int inOfs, int len, byte[] out, int outOfs)
-         throws IllegalBlockSizeException {
-         if (out.length - outOfs < (len + tagLenBytes)) {
-             throw new RuntimeException("Output buffer too small");
-         }
+    int encryptFinal(byte[] in, int inOfs, int len, byte[] out, int outOfs)
+        throws IllegalBlockSizeException, ShortBufferException {
+        if (out.length - outOfs < (len + tagLenBytes)) {
+            throw new ShortBufferException("Output buffer too small");
+        }
+
+        processAAD();
+        if (len > 0) {
+            doLastBlock(in, inOfs, len, out, outOfs, true);
+        }
 
-         processAAD();
-         if (len > 0) {
-             //ByteUtil.dumpArray(Arrays.copyOfRange(in, inOfs, inOfs + len));
-             doLastBlock(in, inOfs, len, out, outOfs, true);
-         }
+        byte[] lengthBlock =
+            getLengthBlock(sizeOfAAD*8, processed*8);
+        ghashAllToS.update(lengthBlock);
+        byte[] s = ghashAllToS.digest();
+        byte[] sOut = new byte[s.length];
+        GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock);
+        gctrForSToTag.doFinal(s, 0, s.length, sOut, 0);
 
-         byte[] lengthBlock = getLengthBlock(sizeOfAAD*8, processed*8);
-         ghashAllToS.update(lengthBlock);
-         byte[] s = ghashAllToS.digest();
-         byte[] sOut = new byte[s.length];
-         GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock);
-         gctrForSToTag.doFinal(s, 0, s.length, sOut, 0);
-
-         System.arraycopy(sOut, 0, out, (outOfs + len), tagLenBytes);
-         return (len + tagLenBytes);
-     }
+        System.arraycopy(sOut, 0, out, (outOfs + len), tagLenBytes);
+        return (len + tagLenBytes);
+    }
 
     /**
      * Performs decryption operation.
@@ -432,14 +453,16 @@
      * @param out the buffer for the result
      * @param outOfs the offset in <code>out</code>
      */
-    void decrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) {
+    int decrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) {
         processAAD();
 
-        if (len > 0) { // must be at least AES_BLOCK_SIZE bytes long
-            gctrPAndC.update(in, inOfs, len, out, outOfs);
-            processed += len;
-            ghashAllToS.update(in, inOfs, len);
+        if (len > 0) {
+            // store internally until decryptFinal is called because
+            // spec mentioned that only return recovered data after tag
+            // is successfully verified
+            ibuffer.write(in, inOfs, len);
         }
+        return 0;
     }
 
     /**
@@ -458,44 +481,62 @@
      * @param outOfs the offset in <code>plain</code>
      * @return the number of bytes placed into the <code>out</code> buffer
      */
-     int decryptFinal(byte[] in, int inOfs, int len,
-                      byte[] out, int outOfs)
-         throws IllegalBlockSizeException, AEADBadTagException {
-         if (len < tagLenBytes) {
-             throw new RuntimeException("Input buffer too short - need tag");
-         }
-         if (out.length - outOfs < (len - tagLenBytes)) {
-             throw new RuntimeException("Output buffer too small");
-         }
-         processAAD();
+    int decryptFinal(byte[] in, int inOfs, int len,
+                     byte[] out, int outOfs)
+        throws IllegalBlockSizeException, AEADBadTagException,
+        ShortBufferException {
+        if (len < tagLenBytes) {
+            throw new AEADBadTagException("Input too short - need tag");
+        }
+        if (out.length - outOfs < ((ibuffer.size() + len) - tagLenBytes)) {
+            throw new ShortBufferException("Output buffer too small");
+        }
+        processAAD();
+        if (len != 0) {
+            ibuffer.write(in, inOfs, len);
+        }
 
-         int processedOld = processed;
-         byte[] tag = new byte[tagLenBytes];
-         // get the trailing tag bytes from 'in'
-         System.arraycopy(in, inOfs + len - tagLenBytes, tag, 0, tagLenBytes);
-         len -= tagLenBytes;
+        // refresh 'in' to all buffered-up bytes
+        in = ibuffer.toByteArray();
+        inOfs = 0;
+        len = in.length;
+        ibuffer.reset();
 
-         if (len > 0) {
-             doLastBlock(in, inOfs, len, out, outOfs, false);
-         }
+        byte[] tag = new byte[tagLenBytes];
+        // get the trailing tag bytes from 'in'
+        System.arraycopy(in, len - tagLenBytes, tag, 0, tagLenBytes);
+        len -= tagLenBytes;
 
-         byte[] lengthBlock = getLengthBlock(sizeOfAAD*8, processed*8);
-         ghashAllToS.update(lengthBlock);
+        if (len > 0) {
+            doLastBlock(in, inOfs, len, out, outOfs, false);
+        }
 
-         byte[] s = ghashAllToS.digest();
-         byte[] sOut = new byte[s.length];
-         GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock);
-         gctrForSToTag.doFinal(s, 0, s.length, sOut, 0);
-         for (int i = 0; i < tagLenBytes; i++) {
-             if (tag[i] != sOut[i]) {
-                 throw new AEADBadTagException("Tag mismatch!");
-             }
-         }
-         return len;
-     }
+        byte[] lengthBlock =
+            getLengthBlock(sizeOfAAD*8, processed*8);
+        ghashAllToS.update(lengthBlock);
+
+        byte[] s = ghashAllToS.digest();
+        byte[] sOut = new byte[s.length];
+        GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock);
+        gctrForSToTag.doFinal(s, 0, s.length, sOut, 0);
+        for (int i = 0; i < tagLenBytes; i++) {
+            if (tag[i] != sOut[i]) {
+                throw new AEADBadTagException("Tag mismatch!");
+            }
+        }
+        return len;
+    }
 
     // return tag length in bytes
     int getTagLen() {
         return this.tagLenBytes;
     }
+
+    int getBufferedLength() {
+        if (ibuffer == null) {
+            return 0;
+        } else {
+            return ibuffer.size();
+        }
+    }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/OutputFeedback.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/OutputFeedback.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -149,9 +149,10 @@
      * @param plainLen the length of the input data
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
+     * @return the length of the encrypted data
      */
-    void encrypt(byte[] plain, int plainOffset, int plainLen,
-                        byte[] cipher, int cipherOffset)
+    int encrypt(byte[] plain, int plainOffset, int plainLen,
+                byte[] cipher, int cipherOffset)
     {
         int i;
         int len = blockSize - numBytes;
@@ -195,6 +196,7 @@
                 System.arraycopy(k, 0, register, len, numBytes);
             }
         }
+        return plainLen;
     }
 
     /**
@@ -219,11 +221,12 @@
      * @param cipherLen the length of the input data
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
+     * @return the length of the decrypted data
      */
-    void decrypt(byte[] cipher, int cipherOffset, int cipherLen,
+    int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
                         byte[] plain, int plainOffset)
     {
         // OFB encrypt and decrypt are identical
-        encrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
+        return encrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
     }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/PCBC.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PCBC.java	Fri Oct 11 09:17:18 2013 -0400
@@ -136,8 +136,8 @@
      * @param cipher the buffer for the result
      * @param cipherOffset the offset in <code>cipher</code>
      */
-    void encrypt(byte[] plain, int plainOffset, int plainLen,
-                        byte[] cipher, int cipherOffset)
+    int encrypt(byte[] plain, int plainOffset, int plainLen,
+                byte[] cipher, int cipherOffset)
     {
         int i;
         int endIndex = plainOffset + plainLen;
@@ -152,6 +152,7 @@
                 k[i] = (byte)(plain[i+plainOffset] ^ cipher[i+cipherOffset]);
             }
         }
+        return plainLen;
     }
 
     /**
@@ -177,8 +178,8 @@
      * @param plain the buffer for the result
      * @param plainOffset the offset in <code>plain</code>
      */
-    void decrypt(byte[] cipher, int cipherOffset, int cipherLen,
-                        byte[] plain, int plainOffset)
+    int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
+                byte[] plain, int plainOffset)
     {
         int i;
         int endIndex = cipherOffset + cipherLen;
@@ -194,5 +195,6 @@
                 k[i] = (byte)(plain[i+plainOffset] ^ cipher[i+cipherOffset]);
             }
         }
+        return cipherLen;
     }
 }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2004, 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
@@ -278,10 +278,11 @@
                         (JFIFMarkerSegment) findMarkerSegment
                         (JFIFMarkerSegment.class, true);
                     if (jfif == null) {
-                        throw new IIOException
-                            ("ICC APP2 encountered without prior JFIF!");
+                        newGuy = new MarkerSegment(buffer);
+                        newGuy.loadData(buffer);
+                    } else {
+                        jfif.addICC(buffer);
                     }
-                    jfif.addICC(buffer);
                     // newGuy remains null
                 } else {
                     newGuy = new MarkerSegment(buffer);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,6 +41,7 @@
 import javax.swing.table.*;
 import javax.accessibility.*;
 
+import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 import sun.swing.plaf.synth.*;
@@ -1328,71 +1329,9 @@
     /**
      * Data model for filter combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel
-            implements ComboBoxModel, PropertyChangeListener {
-        protected FileFilter[] filters;
-
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if (filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if (currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if (found == false) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if (filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public Object getElementAt(int index) {
-            if (index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if (filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return GTKFileChooserUI.this.getFileChooser();
         }
     }
 }
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,6 +38,7 @@
 import java.io.IOException;
 import java.util.*;
 import sun.awt.shell.ShellFolder;
+import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 /**
@@ -777,70 +778,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
-            PropertyChangeListener {
-        protected FileFilter[] filters;
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if(prop.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if(filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if(currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if (!found) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if(filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public FileFilter getElementAt(int index) {
-            if(index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if(filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return MotifFileChooserUI.this.getFileChooser();
         }
     }
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1193,70 +1193,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
-            PropertyChangeListener {
-        protected FileFilter[] filters;
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if(filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if(currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if(found == false) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if(filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public FileFilter getElementAt(int index) {
-            if(index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if(filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return WindowsFileChooserUI.this.getFileChooser();
         }
     }
 
--- a/jdk/src/share/classes/com/sun/jdi/AbsentInformationException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/AbsentInformationException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,6 +31,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class AbsentInformationException extends Exception
 {
     private static final long serialVersionUID = 4988939309582416373L;
--- a/jdk/src/share/classes/com/sun/jdi/Accessible.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Accessible.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,6 +36,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface Accessible {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/ArrayReference.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ArrayReference.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface ArrayReference extends ObjectReference {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/ArrayType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ArrayType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,6 +38,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface ArrayType extends ReferenceType {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/BooleanType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/BooleanType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,5 +35,6 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface BooleanType extends PrimitiveType {
 }
--- a/jdk/src/share/classes/com/sun/jdi/BooleanValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/BooleanValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface BooleanValue extends PrimitiveValue
-{
+@jdk.Exported
+public interface BooleanValue extends PrimitiveValue {
+
     /**
      * Returns this BooleanValue as a boolean.
      *
--- a/jdk/src/share/classes/com/sun/jdi/Bootstrap.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Bootstrap.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,6 +34,7 @@
  * @since  1.3
  */
 
+@jdk.Exported
 public class Bootstrap extends Object {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/ByteType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ByteType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,6 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface ByteType extends PrimitiveType
-{
+@jdk.Exported
+public interface ByteType extends PrimitiveType {
 }
--- a/jdk/src/share/classes/com/sun/jdi/ByteValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ByteValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,8 +33,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface ByteValue extends PrimitiveValue, Comparable<ByteValue>
-{
+@jdk.Exported
+public interface ByteValue extends PrimitiveValue, Comparable<ByteValue> {
+
     /**
      * Returns this ByteValue as a <code>byte</code>.
      *
--- a/jdk/src/share/classes/com/sun/jdi/CharType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/CharType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,6 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface CharType extends PrimitiveType
-{
+@jdk.Exported
+public interface CharType extends PrimitiveType {
 }
--- a/jdk/src/share/classes/com/sun/jdi/CharValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/CharValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface CharValue extends PrimitiveValue, Comparable<CharValue>
-{
+@jdk.Exported
+public interface CharValue extends PrimitiveValue, Comparable<CharValue> {
+
     /**
      * Returns this CharValue as a <code>char</code>.
      *
--- a/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface ClassLoaderReference extends ObjectReference {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -67,6 +67,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class ClassNotLoadedException extends Exception
 {
     private static final long serialVersionUID = -6242978768444298722L;
--- a/jdk/src/share/classes/com/sun/jdi/ClassNotPreparedException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ClassNotPreparedException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class ClassNotPreparedException extends RuntimeException {
     private static final long serialVersionUID = -6120698967144079642L;
     public ClassNotPreparedException()
--- a/jdk/src/share/classes/com/sun/jdi/ClassObjectReference.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ClassObjectReference.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface ClassObjectReference extends ObjectReference {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/ClassType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ClassType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,6 +41,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface ClassType extends ReferenceType {
     /**
      * Gets the superclass of this class.
--- a/jdk/src/share/classes/com/sun/jdi/DoubleType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/DoubleType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,6 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface DoubleType extends PrimitiveType
-{
+@jdk.Exported
+public interface DoubleType extends PrimitiveType {
 }
--- a/jdk/src/share/classes/com/sun/jdi/DoubleValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/DoubleValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface DoubleValue extends PrimitiveValue, Comparable<DoubleValue>
-{
+@jdk.Exported
+public interface DoubleValue extends PrimitiveValue, Comparable<DoubleValue> {
+
     /**
      * Returns this DoubleValue as a <code>double</code>.
      *
--- a/jdk/src/share/classes/com/sun/jdi/Field.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Field.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,6 +38,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface Field extends TypeComponent, Comparable<Field> {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/FloatType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/FloatType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,6 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface FloatType extends PrimitiveType
-{
+@jdk.Exported
+public interface FloatType extends PrimitiveType {
 }
--- a/jdk/src/share/classes/com/sun/jdi/FloatValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/FloatValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface FloatValue extends PrimitiveValue, Comparable<FloatValue>
-{
+@jdk.Exported
+public interface FloatValue extends PrimitiveValue, Comparable<FloatValue> {
+
     /**
      * Returns this FloatValue as a float.
      *
--- a/jdk/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/IncompatibleThreadStateException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,16 +32,15 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
-public class IncompatibleThreadStateException extends Exception
-{
+@jdk.Exported
+public class IncompatibleThreadStateException extends Exception {
     private static final long serialVersionUID = 6199174323414551389L;
-    public IncompatibleThreadStateException()
-    {
+
+    public IncompatibleThreadStateException() {
         super();
     }
 
-    public IncompatibleThreadStateException(String s)
-    {
+    public IncompatibleThreadStateException(String s) {
         super(s);
     }
 }
--- a/jdk/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/InconsistentDebugInfoException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,6 +34,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class InconsistentDebugInfoException extends RuntimeException {
     private static final long serialVersionUID = 7964236415376861808L;
     public InconsistentDebugInfoException() {
--- a/jdk/src/share/classes/com/sun/jdi/IntegerType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/IntegerType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,6 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface IntegerType extends PrimitiveType
-{
+@jdk.Exported
+public interface IntegerType extends PrimitiveType {
 }
--- a/jdk/src/share/classes/com/sun/jdi/IntegerValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/IntegerValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface IntegerValue extends PrimitiveValue, Comparable<IntegerValue>
-{
+@jdk.Exported
+public interface IntegerValue extends PrimitiveValue, Comparable<IntegerValue> {
+
     /**
      * Returns this IntegerValue as an int.
      *
--- a/jdk/src/share/classes/com/sun/jdi/InterfaceType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/InterfaceType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,6 +43,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface InterfaceType extends ReferenceType {
     /**
      * Gets the interfaces directly extended by this interface.
--- a/jdk/src/share/classes/com/sun/jdi/InternalException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/InternalException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class InternalException extends RuntimeException {
      private static final long serialVersionUID = -9171606393104480607L;
      private int errorCode;
--- a/jdk/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/InvalidCodeIndexException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,6 +34,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 @Deprecated
 public class InvalidCodeIndexException extends RuntimeException {
     private static final long serialVersionUID = 7416010225133747805L;
--- a/jdk/src/share/classes/com/sun/jdi/InvalidLineNumberException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/InvalidLineNumberException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,6 +34,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 @Deprecated
 public class InvalidLineNumberException extends RuntimeException {
     private static final long serialVersionUID = 4048709912372692875L;
--- a/jdk/src/share/classes/com/sun/jdi/InvalidStackFrameException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/InvalidStackFrameException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class InvalidStackFrameException extends RuntimeException {
     private static final long serialVersionUID = -1919378296505827922L;
     public InvalidStackFrameException() {
--- a/jdk/src/share/classes/com/sun/jdi/InvalidTypeException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/InvalidTypeException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,16 +32,15 @@
  * @author James McIlree
  * @since  1.3
  */
-public class InvalidTypeException extends Exception
-{
+@jdk.Exported
+public class InvalidTypeException extends Exception {
     private static final long serialVersionUID = 2256667231949650806L;
-    public InvalidTypeException()
-    {
+
+    public InvalidTypeException() {
         super();
     }
 
-    public InvalidTypeException(String s)
-    {
+    public InvalidTypeException(String s) {
         super(s);
     }
 }
--- a/jdk/src/share/classes/com/sun/jdi/InvocationException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/InvocationException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,19 +32,17 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
-public class InvocationException extends Exception
-{
+@jdk.Exported
+public class InvocationException extends Exception {
     private static final long serialVersionUID = 6066780907971918568L;
     ObjectReference exception;
 
-    public InvocationException(ObjectReference exception)
-    {
+    public InvocationException(ObjectReference exception) {
         super("Exception occurred in target VM");
         this.exception = exception;
     }
 
-    public ObjectReference exception()
-    {
+    public ObjectReference exception() {
         return exception;
     }
 }
--- a/jdk/src/share/classes/com/sun/jdi/JDIPermission.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/JDIPermission.java	Fri Oct 11 09:17:18 2013 -0400
@@ -78,6 +78,7 @@
  *
  */
 
+@jdk.Exported
 public final class JDIPermission extends java.security.BasicPermission {
     private static final long serialVersionUID = -6988461416938786271L;
     /**
--- a/jdk/src/share/classes/com/sun/jdi/LocalVariable.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/LocalVariable.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,6 +42,7 @@
  * @since  1.3
  */
 
+@jdk.Exported
 public interface LocalVariable extends Mirror, Comparable<LocalVariable> {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/Locatable.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Locatable.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,6 +33,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface Locatable {
     /**
      * Returns the {@link Location} of this mirror, if there
--- a/jdk/src/share/classes/com/sun/jdi/Location.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Location.java	Fri Oct 11 09:17:18 2013 -0400
@@ -86,6 +86,7 @@
  * @author James McIlree
  * @since 1.3
  */
+@jdk.Exported
 public interface Location extends Mirror, Comparable<Location> {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/LongType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/LongType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,6 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface LongType extends PrimitiveType
-{
+@jdk.Exported
+public interface LongType extends PrimitiveType {
 }
--- a/jdk/src/share/classes/com/sun/jdi/LongValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/LongValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface LongValue extends PrimitiveValue, Comparable<LongValue>
-{
+@jdk.Exported
+public interface LongValue extends PrimitiveValue, Comparable<LongValue> {
+
     /**
      * Returns this LongValue as a long.
      *
--- a/jdk/src/share/classes/com/sun/jdi/Method.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Method.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface Method extends TypeComponent, Locatable, Comparable<Method> {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/Mirror.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Mirror.java	Fri Oct 11 09:17:18 2013 -0400
@@ -56,6 +56,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface Mirror {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/MonitorInfo.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/MonitorInfo.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @since  1.6
  */
 
+@jdk.Exported
 public interface MonitorInfo extends Mirror {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/NativeMethodException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/NativeMethodException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class NativeMethodException extends RuntimeException {
 
     private static final long serialVersionUID = 3924951669039469992L;
--- a/jdk/src/share/classes/com/sun/jdi/ObjectCollectedException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ObjectCollectedException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class ObjectCollectedException extends RuntimeException {
     private static final long serialVersionUID = -1928428056197269588L;
     public ObjectCollectedException() {
--- a/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,8 +55,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface ObjectReference extends Value
-{
+@jdk.Exported
+public interface ObjectReference extends Value {
+
     /**
      * Gets the {@link ReferenceType} that mirrors the type
      * of this object. The type may be a subclass or implementor of the
--- a/jdk/src/share/classes/com/sun/jdi/PathSearchingVirtualMachine.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/PathSearchingVirtualMachine.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,6 +33,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface PathSearchingVirtualMachine extends VirtualMachine {
     /**
      * Get the class path for this virtual machine.
--- a/jdk/src/share/classes/com/sun/jdi/PrimitiveType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/PrimitiveType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,5 +37,6 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface PrimitiveType extends Type {
 }
--- a/jdk/src/share/classes/com/sun/jdi/PrimitiveValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/PrimitiveValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,8 +35,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface PrimitiveValue extends Value
-{
+@jdk.Exported
+public interface PrimitiveValue extends Value {
+
     /**
      * Converts this value to a BooleanValue and returns the result
      * as a boolean.
--- a/jdk/src/share/classes/com/sun/jdi/ReferenceType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ReferenceType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -77,6 +77,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface ReferenceType
     extends Type, Comparable<ReferenceType>, Accessible
 {
--- a/jdk/src/share/classes/com/sun/jdi/ShortType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ShortType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,5 +35,6 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface ShortType extends PrimitiveType {
 }
--- a/jdk/src/share/classes/com/sun/jdi/ShortValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ShortValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface ShortValue extends PrimitiveValue, Comparable<ShortValue>
-{
+@jdk.Exported
+public interface ShortValue extends PrimitiveValue, Comparable<ShortValue> {
+
     /**
      * Returns this ShortValue as a short.
      *
--- a/jdk/src/share/classes/com/sun/jdi/StackFrame.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/StackFrame.java	Fri Oct 11 09:17:18 2013 -0400
@@ -58,8 +58,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface StackFrame extends Mirror, Locatable
-{
+@jdk.Exported
+public interface StackFrame extends Mirror, Locatable {
+
     /**
      * Returns the {@link Location} of the current instruction in the frame.
      * The method for which this frame was created can also be accessed
--- a/jdk/src/share/classes/com/sun/jdi/StringReference.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/StringReference.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,8 +35,8 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface StringReference extends ObjectReference
-{
+@jdk.Exported
+public interface StringReference extends ObjectReference {
     /**
      * Returns the StringReference as a String. The returned string
      * is the equivalent of the mirrored string, but is an entity in the
--- a/jdk/src/share/classes/com/sun/jdi/ThreadGroupReference.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ThreadGroupReference.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,8 +37,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface ThreadGroupReference extends ObjectReference
-{
+@jdk.Exported
+public interface ThreadGroupReference extends ObjectReference {
+
     /**
      * Returns the name of this thread group.
      *
--- a/jdk/src/share/classes/com/sun/jdi/ThreadReference.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/ThreadReference.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,8 +36,8 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface ThreadReference extends ObjectReference
-{
+@jdk.Exported
+public interface ThreadReference extends ObjectReference {
     /** Thread status is unknown */
     public final int THREAD_STATUS_UNKNOWN  =-1;
     /** Thread has completed execution */
--- a/jdk/src/share/classes/com/sun/jdi/Type.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Type.java	Fri Oct 11 09:17:18 2013 -0400
@@ -127,8 +127,9 @@
  * @author James McIlree
  * @since  1.3
  */
-public interface Type extends Mirror
-{
+@jdk.Exported
+public interface Type extends Mirror {
+
     /**
      * Returns the JNI-style signature for this type.
      * <p>
--- a/jdk/src/share/classes/com/sun/jdi/TypeComponent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/TypeComponent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface TypeComponent extends Mirror, Accessible {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/VMCannotBeModifiedException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author Jim Holmlund
  * @since  1.5
  */
+@jdk.Exported
 public class VMCannotBeModifiedException extends UnsupportedOperationException {
     private static final long serialVersionUID = -4063879815130164009L;
     public VMCannotBeModifiedException() {
--- a/jdk/src/share/classes/com/sun/jdi/VMDisconnectedException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/VMDisconnectedException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,6 +33,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public class VMDisconnectedException extends RuntimeException {
 
     private static final long serialVersionUID = 2892975269768351637L;
--- a/jdk/src/share/classes/com/sun/jdi/VMMismatchException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/VMMismatchException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,6 +33,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class VMMismatchException extends RuntimeException {
     private static final long serialVersionUID = 289169358790459564L;
     public VMMismatchException() {
--- a/jdk/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/VMOutOfMemoryException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public class VMOutOfMemoryException extends RuntimeException {
     private static final long serialVersionUID = 71504228548910686L;
     public VMOutOfMemoryException() {
--- a/jdk/src/share/classes/com/sun/jdi/Value.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/Value.java	Fri Oct 11 09:17:18 2013 -0400
@@ -168,8 +168,8 @@
  * @since  1.3
  */
 
-public interface Value extends Mirror
-{
+@jdk.Exported
+public interface Value extends Mirror {
     /**
      * Returns the run-time type of this value.
      *
--- a/jdk/src/share/classes/com/sun/jdi/VirtualMachine.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/VirtualMachine.java	Fri Oct 11 09:17:18 2013 -0400
@@ -70,6 +70,7 @@
  * @author James McIlree
  * @since  1.3
  */
+@jdk.Exported
 public interface VirtualMachine extends Mirror {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/VirtualMachineManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/VirtualMachineManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -271,6 +271,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface VirtualMachineManager {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/VoidType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/VoidType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,5 +35,6 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface VoidType extends Type {
 }
--- a/jdk/src/share/classes/com/sun/jdi/VoidValue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/VoidValue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface VoidValue extends Value {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/connect/AttachingConnector.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/AttachingConnector.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface AttachingConnector extends Connector {
     /**
      * Attaches to a running application and and returns a
--- a/jdk/src/share/classes/com/sun/jdi/connect/Connector.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/Connector.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface Connector {
     /**
      * Returns a short identifier for the connector. Connector implementors
@@ -91,6 +92,7 @@
      * {@link Connector.IntegerArgument},
      * or {@link Connector.SelectedArgument}.
      */
+    @jdk.Exported
     public interface Argument extends Serializable {
         /**
          * Returns a short, unique identifier for the argument.
@@ -156,6 +158,7 @@
      * whose value is Boolean.  Boolean values are represented
      * by the localized versions of the strings "true" and "false".
      */
+    @jdk.Exported
     public interface BooleanArgument extends Argument {
         /**
          * Sets the value of the argument.
@@ -196,6 +199,7 @@
      * whose value is an integer.  Integer values are represented
      * by their corresponding strings.
      */
+    @jdk.Exported
     public interface IntegerArgument extends Argument {
         /**
          * Sets the value of the argument.
@@ -257,6 +261,7 @@
      * Specification for and value of a Connector argument,
      * whose value is a String.
      */
+    @jdk.Exported
     public interface StringArgument extends Argument {
         /**
          * Performs basic sanity check of argument.
@@ -269,6 +274,7 @@
      * Specification for and value of a Connector argument,
      * whose value is a String selected from a list of choices.
      */
+    @jdk.Exported
     public interface SelectedArgument extends Argument {
         /**
          * Return the possible values for the argument
--- a/jdk/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,8 +36,9 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
-public class IllegalConnectorArgumentsException extends Exception
-{
+@jdk.Exported
+public class IllegalConnectorArgumentsException extends Exception {
+
     private static final long serialVersionUID = -3042212603611350941L;
     List<String> names;
 
--- a/jdk/src/share/classes/com/sun/jdi/connect/LaunchingConnector.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/LaunchingConnector.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface LaunchingConnector extends Connector {
     /**
      * Launches an application and connects to its VM. Properties
--- a/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface ListeningConnector extends Connector {
     /**
      * Indicates whether this listening connector supports multiple
--- a/jdk/src/share/classes/com/sun/jdi/connect/Transport.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/Transport.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,6 +42,7 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
+@jdk.Exported
 public interface Transport {
     /**
      * Returns a short identifier for the transport.
--- a/jdk/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/TransportTimeoutException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -54,6 +54,7 @@
  *
  * @since 1.5
  */
+@jdk.Exported
 public class TransportTimeoutException extends java.io.IOException {
     private static final long serialVersionUID = 4107035242623365074L;
     /**
--- a/jdk/src/share/classes/com/sun/jdi/connect/VMStartException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/VMStartException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,8 +34,9 @@
  * @author Gordon Hirsch
  * @since  1.3
  */
-public class VMStartException extends Exception
-{
+@jdk.Exported
+public class VMStartException extends Exception {
+
     private static final long serialVersionUID = 6408644824640801020L;
     Process process;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/jdi/connect/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This package defines connections between the virtual machine
+ * using the JDI and the target virtual machine.
+ * In concert with {@link com.sun.jdi.VirtualMachineManager}
+ * it is the mechanism for launching, attaching, etc to
+ * target virtual machines.
+ * <p>
+ * Methods may be added to the interfaces in the JDI packages in future
+ * releases. Existing packages may be renamed if the JDI becomes a standard
+ * extension.
+ */
+
+@jdk.Exported
+package com.sun.jdi.connect;
--- a/jdk/src/share/classes/com/sun/jdi/connect/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-<html>
-<head>
-<title>com.sun.jdi.connect description</title>
-<!--
-
-Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  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.
--->
-</head>
-<body bgcolor="white">
-
-This package defines 
-connections between the virtual machine
-using the JDI and the target virtual machine. 
-In concert with {@link com.sun.jdi.VirtualMachineManager}
-it is the mechanism for launching, attaching, etc to 
-target virtual machines.
-<p>
-Methods may be added to the interfaces in the JDI packages in future 
-releases. Existing packages may be renamed if the JDI becomes a standard 
-extension.
-  </body>
-</html>
--- a/jdk/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  *
  * @since 1.5
  */
+@jdk.Exported
 public class ClosedConnectionException extends java.io.IOException {
     private static final long serialVersionUID = 3877032124297204774L;
     /**
--- a/jdk/src/share/classes/com/sun/jdi/connect/spi/Connection.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/spi/Connection.java	Fri Oct 11 09:17:18 2013 -0400
@@ -56,6 +56,7 @@
  * @since 1.5
  */
 
+@jdk.Exported
 public abstract class Connection {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java	Fri Oct 11 09:17:18 2013 -0400
@@ -77,6 +77,7 @@
  * @since 1.5
  */
 
+@jdk.Exported
 public abstract class TransportService {
 
     /**
@@ -96,6 +97,7 @@
     /**
      * The transport service capabilities.
      */
+    @jdk.Exported
     public static abstract class Capabilities {
 
         /**
@@ -229,6 +231,7 @@
      * #stopListening stopListening} to stop the transport
      * service from listening on an address.
      */
+    @jdk.Exported
     public static abstract class ListenKey {
 
         /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/jdi/connect/spi/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,33 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This package comprises the interfaces and classes used to
+ * develop new {@link com.sun.jdi.connect.spi.TransportService}
+ * implementations.
+ */
+
+@jdk.Exported
+package com.sun.jdi.connect.spi;
--- a/jdk/src/share/classes/com/sun/jdi/connect/spi/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<html>
-<head>
-    <title>com.sun.jdi.connect.spi description</title>
-<!--
- 
-Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-</head>
-<body bgcolor="white">
-This package comprises the interfaces and classes used to
-develop new {@link com.sun.jdi.connect.spi.TransportService} 
-implementations.
-  </body>
-</html>
--- a/jdk/src/share/classes/com/sun/jdi/event/AccessWatchpointEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/AccessWatchpointEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,5 +37,6 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface AccessWatchpointEvent extends WatchpointEvent {
 }
--- a/jdk/src/share/classes/com/sun/jdi/event/BreakpointEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/BreakpointEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -47,6 +47,6 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface BreakpointEvent extends LocatableEvent {
-
 }
--- a/jdk/src/share/classes/com/sun/jdi/event/ClassPrepareEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/ClassPrepareEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ClassPrepareEvent extends Event {
     /**
      * Returns the thread in which this event has occurred.
--- a/jdk/src/share/classes/com/sun/jdi/event/ClassUnloadEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/ClassUnloadEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ClassUnloadEvent extends Event {
     /**
      * Returns the name of the class that has been unloaded.
--- a/jdk/src/share/classes/com/sun/jdi/event/Event.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/Event.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,6 +43,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface Event extends Mirror {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/EventIterator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/EventIterator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,7 @@
  * @since  1.3
  */
 
+@jdk.Exported
 public interface EventIterator extends Iterator<Event> {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/EventQueue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/EventQueue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -57,6 +57,7 @@
  * @since  1.3
  */
 
+@jdk.Exported
 public interface EventQueue extends Mirror {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/EventSet.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/EventSet.java	Fri Oct 11 09:17:18 2013 -0400
@@ -127,6 +127,7 @@
  * @since  1.3
  */
 
+@jdk.Exported
 public interface EventSet extends Mirror, Set<Event> {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/ExceptionEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/ExceptionEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ExceptionEvent extends LocatableEvent {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/LocatableEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/LocatableEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,6 +36,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface LocatableEvent extends Event, Locatable {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/MethodEntryEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/MethodEntryEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,6 +43,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface MethodEntryEvent extends LocatableEvent {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/MethodExitEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/MethodExitEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface MethodExitEvent extends LocatableEvent {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/ModificationWatchpointEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/ModificationWatchpointEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,6 +38,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ModificationWatchpointEvent extends WatchpointEvent {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/MonitorContendedEnterEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/MonitorContendedEnterEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,7 @@
  * @author Swamy Venkataramanappa
  * @since  1.6
  */
+@jdk.Exported
 public interface MonitorContendedEnterEvent extends LocatableEvent {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/MonitorContendedEnteredEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/MonitorContendedEnteredEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @author Swamy Venkataramanappa
  * @since  1.6
  */
+@jdk.Exported
 public interface MonitorContendedEnteredEvent extends LocatableEvent {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/MonitorWaitEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/MonitorWaitEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,6 +38,7 @@
  * @author Swamy Venkataramanappa
  * @since  1.6
  */
+@jdk.Exported
 public interface MonitorWaitEvent extends LocatableEvent {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/MonitorWaitedEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/MonitorWaitedEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,6 +38,7 @@
  * @author Swamy Venkataramanappa
  * @since  1.6
  */
+@jdk.Exported
 public interface MonitorWaitedEvent extends LocatableEvent {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/event/StepEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/StepEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -46,6 +46,6 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface StepEvent extends LocatableEvent {
-
 }
--- a/jdk/src/share/classes/com/sun/jdi/event/ThreadDeathEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/ThreadDeathEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ThreadDeathEvent extends Event {
     /**
      * Returns the thread which is terminating.
--- a/jdk/src/share/classes/com/sun/jdi/event/ThreadStartEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/ThreadStartEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -52,6 +52,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ThreadStartEvent extends Event {
     /**
      * Returns the thread which has started.
--- a/jdk/src/share/classes/com/sun/jdi/event/VMDeathEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/VMDeathEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -68,5 +68,6 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface VMDeathEvent extends Event {
 }
--- a/jdk/src/share/classes/com/sun/jdi/event/VMDisconnectEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/VMDisconnectEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -52,5 +52,6 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface VMDisconnectEvent extends Event {
 }
--- a/jdk/src/share/classes/com/sun/jdi/event/VMStartEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/VMStartEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,6 +43,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface VMStartEvent extends Event {
     /**
      * Returns the initial thread of the VM which has started.
--- a/jdk/src/share/classes/com/sun/jdi/event/WatchpointEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/event/WatchpointEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,6 +37,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface WatchpointEvent extends LocatableEvent {
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/jdi/event/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This package defines JDI events and event processing.
+ * An {@link com.sun.jdi.event.Event} is always a member of an
+ * {@link com.sun.jdi.event.EventSet}, which
+ * is retrieved from the {@link com.sun.jdi.event.EventQueue}.
+ * Examples of Events include
+ * {@link com.sun.jdi.event.BreakpointEvent "breakpoints events"},
+ * {@link com.sun.jdi.event.ThreadStartEvent "thread creation events"} and
+ * {@link com.sun.jdi.event.VMDeathEvent "virtual machine death event"}.
+ *  With the exception
+ * of termination events, all events received must be requested with an
+ * {@link com.sun.jdi.request.EventRequest "EventRequest"}.  The
+ * {@link com.sun.jdi.request} package defines event requests and event
+ * request management.
+ * <p>
+ * Methods may be added to the interfaces in the JDI packages in future
+ * releases. Existing packages may be renamed if the JDI becomes a standard
+ * extension.
+ */
+
+@jdk.Exported
+package com.sun.jdi.event;
--- a/jdk/src/share/classes/com/sun/jdi/event/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-<html>
-<head>
-    <title>com.sun.jdi.event description</title>
-<!--
- 
-Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  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.
--->
-</head>
-<body bgcolor="white">
-This package defines JDI events and event processing.
-An {@link com.sun.jdi.event.Event} is always a member of an 
-{@link com.sun.jdi.event.EventSet}, which
-is retrieved from the {@link com.sun.jdi.event.EventQueue}. 
-Examples of Events include
-{@link com.sun.jdi.event.BreakpointEvent "breakpoints events"}, 
-{@link com.sun.jdi.event.ThreadStartEvent "thread creation events"} and 
-{@link com.sun.jdi.event.VMDeathEvent "virtual machine death event"}. 
-With the exception
-of termination events, all events received must be requested with an
-{@link com.sun.jdi.request.EventRequest "EventRequest"}.  The 
-{@link com.sun.jdi.request} package defines event requests and event
-request management.
-<p>
-Methods may be added to the interfaces in the JDI packages in future 
-releases. Existing packages may be renamed if the JDI becomes a standard 
-extension.
-  </body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/jdi/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This is the core package of the Java Debug
+ * Interface (JDI), it defines mirrors for values, types, and the target
+ * VirtualMachine itself - as well bootstrapping facilities.
+ * {@link com.sun.jdi.VirtualMachine} mirrors the target virtual machine and
+ * is the origin of all information provided by the JDI.  A VirtualMachine
+ * is typically created by using the
+ * {@link com.sun.jdi.VirtualMachineManager} to create
+ * a connection to the target virtual machine (see the
+ * {@link com.sun.jdi.connect} package).  In turn the
+ * {@link com.sun.jdi.VirtualMachineManager} is typically created by calling
+ * {@link com.sun.jdi.Bootstrap#virtualMachineManager()}.
+ * <p>
+ * Most of the methods within this package can throw the unchecked exception
+ * {@link com.sun.jdi.VMDisconnectedException}.
+ * <p>
+ * Methods may be added to the interfaces in the JDI packages in future
+ * releases. Existing packages may be renamed if the JDI becomes a standard
+ * extension.
+ */
+
+@jdk.Exported
+package com.sun.jdi;
--- a/jdk/src/share/classes/com/sun/jdi/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-<html>
-<head>
-    <title>com.sun.jdi package description</title>
-<!--
- 
-Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  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.
--->
-</head>
-<body bgcolor="white">
-This is the core package of the Java Debug 
-Interface (JDI), it defines mirrors for values, types, and the target
-VirtualMachine itself - as well bootstrapping facilities.
-{@link com.sun.jdi.VirtualMachine} mirrors the target virtual machine and
-is the origin of all information provided by the JDI.  A VirtualMachine
-is typically created by using the 
-{@link com.sun.jdi.VirtualMachineManager} to create
-a connection to the target virtual machine (see the 
-{@link com.sun.jdi.connect} package).  In turn the 
-{@link com.sun.jdi.VirtualMachineManager} is typically created by calling 
-{@link com.sun.jdi.Bootstrap#virtualMachineManager()}. 
-<p>
-Most of the methods within this package can throw the unchecked exception
-{@link com.sun.jdi.VMDisconnectedException}. 
-<p>
-Methods may be added to the interfaces in the JDI packages in future 
-releases. Existing packages may be renamed if the JDI becomes a standard 
-extension.
-  </body>
-</html>
--- a/jdk/src/share/classes/com/sun/jdi/request/AccessWatchpointRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/AccessWatchpointRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -56,5 +56,6 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface AccessWatchpointRequest extends WatchpointRequest {
 }
--- a/jdk/src/share/classes/com/sun/jdi/request/BreakpointRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/BreakpointRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -46,6 +46,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface BreakpointRequest extends EventRequest, Locatable {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/ClassPrepareRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/ClassPrepareRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -47,6 +47,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ClassPrepareRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/ClassUnloadRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/ClassUnloadRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -46,6 +46,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ClassUnloadRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/DuplicateRequestException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,16 +31,15 @@
  * @author Robert Field
  * @since  1.3
  */
-public class DuplicateRequestException extends RuntimeException
-{
+@jdk.Exported
+public class DuplicateRequestException extends RuntimeException {
     private static final long serialVersionUID = -3719784920313411060L;
-    public DuplicateRequestException()
-    {
+
+    public DuplicateRequestException() {
         super();
     }
 
-    public DuplicateRequestException(String s)
-    {
+    public DuplicateRequestException(String s) {
         super(s);
     }
 }
--- a/jdk/src/share/classes/com/sun/jdi/request/EventRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/EventRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -78,6 +78,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface EventRequest extends Mirror {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/EventRequestManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/EventRequestManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @since  1.3
  */
 
+@jdk.Exported
 public interface EventRequestManager extends Mirror {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/ExceptionRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/ExceptionRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,6 +43,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ExceptionRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/InvalidRequestStateException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public class InvalidRequestStateException extends RuntimeException {
     private static final long serialVersionUID = -3774632428543322148L;
     public InvalidRequestStateException()
--- a/jdk/src/share/classes/com/sun/jdi/request/MethodEntryRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/MethodEntryRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface MethodEntryRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/MethodExitRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/MethodExitRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface MethodExitRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/ModificationWatchpointRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/ModificationWatchpointRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,5 +55,6 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ModificationWatchpointRequest extends WatchpointRequest {
 }
--- a/jdk/src/share/classes/com/sun/jdi/request/MonitorContendedEnterRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/MonitorContendedEnterRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @author Swamy Venkataramanappa
  * @since  1.6
  */
+@jdk.Exported
 public interface MonitorContendedEnterRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/MonitorContendedEnteredRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/MonitorContendedEnteredRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @author Swamy Venkataramanappa
  * @since  1.6
  */
+@jdk.Exported
 public interface MonitorContendedEnteredRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/MonitorWaitRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/MonitorWaitRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @author Swamy Venkataramanappa
  * @since  1.6
  */
+@jdk.Exported
 public interface MonitorWaitRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/MonitorWaitedRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/MonitorWaitedRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @author Swamy Venkataramanappa
  * @since  1.6
  */
+@jdk.Exported
 public interface MonitorWaitedRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/StepRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/StepRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,6 +43,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface StepRequest extends EventRequest {
 
     /** Step into any newly pushed frames */
--- a/jdk/src/share/classes/com/sun/jdi/request/ThreadDeathRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/ThreadDeathRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ThreadDeathRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/ThreadStartRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/ThreadStartRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface ThreadStartRequest extends EventRequest {
 
     /**
--- a/jdk/src/share/classes/com/sun/jdi/request/VMDeathRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/VMDeathRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -56,6 +56,7 @@
  * @author Robert Field
  * @since  1.4
  */
+@jdk.Exported
 public interface VMDeathRequest extends EventRequest {
 
 }
--- a/jdk/src/share/classes/com/sun/jdi/request/WatchpointRequest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jdi/request/WatchpointRequest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,6 +38,7 @@
  * @author Robert Field
  * @since  1.3
  */
+@jdk.Exported
 public interface WatchpointRequest extends EventRequest {
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/jdi/request/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This package is used to request that a JDI
+ * event be sent under specified conditions.
+ * With the exception of termination events, which are
+ * always sent, there is one kind of
+ * {@link com.sun.jdi.request.EventRequest} for each kind of
+ * {@link com.sun.jdi.event.Event Event} - for example,
+ * {@link com.sun.jdi.request.BreakpointRequest} is used to request a
+ * {@link com.sun.jdi.event.BreakpointEvent BreakpointEvent}.
+ * Event requests are created by the
+ * {@link com.sun.jdi.request.EventRequestManager}.
+ * Events and event processing are defined in the
+ * {@link com.sun.jdi.event} package.
+ * <p>
+ * Methods may be added to the interfaces in the JDI packages in future
+ * releases. Existing packages may be renamed if the JDI becomes a standard
+ * extension.
+ */
+
+@jdk.Exported
+package com.sun.jdi.request;
--- a/jdk/src/share/classes/com/sun/jdi/request/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<html>
-<head>
-    <title>com.sun.jdi.request description</title>
-<!--
- 
-Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  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.
--->
-</head>
-<body bgcolor="white">
-This package is used to request that a JDI
-event be sent under specified conditions.
-With the exception of termination events, which are
-always sent, there is one kind of 
-{@link com.sun.jdi.request.EventRequest} for each kind of 
-{@link com.sun.jdi.event.Event Event} - for example,
-{@link com.sun.jdi.request.BreakpointRequest} is used to request a
-{@link com.sun.jdi.event.BreakpointEvent BreakpointEvent}.
-Event requests are created by the 
-{@link com.sun.jdi.request.EventRequestManager}.  
-Events and event processing are defined in the
-{@link com.sun.jdi.event} package.
-<p>
-Methods may be added to the interfaces in the JDI packages in future 
-releases. Existing packages may be renamed if the JDI becomes a standard 
-extension.
-  </body>
-</html>
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtxFactory.java	Fri Oct 11 09:17:18 2013 -0400
@@ -237,7 +237,7 @@
     private static String[] getTypeNames(Class<?> currentClass, Vector<String> v) {
 
         getClassesAux(currentClass, v);
-        Class[] members = currentClass.getInterfaces();
+        Class<?>[] members = currentClass.getInterfaces();
         for (int i = 0; i < members.length; i++) {
             getClassesAux(members[i], v);
         }
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -237,7 +237,7 @@
              !socketFactory.equals(LdapCtx.DEFAULT_SSL_FACTORY)) {
             try {
                 Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
-                Class[] interfaces = socketFactoryClass.getInterfaces();
+                Class<?>[] interfaces = socketFactoryClass.getInterfaces();
                 for (int i = 0; i < interfaces.length; i++) {
                     if (interfaces[i].getCanonicalName().equals(COMPARATOR)) {
                         foundSockCmp = true;
--- a/jdk/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java	Fri Oct 11 09:17:18 2013 -0400
@@ -85,6 +85,7 @@
  * </ul>
  **/
 
+@jdk.Exported
 public class GarbageCollectionNotificationInfo implements  CompositeDataView {
 
     private final String gcName;
--- a/jdk/src/share/classes/com/sun/management/GarbageCollectorMXBean.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/management/GarbageCollectorMXBean.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,6 +37,7 @@
  * @author  Mandy Chung
  * @since   1.5
  */
+@jdk.Exported
 public interface GarbageCollectorMXBean
     extends java.lang.management.GarbageCollectorMXBean {
 
--- a/jdk/src/share/classes/com/sun/management/GcInfo.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/management/GcInfo.java	Fri Oct 11 09:17:18 2013 -0400
@@ -64,6 +64,7 @@
  * @author  Mandy Chung
  * @since   1.5
  */
+@jdk.Exported
 public class GcInfo implements CompositeData, CompositeDataView {
     private final long index;
     private final long startTime;
--- a/jdk/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java	Fri Oct 11 09:17:18 2013 -0400
@@ -48,6 +48,7 @@
  *
  * @see ManagementFactory#getPlatformMXBeans(Class)
  */
+@jdk.Exported
 public interface HotSpotDiagnosticMXBean extends PlatformManagedObject {
     /**
      * Dumps the heap to the <tt>outputFile</tt> file in the same
--- a/jdk/src/share/classes/com/sun/management/OperatingSystemMXBean.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/management/OperatingSystemMXBean.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @author  Mandy Chung
  * @since   1.5
  */
+@jdk.Exported
 public interface OperatingSystemMXBean extends
     java.lang.management.OperatingSystemMXBean {
 
--- a/jdk/src/share/classes/com/sun/management/ThreadMXBean.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/management/ThreadMXBean.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,6 +38,7 @@
  * @since   6u25
  */
 
+@jdk.Exported
 public interface ThreadMXBean extends java.lang.management.ThreadMXBean {
     /**
      * Returns the total CPU time for each thread whose ID is
--- a/jdk/src/share/classes/com/sun/management/UnixOperatingSystemMXBean.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/management/UnixOperatingSystemMXBean.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * @author  Mandy Chung
  * @since   1.5
  */
+@jdk.Exported
 public interface UnixOperatingSystemMXBean extends
     com.sun.management.OperatingSystemMXBean {
 
--- a/jdk/src/share/classes/com/sun/management/VMOption.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/management/VMOption.java	Fri Oct 11 09:17:18 2013 -0400
@@ -52,6 +52,7 @@
  * @author Mandy Chung
  * @since 1.6
  */
+@jdk.Exported
 public class VMOption {
     private String name;
     private String value;
@@ -64,6 +65,7 @@
      *
      * @since 1.6
      */
+    @jdk.Exported
     public enum Origin {
         /**
          * The VM option has not been set and its value
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/management/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This package contains Oracle Corporation's platform extension to
+ * the implementation of the
+ * <a href="{@docRoot}/../../../../api/java/lang/management/package-summary.html">
+ * java.lang.management</a> API and also defines the management
+ * interface for some other components for the platform.
+ *
+ * <p>
+ * All platform MBeans are registered in the <em>platform MBeanServer</em>
+ * which can be obtained via the
+ * <a href="{@docRoot}/../../../../api/java/lang/management/ManagementFactory.html#getPlatformMBeanServer()">
+ * java.lang.management.ManagementFactory.getPlatformMBeanServer</a>
+ *
+ * @author  Mandy Chung
+ * @since   1.5
+ */
+
+@jdk.Exported
+package com.sun.management;
--- a/jdk/src/share/classes/com/sun/management/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute 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.
--->
-
-</head>
-<body bgcolor="white">
-
-This package contains Oracle Corporation's platform extension to
-the implementation of the
-<a href="{@docRoot}/../../../../api/java/lang/management/package-summary.html">
-java.lang.management</a> API and also defines the management
-interface for some other components for the platform.
-
-<p>
-All platform MBeans are registered in the <em>platform MBeanServer</em>
-which can be obtained via the
-<a href="{@docRoot}/../../../../api/java/lang/management/ManagementFactory.html#getPlatformMBeanServer()">
-java.lang.management.ManagementFactory.getPlatformMBeanServer</a>
-
-@author  Mandy Chung
-@since   1.5
-
-</body>
-</html>
-
-
--- a/jdk/src/share/classes/com/sun/net/httpserver/Authenticator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/Authenticator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,6 +36,7 @@
  * Note. This implies that any caching of credentials or other authentication
  * information must be done outside of this class.
  */
+@jdk.Exported
 public abstract class Authenticator {
 
     /**
@@ -47,6 +48,7 @@
      * Indicates an authentication failure. The authentication
      * attempt has completed.
      */
+    @jdk.Exported
     public static class Failure extends Result {
 
         private int responseCode;
@@ -68,6 +70,7 @@
      * authenticated user principal can be acquired by calling
      * getPrincipal().
      */
+    @jdk.Exported
     public static class Success extends Result {
         private HttpPrincipal principal;
 
@@ -89,6 +92,7 @@
      * set any necessary response headers in the given HttpExchange
      * before returning this Retry object.
      */
+    @jdk.Exported
     public static class Retry extends Result {
 
         private int responseCode;
--- a/jdk/src/share/classes/com/sun/net/httpserver/BasicAuthenticator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/BasicAuthenticator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,6 +33,7 @@
  * to provide an implementation of {@link #checkCredentials(String,String)}
  * which is called to verify each incoming request.
  */
+@jdk.Exported
 public abstract class BasicAuthenticator extends Authenticator {
 
     protected String realm;
--- a/jdk/src/share/classes/com/sun/net/httpserver/Filter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/Filter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * exchange handler.
  * @since 1.6
  */
+@jdk.Exported
 public abstract class Filter {
 
     protected Filter () {}
@@ -48,6 +49,7 @@
      * Each filter in the chain is given one of these
      * so it can invoke the next filter in the chain
      */
+    @jdk.Exported
     public static class Chain {
         /* the last element in the chain must invoke the users
          * handler
--- a/jdk/src/share/classes/com/sun/net/httpserver/Headers.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/Headers.java	Fri Oct 11 09:17:18 2013 -0400
@@ -58,6 +58,7 @@
  * as a header line containing the key but no associated value.
  * @since 1.6
  */
+@jdk.Exported
 public class Headers implements Map<String,List<String>> {
 
         HashMap<String,List<String>> map;
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpContext.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpContext.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,7 @@
  * context can be pre- and post-processed by each Filter in the chain.
  * @since 1.6
  */
+@jdk.Exported
 public abstract class HttpContext {
 
     protected HttpContext () {
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java	Fri Oct 11 09:17:18 2013 -0400
@@ -65,6 +65,7 @@
  * @since 1.6
  */
 
+@jdk.Exported
 public abstract class HttpExchange {
 
     protected HttpExchange () {
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * HTTP exchange is handled by one of these handlers.
  * @since 1.6
  */
+@jdk.Exported
 public interface HttpHandler {
     /**
      * Handle the given request and generate an appropriate response.
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,6 +33,7 @@
  * Represents a user authenticated by HTTP Basic or Digest
  * authentication.
  */
+@jdk.Exported
 public class HttpPrincipal implements Principal {
     private String username, realm;
 
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpServer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpServer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -87,6 +87,7 @@
  * @since 1.6
  */
 
+@jdk.Exported
 public abstract class HttpServer {
 
     /**
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpsConfigurator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpsConfigurator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -67,6 +67,7 @@
  * </blockquote></pre>
  * @since 1.6
  */
+@jdk.Exported
 public class HttpsConfigurator {
 
     private SSLContext context;
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpsExchange.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpsExchange.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @since 1.6
  */
 
+@jdk.Exported
 public abstract class HttpsExchange extends HttpExchange {
 
     protected HttpsExchange () {
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpsParameters.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpsParameters.java	Fri Oct 11 09:17:18 2013 -0400
@@ -49,6 +49,7 @@
  * are used, and any settings made in this object are ignored.
  * @since 1.6
  */
+@jdk.Exported
 public abstract class HttpsParameters {
 
     private String[] cipherSuites;
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpsServer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpsServer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @since 1.6
  */
 
+@jdk.Exported
 public abstract class HttpsServer extends HttpServer {
 
     /**
--- a/jdk/src/share/classes/com/sun/net/httpserver/package-info.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -123,4 +123,5 @@
    <p>
    @since 1.6
  */
+@jdk.Exported
 package com.sun.net.httpserver;
--- a/jdk/src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,7 @@
  * {@link HttpServer} and associated classes. Applications do not normally use
  * this class. See {@link #provider()} for how providers are found and loaded.
  */
+@jdk.Exported
 public abstract class HttpServerProvider {
 
     /**
--- a/jdk/src/share/classes/com/sun/net/httpserver/spi/package-info.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/httpserver/spi/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -24,7 +24,8 @@
  */
 
 /**
- Provides a pluggable service provider interface, which allows the HTTP server
- implementation to be replaced with other implementations.
-*/
+ * Provides a pluggable service provider interface, which allows the HTTP server
+ * implementation to be replaced with other implementations.
+ */
+@jdk.Exported
 package com.sun.net.httpserver.spi;
--- a/jdk/src/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -404,6 +404,7 @@
         return delegate.getContent();
     }
 
+    @SuppressWarnings("rawtypes")
     public Object getContent(Class[] classes) throws IOException {
         return delegate.getContent(classes);
     }
--- a/jdk/src/share/classes/com/sun/nio/sctp/AbstractNotificationHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/AbstractNotificationHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public class AbstractNotificationHandler<T>
     implements NotificationHandler<T>
 {
--- a/jdk/src/share/classes/com/sun/nio/sctp/Association.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/Association.java	Fri Oct 11 09:17:18 2013 -0400
@@ -51,6 +51,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public class Association {
     private final int associationID;
     private final int maxInStreams;
--- a/jdk/src/share/classes/com/sun/nio/sctp/AssociationChangeNotification.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/AssociationChangeNotification.java	Fri Oct 11 09:17:18 2013 -0400
@@ -29,6 +29,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public abstract class AssociationChangeNotification
     implements Notification
 {
@@ -37,6 +38,7 @@
      *
      * @since 1.7
      */
+    @jdk.Exported
     public enum AssocChangeEvent
     {
         /**
--- a/jdk/src/share/classes/com/sun/nio/sctp/HandlerResult.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/HandlerResult.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,6 +34,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public enum HandlerResult {
     /**
      * Try to receieve another message or notification.
--- a/jdk/src/share/classes/com/sun/nio/sctp/IllegalReceiveException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/IllegalReceiveException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,6 +31,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public class IllegalReceiveException extends IllegalStateException {
     private static final long serialVersionUID = 2296619040988576224L;
 
--- a/jdk/src/share/classes/com/sun/nio/sctp/IllegalUnbindException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/IllegalUnbindException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,6 +31,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public class IllegalUnbindException extends IllegalStateException {
     private static final long serialVersionUID = -310540883995532224L;
 
--- a/jdk/src/share/classes/com/sun/nio/sctp/InvalidStreamException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/InvalidStreamException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,6 +30,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public class InvalidStreamException extends IllegalArgumentException {
     private static final long serialVersionUID = -9172703378046665558L;
 
--- a/jdk/src/share/classes/com/sun/nio/sctp/MessageInfo.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/MessageInfo.java	Fri Oct 11 09:17:18 2013 -0400
@@ -56,6 +56,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public abstract class MessageInfo {
     /**
      * Initializes a new instance of this class.
--- a/jdk/src/share/classes/com/sun/nio/sctp/Notification.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/Notification.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,6 +37,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public interface Notification {
     /**
      * Returns the association that this notification is applicable to.
--- a/jdk/src/share/classes/com/sun/nio/sctp/NotificationHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/NotificationHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -49,6 +49,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public interface NotificationHandler<T> {
     /**
      * Invoked when a notification is received from the SCTP stack.
--- a/jdk/src/share/classes/com/sun/nio/sctp/PeerAddressChangeNotification.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/PeerAddressChangeNotification.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public abstract class PeerAddressChangeNotification
     implements Notification
 {
@@ -46,6 +47,7 @@
      *
      * @since 1.7
      */
+    @jdk.Exported
     public enum AddressChangeEvent {
         /**
          * This address is now reachable.
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpChannel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpChannel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -134,6 +134,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public abstract class SctpChannel
     extends AbstractSelectableChannel
 {
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -134,6 +134,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public abstract class SctpMultiChannel
     extends AbstractSelectableChannel
 {
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -68,6 +68,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public abstract class SctpServerChannel
     extends AbstractSelectableChannel
 {
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpSocketOption.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,4 +35,5 @@
  *
  * @see SctpStandardSocketOptions
  */
+@jdk.Exported
 public interface SctpSocketOption<T> extends SocketOption<T> { }
--- a/jdk/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,6 +34,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public class SctpStandardSocketOptions {
     private SctpStandardSocketOptions() {}
     /**
@@ -315,6 +316,7 @@
      *
      * @since 1.7
      */
+    @jdk.Exported
     public static class InitMaxStreams {
         private int maxInStreams;
         private int maxOutStreams;
--- a/jdk/src/share/classes/com/sun/nio/sctp/SendFailedNotification.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/SendFailedNotification.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,6 +37,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public abstract class SendFailedNotification implements Notification {
     /**
      * Initializes a new instance of this class.
--- a/jdk/src/share/classes/com/sun/nio/sctp/ShutdownNotification.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/ShutdownNotification.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  *
  * @since 1.7
  */
+@jdk.Exported
 public abstract class ShutdownNotification implements Notification {
     /**
      * Initializes a new instance of this class.
--- a/jdk/src/share/classes/com/sun/nio/sctp/package-info.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/nio/sctp/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -72,4 +72,5 @@
  * @since 1.7
  */
 
+@jdk.Exported
 package com.sun.nio.sctp;
--- a/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/LdapPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  *
  * @since 1.6
  */
+@jdk.Exported
 public final class LdapPrincipal implements Principal, java.io.Serializable {
 
     private static final long serialVersionUID = 6820120005580754861L;
--- a/jdk/src/share/classes/com/sun/security/auth/NTDomainPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/NTDomainPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class NTDomainPrincipal implements Principal, java.io.Serializable {
 
     private static final long serialVersionUID = -4408637351440771220L;
--- a/jdk/src/share/classes/com/sun/security/auth/NTNumericCredential.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/NTNumericCredential.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,6 +31,7 @@
  *
  */
 
+@jdk.Exported
 public class NTNumericCredential {
 
     private long impersonationToken;
--- a/jdk/src/share/classes/com/sun/security/auth/NTSid.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/NTSid.java	Fri Oct 11 09:17:18 2013 -0400
@@ -47,6 +47,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class NTSid implements Principal, java.io.Serializable {
 
     private static final long serialVersionUID = 4412290580770249885L;
--- a/jdk/src/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,6 +43,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class NTSidDomainPrincipal extends NTSid {
 
     private static final long serialVersionUID = 5247810785821650912L;
--- a/jdk/src/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,7 @@
  * @see javax.security.auth.Subject
  * @see com.sun.security.auth.NTSid
  */
+@jdk.Exported
 public class NTSidGroupPrincipal extends NTSid {
 
     private static final long serialVersionUID = -1373347438636198229L;
--- a/jdk/src/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class NTSidPrimaryGroupPrincipal extends NTSid {
 
     private static final long serialVersionUID = 8011978367305190527L;
--- a/jdk/src/share/classes/com/sun/security/auth/NTSidUserPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/NTSidUserPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class NTSidUserPrincipal extends NTSid {
 
     private static final long serialVersionUID = -5573239889517749525L;
--- a/jdk/src/share/classes/com/sun/security/auth/NTUserPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/NTUserPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,6 +41,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class NTUserPrincipal implements Principal, java.io.Serializable {
 
     private static final long serialVersionUID = -8737649811939033735L;
--- a/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java	Fri Oct 11 09:17:18 2013 -0400
@@ -215,6 +215,7 @@
  * @see java.security.ProtectionDomain
  * @see java.security.Security security properties
  */
+@jdk.Exported(false)
 @Deprecated
 public class PolicyFile extends javax.security.auth.Policy {
 
--- a/jdk/src/share/classes/com/sun/security/auth/PrincipalComparator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/PrincipalComparator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -50,6 +50,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public interface PrincipalComparator {
     /**
      * Check if the specified <code>Subject</code> is implied by
--- a/jdk/src/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported(false)
 @Deprecated
 public class SolarisNumericGroupPrincipal implements
                                         Principal,
--- a/jdk/src/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported(false)
 @Deprecated
 public class SolarisNumericUserPrincipal implements
                                         Principal,
--- a/jdk/src/share/classes/com/sun/security/auth/SolarisPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/SolarisPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported(false)
 @Deprecated
 public class SolarisPrincipal implements Principal, java.io.Serializable {
 
--- a/jdk/src/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,6 +41,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class UnixNumericGroupPrincipal implements
                                         Principal,
                                         java.io.Serializable {
--- a/jdk/src/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,6 +41,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class UnixNumericUserPrincipal implements
                                         Principal,
                                         java.io.Serializable {
--- a/jdk/src/share/classes/com/sun/security/auth/UnixPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/UnixPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,6 +41,7 @@
  * @see java.security.Principal
  * @see javax.security.auth.Subject
  */
+@jdk.Exported
 public class UnixPrincipal implements Principal, java.io.Serializable {
 
     private static final long serialVersionUID = -2951667807323493631L;
--- a/jdk/src/share/classes/com/sun/security/auth/UserPrincipal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/UserPrincipal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,6 +42,7 @@
  *
  * @since 1.6
  */
+@jdk.Exported
 public final class UserPrincipal implements Principal, java.io.Serializable {
 
     private static final long serialVersionUID = 892106070870210969L;
--- a/jdk/src/share/classes/com/sun/security/auth/X500Principal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/X500Principal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -49,6 +49,7 @@
  *             class.
  * @see javax.security.auth.x500.X500Principal
 */
+@jdk.Exported(false)
 @Deprecated
 public class X500Principal implements Principal, java.io.Serializable {
 
--- a/jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -54,6 +54,7 @@
  * @see javax.security.auth.callback
  * @deprecated This class will be removed in a future release.
  */
+@jdk.Exported(false)
 @Deprecated
 public class DialogCallbackHandler implements CallbackHandler {
 
--- a/jdk/src/share/classes/com/sun/security/auth/callback/TextCallbackHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/callback/TextCallbackHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -53,6 +53,7 @@
  * @see javax.security.auth.callback
  */
 
+@jdk.Exported
 public class TextCallbackHandler implements CallbackHandler {
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/security/auth/callback/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+@jdk.Exported
+package com.sun.security.auth.callback;
--- a/jdk/src/share/classes/com/sun/security/auth/login/ConfigFile.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/login/ConfigFile.java	Fri Oct 11 09:17:18 2013 -0400
@@ -83,6 +83,7 @@
  * @see javax.security.auth.login.LoginContext
  * @see java.security.Security security properties
  */
+@jdk.Exported
 public class ConfigFile extends Configuration {
 
     private final sun.security.provider.ConfigFile.Spi spi;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/security/auth/login/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+@jdk.Exported
+package com.sun.security.auth.login;
--- a/jdk/src/share/classes/com/sun/security/auth/module/JndiLoginModule.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/JndiLoginModule.java	Fri Oct 11 09:17:18 2013 -0400
@@ -151,6 +151,7 @@
  * </pre>
  *
  */
+@jdk.Exported
 public class JndiLoginModule implements LoginModule {
 
     private static final ResourceBundle rb = AccessController.doPrivileged(
--- a/jdk/src/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java	Fri Oct 11 09:17:18 2013 -0400
@@ -110,6 +110,7 @@
  *
  * </dl>
  */
+@jdk.Exported
 public class KeyStoreLoginModule implements LoginModule {
 
     private static final ResourceBundle rb = AccessController.doPrivileged(
--- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java	Fri Oct 11 09:17:18 2013 -0400
@@ -379,6 +379,7 @@
  * @author Ram Marti
  */
 
+@jdk.Exported
 public class Krb5LoginModule implements LoginModule {
 
     // initial state
--- a/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java	Fri Oct 11 09:17:18 2013 -0400
@@ -304,6 +304,7 @@
  *
  * @since 1.6
  */
+@jdk.Exported
 public class LdapLoginModule implements LoginModule {
 
     // Use the default classloader for this class to load the prompt strings.
--- a/jdk/src/share/classes/com/sun/security/auth/module/NTLoginModule.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/NTLoginModule.java	Fri Oct 11 09:17:18 2013 -0400
@@ -57,6 +57,7 @@
  *
  * @see javax.security.auth.spi.LoginModule
  */
+@jdk.Exported
 public class NTLoginModule implements LoginModule {
 
     private NTSystem ntSystem;
--- a/jdk/src/share/classes/com/sun/security/auth/module/NTSystem.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/NTSystem.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,6 +30,7 @@
  * security information for the current user.
  *
  */
+@jdk.Exported
 public class NTSystem {
 
     private native void getCurrent(boolean debug);
--- a/jdk/src/share/classes/com/sun/security/auth/module/SolarisLoginModule.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/SolarisLoginModule.java	Fri Oct 11 09:17:18 2013 -0400
@@ -52,6 +52,7 @@
  *             UnixLoginModule.
  *
  */
+@jdk.Exported(false)
 @Deprecated
 public class SolarisLoginModule implements LoginModule {
 
--- a/jdk/src/share/classes/com/sun/security/auth/module/SolarisSystem.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/SolarisSystem.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,6 +30,7 @@
  * UID/GID/groups information for the current user.
  *
  */
+@jdk.Exported
 public class SolarisSystem {
 
     private native void getSolarisInfo();
--- a/jdk/src/share/classes/com/sun/security/auth/module/UnixLoginModule.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/UnixLoginModule.java	Fri Oct 11 09:17:18 2013 -0400
@@ -47,6 +47,7 @@
  * debug messages will be output to the output stream, System.out.
  *
  */
+@jdk.Exported
 public class UnixLoginModule implements LoginModule {
 
     // initial state
--- a/jdk/src/share/classes/com/sun/security/auth/module/UnixSystem.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/auth/module/UnixSystem.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,6 +30,7 @@
  * UID/GID/groups information for the current user.
  *
  */
+@jdk.Exported
 public class UnixSystem {
 
     private native void getUnixInfo();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/security/auth/module/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+@jdk.Exported
+package com.sun.security.auth.module;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/security/auth/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+@jdk.Exported
+package com.sun.security.auth;
--- a/jdk/src/share/classes/com/sun/security/jgss/AuthorizationDataEntry.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/jgss/AuthorizationDataEntry.java	Fri Oct 11 09:17:18 2013 -0400
@@ -28,7 +28,8 @@
 /**
  * Kerberos 5 AuthorizationData entry.
  */
-final public class AuthorizationDataEntry {
+@jdk.Exported
+public final class AuthorizationDataEntry {
 
     private final int type;
     private final byte[] data;
--- a/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSContext.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSContext.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * functionalities not defined by {@code org.ietf.jgss.GSSContext},
  * such as querying context-specific attributes.
  */
+@jdk.Exported
 public interface ExtendedGSSContext extends GSSContext {
     /**
      * Return the mechanism-specific attribute associated with {@code type}.
--- a/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSCredential.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSCredential.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,6 +32,7 @@
  * functionalities not defined by {@code org.ietf.jgss.GSSCredential}.
  * @since 1.8
  */
+@jdk.Exported
 public interface ExtendedGSSCredential extends GSSCredential {
     /**
      * Impersonates a principal. In Kerberos, this can be implemented
--- a/jdk/src/share/classes/com/sun/security/jgss/GSSUtil.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/jgss/GSSUtil.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,6 +33,7 @@
  * GSS-API Utilities for using in conjunction with Sun Microsystem's
  * implementation of Java GSS-API.
  */
+@jdk.Exported
 public class GSSUtil {
 
     /**
--- a/jdk/src/share/classes/com/sun/security/jgss/InquireSecContextPermission.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/jgss/InquireSecContextPermission.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
  *
  * <p>The target name is the {@link InquireType} allowed.
  */
+@jdk.Exported
 public final class InquireSecContextPermission extends BasicPermission {
     private static final long serialVersionUID = -7131173349668647297L;
 
--- a/jdk/src/share/classes/com/sun/security/jgss/InquireType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/security/jgss/InquireType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -29,6 +29,7 @@
  * Attribute types that can be specified as an argument of
  * {@link com.sun.security.jgss.ExtendedGSSContext#inquireSecContext}
  */
+@jdk.Exported
 public enum InquireType {
     /**
      * Attribute type for retrieving the session key of an
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/security/jgss/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+@jdk.Exported
+package com.sun.security.jgss;
--- a/jdk/src/share/classes/com/sun/tools/attach/AgentInitializationException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/attach/AgentInitializationException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,7 @@
  * the error returned by the agent's <code>Agent_OnAttach</code> function.
  * This error code can be obtained by invoking the {@link #returnValue() returnValue} method.
  */
+@jdk.Exported
 public class AgentInitializationException extends Exception {
 
     /** use serialVersionUID for interoperability */
--- a/jdk/src/share/classes/com/sun/tools/attach/AgentLoadException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/attach/AgentLoadException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,6 +36,7 @@
  * com.sun.tools.attach.VirtualMachine#loadAgentPath loadAgentPath} methods
  * if the agent, or agent library, cannot be loaded.
  */
+@jdk.Exported
 public class AgentLoadException extends Exception {
 
     /** use serialVersionUID for interoperability */
--- a/jdk/src/share/classes/com/sun/tools/attach/AttachNotSupportedException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/attach/AttachNotSupportedException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,6 +36,7 @@
  * AttachProvider.attachVirtualMachine} if the provider attempts to
  * attach to a Java virtual machine with which it not comptatible.
  */
+@jdk.Exported
 public class AttachNotSupportedException extends Exception {
 
     /** use serialVersionUID for interoperability */
--- a/jdk/src/share/classes/com/sun/tools/attach/AttachPermission.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/attach/AttachPermission.java	Fri Oct 11 09:17:18 2013 -0400
@@ -79,6 +79,7 @@
  * @see com.sun.tools.attach.spi.AttachProvider
  */
 
+@jdk.Exported
 public final class AttachPermission extends java.security.BasicPermission {
 
     /** use serialVersionUID for interoperability */
--- a/jdk/src/share/classes/com/sun/tools/attach/VirtualMachine.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/attach/VirtualMachine.java	Fri Oct 11 09:17:18 2013 -0400
@@ -102,6 +102,7 @@
  * @since 1.6
  */
 
+@jdk.Exported
 public abstract class VirtualMachine {
     private AttachProvider provider;
     private String id;
--- a/jdk/src/share/classes/com/sun/tools/attach/VirtualMachineDescriptor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/attach/VirtualMachineDescriptor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,6 +55,7 @@
  *
  * @since 1.6
  */
+@jdk.Exported
 public class VirtualMachineDescriptor {
 
     private AttachProvider provider;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/tools/attach/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides the API to attach to a Java<sup><font size=-2>TM</font></sup>
+ * virtual machine.
+ * <p>
+ * A tool, written in the Java Language, uses this API to attach to a target
+ * virtual machine (VM) and load its tool agent into the target VM. For
+ * example, a management console might have a management agent which it uses
+ * to  obtain management information from instrumented objects in a Java
+ * virtual machine. If the management console is required to manage
+ * an application that is running in a virtual machine that does not include
+ * the management agent, then this API can be used to attach to the target
+ * VM and load the agent.
+ *
+ * @since 1.6
+ */
+
+@jdk.Exported
+package com.sun.tools.attach;
--- a/jdk/src/share/classes/com/sun/tools/attach/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<!-- 
- Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  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.
--->
-
-<!doctype html public "-//IETF//DTD HTML//EN">
-<html>
-<body bgcolor="white">
-
-Provides the API to attach to a Java<sup><font size=-2>TM</font></sup> 
-virtual machine.
-
-A tool, written in the Java Language, uses this API to attach to a target 
-virtual machine (VM) and load its tool agent into the target VM. For 
-example, a management console might have a management agent which it uses
-to obtain management information from instrumented objects in a Java
-virtual machine. If the management console is required to manage
-an application that is running in a virtual machine that does not include
-the management agent, then this API can be used to attach to the target
-VM and load the agent.
-
-@since 1.6
-
-</body>
-</html>
-
-
-
--- a/jdk/src/share/classes/com/sun/tools/attach/spi/AttachProvider.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/attach/spi/AttachProvider.java	Fri Oct 11 09:17:18 2013 -0400
@@ -74,6 +74,7 @@
  * @since 1.6
  */
 
+@jdk.Exported
 public abstract class AttachProvider {
 
     private static final Object lock = new Object();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/tools/attach/spi/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+
+/**
+ * Only developers who are defining new attach providers should need to make
+ * direct use of this package.
+ *
+ * @since 1.6
+ */
+
+@jdk.Exported
+package com.sun.tools.attach.spi;
--- a/jdk/src/share/classes/com/sun/tools/attach/spi/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-<!--
- Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  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.
--->
-
-<!doctype html public "-//IETF//DTD HTML//EN">
-<html>
-<body bgcolor="white">
-
-Provider classes for the <tt>{@link com.sun.tools.attach}</tt> package.
-
-<p> Only developers who are defining new attach providers should need to make
-direct use of this package.  </p>
-
-@since 1.6
-
-</body>
-</html>
--- a/jdk/src/share/classes/com/sun/tools/jconsole/JConsoleContext.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/jconsole/JConsoleContext.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,6 +43,7 @@
  *
  * @since 1.6
  */
+@jdk.Exported
 public interface JConsoleContext {
     /**
      * The {@link ConnectionState ConnectionState} bound property name.
@@ -53,6 +54,7 @@
      * Values for the {@linkplain #CONNECTION_STATE_PROPERTY
      * <i>ConnectionState</i>} bound property.
      */
+    @jdk.Exported
     public enum ConnectionState {
         /**
          * The connection has been successfully established.
--- a/jdk/src/share/classes/com/sun/tools/jconsole/JConsolePlugin.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/jconsole/JConsolePlugin.java	Fri Oct 11 09:17:18 2013 -0400
@@ -72,6 +72,7 @@
  *
  * @since 1.6
  */
+@jdk.Exported
 public abstract class JConsolePlugin {
     private volatile JConsoleContext context = null;
     private List<PropertyChangeListener> listeners = null;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/tools/jconsole/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+/**
+ * This package contains the JConsole API.
+ *
+ * @since 1.6
+ */
+
+@jdk.Exported
+package com.sun.tools.jconsole;
--- a/jdk/src/share/classes/com/sun/tools/jconsole/package.html	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-<!--
- Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  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.
--->
-
-<!doctype html public "-//IETF//DTD HTML//EN">
-<html>
-<head>
-</head>
-<body bgcolor="white">
-
-This package contains the JConsole API.
-
-@since 1.6
-
-</body>
-</html>
--- a/jdk/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, 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
@@ -196,19 +196,7 @@
 
         try {
             if (home.length() > 0) {
-                /*
-                 * A wrinkle in the environment:
-                 * 64-bit executables are stored under $JAVA_HOME/bin/os_arch
-                 * 32-bit executables are stored under $JAVA_HOME/bin
-                 */
-                String os_arch = System.getProperty("os.arch");
-                if ("SunOS".equals(System.getProperty("os.name")) &&
-                   ("sparcv9".equals(os_arch) || "amd64".equals(os_arch))) {
-                    exePath = home + File.separator + "bin" + File.separator +
-                        os_arch + File.separator + exe;
-                } else {
-                    exePath = home + File.separator + "bin" + File.separator + exe;
-                }
+                exePath = home + File.separator + "bin" + File.separator + exe;
             } else {
                 exePath = exe;
             }
--- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Fri Oct 11 09:17:18 2013 -0400
@@ -67,7 +67,7 @@
 public class AWTKeyStroke implements Serializable {
     static final long serialVersionUID = -6430539691155161871L;
 
-    private static Map modifierKeywords;
+    private static Map<String, Integer> modifierKeywords;
     /**
      * Associates VK_XXX (as a String) with code (as Integer). This is
      * done to avoid the overhead of the reflective call to find the
@@ -85,8 +85,8 @@
      * AWTKeyStroke class.
      * Must be called under locked AWTKeyStro
      */
-    private static Class getAWTKeyStrokeClass() {
-        Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+    private static Class<AWTKeyStroke> getAWTKeyStrokeClass() {
+        Class<AWTKeyStroke> clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
         if (clazz == null) {
             clazz = AWTKeyStroke.class;
             AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class);
@@ -182,7 +182,7 @@
             throw new IllegalArgumentException("subclass cannot be null");
         }
         synchronized (AWTKeyStroke.class) {
-            Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+            Class<AWTKeyStroke> keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
             if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){
                 // Already registered
                 return;
@@ -229,8 +229,8 @@
      */
     private static Constructor getCtor(final Class clazz)
     {
-        Object ctor = AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        Constructor ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor>() {
+            public Constructor run() {
                 try {
                     Constructor ctor = clazz.getDeclaredConstructor((Class[]) null);
                     if (ctor != null) {
@@ -249,17 +249,17 @@
     private static synchronized AWTKeyStroke getCachedStroke
         (char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
     {
-        Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
+        Map<AWTKeyStroke, AWTKeyStroke> cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
         AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);
 
         if (cache == null) {
-            cache = new HashMap();
+            cache = new HashMap<>();
             AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache);
         }
 
         if (cacheKey == null) {
             try {
-                Class clazz = getAWTKeyStrokeClass();
+                Class<AWTKeyStroke> clazz = getAWTKeyStrokeClass();
                 cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null);
                 AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey);
             } catch (InstantiationException e) {
@@ -485,11 +485,11 @@
      * If typed, pressed or released is not specified, pressed is assumed. Here
      * are some examples:
      * <pre>
-     *     "INSERT" => getAWTKeyStroke(KeyEvent.VK_INSERT, 0);
-     *     "control DELETE" => getAWTKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
-     *     "alt shift X" => getAWTKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
-     *     "alt shift released X" => getAWTKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
-     *     "typed a" => getAWTKeyStroke('a');
+     *     "INSERT" =&gt; getAWTKeyStroke(KeyEvent.VK_INSERT, 0);
+     *     "control DELETE" =&gt; getAWTKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
+     *     "alt shift X" =&gt; getAWTKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
+     *     "alt shift released X" =&gt; getAWTKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
+     *     "typed a" =&gt; getAWTKeyStroke('a');
      * </pre>
      *
      * @param s a String formatted as described above
@@ -513,7 +513,7 @@
 
         synchronized (AWTKeyStroke.class) {
             if (modifierKeywords == null) {
-                Map uninitializedMap = new HashMap(8, 1.0f);
+                Map<String, Integer> uninitializedMap = new HashMap<>(8, 1.0f);
                 uninitializedMap.put("shift",
                                      Integer.valueOf(InputEvent.SHIFT_DOWN_MASK
                                                      |InputEvent.SHIFT_MASK));
@@ -861,12 +861,12 @@
 }
 
 class VKCollection {
-    Map code2name;
-    Map name2code;
+    Map<Integer, String> code2name;
+    Map<String, Integer> name2code;
 
     public VKCollection() {
-        code2name = new HashMap();
-        name2code = new HashMap();
+        code2name = new HashMap<>();
+        name2code = new HashMap<>();
     }
 
     public synchronized void put(String name, Integer code) {
--- a/jdk/src/share/classes/java/awt/CardLayout.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/CardLayout.java	Fri Oct 11 09:17:18 2013 -0400
@@ -66,7 +66,7 @@
      * pairs of components and their names.
      * @see java.util.Vector
      */
-    Vector vector = new Vector();
+    Vector<Card> vector = new Vector<>();
 
     /*
      * A pair of Component and String that represents its name.
@@ -570,10 +570,10 @@
 
         if (f.defaulted("vector")) {
             //  pre-1.4 stream
-            Hashtable tab = (Hashtable)f.get("tab", null);
-            vector = new Vector();
+            Hashtable<String, Component> tab = (Hashtable)f.get("tab", null);
+            vector = new Vector<>();
             if (tab != null && !tab.isEmpty()) {
-                for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) {
+                for (Enumeration<String> e = tab.keys() ; e.hasMoreElements() ; ) {
                     String key = (String)e.nextElement();
                     Component comp = (Component)tab.get(key);
                     vector.add(new Card(key, comp));
@@ -594,7 +594,7 @@
     private void writeObject(ObjectOutputStream s)
         throws IOException
     {
-        Hashtable tab = new Hashtable();
+        Hashtable<String, Component> tab = new Hashtable<>();
         int ncomponents = vector.size();
         for (int i = 0; i < ncomponents; i++) {
             Card card = (Card)vector.get(i);
--- a/jdk/src/share/classes/java/awt/Component.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/Component.java	Fri Oct 11 09:17:18 2013 -0400
@@ -972,6 +972,10 @@
             public AccessControlContext getAccessControlContext(Component comp) {
                 return comp.getAccessControlContext();
             }
+
+            public void revalidateSynchronously(Component comp) {
+                comp.revalidateSynchronously();
+            }
         });
     }
 
@@ -2022,7 +2026,7 @@
      * @return an instance of <code>Point</code> representing
      *          the top-left corner of the component's bounds in the
      *          coordinate space of the screen
-     * @throws <code>IllegalComponentStateException</code> if the
+     * @throws IllegalComponentStateException if the
      *          component is not showing on the screen
      * @see #setLocation
      * @see #getLocation
@@ -2977,6 +2981,13 @@
      * @since 1.7
      */
     public void revalidate() {
+        revalidateSynchronously();
+    }
+
+    /**
+     * Revalidates the component synchronously.
+     */
+    final void revalidateSynchronously() {
         synchronized (getTreeLock()) {
             invalidate();
 
--- a/jdk/src/share/classes/java/awt/Container.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/Container.java	Fri Oct 11 09:17:18 2013 -0400
@@ -258,6 +258,12 @@
             public void validateUnconditionally(Container cont) {
                 cont.validateUnconditionally();
             }
+
+            @Override
+            public Component findComponentAt(Container cont, int x, int y,
+                    boolean ignoreEnabled) {
+                return cont.findComponentAt(x, y, ignoreEnabled);
+            }
         });
     }
 
@@ -2651,7 +2657,6 @@
      * behavior. Setting 'ignoreEnabled' to 'false' bypasses disabled
      * Components during the search. This behavior is used by the
      * lightweight cursor support in sun.awt.GlobalCursorManager.
-     * The cursor code calls this function directly via native code.
      *
      * The addition of this feature is temporary, pending the
      * adoption of new, public API which exports this feature.
--- a/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java	Fri Oct 11 09:17:18 2013 -0400
@@ -85,7 +85,7 @@
      * list should be reused if possible.
      */
     transient private Container cachedRoot;
-    transient private List cachedCycle;
+    transient private List<Component> cachedCycle;
 
     /*
      * We suppose to use getFocusTraversalCycle & getComponentIndex methods in order
@@ -111,7 +111,7 @@
         return cycle.indexOf(aComponent);
     }
 
-    private void enumerateCycle(Container container, List cycle) {
+    private void enumerateCycle(Container container, List<Component> cycle) {
         if (!(container.isVisible() && container.isDisplayable())) {
             return;
         }
--- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -808,13 +808,13 @@
             }
         }
         boolean stopPostProcessing = false;
-        java.util.List processors = getKeyEventPostProcessors();
+        java.util.List<KeyEventPostProcessor> processors = getKeyEventPostProcessors();
         if (processors != null) {
-            for (java.util.Iterator iter = processors.iterator();
+            for (java.util.Iterator<KeyEventPostProcessor> iter = processors.iterator();
                  !stopPostProcessing && iter.hasNext(); )
             {
-                stopPostProcessing = (((KeyEventPostProcessor)(iter.next())).
-                            postProcessKeyEvent(e));
+                stopPostProcessing = iter.next().
+                            postProcessKeyEvent(e);
             }
         }
         if (!stopPostProcessing) {
@@ -1059,12 +1059,12 @@
             return true;
         }
 
-        java.util.List dispatchers = getKeyEventDispatchers();
+        java.util.List<KeyEventDispatcher> dispatchers = getKeyEventDispatchers();
         if (dispatchers != null) {
-            for (java.util.Iterator iter = dispatchers.iterator();
+            for (java.util.Iterator<KeyEventDispatcher> iter = dispatchers.iterator();
                  iter.hasNext(); )
              {
-                 if (((KeyEventDispatcher)(iter.next())).
+                 if (iter.next().
                      dispatchKeyEvent(ke))
                  {
                      return true;
@@ -1131,7 +1131,7 @@
                 oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(),
                                                  stroke.getModifiers(),
                                                  !stroke.isOnKeyRelease());
-            Set toTest;
+            Set<AWTKeyStroke> toTest;
             boolean contains, containsOpp;
 
             toTest = focusedComponent.getFocusTraversalKeys(
@@ -1246,7 +1246,7 @@
      * any) should be cancelled.
      *
      * @param after the timestamp specified in the call to
-     *        <code>enqueueKeyEvents</code>, or any value < 0
+     *        <code>enqueueKeyEvents</code>, or any value &lt; 0
      * @param untilFocused the Component specified in the call to
      *        <code>enqueueKeyEvents</code>
      * @see #enqueueKeyEvents
--- a/jdk/src/share/classes/java/awt/Dialog.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/Dialog.java	Fri Oct 11 09:17:18 2013 -0400
@@ -61,7 +61,7 @@
  * <p>
  * The default layout for a dialog is <code>BorderLayout</code>.
  * <p>
- * A dialog may have its native decorations (i.e. Frame & Titlebar) turned off
+ * A dialog may have its native decorations (i.e. Frame &amp; Titlebar) turned off
  * with <code>setUndecorated</code>.  This can only be done while the dialog
  * is not {@link Component#isDisplayable() displayable}.
  * <p>
--- a/jdk/src/share/classes/java/awt/Event.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/Event.java	Fri Oct 11 09:17:18 2013 -0400
@@ -524,7 +524,7 @@
      * This field has been replaced by MouseEvent.getClickCount().
      *
      * @serial
-     * @see java.awt.event.MouseEvent#getClickCount().
+     * @see java.awt.event.MouseEvent#getClickCount()
      */
     public int clickCount;
 
--- a/jdk/src/share/classes/java/awt/EventQueue.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/EventQueue.java	Fri Oct 11 09:17:18 2013 -0400
@@ -690,7 +690,10 @@
         final Object src = event.getSource();
         final PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
             public Void run() {
-                if (fwDispatcher == null) {
+                // In case fwDispatcher is installed and we're already on the
+                // dispatch thread (e.g. performing DefaultKeyboardFocusManager.sendMessage),
+                // dispatch the event straight away.
+                if (fwDispatcher == null || isDispatchThreadImpl()) {
                     dispatchEventImpl(event, src);
                 } else {
                     fwDispatcher.scheduleDispatch(new Runnable() {
--- a/jdk/src/share/classes/java/awt/Frame.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/Frame.java	Fri Oct 11 09:17:18 2013 -0400
@@ -265,12 +265,12 @@
      *
      * <p>Note that the correct test for frame being fully maximized is
      * <pre>
-     *     (state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH
+     *     (state &amp; Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH
      * </pre>
      *
      * <p>To test is frame is maximized in <em>some</em> direction use
      * <pre>
-     *     (state & Frame.MAXIMIZED_BOTH) != 0
+     *     (state &amp; Frame.MAXIMIZED_BOTH) != 0
      * </pre>
      *
      * @see #setExtendedState(int)
--- a/jdk/src/share/classes/java/awt/GradientPaintContext.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/GradientPaintContext.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,7 +41,7 @@
         new DirectColorModel(24, 0x000000ff, 0x0000ff00, 0x00ff0000);
 
     static ColorModel cachedModel;
-    static WeakReference cached;
+    static WeakReference<Raster> cached;
 
     static synchronized Raster getCachedRaster(ColorModel cm, int w, int h) {
         if (cm == cachedModel) {
@@ -76,7 +76,7 @@
             }
         }
         cachedModel = cm;
-        cached = new WeakReference(ras);
+        cached = new WeakReference<>(ras);
     }
 
     double x1;
--- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Fri Oct 11 09:17:18 2013 -0400
@@ -95,18 +95,18 @@
         String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
         try {
 //          long t0 = System.currentTimeMillis();
-            Class geCls;
+            Class<GraphicsEnvironment> geCls;
             try {
                 // First we try if the bootclassloader finds the requested
                 // class. This way we can avoid to run in a privileged block.
-                geCls = Class.forName(nm);
+                geCls = (Class<GraphicsEnvironment>)Class.forName(nm);
             } catch (ClassNotFoundException ex) {
                 // If the bootclassloader fails, we try again with the
                 // application classloader.
                 ClassLoader cl = ClassLoader.getSystemClassLoader();
-                geCls = Class.forName(nm, true, cl);
+                geCls = (Class<GraphicsEnvironment>)Class.forName(nm, true, cl);
             }
-            ge = (GraphicsEnvironment) geCls.newInstance();
+            ge = geCls.newInstance();
 //          long t1 = System.currentTimeMillis();
 //          System.out.println("GE creation took " + (t1-t0)+ "ms.");
             if (isHeadless()) {
@@ -161,7 +161,7 @@
     private static boolean getHeadlessProperty() {
         if (headless == null) {
             java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     String nm = System.getProperty("java.awt.headless");
 
--- a/jdk/src/share/classes/java/awt/GridBagConstraints.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/GridBagConstraints.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,7 +30,7 @@
  * <code>GridBagLayout</code> class.
  *
  * @author Doug Stein
- * @author Bill Spitzak (orignial NeWS & OLIT implementation)
+ * @author Bill Spitzak (orignial NeWS &amp; OLIT implementation)
  * @see java.awt.GridBagLayout
  * @since JDK1.0
  */
--- a/jdk/src/share/classes/java/awt/GridBagLayout.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/GridBagLayout.java	Fri Oct 11 09:17:18 2013 -0400
@@ -120,9 +120,9 @@
  * Orientation relative values are interpreted relative to the container's
  * <code>ComponentOrientation</code> property while absolute values
  * are not.  Baseline relative values are calculated relative to the
- * baseline.  Valid values are:</dd>
+ * baseline.  Valid values are:
  * <p>
- * <center><table BORDER=0 COLS=3 WIDTH=800
+ * <center><table BORDER=0 WIDTH=800
  *        SUMMARY="absolute, relative and baseline values as described above">
  * <tr>
  * <th><P ALIGN="LEFT">Absolute Values</th>
@@ -131,6 +131,7 @@
  * </tr>
  * <tr>
  * <td>
+ * <ul style="list-style-type:none">
  * <li><code>GridBagConstraints.NORTH</code></li>
  * <li><code>GridBagConstraints.SOUTH</code></li>
  * <li><code>GridBagConstraints.WEST</code></li>
@@ -140,8 +141,10 @@
  * <li><code>GridBagConstraints.SOUTHWEST</code></li>
  * <li><code>GridBagConstraints.SOUTHEAST</code></li>
  * <li><code>GridBagConstraints.CENTER</code> (the default)</li>
+ * </ul>
  * </td>
  * <td>
+ * <ul style="list-style-type:none">
  * <li><code>GridBagConstraints.PAGE_START</code></li>
  * <li><code>GridBagConstraints.PAGE_END</code></li>
  * <li><code>GridBagConstraints.LINE_START</code></li>
@@ -150,8 +153,10 @@
  * <li><code>GridBagConstraints.FIRST_LINE_END</code></li>
  * <li><code>GridBagConstraints.LAST_LINE_START</code></li>
  * <li><code>GridBagConstraints.LAST_LINE_END</code></li>
+ * </ul>
  * </td>
  * <td>
+ * <ul style="list-style-type:none">
  * <li><code>GridBagConstraints.BASELINE</code></li>
  * <li><code>GridBagConstraints.BASELINE_LEADING</code></li>
  * <li><code>GridBagConstraints.BASELINE_TRAILING</code></li>
@@ -161,9 +166,10 @@
  * <li><code>GridBagConstraints.BELOW_BASELINE</code></li>
  * <li><code>GridBagConstraints.BELOW_BASELINE_LEADING</code></li>
  * <li><code>GridBagConstraints.BELOW_BASELINE_TRAILING</code></li>
+ * </ul>
  * </td>
  * </tr>
- * </table></center><p>
+ * </table></center>
  * <dt>{@link GridBagConstraints#weightx},
  * {@link GridBagConstraints#weighty}
  * <dd>Used to determine how to distribute space, which is
@@ -246,7 +252,7 @@
  * left-to-right container and Figure 3 shows the layout for a horizontal,
  * right-to-left container.
  * <p>
- * <center><table COLS=2 WIDTH=600 summary="layout">
+ * <center><table WIDTH=600 summary="layout">
  * <tr ALIGN=CENTER>
  * <td>
  * <img src="doc-files/GridBagLayout-1.gif" alt="The preceeding text describes this graphic (Figure 1)." ALIGN=center HSPACE=10 VSPACE=7>
@@ -349,7 +355,7 @@
  * </pre></blockquote><hr>
  * <p>
  * @author Doug Stein
- * @author Bill Spitzak (orignial NeWS & OLIT implementation)
+ * @author Bill Spitzak (orignial NeWS &amp; OLIT implementation)
  * @see       java.awt.GridBagConstraints
  * @see       java.awt.GridBagLayoutInfo
  * @see       java.awt.ComponentOrientation
--- a/jdk/src/share/classes/java/awt/GridLayout.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/GridLayout.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,7 +55,7 @@
  * If the container's <code>ComponentOrientation</code> property is horizontal
  * and right-to-left, the example produces the output shown in Figure 2.
  * <p>
- * <center><table COLS=2 WIDTH=600 summary="layout">
+ * <center><table WIDTH=600 summary="layout">
  * <tr ALIGN=CENTER>
  * <td><img SRC="doc-files/GridLayout-1.gif"
  *      alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 1 then 2.
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -348,7 +348,7 @@
      * Component of those Windows that has no such array of its own explicitly
      * set.
      */
-    private Set[] defaultFocusTraversalKeys = new Set[4];
+    private Set<AWTKeyStroke>[] defaultFocusTraversalKeys = new Set[4];
 
     /**
      * The current focus cycle root. If the focus owner is itself a focus cycle
@@ -376,7 +376,7 @@
      * KeyEventDispatchers are registered, this field may be null or refer to
      * a List of length 0.
      */
-    private java.util.LinkedList keyEventDispatchers;
+    private java.util.LinkedList<KeyEventDispatcher> keyEventDispatchers;
 
     /**
      * This KeyboardFocusManager's KeyEventPostProcessor chain. The List does
@@ -385,12 +385,12 @@
      * If no other KeyEventPostProcessors are registered, this field may be
      * null or refer to a List of length 0.
      */
-    private java.util.LinkedList keyEventPostProcessors;
+    private java.util.LinkedList<KeyEventPostProcessor> keyEventPostProcessors;
 
     /**
      * Maps Windows to those Windows' most recent focus owners.
      */
-    private static java.util.Map mostRecentFocusOwners = new WeakHashMap();
+    private static java.util.Map<Window, WeakReference<Component>> mostRecentFocusOwners = new WeakHashMap<>();
 
     /**
      * We cache the permission used to verify that the calling thread is
@@ -431,7 +431,7 @@
      */
     public KeyboardFocusManager() {
         for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) {
-            Set work_set = new HashSet();
+            Set<AWTKeyStroke> work_set = new HashSet<>();
             for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) {
                 work_set.add(defaultFocusTraversalKeyStrokes[i][j]);
             }
@@ -1125,7 +1125,7 @@
             throw new IllegalArgumentException("cannot set null Set of default focus traversal keys");
         }
 
-        Set oldKeys;
+        Set<AWTKeyStroke> oldKeys;
 
         synchronized (this) {
             for (AWTKeyStroke keystroke : keystrokes) {
@@ -1153,7 +1153,7 @@
 
             oldKeys = defaultFocusTraversalKeys[id];
             defaultFocusTraversalKeys[id] =
-                Collections.unmodifiableSet(new HashSet(keystrokes));
+                Collections.unmodifiableSet(new HashSet<>(keystrokes));
         }
 
         firePropertyChange(defaultFocusTraversalKeyPropertyNames[id],
@@ -1699,7 +1699,7 @@
         if (dispatcher != null) {
             synchronized (this) {
                 if (keyEventDispatchers == null) {
-                    keyEventDispatchers = new java.util.LinkedList();
+                    keyEventDispatchers = new java.util.LinkedList<>();
                 }
                 keyEventDispatchers.add(dispatcher);
             }
@@ -1787,7 +1787,7 @@
         if (processor != null) {
             synchronized (this) {
                 if (keyEventPostProcessors == null) {
-                    keyEventPostProcessors = new java.util.LinkedList();
+                    keyEventPostProcessors = new java.util.LinkedList<>();
                 }
                 keyEventPostProcessors.add(processor);
             }
@@ -1865,9 +1865,9 @@
         // of Component.parent fields.  Since WeakHasMap refers to its
         // values strongly, we need to break the strong link from the
         // value (component) back to its key (window).
-        WeakReference weakValue = null;
+        WeakReference<Component> weakValue = null;
         if (component != null) {
-            weakValue = new WeakReference(component);
+            weakValue = new WeakReference<>(component);
         }
         mostRecentFocusOwners.put(window, weakValue);
     }
@@ -1906,7 +1906,7 @@
      * javax.swing.JComponent.runInputVerifier() using reflection.
      */
     static synchronized Component getMostRecentFocusOwner(Window window) {
-        WeakReference weakValue =
+        WeakReference<Component> weakValue =
             (WeakReference)mostRecentFocusOwners.get(window);
         return weakValue == null ? null : (Component)weakValue.get();
     }
@@ -2034,7 +2034,7 @@
      * oldest</b> timestamp (if any) should be cancelled.
      *
      * @param after the timestamp specified in the call to
-     *        <code>enqueueKeyEvents</code>, or any value < 0
+     *        <code>enqueueKeyEvents</code>, or any value &lt; 0
      * @param untilFocused the Component specified in the call to
      *        <code>enqueueKeyEvents</code>
      * @see #enqueueKeyEvents
@@ -2649,11 +2649,11 @@
                 Component lastFocusOwner = null;
                 Component currentFocusOwner = null;
 
-                for (Iterator iter = localLightweightRequests.iterator(); iter.hasNext(); ) {
+                for (Iterator<KeyboardFocusManager.LightweightFocusRequest> iter = localLightweightRequests.iterator(); iter.hasNext(); ) {
 
                     currentFocusOwner = manager.getGlobalFocusOwner();
                     LightweightFocusRequest lwFocusRequest =
-                        (LightweightFocusRequest)iter.next();
+                        iter.next();
 
                     /*
                      * WARNING: This is based on DKFM's logic solely!
@@ -2978,12 +2978,12 @@
             if (hwFocusRequest != null) {
                 heavyweightRequests.removeFirst();
                 if (hwFocusRequest.lightweightRequests != null) {
-                    for (Iterator lwIter = hwFocusRequest.lightweightRequests.
+                    for (Iterator<KeyboardFocusManager.LightweightFocusRequest> lwIter = hwFocusRequest.lightweightRequests.
                              iterator();
                          lwIter.hasNext(); )
                     {
                         manager.dequeueKeyEvents
-                            (-1, ((LightweightFocusRequest)lwIter.next()).
+                            (-1, lwIter.next().
                              component);
                     }
                 }
@@ -3063,8 +3063,8 @@
     // Accessor to private field isProxyActive of KeyEvent
     private static boolean isProxyActiveImpl(KeyEvent e) {
         if (proxyActive == null) {
-            proxyActive = (Field) AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
+            proxyActive =  AccessController.doPrivileged(new PrivilegedAction<Field>() {
+                    public Field run() {
                         Field field = null;
                         try {
                             field = KeyEvent.class.getDeclaredField("isProxyActive");
--- a/jdk/src/share/classes/java/awt/MenuBar.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/MenuBar.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,7 +43,7 @@
  * This is what a menu bar might look like:
  * <p>
  * <img src="doc-files/MenuBar-1.gif"
- * <alt="Diagram of MenuBar containing 2 menus: Examples and Options.
+ * alt="Diagram of MenuBar containing 2 menus: Examples and Options.
  * Examples menu is expanded showing items: Basic, Simple, Check, and More Examples."
  * ALIGN=center HSPACE=10 VSPACE=7>
  * <p>
--- a/jdk/src/share/classes/java/awt/ScrollPane.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/ScrollPane.java	Fri Oct 11 09:17:18 2013 -0400
@@ -247,7 +247,7 @@
      * component is removed and the new one is added.
      * @param comp the component to be added
      * @param constraints  not applicable
-     * @param index position of child component (must be <= 0)
+     * @param index position of child component (must be &lt;= 0)
      */
     protected final void addImpl(Component comp, Object constraints, int index) {
         synchronized (getTreeLock()) {
--- a/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java	Fri Oct 11 09:17:18 2013 -0400
@@ -220,7 +220,7 @@
      * This method is public for this class to properly implement
      * <code>Adjustable</code> interface.
      *
-     * @throws <code>AWTError</code>  Always throws an error when called.
+     * @throws AWTError Always throws an error when called.
      */
     public void setMinimum(int min) {
         throw new AWTError(SCROLLPANE_ONLY);
@@ -237,7 +237,7 @@
      * This method is public for this class to properly implement
      * <code>Adjustable</code> interface.
      *
-     * @throws <code>AWTError</code>  Always throws an error when called.
+     * @throws AWTError Always throws an error when called.
      */
     public void setMaximum(int max) {
         throw new AWTError(SCROLLPANE_ONLY);
@@ -274,7 +274,7 @@
      * This method is public for this class to properly implement
      * <code>Adjustable</code> interface.
      *
-     * @throws <code>AWTError</code>  Always throws an error when called.
+     * @throws AWTError Always throws an error when called.
      */
     public void setVisibleAmount(int v) {
         throw new AWTError(SCROLLPANE_ONLY);
--- a/jdk/src/share/classes/java/awt/Scrollbar.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/Scrollbar.java	Fri Oct 11 09:17:18 2013 -0400
@@ -715,6 +715,9 @@
      * The unit increment must be greater than zero.
      * Attepts to set the unit increment to a value lower than 1
      * will result in a value of 1 being set.
+     * <p>
+     * In some operating systems, this property
+     * can be ignored by the underlying controls.
      *
      * @param        v  the amount by which to increment or decrement
      *                         the scroll bar's value
@@ -752,6 +755,9 @@
      * scroll bar, generally through a mouse or keyboard gesture
      * that the scroll bar receives as an adjustment event.
      * The unit increment must be greater than zero.
+     * <p>
+     * In some operating systems, this property
+     * can be ignored by the underlying controls.
      *
      * @return      the unit increment of this scroll bar
      * @see         java.awt.Scrollbar#setUnitIncrement
--- a/jdk/src/share/classes/java/awt/SequencedEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/SequencedEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -49,7 +49,7 @@
 
     private static final int ID =
         java.awt.event.FocusEvent.FOCUS_LAST + 1;
-    private static final LinkedList list = new LinkedList();
+    private static final LinkedList<SequencedEvent> list = new LinkedList<>();
 
     private final AWTEvent nested;
     private AppContext appContext;
--- a/jdk/src/share/classes/java/awt/SystemTray.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/SystemTray.java	Fri Oct 11 09:17:18 2013 -0400
@@ -63,8 +63,8 @@
  *
  * <p>The following code snippet demonstrates how to access
  * and customize the system tray:
+ * <pre>
  * <code>
- * <pre>
  *     {@link TrayIcon} trayIcon = null;
  *     if (SystemTray.isSupported()) {
  *         // get the SystemTray instance
@@ -109,8 +109,8 @@
  *         trayIcon.{@link TrayIcon#setImage(java.awt.Image) setImage}(updatedImage);
  *     }
  *     // ...
+ * </code>
  * </pre>
- * </code>
  *
  * @since 1.6
  * @see TrayIcon
--- a/jdk/src/share/classes/java/awt/TextComponent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/TextComponent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -972,7 +972,7 @@
          * coordinates.  If the index is invalid a null rectangle
          * is returned.
          *
-         * @param i the index into the String >= 0
+         * @param i the index into the String &gt;= 0
          * @return the screen coordinates of the character's bounding box
          */
         public Rectangle getCharacterBounds(int i) {
@@ -982,7 +982,7 @@
         /**
          * Returns the number of characters (valid indicies)
          *
-         * @return the number of characters >= 0
+         * @return the number of characters &gt;= 0
          */
         public int getCharCount() {
             return TextComponent.this.getText().length();
@@ -1018,7 +1018,7 @@
          * Return 0 if the text is empty, or the caret position
          * if no selection.
          *
-         * @return the index into the text of the start of the selection >= 0
+         * @return the index into the text of the start of the selection &gt;= 0
          */
         public int getSelectionStart() {
             return TextComponent.this.getSelectionStart();
@@ -1031,7 +1031,7 @@
          * Return 0 if the text is empty, or the caret position
          * if no selection.
          *
-         * @return the index into teh text of the end of the selection >= 0
+         * @return the index into teh text of the end of the selection &gt;= 0
          */
         public int getSelectionEnd() {
             return TextComponent.this.getSelectionEnd();
@@ -1056,7 +1056,7 @@
          *
          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
          * or AccessibleText.SENTENCE to retrieve
-         * @param index an index within the text >= 0
+         * @param index an index within the text &gt;= 0
          * @return the letter, word, or sentence,
          *   null for an invalid index or part
          */
@@ -1122,7 +1122,7 @@
          *
          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
          * or AccessibleText.SENTENCE to retrieve
-         * @param index an index within the text >= 0
+         * @param index an index within the text &gt;= 0
          * @return the letter, word, or sentence, null for an invalid
          *  index or part
          */
@@ -1175,7 +1175,7 @@
          *
          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
          *   or AccessibleText.SENTENCE to retrieve
-         * @param index an index within the text >= 0
+         * @param index an index within the text &gt;= 0
          * @return the letter, word, or sentence, null for an invalid index
          *  or part
          */
--- a/jdk/src/share/classes/java/awt/TextField.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/TextField.java	Fri Oct 11 09:17:18 2013 -0400
@@ -503,7 +503,7 @@
      *
      * @see #addActionListener
      * @see #removeActionListener
-     * @see     java.awt.event#ActionListener
+     * @see java.awt.event.ActionListener
      * @since 1.4
      */
     public synchronized ActionListener[] getActionListeners() {
--- a/jdk/src/share/classes/java/awt/TexturePaintContext.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/TexturePaintContext.java	Fri Oct 11 09:17:18 2013 -0400
@@ -73,11 +73,11 @@
         WritableRaster raster = bufImg.getRaster();
         ColorModel cm = bufImg.getColorModel();
         int maxw = devBounds.width;
-        Object val = hints.get(hints.KEY_INTERPOLATION);
+        Object val = hints.get(RenderingHints.KEY_INTERPOLATION);
         boolean filter =
             (val == null
-             ? (hints.get(hints.KEY_RENDERING) == hints.VALUE_RENDER_QUALITY)
-             : (val != hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
+             ? (hints.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_QUALITY)
+             : (val != RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
         if (raster instanceof IntegerInterleavedRaster &&
             (!filter || isFilterableDCM(cm)))
         {
@@ -234,8 +234,8 @@
         return outRas;
     }
 
-    private static WeakReference xrgbRasRef;
-    private static WeakReference argbRasRef;
+    private static WeakReference<Raster> xrgbRasRef;
+    private static WeakReference<Raster> argbRasRef;
 
     synchronized static WritableRaster makeRaster(ColorModel cm,
                                                   Raster srcRas,
@@ -278,13 +278,13 @@
             return;
         }
         if (xrgbmodel == cm) {
-            xrgbRasRef = new WeakReference(outRas);
+            xrgbRasRef = new WeakReference<>(outRas);
         } else if (argbmodel == cm) {
-            argbRasRef = new WeakReference(outRas);
+            argbRasRef = new WeakReference<>(outRas);
         }
     }
 
-    private static WeakReference byteRasRef;
+    private static WeakReference<Raster> byteRasRef;
 
     synchronized static WritableRaster makeByteRaster(Raster srcRas,
                                                       int w, int h)
@@ -307,7 +307,7 @@
         if (outRas == null) {
             return;
         }
-        byteRasRef = new WeakReference(outRas);
+        byteRasRef = new WeakReference<>(outRas);
     }
 
     public abstract WritableRaster makeRaster(int w, int h);
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,7 @@
 import sun.awt.NullComponentPeer;
 import sun.awt.PeerEvent;
 import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 import sun.security.util.SecurityConstants;
 
 import sun.util.CoreResourceBundleControl;
@@ -467,7 +468,7 @@
         GraphicsEnvironment.checkHeadless();
     }
 
-/**
+    /**
      * Controls whether the layout of Containers is validated dynamically
      * during resizing, or statically, after resizing is complete.
      * Use {@code isDynamicLayoutActive()} to detect if this feature enabled
@@ -497,9 +498,12 @@
      * @see       java.awt.GraphicsEnvironment#isHeadless
      * @since     1.4
      */
-    public void setDynamicLayout(boolean dynamic)
+    public void setDynamicLayout(final boolean dynamic)
         throws HeadlessException {
         GraphicsEnvironment.checkHeadless();
+        if (this != getDefaultToolkit()) {
+            getDefaultToolkit().setDynamicLayout(dynamic);
+        }
     }
 
     /**
@@ -1239,7 +1243,8 @@
     }
 
     /**
-     * Emits an audio beep.
+     * Emits an audio beep depending on native system settings and hardware
+     * capabilities.
      * @since     JDK1.1
      */
     public abstract void beep();
@@ -1598,6 +1603,12 @@
      * here, so that only one copy is maintained.
      */
     private static ResourceBundle resources;
+    private static ResourceBundle platformResources;
+
+    // called by platform toolkit
+    private static void setPlatformResources(ResourceBundle bundle) {
+        platformResources = bundle;
+    }
 
     /**
      * Initialize JNI field and method ids
@@ -1646,6 +1657,14 @@
     }
 
     static {
+        AWTAccessor.setToolkitAccessor(
+                new AWTAccessor.ToolkitAccessor() {
+                    @Override
+                    public void setPlatformResources(ResourceBundle bundle) {
+                        Toolkit.setPlatformResources(bundle);
+                    }
+                });
+
         java.security.AccessController.doPrivileged(
                                  new java.security.PrivilegedAction<Void>() {
             public Void run() {
@@ -1673,6 +1692,15 @@
      * This method returns defaultValue if the property is not found.
      */
     public static String getProperty(String key, String defaultValue) {
+        // first try platform specific bundle
+        if (platformResources != null) {
+            try {
+                return platformResources.getString(key);
+            }
+            catch (MissingResourceException e) {}
+        }
+
+        // then shared one
         if (resources != null) {
             try {
                 return resources.getString(key);
--- a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java	Fri Oct 11 09:17:18 2013 -0400
@@ -224,8 +224,8 @@
             // starts. Thus, the enter() method will not hang.
             //
             // Event pump should be privileged. See 6300270.
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                public Void run() {
                     run.run();
                     return null;
                 }
--- a/jdk/src/share/classes/java/awt/Window.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/Window.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1075,7 +1075,6 @@
      * Hide this Window, its subcomponents, and all of its owned children.
      * The Window and its subcomponents can be made visible again
      * with a call to {@code show}.
-     * </p>
      * @see #show
      * @see #dispose
      * @deprecated As of JDK version 1.5, replaced by
@@ -3373,27 +3372,27 @@
      * this property of the Window.
      * <p>
      * For example, after the following code is executed:
-     * <pre><blockquote>
+     * <pre>
      * setLocationByPlatform(true);
      * setVisible(true);
      * boolean flag = isLocationByPlatform();
-     * </blockquote></pre>
+     * </pre>
      * The window will be shown at platform's default location and
      * {@code flag} will be {@code false}.
      * <p>
      * In the following sample:
-     * <pre><blockquote>
+     * <pre>
      * setLocationByPlatform(true);
      * setLocation(10, 10);
      * boolean flag = isLocationByPlatform();
      * setVisible(true);
-     * </blockquote></pre>
+     * </pre>
      * The window will be shown at (10, 10) and {@code flag} will be
      * {@code false}.
      *
      * @param locationByPlatform {@code true} if this Window should appear
      *        at the default location, {@code false} if at the current location
-     * @throws {@code IllegalComponentStateException} if the window
+     * @throws IllegalComponentStateException if the window
      *         is showing on screen and locationByPlatform is {@code true}.
      * @see #setLocation
      * @see #isShowing
--- a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -454,7 +454,7 @@
 
     /**
      * Constructs a <code>DataFlavor</code> from a <code>mimeType</code> string.
-     * The string can specify a "class=<fully specified Java class name>"
+     * The string can specify a "class=&lt;fully specified Java class name&gt;"
      * parameter to create a <code>DataFlavor</code> with the desired
      * representation class. If the string does not contain "class=" parameter,
      * <code>java.io.InputStream</code> is used as default.
--- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Fri Oct 11 09:17:18 2013 -0400
@@ -70,7 +70,7 @@
     /**
      * System singleton which maps a thread's ClassLoader to a SystemFlavorMap.
      */
-    private static final WeakHashMap flavorMaps = new WeakHashMap();
+    private static final WeakHashMap<ClassLoader, FlavorMap> flavorMaps = new WeakHashMap<>();
 
     /**
      * Copied from java.util.Properties.
@@ -139,7 +139,7 @@
      * native Strings.
      * Do not use the field directly, use getFlavorToNative() instead.
      */
-    private final Map flavorToNative = new HashMap();
+    private final Map<DataFlavor, List<String>> flavorToNative = new HashMap<>();
 
     /**
      * Accessor to flavorToNative map.  Since we use lazy initialization we must
@@ -148,7 +148,7 @@
      *
      * @return flavorToNative
      */
-    private synchronized Map getFlavorToNative() {
+    private synchronized Map<DataFlavor, List<String>> getFlavorToNative() {
         if (!isMapInitialized) {
             initSystemFlavorMap();
         }
@@ -164,13 +164,13 @@
      * Caches the result of getNativesForFlavor(). Maps DataFlavors to
      * SoftReferences which reference Lists of String natives.
      */
-    private Map getNativesForFlavorCache = new HashMap();
+    private Map<DataFlavor, SoftReference<List<String>>> getNativesForFlavorCache = new HashMap<>();
 
     /**
      * Caches the result getFlavorsForNative(). Maps String natives to
      * SoftReferences which reference Lists of DataFlavors.
      */
-    private Map getFlavorsForNativeCache = new HashMap();
+    private Map<String, SoftReference<List<DataFlavor>>> getFlavorsForNativeCache = new HashMap<>();
 
     /**
      * Dynamic mapping generation used for text mappings should not be applied
@@ -193,7 +193,7 @@
         FlavorMap fm;
 
         synchronized(flavorMaps) {
-            fm = (FlavorMap)flavorMaps.get(contextClassLoader);
+            fm = flavorMaps.get(contextClassLoader);
             if (fm == null) {
                 fm = new SystemFlavorMap();
                 flavorMaps.put(contextClassLoader, fm);
@@ -520,10 +520,10 @@
      * the appropriate Map location, but rather will be appended to a List
      * stored in that location.
      */
-    private void store(Object hashed, Object listed, Map map) {
-        List list = (List)map.get(hashed);
+    private <H, L> void store(H hashed, L listed, Map<H, List<L>> map) {
+        List<L> list = map.get(hashed);
         if (list == null) {
-            list = new ArrayList(1);
+            list = new ArrayList<>(1);
             map.put(hashed, list);
         }
         if (!list.contains(listed)) {
@@ -537,17 +537,17 @@
      * case, a new DataFlavor is synthesized, stored, and returned, if and
      * only if the specified native is encoded as a Java MIME type.
      */
-    private List nativeToFlavorLookup(String nat) {
+    private List<DataFlavor> nativeToFlavorLookup(String nat) {
         List<DataFlavor> flavors = getNativeToFlavor().get(nat);
 
         if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
             DataTransferer transferer = DataTransferer.getInstance();
             if (transferer != null) {
-                List platformFlavors =
+                List<DataFlavor> platformFlavors =
                     transferer.getPlatformMappingsForNative(nat);
                 if (!platformFlavors.isEmpty()) {
                     if (flavors != null) {
-                        platformFlavors.removeAll(new HashSet(flavors));
+                        platformFlavors.removeAll(new HashSet<>(flavors));
                         // Prepending the platform-specific mappings ensures
                         // that the flavors added with
                         // addFlavorForUnencodedNative() are at the end of
@@ -573,15 +573,15 @@
             }
 
             if (flavor != null) {
-                flavors = new ArrayList(1);
+                flavors = new ArrayList<>(1);
                 getNativeToFlavor().put(nat, flavors);
                 flavors.add(flavor);
                 getFlavorsForNativeCache.remove(nat);
                 getFlavorsForNativeCache.remove(null);
 
-                List natives = (List)getFlavorToNative().get(flavor);
+                List<String> natives = getFlavorToNative().get(flavor);
                 if (natives == null) {
-                    natives = new ArrayList(1);
+                    natives = new ArrayList<>(1);
                     getFlavorToNative().put(flavor, natives);
                 }
                 natives.add(nat);
@@ -590,7 +590,7 @@
             }
         }
 
-        return (flavors != null) ? flavors : new ArrayList(0);
+        return (flavors != null) ? flavors : new ArrayList<>(0);
     }
 
     /**
@@ -601,18 +601,18 @@
      * encoding the DataFlavor's MIME type. Otherwise an empty List is returned
      * and 'flavorToNative' remains unaffected.
      */
-    private List flavorToNativeLookup(final DataFlavor flav,
-                                      final boolean synthesize) {
-        List natives = (List)getFlavorToNative().get(flav);
+    private List<String> flavorToNativeLookup(final DataFlavor flav,
+                                              final boolean synthesize) {
+        List<String> natives = getFlavorToNative().get(flav);
 
         if (flav != null && !disabledMappingGenerationKeys.contains(flav)) {
             DataTransferer transferer = DataTransferer.getInstance();
             if (transferer != null) {
-                List platformNatives =
+                List<String> platformNatives =
                     transferer.getPlatformMappingsForFlavor(flav);
                 if (!platformNatives.isEmpty()) {
                     if (natives != null) {
-                        platformNatives.removeAll(new HashSet(natives));
+                        platformNatives.removeAll(new HashSet<>(natives));
                         // Prepend the platform-specific mappings to ensure
                         // that the natives added with
                         // addUnencodedNativeForFlavor() are at the end of
@@ -627,7 +627,7 @@
         if (natives == null) {
             if (synthesize) {
                 String encoded = encodeDataFlavor(flav);
-                natives = new ArrayList(1);
+                natives = new ArrayList<>(1);
                 getFlavorToNative().put(flav, natives);
                 natives.add(encoded);
                 getNativesForFlavorCache.remove(flav);
@@ -635,14 +635,14 @@
 
                 List<DataFlavor> flavors = getNativeToFlavor().get(encoded);
                 if (flavors == null) {
-                    flavors = new ArrayList(1);
+                    flavors = new ArrayList<>(1);
                     getNativeToFlavor().put(encoded, flavors);
                 }
                 flavors.add(flav);
                 getFlavorsForNativeCache.remove(encoded);
                 getFlavorsForNativeCache.remove(null);
             } else {
-                natives = new ArrayList(0);
+                natives = new ArrayList<>(0);
             }
         }
 
@@ -675,21 +675,21 @@
      * @since 1.4
      */
     public synchronized List<String> getNativesForFlavor(DataFlavor flav) {
-        List retval = null;
+        List<String> retval = null;
 
         // Check cache, even for null flav
-        SoftReference ref = (SoftReference)getNativesForFlavorCache.get(flav);
+        SoftReference<List<String>> ref = getNativesForFlavorCache.get(flav);
         if (ref != null) {
-            retval = (List)ref.get();
+            retval = ref.get();
             if (retval != null) {
                 // Create a copy, because client code can modify the returned
                 // list.
-                return new ArrayList(retval);
+                return new ArrayList<>(retval);
             }
         }
 
         if (flav == null) {
-            retval = new ArrayList<String>(getNativeToFlavor().keySet());
+            retval = new ArrayList<>(getNativeToFlavor().keySet());
         } else if (disabledMappingGenerationKeys.contains(flav)) {
             // In this case we shouldn't synthesize a native for this flavor,
             // since its mappings were explicitly specified.
@@ -699,7 +699,7 @@
             // For text/* flavors, flavor-to-native mappings specified in
             // flavormap.properties are stored per flavor's base type.
             if ("text".equals(flav.getPrimaryType())) {
-                retval = (List)getFlavorToNative().get(flav.mimeType.getBaseType());
+                retval = getAllNativesForType(flav.mimeType.getBaseType());
                 if (retval != null) {
                     // To prevent the List stored in the map from modification.
                     retval = new ArrayList(retval);
@@ -707,15 +707,15 @@
             }
 
             // Also include text/plain natives, but don't duplicate Strings
-            List textPlainList = (List)getFlavorToNative().get(TEXT_PLAIN_BASE_TYPE);
+            List<String> textPlainList = getAllNativesForType(TEXT_PLAIN_BASE_TYPE);
 
             if (textPlainList != null && !textPlainList.isEmpty()) {
                 // To prevent the List stored in the map from modification.
                 // This also guarantees that removeAll() is supported.
-                textPlainList = new ArrayList(textPlainList);
+                textPlainList = new ArrayList<>(textPlainList);
                 if (retval != null && !retval.isEmpty()) {
                     // Use HashSet to get constant-time performance for search.
-                    textPlainList.removeAll(new HashSet(retval));
+                    textPlainList.removeAll(new HashSet<>(retval));
                     retval.addAll(textPlainList);
                 } else {
                     retval = textPlainList;
@@ -728,7 +728,7 @@
                 // In this branch it is guaranteed that natives explicitly
                 // listed for flav's MIME type were added with
                 // addUnencodedNativeForFlavor(), so they have lower priority.
-                List explicitList =
+                List<String> explicitList =
                     flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND);
 
                 // flavorToNativeLookup() never returns null.
@@ -736,14 +736,14 @@
                 if (!explicitList.isEmpty()) {
                     // To prevent the List stored in the map from modification.
                     // This also guarantees that removeAll() is supported.
-                    explicitList = new ArrayList(explicitList);
+                    explicitList = new ArrayList<>(explicitList);
                     // Use HashSet to get constant-time performance for search.
-                    explicitList.removeAll(new HashSet(retval));
+                    explicitList.removeAll(new HashSet<>(retval));
                     retval.addAll(explicitList);
                 }
             }
         } else if (DataTransferer.isFlavorNoncharsetTextType(flav)) {
-            retval = (List)getFlavorToNative().get(flav.mimeType.getBaseType());
+            retval = getAllNativesForType(flav.mimeType.getBaseType());
 
             if (retval == null || retval.isEmpty()) {
                 retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND);
@@ -751,7 +751,7 @@
                 // In this branch it is guaranteed that natives explicitly
                 // listed for flav's MIME type were added with
                 // addUnencodedNativeForFlavor(), so they have lower priority.
-                List explicitList =
+                List<String> explicitList =
                     flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND);
 
                 // flavorToNativeLookup() never returns null.
@@ -759,10 +759,10 @@
                 if (!explicitList.isEmpty()) {
                     // To prevent the List stored in the map from modification.
                     // This also guarantees that add/removeAll() are supported.
-                    retval = new ArrayList(retval);
-                    explicitList = new ArrayList(explicitList);
+                    retval = new ArrayList<>(retval);
+                    explicitList = new ArrayList<>(explicitList);
                     // Use HashSet to get constant-time performance for search.
-                    explicitList.removeAll(new HashSet(retval));
+                    explicitList.removeAll(new HashSet<>(retval));
                     retval.addAll(explicitList);
                 }
             }
@@ -770,9 +770,9 @@
             retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND);
         }
 
-        getNativesForFlavorCache.put(flav, new SoftReference(retval));
+        getNativesForFlavorCache.put(flav, new SoftReference<>(retval));
         // Create a copy, because client code can modify the returned list.
-        return new ArrayList(retval);
+        return new ArrayList<>(retval);
     }
 
     /**
@@ -809,11 +809,11 @@
     public synchronized List<DataFlavor> getFlavorsForNative(String nat) {
 
         // Check cache, even for null nat
-        SoftReference ref = (SoftReference)getFlavorsForNativeCache.get(nat);
+        SoftReference<List<DataFlavor>> ref = getFlavorsForNativeCache.get(nat);
         if (ref != null) {
-            ArrayList retval = (ArrayList)ref.get();
+            List<DataFlavor> retval = ref.get();
             if (retval != null) {
-                return (List)retval.clone();
+                return new ArrayList<>(retval);
             }
         }
 
@@ -859,16 +859,15 @@
 
         }
 
-        final ArrayList arrayList = new ArrayList(returnValue);
-        getFlavorsForNativeCache.put(nat, new SoftReference(arrayList));
-        return (List)arrayList.clone();
+        final List<DataFlavor> arrayList = new ArrayList<>(returnValue);
+        getFlavorsForNativeCache.put(nat, new SoftReference<>(arrayList));
+        return new ArrayList<>(arrayList);
     }
 
-    private static LinkedHashSet<DataFlavor> convertMimeTypeToDataFlavors(
+    private static Set<DataFlavor> convertMimeTypeToDataFlavors(
         final String baseType) {
 
-        final LinkedHashSet<DataFlavor> returnValue =
-            new LinkedHashSet<DataFlavor>();
+        final Set<DataFlavor> returnValue = new LinkedHashSet<>();
 
         String subType = null;
 
@@ -1009,11 +1008,11 @@
             flavor_list.toArray(flavors);
         }
 
-        HashMap retval = new HashMap(flavors.length, 1.0f);
-        for (int i = 0; i < flavors.length; i++) {
-            List natives = getNativesForFlavor(flavors[i]);
-            String nat = (natives.isEmpty()) ? null : (String)natives.get(0);
-            retval.put(flavors[i], nat);
+        Map<DataFlavor, String> retval = new HashMap<>(flavors.length, 1.0f);
+        for (DataFlavor flavor : flavors) {
+            List<String> natives = getNativesForFlavor(flavor);
+            String nat = (natives.isEmpty()) ? null : natives.get(0);
+            retval.put(flavor, nat);
         }
 
         return retval;
@@ -1054,12 +1053,11 @@
             native_list.toArray(natives);
         }
 
-        HashMap retval = new HashMap(natives.length, 1.0f);
-        for (int i = 0; i < natives.length; i++) {
-            List flavors = getFlavorsForNative(natives[i]);
-            DataFlavor flav = (flavors.isEmpty())
-                ? null : (DataFlavor)flavors.get(0);
-            retval.put(natives[i], flav);
+        Map<String, DataFlavor> retval = new HashMap<>(natives.length, 1.0f);
+        for (String aNative : natives) {
+            List<DataFlavor> flavors = getFlavorsForNative(aNative);
+            DataFlavor flav = (flavors.isEmpty())? null : flavors.get(0);
+            retval.put(aNative, flav);
         }
 
         return retval;
@@ -1091,9 +1089,9 @@
             throw new NullPointerException("null arguments not permitted");
         }
 
-        List natives = (List)getFlavorToNative().get(flav);
+        List<String> natives = getFlavorToNative().get(flav);
         if (natives == null) {
-            natives = new ArrayList(1);
+            natives = new ArrayList<>(1);
             getFlavorToNative().put(flav, natives);
         } else if (natives.contains(nat)) {
             return;
@@ -1138,8 +1136,8 @@
         }
 
         getFlavorToNative().remove(flav);
-        for (int i = 0; i < natives.length; i++) {
-            addUnencodedNativeForFlavor(flav, natives[i]);
+        for (String aNative : natives) {
+            addUnencodedNativeForFlavor(flav, aNative);
         }
         disabledMappingGenerationKeys.add(flav);
         // Clear the cache to handle the case of empty natives.
@@ -1171,9 +1169,9 @@
             throw new NullPointerException("null arguments not permitted");
         }
 
-        List flavors = (List)getNativeToFlavor().get(nat);
+        List<DataFlavor> flavors = getNativeToFlavor().get(nat);
         if (flavors == null) {
-            flavors = new ArrayList(1);
+            flavors = new ArrayList<>(1);
             getNativeToFlavor().put(nat, flavors);
         } else if (flavors.contains(flav)) {
             return;
@@ -1217,8 +1215,8 @@
         }
 
         getNativeToFlavor().remove(nat);
-        for (int i = 0; i < flavors.length; i++) {
-            addFlavorForUnencodedNative(nat, flavors[i]);
+        for (DataFlavor flavor : flavors) {
+            addFlavorForUnencodedNative(nat, flavor);
         }
         disabledMappingGenerationKeys.add(nat);
         // Clear the cache to handle the case of empty flavors.
@@ -1321,4 +1319,18 @@
             ? new DataFlavor(retval_str)
             : null;
     }
+
+    private List<String> getAllNativesForType(String type) {
+        List<String> retval = null;
+        for (DataFlavor dataFlavor : convertMimeTypeToDataFlavors(type)) {
+            List<String> natives = getFlavorToNative().get(dataFlavor);
+            if (!natives.isEmpty()) {
+                if (retval == null) {
+                    retval = new ArrayList<>();
+                }
+                retval.addAll(natives);
+            }
+        }
+        return retval;
+    }
 }
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -114,7 +114,7 @@
      * @param dgl the <code>DragGestureRecognizer</code>
      * to notify when a drag gesture is detected
      * <P>
-     * @throws <code>IllegalArgumentException</code>
+     * @throws IllegalArgumentException
      * if ds is <code>null</code>.
      */
 
@@ -157,7 +157,7 @@
      * @param sa the set (logical OR) of the <code>DnDConstants</code>
      * that this Drag and Drop operation will support
      * <P>
-     * @throws <code>IllegalArgumentException</code>
+     * @throws IllegalArgumentException
      * if ds is <code>null</code>.
      */
 
@@ -185,7 +185,7 @@
      * the <code>DragGestureRecognizer</code>
      * is not associated with any <code>Component</code>.
      * <P>
-     * @throws <code>IllegalArgumentException</code>
+     * @throws IllegalArgumentException
      * if ds is <code>null</code>.
      */
 
@@ -202,7 +202,7 @@
      * <code>DragGestureRecognizer</code> will
      * use to process the Drag and Drop operation
      * <P>
-     * @throws <code>IllegalArgumentException</code>
+     * @throws IllegalArgumentException
      * if ds is <code>null</code>.
      */
 
@@ -332,7 +332,7 @@
      * @param dgl the <code>DragGestureListener</code> to unregister
      * from this <code>DragGestureRecognizer</code>
      * <P>
-     * @throws <code>IllegalArgumentException</code> if
+     * @throws IllegalArgumentException if
      * dgl is not (equal to) the currently registered <code>DragGestureListener</code>.
      */
 
--- a/jdk/src/share/classes/java/awt/dnd/DragSource.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DragSource.java	Fri Oct 11 09:17:18 2013 -0400
@@ -676,7 +676,7 @@
      *          <code><em>Foo</em>Listener</code>s on this
      *          <code>DragSource</code>, or an empty array if no such listeners
      *          have been added
-     * @exception <code>ClassCastException</code> if <code>listenerType</code>
+     * @exception ClassCastException if <code>listenerType</code>
      *          doesn't specify a class or interface that implements
      *          <code>java.util.EventListener</code>
      *
--- a/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java	Fri Oct 11 09:17:18 2013 -0400
@@ -63,7 +63,7 @@
  * itself between the platform and the
  * listeners provided by the initiator of the drag operation.
  * <p>
- * <a name="defaultCursor" />
+ * <a name="defaultCursor"></a>
  * By default, {@code DragSourceContext} sets the cursor as appropriate
  * for the current state of the drag and drop operation. For example, if
  * the user has chosen {@linkplain DnDConstants#ACTION_MOVE the move action},
--- a/jdk/src/share/classes/java/awt/dnd/DragSourceDragEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DragSourceDragEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -47,9 +47,9 @@
  * source and the drop action selected by the user. The user can select a drop
  * action by pressing modifier keys during the drag operation:
  * <pre>
- *   Ctrl + Shift -> ACTION_LINK
- *   Ctrl         -> ACTION_COPY
- *   Shift        -> ACTION_MOVE
+ *   Ctrl + Shift -&gt; ACTION_LINK
+ *   Ctrl         -&gt; ACTION_COPY
+ *   Shift        -&gt; ACTION_MOVE
  * </pre>
  * If the user selects a drop action, the <i>user drop action</i> is one of
  * <code>DnDConstants</code> that represents the selected drop action if this
@@ -103,7 +103,7 @@
      *        in one event. Use of the extended modifiers is
      *        preferred.
      *
-     * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
+     * @throws IllegalArgumentException if <code>dsc</code> is <code>null</code>.
      *
      * @see java.awt.event.InputEvent
      * @see DragSourceEvent#getLocation
@@ -154,7 +154,7 @@
      * @param x   the horizontal coordinate for the cursor location
      * @param y   the vertical coordinate for the cursor location
      *
-     * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
+     * @throws IllegalArgumentException if <code>dsc</code> is <code>null</code>.
      *
      * @see java.awt.event.InputEvent
      * @since 1.4
--- a/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DragSourceDropEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -63,7 +63,7 @@
      * @param action the drop action
      * @param success a boolean indicating if the drop was successful
      *
-     * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
+     * @throws IllegalArgumentException if <code>dsc</code> is <code>null</code>.
      *
      * @see DragSourceEvent#getLocation
      */
@@ -91,7 +91,7 @@
      * @param x   the horizontal coordinate for the cursor location
      * @param y   the vertical coordinate for the cursor location
      *
-     * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
+     * @throws IllegalArgumentException if <code>dsc</code> is <code>null</code>.
      *
      * @since 1.4
      */
@@ -112,7 +112,7 @@
      *
      * @param dsc the <code>DragSourceContext</code>
      *
-     * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
+     * @throws IllegalArgumentException if <code>dsc</code> is <code>null</code>.
      *
      * @see DragSourceEvent#getLocation
      */
--- a/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -96,7 +96,7 @@
      *
      * @param dsc the <code>DragSourceContext</code>
      *
-     * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
+     * @throws IllegalArgumentException if <code>dsc</code> is <code>null</code>.
      *
      * @see #getLocation
      */
@@ -117,7 +117,7 @@
      * @param x   the horizontal coordinate for the cursor location
      * @param y   the vertical coordinate for the cursor location
      *
-     * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
+     * @throws IllegalArgumentException if <code>dsc</code> is <code>null</code>.
      *
      * @since 1.4
      */
--- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java	Fri Oct 11 09:17:18 2013 -0400
@@ -305,7 +305,7 @@
      * <P>
      * @param dtl The new <code>DropTargetListener</code>
      * <P>
-     * @throws <code>TooManyListenersException</code> if a
+     * @throws TooManyListenersException if a
      * <code>DropTargetListener</code> is already added to this
      * <code>DropTarget</code>.
      */
@@ -351,6 +351,8 @@
      * @see #isActive
      */
     public synchronized void dragEnter(DropTargetDragEvent dtde) {
+        isDraggingInside = true;
+
         if (!active) return;
 
         if (dtListener != null) {
@@ -421,6 +423,8 @@
      * @see #isActive
      */
     public synchronized void dragExit(DropTargetEvent dte) {
+        isDraggingInside = false;
+
         if (!active) return;
 
         if (dtListener != null && active) dtListener.dragExit(dte);
@@ -444,6 +448,8 @@
      * @see #isActive
      */
     public synchronized void drop(DropTargetDropEvent dtde) {
+        isDraggingInside = false;
+
         clearAutoscroll();
 
         if (dtListener != null && active)
@@ -533,6 +539,12 @@
             ((DropTargetPeer)nativePeer).removeDropTarget(this);
 
         componentPeer = nativePeer = null;
+
+        synchronized (this) {
+            if (isDraggingInside) {
+                dragExit(new DropTargetEvent(getDropTargetContext()));
+            }
+        }
     }
 
     /**
@@ -832,7 +844,7 @@
     int     actions = DnDConstants.ACTION_COPY_OR_MOVE;
 
     /**
-     * <code>true</code> if the DropTarget is accepting Drag & Drop operations.
+     * <code>true</code> if the DropTarget is accepting Drag &amp; Drop operations.
      *
      * @serial
      */
@@ -855,4 +867,9 @@
      */
 
     private transient FlavorMap flavorMap;
+
+    /*
+     * If the dragging is currently inside this drop target
+     */
+    private transient boolean isDraggingInside;
 }
--- a/jdk/src/share/classes/java/awt/dnd/DropTargetDragEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DropTargetDragEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -49,9 +49,9 @@
  * source and the drop action selected by the user. The user can select a drop
  * action by pressing modifier keys during the drag operation:
  * <pre>
- *   Ctrl + Shift -> ACTION_LINK
- *   Ctrl         -> ACTION_COPY
- *   Shift        -> ACTION_MOVE
+ *   Ctrl + Shift -&gt; ACTION_LINK
+ *   Ctrl         -&gt; ACTION_COPY
+ *   Shift        -&gt; ACTION_MOVE
  * </pre>
  * If the user selects a drop action, the <i>user drop action</i> is one of
  * <code>DnDConstants</code> that represents the selected drop action if this
@@ -88,11 +88,11 @@
      * @param srcActions The source drop actions
      *
      * @throws NullPointerException if cursorLocn is null
-     * @throws <code>IllegalArgumentException</code> if dropAction is not one of
+     * @throws IllegalArgumentException if dropAction is not one of
      *         <code>DnDConstants</code>.
-     * @throws <code>IllegalArgumentException</code> if srcActions is not
+     * @throws IllegalArgumentException if srcActions is not
      *         a bitwise mask of <code>DnDConstants</code>.
-     * @throws <code>IllegalArgumentException</code> if dtc is <code>null</code>.
+     * @throws IllegalArgumentException if dtc is <code>null</code>.
      */
 
     public DropTargetDragEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions)  {
--- a/jdk/src/share/classes/java/awt/dnd/DropTargetDropEvent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/dnd/DropTargetDropEvent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -48,9 +48,9 @@
  * source and the drop action selected by the user. The user can select a drop
  * action by pressing modifier keys during the drag operation:
  * <pre>
- *   Ctrl + Shift -> ACTION_LINK
- *   Ctrl         -> ACTION_COPY
- *   Shift        -> ACTION_MOVE
+ *   Ctrl + Shift -&gt; ACTION_LINK
+ *   Ctrl         -&gt; ACTION_COPY
+ *   Shift        -&gt; ACTION_MOVE
  * </pre>
  * If the user selects a drop action, the <i>user drop action</i> is one of
  * <code>DnDConstants</code> that represents the selected drop action if this
@@ -92,13 +92,13 @@
      * @param dropAction the user drop action.
      * @param srcActions the source drop actions.
      *
-     * @throws <code>NullPointerException</code>
+     * @throws NullPointerException
      * if cursorLocn is <code>null</code>
-     * @throws <code>IllegalArgumentException</code> if dropAction is not one of
-     *         <code>DnDConstants</code>.
-     * @throws <code>IllegalArgumentException</code> if srcActions is not
-     *         a bitwise mask of <code>DnDConstants</code>.
-     * @throws <code>IllegalArgumentException</code> if dtc is <code>null</code>.
+     * @throws IllegalArgumentException
+     *         if dropAction is not one of  <code>DnDConstants</code>.
+     * @throws IllegalArgumentException
+     *         if srcActions is not a bitwise mask of <code>DnDConstants</code>.
+     * @throws IllegalArgumentException if dtc is <code>null</code>.
      */
 
     public DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions)  {
@@ -136,13 +136,12 @@
      * @param srcActions the source drop actions.
      * @param isLocal  True if the source is in the same JVM as the target
      *
-     * @throws <code>NullPointerException</code> if cursorLocn is
-     *         <code>null</code>
-     * @throws <code>IllegalArgumentException</code> if dropAction is not one of
-     *         <code>DnDConstants</code>.
-     * @throws <code>IllegalArgumentException</code> if srcActions is not
-     *         a bitwise mask of <code>DnDConstants</code>.
-     * @throws <code>IllegalArgumentException</code> if dtc is <code>null</code>.
+     * @throws NullPointerException
+     *         if cursorLocn is  <code>null</code>
+     * @throws IllegalArgumentException
+     *         if dropAction is not one of <code>DnDConstants</code>.
+     * @throws IllegalArgumentException if srcActions is not a bitwise mask of <code>DnDConstants</code>.
+     * @throws IllegalArgumentException  if dtc is <code>null</code>.
      */
 
     public DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions, boolean isLocal)  {
--- a/jdk/src/share/classes/java/awt/event/MouseMotionListener.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/event/MouseMotionListener.java	Fri Oct 11 09:17:18 2013 -0400
@@ -60,9 +60,9 @@
      * mouse button is released (regardless of whether the mouse position
      * is within the bounds of the component).
      * <p>
-     * Due to platform-dependent Drag&Drop implementations,
+     * Due to platform-dependent Drag&amp;Drop implementations,
      * <code>MOUSE_DRAGGED</code> events may not be delivered during a native
-     * Drag&Drop operation.
+     * Drag&amp;Drop operation.
      */
     public void mouseDragged(MouseEvent e);
 
--- a/jdk/src/share/classes/java/awt/font/TransformAttribute.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/awt/font/TransformAttribute.java	Fri Oct 11 09:17:18 2013 -0400
@@ -141,14 +141,16 @@
      * @since 1.6
      */
     public boolean equals(Object rhs) {
-        try {
-            TransformAttribute that = (TransformAttribute)rhs;
-            if (transform == null) {
-                return that.transform == null;
+        if (rhs != null) {
+            try {
+                TransformAttribute that = (TransformAttribute)rhs;
+                if (transform == null) {
+                    return that.transform == null;
+                }
+                return transform.equals(that.transform);
             }
-            return transform.equals(that.transform);
-        }
-        catch (ClassCastException e) {
+            catch (ClassCastException e) {
+            }
         }
         return false;
     }
--- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -149,6 +149,7 @@
      * @return An expression whose value is <code>oldInstance</code>.
      *
      * @throws NullPointerException if {@code out} is {@code null}
+     *                              and this value is used in the method
      *
      * @see #DefaultPersistenceDelegate(String[])
      */
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,8 +41,8 @@
 public class IndexedPropertyDescriptor extends PropertyDescriptor {
 
     private Reference<? extends Class<?>> indexedPropertyTypeRef;
-    private Reference<Method> indexedReadMethodRef;
-    private Reference<Method> indexedWriteMethodRef;
+    private final MethodRef indexedReadMethodRef = new MethodRef();
+    private final MethodRef indexedWriteMethodRef = new MethodRef();
 
     private String indexedReadMethodName;
     private String indexedWriteMethodName;
@@ -173,11 +173,11 @@
      * May return null if the property isn't indexed or is write-only.
      */
     public synchronized Method getIndexedReadMethod() {
-        Method indexedReadMethod = getIndexedReadMethod0();
+        Method indexedReadMethod = this.indexedReadMethodRef.get();
         if (indexedReadMethod == null) {
             Class<?> cls = getClass0();
             if (cls == null ||
-                (indexedReadMethodName == null && indexedReadMethodRef == null)) {
+                (indexedReadMethodName == null && !this.indexedReadMethodRef.isSet())) {
                 // the Indexed readMethod was explicitly set to null.
                 return null;
             }
@@ -215,20 +215,19 @@
 
         // the indexed property type is set by the reader.
         setIndexedPropertyType(findIndexedPropertyType(readMethod,
-                                                       getIndexedWriteMethod0()));
+                                                       this.indexedWriteMethodRef.get()));
         setIndexedReadMethod0(readMethod);
     }
 
     private void setIndexedReadMethod0(Method readMethod) {
+        this.indexedReadMethodRef.set(readMethod);
         if (readMethod == null) {
             indexedReadMethodName = null;
-            indexedReadMethodRef = null;
             return;
         }
         setClass0(readMethod.getDeclaringClass());
 
         indexedReadMethodName = readMethod.getName();
-        this.indexedReadMethodRef = getSoftReference(readMethod);
         setTransient(readMethod.getAnnotation(Transient.class));
     }
 
@@ -241,11 +240,11 @@
      * May return null if the property isn't indexed or is read-only.
      */
     public synchronized Method getIndexedWriteMethod() {
-        Method indexedWriteMethod = getIndexedWriteMethod0();
+        Method indexedWriteMethod = this.indexedWriteMethodRef.get();
         if (indexedWriteMethod == null) {
             Class<?> cls = getClass0();
             if (cls == null ||
-                (indexedWriteMethodName == null && indexedWriteMethodRef == null)) {
+                (indexedWriteMethodName == null && !this.indexedWriteMethodRef.isSet())) {
                 // the Indexed writeMethod was explicitly set to null.
                 return null;
             }
@@ -301,15 +300,14 @@
     }
 
     private void setIndexedWriteMethod0(Method writeMethod) {
+        this.indexedWriteMethodRef.set(writeMethod);
         if (writeMethod == null) {
             indexedWriteMethodName = null;
-            indexedWriteMethodRef = null;
             return;
         }
         setClass0(writeMethod.getDeclaringClass());
 
         indexedWriteMethodName = writeMethod.getName();
-        this.indexedWriteMethodRef = getSoftReference(writeMethod);
         setTransient(writeMethod.getAnnotation(Transient.class));
     }
 
@@ -349,18 +347,6 @@
                 : null;
     }
 
-    private Method getIndexedReadMethod0() {
-        return (this.indexedReadMethodRef != null)
-                ? this.indexedReadMethodRef.get()
-                : null;
-    }
-
-    private Method getIndexedWriteMethod0() {
-        return (this.indexedWriteMethodRef != null)
-                ? this.indexedWriteMethodRef.get()
-                : null;
-    }
-
     private Class<?> findIndexedPropertyType(Method indexedReadMethod,
                                           Method indexedWriteMethod)
         throws IntrospectionException {
@@ -492,8 +478,8 @@
      */
     IndexedPropertyDescriptor(IndexedPropertyDescriptor old) {
         super(old);
-        indexedReadMethodRef = old.indexedReadMethodRef;
-        indexedWriteMethodRef = old.indexedWriteMethodRef;
+        this.indexedReadMethodRef.set(old.indexedReadMethodRef.get());
+        this.indexedWriteMethodRef.set(old.indexedWriteMethodRef.get());
         indexedPropertyTypeRef = old.indexedPropertyTypeRef;
         indexedWriteMethodName = old.indexedWriteMethodName;
         indexedReadMethodName = old.indexedReadMethodName;
@@ -502,7 +488,7 @@
     void updateGenericsFor(Class<?> type) {
         super.updateGenericsFor(type);
         try {
-            setIndexedPropertyType(findIndexedPropertyType(getIndexedReadMethod0(), getIndexedWriteMethod0()));
+            setIndexedPropertyType(findIndexedPropertyType(this.indexedReadMethodRef.get(), this.indexedWriteMethodRef.get()));
         }
         catch (IntrospectionException exception) {
             setIndexedPropertyType(null);
@@ -532,7 +518,7 @@
     void appendTo(StringBuilder sb) {
         super.appendTo(sb);
         appendTo(sb, "indexedPropertyType", this.indexedPropertyTypeRef);
-        appendTo(sb, "indexedReadMethod", this.indexedReadMethodRef);
-        appendTo(sb, "indexedWriteMethod", this.indexedWriteMethodRef);
+        appendTo(sb, "indexedReadMethod", this.indexedReadMethodRef.get());
+        appendTo(sb, "indexedWriteMethod", this.indexedWriteMethodRef.get());
     }
 }
--- a/jdk/src/share/classes/java/beans/MethodDescriptor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,7 +38,7 @@
 
 public class MethodDescriptor extends FeatureDescriptor {
 
-    private Reference<Method> methodRef;
+    private final MethodRef methodRef = new MethodRef();
 
     private String[] paramNames;
 
@@ -81,7 +81,7 @@
      * @return The low-level description of the method
      */
     public synchronized Method getMethod() {
-        Method method = getMethod0();
+        Method method = this.methodRef.get();
         if (method == null) {
             Class<?> cls = getClass0();
             String name = getName();
@@ -114,13 +114,7 @@
             setClass0(method.getDeclaringClass());
         }
         setParams(getParameterTypes(getClass0(), method));
-        this.methodRef = getSoftReference(method);
-    }
-
-    private Method getMethod0() {
-        return (this.methodRef != null)
-                ? this.methodRef.get()
-                : null;
+        this.methodRef.set(method);
     }
 
     private synchronized void setParams(Class<?>[] param) {
@@ -177,12 +171,10 @@
      */
 
     MethodDescriptor(MethodDescriptor x, MethodDescriptor y) {
-        super(x,y);
+        super(x, y);
 
-        methodRef = x.methodRef;
-        if (y.methodRef != null) {
-            methodRef = y.methodRef;
-        }
+        Method method = y.methodRef.get();
+        this.methodRef.set(null != method ? method : x.methodRef.get());
         params = x.params;
         if (y.params != null) {
             params = y.params;
@@ -205,7 +197,7 @@
     MethodDescriptor(MethodDescriptor old) {
         super(old);
 
-        methodRef = old.methodRef;
+        this.methodRef.set(old.getMethod());
         params = old.params;
         paramNames = old.paramNames;
 
@@ -219,7 +211,7 @@
     }
 
     void appendTo(StringBuilder sb) {
-        appendTo(sb, "method", this.methodRef);
+        appendTo(sb, "method", this.methodRef.get());
         if (this.parameterDescriptors != null) {
             sb.append("; parameterDescriptors={");
             for (ParameterDescriptor pd : this.parameterDescriptors) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/beans/MethodRef.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,87 @@
+/*
+ * 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 java.beans;
+
+import java.lang.ref.SoftReference;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Method;
+
+import static sun.reflect.misc.ReflectUtil.isPackageAccessible;
+
+final class MethodRef {
+    private String signature;
+    private SoftReference<Method> methodRef;
+    private WeakReference<Class<?>> typeRef;
+
+    void set(Method method) {
+        if (method == null) {
+            this.signature = null;
+            this.methodRef = null;
+            this.typeRef = null;
+        }
+        else {
+            this.signature = method.toGenericString();
+            this.methodRef = new SoftReference<>(method);
+            this.typeRef = new WeakReference<Class<?>>(method.getDeclaringClass());
+        }
+    }
+
+    boolean isSet() {
+        return this.methodRef != null;
+    }
+
+    Method get() {
+        if (this.methodRef == null) {
+            return null;
+        }
+        Method method = this.methodRef.get();
+        if (method == null) {
+            method = find(this.typeRef.get(), this.signature);
+            if (method == null) {
+                this.signature = null;
+                this.methodRef = null;
+                this.typeRef = null;
+            }
+            else {
+                this.methodRef = new SoftReference<>(method);
+            }
+        }
+        return isPackageAccessible(method.getDeclaringClass()) ? method : null;
+    }
+
+    private static Method find(Class<?> type, String signature) {
+        if (type != null) {
+            for (Method method : type.getMethods()) {
+                if (type.equals(method.getDeclaringClass())) {
+                    if (method.toGenericString().equals(signature)) {
+                        return method;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+}
--- a/jdk/src/share/classes/java/beans/PersistenceDelegate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/beans/PersistenceDelegate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -162,6 +162,7 @@
      * @return An expression whose value is <code>oldInstance</code>.
      *
      * @throws NullPointerException if {@code out} is {@code null}
+     *                              and this value is used in the method
      */
     protected abstract Expression instantiate(Object oldInstance, Encoder out);
 
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,8 +36,8 @@
 public class PropertyDescriptor extends FeatureDescriptor {
 
     private Reference<? extends Class<?>> propertyTypeRef;
-    private Reference<Method> readMethodRef;
-    private Reference<Method> writeMethodRef;
+    private final MethodRef readMethodRef = new MethodRef();
+    private final MethodRef writeMethodRef = new MethodRef();
     private Reference<? extends Class<?>> propertyEditorClassRef;
 
     private boolean bound;
@@ -68,8 +68,8 @@
     public PropertyDescriptor(String propertyName, Class<?> beanClass)
                 throws IntrospectionException {
         this(propertyName, beanClass,
-             Introspector.IS_PREFIX + NameGenerator.capitalize(propertyName),
-             Introspector.SET_PREFIX + NameGenerator.capitalize(propertyName));
+                Introspector.IS_PREFIX + NameGenerator.capitalize(propertyName),
+                Introspector.SET_PREFIX + NameGenerator.capitalize(propertyName));
     }
 
     /**
@@ -203,10 +203,10 @@
      * May return null if the property can't be read.
      */
     public synchronized Method getReadMethod() {
-        Method readMethod = getReadMethod0();
+        Method readMethod = this.readMethodRef.get();
         if (readMethod == null) {
             Class<?> cls = getClass0();
-            if (cls == null || (readMethodName == null && readMethodRef == null)) {
+            if (cls == null || (readMethodName == null && !this.readMethodRef.isSet())) {
                 // The read method was explicitly set to null.
                 return null;
             }
@@ -247,17 +247,16 @@
      */
     public synchronized void setReadMethod(Method readMethod)
                                 throws IntrospectionException {
+        this.readMethodRef.set(readMethod);
         if (readMethod == null) {
             readMethodName = null;
-            readMethodRef = null;
             return;
         }
         // The property type is determined by the read method.
-        setPropertyType(findPropertyType(readMethod, getWriteMethod0()));
+        setPropertyType(findPropertyType(readMethod, this.writeMethodRef.get()));
         setClass0(readMethod.getDeclaringClass());
 
         readMethodName = readMethod.getName();
-        this.readMethodRef = getSoftReference(readMethod);
         setTransient(readMethod.getAnnotation(Transient.class));
     }
 
@@ -268,10 +267,10 @@
      * May return null if the property can't be written.
      */
     public synchronized Method getWriteMethod() {
-        Method writeMethod = getWriteMethod0();
+        Method writeMethod = this.writeMethodRef.get();
         if (writeMethod == null) {
             Class<?> cls = getClass0();
-            if (cls == null || (writeMethodName == null && writeMethodRef == null)) {
+            if (cls == null || (writeMethodName == null && !this.writeMethodRef.isSet())) {
                 // The write method was explicitly set to null.
                 return null;
             }
@@ -318,9 +317,9 @@
      */
     public synchronized void setWriteMethod(Method writeMethod)
                                 throws IntrospectionException {
+        this.writeMethodRef.set(writeMethod);
         if (writeMethod == null) {
             writeMethodName = null;
-            writeMethodRef = null;
             return;
         }
         // Set the property type - which validates the method
@@ -328,22 +327,9 @@
         setClass0(writeMethod.getDeclaringClass());
 
         writeMethodName = writeMethod.getName();
-        this.writeMethodRef = getSoftReference(writeMethod);
         setTransient(writeMethod.getAnnotation(Transient.class));
     }
 
-    private Method getReadMethod0() {
-        return (this.readMethodRef != null)
-                ? this.readMethodRef.get()
-                : null;
-    }
-
-    private Method getWriteMethod0() {
-        return (this.writeMethodRef != null)
-                ? this.writeMethodRef.get()
-                : null;
-    }
-
     /**
      * Overridden to ensure that a super class doesn't take precedent
      */
@@ -617,8 +603,8 @@
     PropertyDescriptor(PropertyDescriptor old) {
         super(old);
         propertyTypeRef = old.propertyTypeRef;
-        readMethodRef = old.readMethodRef;
-        writeMethodRef = old.writeMethodRef;
+        this.readMethodRef.set(old.readMethodRef.get());
+        this.writeMethodRef.set(old.writeMethodRef.get());
         propertyEditorClassRef = old.propertyEditorClassRef;
 
         writeMethodName = old.writeMethodName;
@@ -632,7 +618,7 @@
     void updateGenericsFor(Class<?> type) {
         setClass0(type);
         try {
-            setPropertyType(findPropertyType(getReadMethod0(), getWriteMethod0()));
+            setPropertyType(findPropertyType(this.readMethodRef.get(), this.writeMethodRef.get()));
         }
         catch (IntrospectionException exception) {
             setPropertyType(null);
@@ -723,8 +709,8 @@
         appendTo(sb, "constrained", this.constrained);
         appendTo(sb, "propertyEditorClass", this.propertyEditorClassRef);
         appendTo(sb, "propertyType", this.propertyTypeRef);
-        appendTo(sb, "readMethod", this.readMethodRef);
-        appendTo(sb, "writeMethod", this.writeMethodRef);
+        appendTo(sb, "readMethod", this.readMethodRef.get());
+        appendTo(sb, "writeMethod", this.writeMethodRef.get());
     }
 
     private boolean isAssignable(Method m1, Method m2) {
--- a/jdk/src/share/classes/java/beans/ThreadGroupContext.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/beans/ThreadGroupContext.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,24 +41,20 @@
  */
 final class ThreadGroupContext {
 
-    private static final WeakIdentityMap<ThreadGroupContext> contexts = new WeakIdentityMap<>();
+    private static final WeakIdentityMap<ThreadGroupContext> contexts = new WeakIdentityMap<ThreadGroupContext>() {
+        protected ThreadGroupContext create(Object key) {
+            return new ThreadGroupContext();
+        }
+    };
 
     /**
-     * Returns the appropriate {@code AppContext} for the caller,
+     * Returns the appropriate {@code ThreadGroupContext} for the caller,
      * as determined by its {@code ThreadGroup}.
      *
      * @return  the application-dependent context
      */
     static ThreadGroupContext getContext() {
-        ThreadGroup group = Thread.currentThread().getThreadGroup();
-        synchronized (contexts) {
-            ThreadGroupContext context = contexts.get(group);
-            if (context == null) {
-                context = new ThreadGroupContext();
-                contexts.put(group, context);
-            }
-            return context;
-        }
+        return contexts.get(Thread.currentThread().getThreadGroup());
     }
 
     private volatile boolean isDesignTime;
--- a/jdk/src/share/classes/java/beans/WeakIdentityMap.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/beans/WeakIdentityMap.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,18 +33,22 @@
  * and reference-equality in place of object-equality to compare them.
  * An entry will automatically be removed when its key is no longer
  * in ordinary use.  Both null values and the null key are supported.
+ * This class does not require additional synchronization.
+ * A thread-safety is provided by a fragile combination
+ * of synchronized blocks and volatile fields.
+ * Be very careful during editing!
  *
  * @see java.util.IdentityHashMap
  * @see java.util.WeakHashMap
  */
-final class WeakIdentityMap<T> {
+abstract class WeakIdentityMap<T> {
 
     private static final int MAXIMUM_CAPACITY = 1 << 30; // it MUST be a power of two
     private static final Object NULL = new Object(); // special object for null key
 
     private final ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
 
-    private Entry<T>[] table = newTable(1<<3); // table's length MUST be a power of two
+    private volatile Entry<T>[] table = newTable(1<<3); // table's length MUST be a power of two
     private int threshold = 6; // the next size value at which to resize
     private int size = 0; // the number of key-value mappings
 
@@ -54,78 +58,83 @@
             key = NULL;
         }
         int hash = key.hashCode();
-        int index = getIndex(this.table, hash);
-        for (Entry<T> entry = this.table[index]; entry != null; entry = entry.next) {
+        Entry<T>[] table = this.table;
+        // unsynchronized search improves performance
+        // the null value does not mean that there are no needed entry
+        int index = getIndex(table, hash);
+        for (Entry<T> entry = table[index]; entry != null; entry = entry.next) {
             if (entry.isMatched(key, hash)) {
                 return entry.value;
             }
         }
-        return null;
+        synchronized (NULL) {
+            // synchronized search improves stability
+            // we must create and add new value if there are no needed entry
+            index = getIndex(this.table, hash);
+            for (Entry<T> entry = this.table[index]; entry != null; entry = entry.next) {
+                if (entry.isMatched(key, hash)) {
+                    return entry.value;
+                }
+            }
+            T value = create(key);
+            this.table[index] = new Entry<T>(key, hash, value, this.queue, this.table[index]);
+            if (++this.size >= this.threshold) {
+                if (this.table.length == MAXIMUM_CAPACITY) {
+                    this.threshold = Integer.MAX_VALUE;
+                }
+                else {
+                    removeStaleEntries();
+                    table = newTable(this.table.length * 2);
+                    transfer(this.table, table);
+                    // If ignoring null elements and processing ref queue caused massive
+                    // shrinkage, then restore old table.  This should be rare, but avoids
+                    // unbounded expansion of garbage-filled tables.
+                    if (this.size >= this.threshold / 2) {
+                        this.table = table;
+                        this.threshold *= 2;
+                    }
+                    else {
+                        transfer(table, this.table);
+                    }
+                }
+            }
+            return value;
+        }
     }
 
-    public T put(Object key, T value) {
-        removeStaleEntries();
-        if (key == null) {
-            key = NULL;
-        }
-        int hash = key.hashCode();
-        int index = getIndex(this.table, hash);
-        for (Entry<T> entry = this.table[index]; entry != null; entry = entry.next) {
-            if (entry.isMatched(key, hash)) {
-                T oldValue = entry.value;
-                entry.value = value;
-                return oldValue;
-            }
-        }
-        this.table[index] = new Entry<T>(key, hash, value, this.queue, this.table[index]);
-        if (++this.size >= this.threshold) {
-            if (this.table.length == MAXIMUM_CAPACITY) {
-                this.threshold = Integer.MAX_VALUE;
-            }
-            else {
-                removeStaleEntries();
-                Entry<T>[] table = newTable(this.table.length * 2);
-                transfer(this.table, table);
-
-                // If ignoring null elements and processing ref queue caused massive
-                // shrinkage, then restore old table.  This should be rare, but avoids
-                // unbounded expansion of garbage-filled tables.
-                if (this.size >= this.threshold / 2) {
-                    this.table = table;
-                    this.threshold *= 2;
-                }
-                else {
-                    transfer(table, this.table);
-                }
-            }
-        }
-        return null;
-    }
+    protected abstract T create(Object key);
 
     private void removeStaleEntries() {
-        for (Object ref = this.queue.poll(); ref != null; ref = this.queue.poll()) {
-            @SuppressWarnings("unchecked")
-            Entry<T> entry = (Entry<T>) ref;
-            int index = getIndex(this.table, entry.hash);
+        Object ref = this.queue.poll();
+        if (ref != null) {
+            synchronized (NULL) {
+                do {
+                    @SuppressWarnings("unchecked")
+                    Entry<T> entry = (Entry<T>) ref;
+                    int index = getIndex(this.table, entry.hash);
 
-            Entry<T> prev = this.table[index];
-            Entry<T> current = prev;
-            while (current != null) {
-                Entry<T> next = current.next;
-                if (current == entry) {
-                    if (prev == entry) {
-                        this.table[index] = next;
+                    Entry<T> prev = this.table[index];
+                    Entry<T> current = prev;
+                    while (current != null) {
+                        Entry<T> next = current.next;
+                        if (current == entry) {
+                            if (prev == entry) {
+                                this.table[index] = next;
+                            }
+                            else {
+                                prev.next = next;
+                            }
+                            entry.value = null; // Help GC
+                            entry.next = null; // Help GC
+                            this.size--;
+                            break;
+                        }
+                        prev = current;
+                        current = next;
                     }
-                    else {
-                        prev.next = next;
-                    }
-                    entry.value = null; // Help GC
-                    entry.next = null; // Help GC
-                    this.size--;
-                    break;
+                    ref = this.queue.poll();
                 }
-                prev = current;
-                current = next;
+                while (ref != null);
             }
         }
     }
@@ -164,8 +173,8 @@
 
     private static class Entry<T> extends WeakReference<Object> {
         private final int hash;
-        private T value;
-        private Entry<T> next;
+        private volatile T value;
+        private volatile Entry<T> next;
 
         Entry(Object key, int hash, T value, ReferenceQueue<Object> queue, Entry<T> next) {
             super(key, queue);
--- a/jdk/src/share/classes/java/lang/instrument/Instrumentation.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/instrument/Instrumentation.java	Fri Oct 11 09:17:18 2013 -0400
@@ -381,6 +381,7 @@
      *
      * @return an array containing all the classes loaded by the JVM, zero-length if there are none
      */
+    @SuppressWarnings("rawtypes")
     Class[]
     getAllLoadedClasses();
 
@@ -393,6 +394,7 @@
      * @return an array containing all the classes for which loader is an initiating loader,
      *          zero-length if there are none
      */
+    @SuppressWarnings("rawtypes")
     Class[]
     getInitiatedClasses(ClassLoader loader);
 
--- a/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Fri Oct 11 09:17:18 2013 -0400
@@ -360,6 +360,10 @@
             return new Name(mh, mhName);
         }
 
+        NamedFunction getterFunction(int i) {
+            return new NamedFunction(getters[i]);
+        }
+
         static final SpeciesData EMPTY = new SpeciesData("", BoundMethodHandle.class);
 
         private SpeciesData(String types, Class<? extends BoundMethodHandle> clazz) {
@@ -394,6 +398,7 @@
         private boolean isPlaceholder() { return clazz == null; }
 
         private static final HashMap<String, SpeciesData> CACHE = new HashMap<>();
+        static { CACHE.put("", EMPTY); }  // make bootstrap predictable
         private static final boolean INIT_DONE;  // set after <clinit> finishes...
 
         SpeciesData extendWithType(char type) {
@@ -524,18 +529,18 @@
          * A concrete BMH species adheres to the following schema:
          *
          * <pre>
-         * class Species_<<types>> extends BoundMethodHandle {
-         *     <<fields>>
-         *     final SpeciesData speciesData() { return SpeciesData.get("<<types>>"); }
+         * class Species_[[types]] extends BoundMethodHandle {
+         *     [[fields]]
+         *     final SpeciesData speciesData() { return SpeciesData.get("[[types]]"); }
          * }
          * </pre>
          *
-         * The {@code <<types>>} signature is precisely the string that is passed to this
+         * The {@code [[types]]} signature is precisely the string that is passed to this
          * method.
          *
-         * The {@code <<fields>>} section consists of one field definition per character in
+         * The {@code [[fields]]} section consists of one field definition per character in
          * the type signature, adhering to the naming schema described in the definition of
-         * {@link #makeFieldName()}.
+         * {@link #makeFieldName}.
          *
          * For example, a concrete BMH species for two reference and one integral bound values
          * would have the following shape:
@@ -817,7 +822,7 @@
          * {@code <init>}. To avoid this, we add an indirection by invoking {@code <init>} through
          * {@link MethodHandle#linkToSpecial}.
          *
-         * The last {@link LambdaForm#Name Name} in the argument's form is expected to be the {@code void}
+         * The last {@link LambdaForm.Name Name} in the argument's form is expected to be the {@code void}
          * result of the {@code <init>} invocation. This entry is replaced.
          */
         private static MethodHandle linkConstructor(MethodHandle cmh) {
--- a/jdk/src/share/classes/java/lang/invoke/CallSite.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/CallSite.java	Fri Oct 11 09:17:18 2013 -0400
@@ -60,7 +60,7 @@
  * <p>
  * Here is a sample use of call sites and bootstrap methods which links every
  * dynamic call site to print its arguments:
-<blockquote><pre><!-- see indy-demo/src/PrintArgsDemo.java -->
+<blockquote><pre>{@code
 static void test() throws Throwable {
     // THE FOLLOWING LINE IS PSEUDOCODE FOR A JVM INSTRUCTION
     InvokeDynamic[#bootstrapDynamic].baz("baz arg", 2, 3.14);
@@ -79,7 +79,7 @@
   // ignore caller and name, but match the type:
   return new ConstantCallSite(printArgs.asType(type));
 }
-</pre></blockquote>
+}</pre></blockquote>
  * @author John Rose, JSR 292 EG
  */
 abstract
@@ -199,12 +199,12 @@
      * which has been linked to this call site.
      * <p>
      * This method is equivalent to the following code:
-     * <blockquote><pre>
+     * <blockquote><pre>{@code
      * MethodHandle getTarget, invoker, result;
      * getTarget = MethodHandles.publicLookup().bind(this, "getTarget", MethodType.methodType(MethodHandle.class));
      * invoker = MethodHandles.exactInvoker(this.type());
      * result = MethodHandles.foldArguments(invoker, getTarget)
-     * </pre></blockquote>
+     * }</pre></blockquote>
      *
      * @return a method handle which always invokes this call site's current target
      */
@@ -261,7 +261,7 @@
                              Object info,
                              // Caller information:
                              Class<?> callerClass) {
-        Object caller = IMPL_LOOKUP.in(callerClass);
+        MethodHandles.Lookup caller = IMPL_LOOKUP.in(callerClass);
         CallSite site;
         try {
             Object binding;
@@ -273,14 +273,44 @@
             } else {
                 Object[] argv = (Object[]) info;
                 maybeReBoxElements(argv);
-                if (3 + argv.length > 255)
-                    throw new BootstrapMethodError("too many bootstrap method arguments");
-                MethodType bsmType = bootstrapMethod.type();
-                if (bsmType.parameterCount() == 4 && bsmType.parameterType(3) == Object[].class)
-                    binding = bootstrapMethod.invoke(caller, name, type, argv);
-                else
-                    binding = MethodHandles.spreadInvoker(bsmType, 3)
-                        .invoke(bootstrapMethod, caller, name, type, argv);
+                switch (argv.length) {
+                case 0:
+                    binding = bootstrapMethod.invoke(caller, name, type);
+                    break;
+                case 1:
+                    binding = bootstrapMethod.invoke(caller, name, type,
+                                                     argv[0]);
+                    break;
+                case 2:
+                    binding = bootstrapMethod.invoke(caller, name, type,
+                                                     argv[0], argv[1]);
+                    break;
+                case 3:
+                    binding = bootstrapMethod.invoke(caller, name, type,
+                                                     argv[0], argv[1], argv[2]);
+                    break;
+                case 4:
+                    binding = bootstrapMethod.invoke(caller, name, type,
+                                                     argv[0], argv[1], argv[2], argv[3]);
+                    break;
+                case 5:
+                    binding = bootstrapMethod.invoke(caller, name, type,
+                                                     argv[0], argv[1], argv[2], argv[3], argv[4]);
+                    break;
+                case 6:
+                    binding = bootstrapMethod.invoke(caller, name, type,
+                                                     argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
+                    break;
+                default:
+                    final int NON_SPREAD_ARG_COUNT = 3;  // (caller, name, type)
+                    if (NON_SPREAD_ARG_COUNT + argv.length > MethodType.MAX_MH_ARITY)
+                        throw new BootstrapMethodError("too many bootstrap method arguments");
+                    MethodType bsmType = bootstrapMethod.type();
+                    MethodType invocationType = MethodType.genericMethodType(NON_SPREAD_ARG_COUNT + argv.length);
+                    MethodHandle typedBSM = bootstrapMethod.asType(invocationType);
+                    MethodHandle spreader = invocationType.invokers().spreadInvoker(NON_SPREAD_ARG_COUNT);
+                    binding = spreader.invokeExact(typedBSM, (Object)caller, (Object)name, (Object)type, argv);
+                }
             }
             //System.out.println("BSM for "+name+type+" => "+binding);
             if (binding instanceof CallSite) {
--- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Fri Oct 11 09:17:18 2013 -0400
@@ -27,12 +27,15 @@
 
 import jdk.internal.org.objectweb.asm.*;
 import sun.misc.Unsafe;
+import sun.security.action.GetPropertyAction;
 
+import java.io.FilePermission;
 import java.lang.reflect.Constructor;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.PropertyPermission;
 
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
 
@@ -66,12 +69,23 @@
     // Used to ensure that each spun class name is unique
     private static final AtomicInteger counter = new AtomicInteger(0);
 
+    // For dumping generated classes to disk, for debugging purposes
+    private static final ProxyClassesDumper dumper;
+
+    static {
+        final String key = "jdk.internal.lambda.dumpProxyClasses";
+        String path = AccessController.doPrivileged(
+                new GetPropertyAction(key), null,
+                new PropertyPermission(key , "read"));
+        dumper = (null == path) ? null : ProxyClassesDumper.getInstance(path);
+    }
+
     // See context values in AbstractValidatingLambdaMetafactory
     private final String implMethodClassName;        // Name of type containing implementation "CC"
     private final String implMethodName;             // Name of implementation method "impl"
     private final String implMethodDesc;             // Type descriptor for implementation methods "(I)Ljava/lang/String;"
-    private final Type[] implMethodArgumentTypes;    // ASM types for implementaion method parameters
-    private final Type implMethodReturnType;         // ASM type for implementaion method return type "Ljava/lang/String;"
+    private final Type[] implMethodArgumentTypes;    // ASM types for implementation method parameters
+    private final Type implMethodReturnType;         // ASM type for implementation method return type "Ljava/lang/String;"
     private final MethodType constructorType;        // Generated class constructor type "(CC)void"
     private final String constructorDesc;            // Type descriptor for constructor "(LCC;)V"
     private final ClassWriter cw;                    // ASM class writer
@@ -259,29 +273,31 @@
 
         final byte[] classBytes = cw.toByteArray();
 
-        /*** Uncomment to dump the generated file
-            System.out.printf("Loaded: %s (%d bytes) %n", lambdaClassName,
-                              classBytes.length);
-            try (FileOutputStream fos = new FileOutputStream(lambdaClassName
-                                            .replace('/', '.') + ".class")) {
-                fos.write(classBytes);
-            } catch (IOException ex) {
-                PlatformLogger.getLogger(InnerClassLambdaMetafactory.class
-                                      .getName()).severe(ex.getMessage(), ex);
-            }
-        ***/
+        // If requested, dump out to a file for debugging purposes
+        if (dumper != null) {
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                @Override
+                public Void run() {
+                    dumper.dumpClass(lambdaClassName, classBytes);
+                    return null;
+                }
+            }, null,
+            new FilePermission("<<ALL FILES>>", "read, write"),
+            // createDirectories may need it
+            new PropertyPermission("user.dir", "read"));
+        }
 
         ClassLoader loader = targetClass.getClassLoader();
         ProtectionDomain pd = (loader == null)
-            ? null
-            : AccessController.doPrivileged(
-            new PrivilegedAction<ProtectionDomain>() {
-                @Override
-                public ProtectionDomain run() {
-                    return targetClass.getProtectionDomain();
-                }
-            }
-        );
+                              ? null
+                              : AccessController.doPrivileged(
+                                      new PrivilegedAction<ProtectionDomain>() {
+                                          @Override
+                                          public ProtectionDomain run() {
+                                              return targetClass.getProtectionDomain();
+                                          }
+                                      }
+                              );
 
         return UNSAFE.defineClass(lambdaClassName,
                                   classBytes, 0, classBytes.length,
--- a/jdk/src/share/classes/java/lang/invoke/InvokeGeneric.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.lang.invoke;
-
-import sun.invoke.util.*;
-import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
-
-/**
- * Adapters which manage inexact MethodHandle.invoke calls.
- * The JVM calls one of these when the exact type match fails.
- * @author jrose
- */
-class InvokeGeneric {
-    // erased type for the call, which originates from an inexact invoke site
-    private final MethodType erasedCallerType;
-    // an invoker of type (MT, MH; A...) -> R
-    private final MethodHandle initialInvoker;
-
-    /** Compute and cache information for this adapter, so that it can
-     *  call out to targets of the erasure-family of the given erased type.
-     */
-    /*non-public*/ InvokeGeneric(MethodType erasedCallerType) throws ReflectiveOperationException {
-        assert(erasedCallerType.equals(erasedCallerType.erase()));
-        this.erasedCallerType = erasedCallerType;
-        this.initialInvoker = makeInitialInvoker();
-        assert initialInvoker.type().equals(erasedCallerType
-                                            .insertParameterTypes(0, MethodType.class, MethodHandle.class))
-            : initialInvoker.type();
-    }
-
-    private static MethodHandles.Lookup lookup() {
-        return IMPL_LOOKUP;
-    }
-
-    /** Return the adapter information for this type's erasure. */
-    /*non-public*/ static MethodHandle generalInvokerOf(MethodType erasedCallerType) throws ReflectiveOperationException {
-        InvokeGeneric gen = new InvokeGeneric(erasedCallerType);
-        return gen.initialInvoker;
-    }
-
-    private MethodHandle makeInitialInvoker() throws ReflectiveOperationException {
-        // postDispatch = #(MH'; MT, MH; A...){MH'(MT, MH; A)}
-        MethodHandle postDispatch = makePostDispatchInvoker();
-        MethodHandle invoker;
-        if (returnConversionPossible()) {
-            invoker = MethodHandles.foldArguments(postDispatch,
-                                                  dispatcher("dispatchWithConversion"));
-        } else {
-            invoker = MethodHandles.foldArguments(postDispatch, dispatcher("dispatch"));
-        }
-        return invoker;
-    }
-
-    private static final Class<?>[] EXTRA_ARGS = { MethodType.class, MethodHandle.class };
-    private MethodHandle makePostDispatchInvoker() {
-        // Take (MH'; MT, MH; A...) and run MH'(MT, MH; A...).
-        MethodType invokerType = erasedCallerType.insertParameterTypes(0, EXTRA_ARGS);
-        return invokerType.invokers().exactInvoker();
-    }
-    private MethodHandle dropDispatchArguments(MethodHandle targetInvoker) {
-        assert(targetInvoker.type().parameterType(0) == MethodHandle.class);
-        return MethodHandles.dropArguments(targetInvoker, 1, EXTRA_ARGS);
-    }
-
-    private MethodHandle dispatcher(String dispatchName) throws ReflectiveOperationException {
-        return lookup().bind(this, dispatchName,
-                             MethodType.methodType(MethodHandle.class,
-                                                   MethodType.class, MethodHandle.class));
-    }
-
-    static final boolean USE_AS_TYPE_PATH = true;
-
-    /** Return a method handle to invoke on the callerType, target, and remaining arguments.
-     *  The method handle must finish the call.
-     *  This is the first look at the caller type and target.
-     */
-    private MethodHandle dispatch(MethodType callerType, MethodHandle target) {
-        MethodType targetType = target.type();
-        if (USE_AS_TYPE_PATH || target.isVarargsCollector()) {
-            MethodHandle newTarget = target.asType(callerType);
-            targetType = callerType;
-            Invokers invokers = targetType.invokers();
-            MethodHandle invoker = invokers.erasedInvokerWithDrops;
-            if (invoker == null) {
-                invokers.erasedInvokerWithDrops = invoker =
-                    dropDispatchArguments(invokers.erasedInvoker());
-            }
-            return invoker.bindTo(newTarget);
-        }
-        throw new RuntimeException("NYI");
-    }
-
-    private MethodHandle dispatchWithConversion(MethodType callerType, MethodHandle target) {
-        MethodHandle finisher = dispatch(callerType, target);
-        if (returnConversionNeeded(callerType, target))
-            finisher = addReturnConversion(finisher, callerType.returnType());  //FIXME: slow
-        return finisher;
-    }
-
-    private boolean returnConversionPossible() {
-        Class<?> needType = erasedCallerType.returnType();
-        return !needType.isPrimitive();
-    }
-    private boolean returnConversionNeeded(MethodType callerType, MethodHandle target) {
-        Class<?> needType = callerType.returnType();
-        if (needType == erasedCallerType.returnType())
-            return false;  // no conversions possible, since must be primitive or Object
-        Class<?> haveType = target.type().returnType();
-        if (VerifyType.isNullConversion(haveType, needType) && !needType.isInterface())
-            return false;
-        return true;
-    }
-    private MethodHandle addReturnConversion(MethodHandle finisher, Class<?> type) {
-        // FIXME: This is slow because it creates a closure node on every call that requires a return cast.
-        MethodType finisherType = finisher.type();
-        MethodHandle caster = ValueConversions.identity(type);
-        caster = caster.asType(caster.type().changeParameterType(0, finisherType.returnType()));
-        finisher = MethodHandles.filterReturnValue(finisher, caster);
-        return finisher.asType(finisherType);
-    }
-
-    public String toString() {
-        return "InvokeGeneric"+erasedCallerType;
-    }
-}
--- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -242,9 +242,6 @@
 
     /**
      * Extract the MemberName of a newly-defined method.
-     *
-     * @param classFile
-     * @return
      */
     private MemberName loadMethod(byte[] classFile) {
         Class<?> invokerClass = loadAndInitializeInvokerClass(classFile, cpPatches(classFile));
@@ -253,10 +250,6 @@
 
     /**
      * Define a given class as anonymous class in the runtime system.
-     *
-     * @param classBytes
-     * @param patches
-     * @return
      */
     private static Class<?> loadAndInitializeInvokerClass(byte[] classBytes, Object[] patches) {
         Class<?> invokerClass = UNSAFE.defineAnonymousClass(HOST_CLASS, classBytes, patches);
@@ -264,14 +257,6 @@
         return invokerClass;
     }
 
-    /**
-     * TODO
-     *
-     * @param invokerClass
-     * @param name
-     * @param type
-     * @return
-     */
     private static MemberName resolveInvokerMember(Class<?> invokerClass, String name, MethodType type) {
         MemberName member = new MemberName(invokerClass, name, type, REF_invokeStatic);
         //System.out.println("resolveInvokerMember => "+member);
@@ -499,10 +484,6 @@
 
     /**
      * Generate customized bytecode for a given LambdaForm.
-     *
-     * @param form
-     * @param invokerType
-     * @return
      */
     static MemberName generateCustomizedCode(LambdaForm form, MethodType invokerType) {
         InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("MH", form, invokerType);
@@ -565,8 +546,6 @@
 
     /**
      * Emit an invoke for the given name.
-     *
-     * @param name
      */
     void emitInvoke(Name name) {
         if (true) {
@@ -645,8 +624,6 @@
 
     /**
      * Emit an invoke for the given name, using the MemberName directly.
-     *
-     * @param name
      */
     void emitStaticInvoke(MemberName member, Name name) {
         assert(member.equals(name.function.member()));
@@ -690,9 +667,6 @@
 
     /**
      * Check if MemberName is a call to MethodHandleImpl.selectAlternative.
-     *
-     * @param member
-     * @return true if member is a call to MethodHandleImpl.selectAlternative
      */
     private boolean isSelectAlternative(MemberName member) {
         return member != null &&
@@ -704,14 +678,12 @@
      * Emit bytecode for the selectAlternative idiom.
      *
      * The pattern looks like (Cf. MethodHandleImpl.makeGuardWithTest):
-     *
+     * <blockquote><pre>{@code
      *   Lambda(a0:L,a1:I)=>{
      *     t2:I=foo.test(a1:I);
      *     t3:L=MethodHandleImpl.selectAlternative(t2:I,(MethodHandle(int)int),(MethodHandle(int)int));
      *     t4:I=MethodHandle.invokeBasic(t3:L,a1:I);t4:I}
-     *
-     * @param selectAlternativeName
-     * @param invokeBasicName
+     * }</pre></blockquote>
      */
     private void emitSelectAlternative(Name selectAlternativeName, Name invokeBasicName) {
         MethodType type = selectAlternativeName.function.methodType();
@@ -750,11 +722,6 @@
         mv.visitLabel(L_done);
     }
 
-    /**
-     *
-     * @param name
-     * @param paramIndex
-     */
     private void emitPushArgument(Name name, int paramIndex) {
         Object arg = name.arguments[paramIndex];
         char ptype = name.function.parameterType(paramIndex);
@@ -923,9 +890,6 @@
 
     /**
      * Generate bytecode for a LambdaForm.vmentry which calls interpretWithArguments.
-     *
-     * @param sig
-     * @return
      */
     static MemberName generateLambdaFormInterpreterEntryPoint(String sig) {
         assert(LambdaForm.isValidSignature(sig));
@@ -993,10 +957,6 @@
 
     /**
      * Generate bytecode for a NamedFunction invoker.
-     *
-     * @param srcType
-     * @param dstType
-     * @return
      */
     static MemberName generateNamedFunctionInvoker(MethodTypeForm typeForm) {
         MethodType invokerType = LambdaForm.NamedFunction.INVOKER_METHOD_TYPE;
--- a/jdk/src/share/classes/java/lang/invoke/Invokers.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/Invokers.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
 
     // exact invoker for the outgoing call
     private /*lazy*/ MethodHandle exactInvoker;
+    private /*lazy*/ MethodHandle basicInvoker;  // invokeBasic (unchecked exact)
 
     // erased (partially untyped but with primitives) invoker for the outgoing call
     // FIXME: get rid of
@@ -74,21 +75,7 @@
     /*non-public*/ MethodHandle exactInvoker() {
         MethodHandle invoker = exactInvoker;
         if (invoker != null)  return invoker;
-        MethodType mtype = targetType;
-        MethodType invokerType = mtype.invokerType();
-        LambdaForm lform;
-        final int MTYPE_ARG_APPENDED = 1;  // argument count for appended mtype value
-        if (mtype.parameterSlotCount() <= MethodType.MAX_MH_INVOKER_ARITY - MTYPE_ARG_APPENDED) {
-            lform = invokeForm(mtype, false, MethodTypeForm.LF_EX_INVOKER);
-            invoker = BoundMethodHandle.bindSingle(invokerType, lform, mtype);
-        } else {
-            // At maximum arity, we cannot afford an extra mtype argument,
-            // so build a fully customized (non-cached) invoker form.
-            lform = invokeForm(mtype, true, MethodTypeForm.LF_EX_INVOKER);
-            invoker = SimpleMethodHandle.make(invokerType, lform);
-        }
-        invoker = invoker.withInternalMemberName(MemberName.makeMethodHandleInvoke("invokeExact", mtype));
-        assert(checkInvoker(invoker));
+        invoker = makeExactOrGeneralInvoker(true);
         exactInvoker = invoker;
         return invoker;
     }
@@ -96,43 +83,56 @@
     /*non-public*/ MethodHandle generalInvoker() {
         MethodHandle invoker = generalInvoker;
         if (invoker != null)  return invoker;
-        MethodType mtype = targetType;
-        MethodType invokerType = mtype.invokerType();
-        LambdaForm lform;
-        final int MTYPE_ARG_APPENDED = 1;  // argument count for appended mtype value
-        assert(GENERIC_INVOKER_SLOP >= MTYPE_ARG_APPENDED);
-        if (mtype.parameterSlotCount() <= MethodType.MAX_MH_INVOKER_ARITY - GENERIC_INVOKER_SLOP) {
-            prepareForGenericCall(mtype);
-            lform = invokeForm(mtype, false, MethodTypeForm.LF_GEN_INVOKER);
-            invoker = BoundMethodHandle.bindSingle(invokerType, lform, mtype);
-        } else {
-            // At maximum arity, we cannot afford an extra mtype argument,
-            // so build a fully customized (non-cached) invoker form.
-            lform = invokeForm(mtype, true, MethodTypeForm.LF_GEN_INVOKER);
-            invoker = SimpleMethodHandle.make(invokerType, lform);
-        }
-        invoker = invoker.withInternalMemberName(MemberName.makeMethodHandleInvoke("invoke", mtype));
-        assert(checkInvoker(invoker));
+        invoker = makeExactOrGeneralInvoker(false);
         generalInvoker = invoker;
         return invoker;
     }
 
-    /*non-public*/ MethodHandle makeBasicInvoker() {
-        MethodHandle invoker = DirectMethodHandle.make(invokeBasicMethod(targetType));
-        assert(targetType == targetType.basicType());
-        // Note:  This is not cached here.  It is cached by the calling MethodTypeForm.
+    private MethodHandle makeExactOrGeneralInvoker(boolean isExact) {
+        MethodType mtype = targetType;
+        MethodType invokerType = mtype.invokerType();
+        int which = (isExact ? MethodTypeForm.LF_EX_INVOKER : MethodTypeForm.LF_GEN_INVOKER);
+        LambdaForm lform = invokeHandleForm(mtype, false, which);
+        MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, mtype);
+        String whichName = (isExact ? "invokeExact" : "invoke");
+        invoker = invoker.withInternalMemberName(MemberName.makeMethodHandleInvoke(whichName, mtype));
         assert(checkInvoker(invoker));
+        maybeCompileToBytecode(invoker);
         return invoker;
     }
 
-    static MemberName invokeBasicMethod(MethodType type) {
-        type = type.basicType();
-        String name = "invokeBasic";
+    /** If the target type seems to be common enough, eagerly compile the invoker to bytecodes. */
+    private void maybeCompileToBytecode(MethodHandle invoker) {
+        final int EAGER_COMPILE_ARITY_LIMIT = 10;
+        if (targetType == targetType.erase() &&
+            targetType.parameterCount() < EAGER_COMPILE_ARITY_LIMIT) {
+            invoker.form.compileToBytecode();
+        }
+    }
+
+    /*non-public*/ MethodHandle basicInvoker() {
+        MethodHandle invoker = basicInvoker;
+        if (invoker != null)  return invoker;
+        MethodType basicType = targetType.basicType();
+        if (basicType != targetType) {
+            // double cache; not used significantly
+            return basicInvoker = basicType.invokers().basicInvoker();
+        }
+        MemberName method = invokeBasicMethod(basicType);
+        invoker = DirectMethodHandle.make(method);
+        assert(checkInvoker(invoker));
+        basicInvoker = invoker;
+        return invoker;
+    }
+
+    // This next one is called from LambdaForm.NamedFunction.<init>.
+    /*non-public*/ static MemberName invokeBasicMethod(MethodType basicType) {
+        assert(basicType == basicType.basicType());
         try {
             //Lookup.findVirtual(MethodHandle.class, name, type);
-            return IMPL_LOOKUP.resolveOrFail(REF_invokeVirtual, MethodHandle.class, name, type);
+            return IMPL_LOOKUP.resolveOrFail(REF_invokeVirtual, MethodHandle.class, "invokeBasic", basicType);
         } catch (ReflectiveOperationException ex) {
-            throw newInternalError("JVM cannot find invoker for "+type, ex);
+            throw newInternalError("JVM cannot find invoker for "+basicType, ex);
         }
     }
 
@@ -184,6 +184,7 @@
             vaInvoker = MethodHandles.filterArgument(arrayInvoker, 0, makeSpreader);
         }
         assert(vaInvoker.type().equals(spreadInvokerType.invokerType()));
+        maybeCompileToBytecode(vaInvoker);
         spreadInvokers[leadingArgCount] = vaInvoker;
         return vaInvoker;
     }
@@ -231,32 +232,38 @@
         return "Invokers"+targetType;
     }
 
-    static MemberName exactInvokerMethod(MethodType mtype, Object[] appendixResult) {
+    static MemberName methodHandleInvokeLinkerMethod(String name,
+                                                     MethodType mtype,
+                                                     Object[] appendixResult) {
+        int which;
+        switch (name) {
+        case "invokeExact":  which = MethodTypeForm.LF_EX_LINKER; break;
+        case "invoke":       which = MethodTypeForm.LF_GEN_LINKER; break;
+        default:             throw new InternalError("not invoker: "+name);
+        }
         LambdaForm lform;
-        final int MTYPE_ARG_APPENDED = 1;  // argument count for appended mtype value
-        if (mtype.parameterSlotCount() <= MethodType.MAX_MH_ARITY - MTYPE_ARG_APPENDED) {
-            lform = invokeForm(mtype, false, MethodTypeForm.LF_EX_LINKER);
+        if (mtype.parameterSlotCount() <= MethodType.MAX_MH_ARITY - MH_LINKER_ARG_APPENDED) {
+            lform = invokeHandleForm(mtype, false, which);
             appendixResult[0] = mtype;
         } else {
-            lform = invokeForm(mtype, true, MethodTypeForm.LF_EX_LINKER);
+            lform = invokeHandleForm(mtype, true, which);
         }
         return lform.vmentry;
     }
 
-    static MemberName genericInvokerMethod(MethodType mtype, Object[] appendixResult) {
-        LambdaForm lform;
-        final int MTYPE_ARG_APPENDED = 1;  // argument count for appended mtype value
-        if (mtype.parameterSlotCount() <= MethodType.MAX_MH_ARITY - (MTYPE_ARG_APPENDED + GENERIC_INVOKER_SLOP)) {
-            lform = invokeForm(mtype, false, MethodTypeForm.LF_GEN_LINKER);
-            appendixResult[0] = mtype;
-            prepareForGenericCall(mtype);
-        } else {
-            lform = invokeForm(mtype, true, MethodTypeForm.LF_GEN_LINKER);
-        }
-        return lform.vmentry;
-    }
+    // argument count to account for trailing "appendix value" (typically the mtype)
+    private static final int MH_LINKER_ARG_APPENDED = 1;
 
-    private static LambdaForm invokeForm(MethodType mtype, boolean customized, int which) {
+    /** Returns an adapter for invokeExact or generic invoke, as a MH or constant pool linker.
+     * If !customized, caller is responsible for supplying, during adapter execution,
+     * a copy of the exact mtype.  This is because the adapter might be generalized to
+     * a basic type.
+     * @param mtype the caller's method type (either basic or full-custom)
+     * @param customized whether to use a trailing appendix argument (to carry the mtype)
+     * @param which bit-encoded 0x01 whether it is a CP adapter ("linker") or MHs.invoker value ("invoker");
+     *                          0x02 whether it is for invokeExact or generic invoke
+     */
+    private static LambdaForm invokeHandleForm(MethodType mtype, boolean customized, int which) {
         boolean isCached;
         if (!customized) {
             mtype = mtype.basicType();  // normalize Z to I, String to Object, etc.
@@ -301,41 +308,24 @@
                 : Arrays.asList(mtype, customized, which, nameCursor, names.length);
         if (MTYPE_ARG >= INARG_LIMIT) {
             assert(names[MTYPE_ARG] == null);
-            names[MTYPE_ARG] = BoundMethodHandle.getSpeciesData("L").getterName(names[THIS_MH], 0);
+            NamedFunction getter = BoundMethodHandle.getSpeciesData("L").getterFunction(0);
+            names[MTYPE_ARG] = new Name(getter, names[THIS_MH]);
             // else if isLinker, then MTYPE is passed in from the caller (e.g., the JVM)
         }
 
         // Make the final call.  If isGeneric, then prepend the result of type checking.
-        MethodType outCallType;
-        Object[] outArgs;
+        MethodType outCallType = mtype.basicType();
+        Object[] outArgs = Arrays.copyOfRange(names, CALL_MH, OUTARG_LIMIT, Object[].class);
         Object mtypeArg = (customized ? mtype : names[MTYPE_ARG]);
         if (!isGeneric) {
             names[CHECK_TYPE] = new Name(NF_checkExactType, names[CALL_MH], mtypeArg);
             // mh.invokeExact(a*):R => checkExactType(mh, TYPEOF(a*:R)); mh.invokeBasic(a*)
-            outArgs = Arrays.copyOfRange(names, CALL_MH, OUTARG_LIMIT, Object[].class);
-            outCallType = mtype;
-        } else if (customized) {
-            names[CHECK_TYPE] = new Name(NF_asType, names[CALL_MH], mtypeArg);
-            // mh.invokeGeneric(a*):R =>
-            //  let mt=TYPEOF(a*:R), tmh=asType(mh, mt);
-            //    tmh.invokeBasic(a*)
-            outArgs = Arrays.copyOfRange(names, CALL_MH, OUTARG_LIMIT, Object[].class);
-            outCallType = mtype;
         } else {
             names[CHECK_TYPE] = new Name(NF_checkGenericType, names[CALL_MH], mtypeArg);
-            // mh.invokeGeneric(a*):R =>
-            //  let mt=TYPEOF(a*:R), gamh=checkGenericType(mh, mt);
-            //    gamh.invokeBasic(mt, mh, a*)
-            final int PREPEND_GAMH = 0, PREPEND_MT = 1, PREPEND_COUNT = 2;
-            assert(GENERIC_INVOKER_SLOP == PREPEND_COUNT);
-            outArgs = Arrays.copyOfRange(names, CALL_MH, OUTARG_LIMIT + PREPEND_COUNT, Object[].class);
-            // prepend arguments:
-            System.arraycopy(outArgs, 0, outArgs, PREPEND_COUNT, outArgs.length - PREPEND_COUNT);
-            outArgs[PREPEND_GAMH] = names[CHECK_TYPE];
-            outArgs[PREPEND_MT] = mtypeArg;
-            outCallType = mtype.insertParameterTypes(0, MethodType.class, MethodHandle.class);
+            // mh.invokeGeneric(a*):R => checkGenericType(mh, TYPEOF(a*:R)).invokeBasic(a*)
+            outArgs[0] = names[CHECK_TYPE];
         }
-        names[LINKER_CALL] = new Name(invokeBasicMethod(outCallType), outArgs);
+        names[LINKER_CALL] = new Name(outCallType, outArgs);
         lform = new LambdaForm(debugName, INARG_LIMIT, names);
         if (isLinker)
             lform.compileToBytecode();  // JVM needs a real methodOop
@@ -343,7 +333,6 @@
             lform = mtype.form().setCachedLambdaForm(which, lform);
         return lform;
     }
-    private static final int GENERIC_INVOKER_SLOP = 2;  // used elsewhere to avoid arity problems
 
     /*non-public*/ static
     WrongMethodTypeException newWrongMethodTypeException(MethodType actual, MethodType expected) {
@@ -362,47 +351,53 @@
             throw newWrongMethodTypeException(expected, actual);
     }
 
-    /** Static definition of MethodHandle.invokeGeneric checking code. */
+    /** Static definition of MethodHandle.invokeGeneric checking code.
+     * Directly returns the type-adjusted MH to invoke, as follows:
+     * {@code (R)MH.invoke(a*) => MH.asType(TYPEOF(a*:R)).invokeBasic(a*)}
+     */
     /*non-public*/ static
     @ForceInline
     Object checkGenericType(Object mhObj, Object expectedObj) {
         MethodHandle mh = (MethodHandle) mhObj;
         MethodType expected = (MethodType) expectedObj;
-        //MethodType actual = mh.type();
-        MethodHandle gamh = expected.form().genericInvoker;
-        if (gamh != null)  return gamh;
-        return prepareForGenericCall(expected);
-    }
-
-    /**
-     * Returns an adapter GA for invoking a MH with type adjustments.
-     * The MethodType of the generic invocation site is prepended to MH
-     * and its arguments as follows:
-     * {@code (R)MH.invoke(A*) => GA.invokeBasic(TYPEOF<A*,R>, MH, A*)}
-     */
-    /*non-public*/ static MethodHandle prepareForGenericCall(MethodType mtype) {
-        // force any needed adapters to be preconstructed
-        MethodTypeForm form = mtype.form();
-        MethodHandle gamh = form.genericInvoker;
-        if (gamh != null)  return gamh;
-        try {
-            // Trigger adapter creation.
-            gamh = InvokeGeneric.generalInvokerOf(form.erasedType);
-            form.genericInvoker = gamh;
-            return gamh;
-        } catch (Exception ex) {
-            throw newInternalError("Exception while resolving inexact invoke", ex);
-        }
+        if (mh.type() == expected)  return mh;
+        MethodHandle atc = mh.asTypeCache;
+        if (atc != null && atc.type() == expected)  return atc;
+        return mh.asType(expected);
+        /* Maybe add more paths here.  Possible optimizations:
+         * for (R)MH.invoke(a*),
+         * let MT0 = TYPEOF(a*:R), MT1 = MH.type
+         *
+         * if MT0==MT1 or MT1 can be safely called by MT0
+         *  => MH.invokeBasic(a*)
+         * if MT1 can be safely called by MT0[R := Object]
+         *  => MH.invokeBasic(a*) & checkcast(R)
+         * if MT1 can be safely called by MT0[* := Object]
+         *  => checkcast(A)* & MH.invokeBasic(a*) & checkcast(R)
+         * if a big adapter BA can be pulled out of (MT0,MT1)
+         *  => BA.invokeBasic(MT0,MH,a*)
+         * if a local adapter LA can cached on static CS0 = new GICS(MT0)
+         *  => CS0.LA.invokeBasic(MH,a*)
+         * else
+         *  => MH.asType(MT0).invokeBasic(A*)
+         */
     }
 
     static MemberName linkToCallSiteMethod(MethodType mtype) {
-        LambdaForm lform = callSiteForm(mtype);
+        LambdaForm lform = callSiteForm(mtype, false);
         return lform.vmentry;
     }
 
-    private static LambdaForm callSiteForm(MethodType mtype) {
+    static MemberName linkToTargetMethod(MethodType mtype) {
+        LambdaForm lform = callSiteForm(mtype, true);
+        return lform.vmentry;
+    }
+
+    // skipCallSite is true if we are optimizing a ConstantCallSite
+    private static LambdaForm callSiteForm(MethodType mtype, boolean skipCallSite) {
         mtype = mtype.basicType();  // normalize Z to I, String to Object, etc.
-        LambdaForm lform = mtype.form().cachedLambdaForm(MethodTypeForm.LF_CS_LINKER);
+        final int which = (skipCallSite ? MethodTypeForm.LF_MH_LINKER : MethodTypeForm.LF_CS_LINKER);
+        LambdaForm lform = mtype.form().cachedLambdaForm(which);
         if (lform != null)  return lform;
         // exactInvokerForm (Object,Object)Object
         //   link with java.lang.invoke.MethodHandle.invokeBasic(MethodHandle,Object,Object)Object/invokeSpecial
@@ -410,24 +405,26 @@
         final int OUTARG_LIMIT = ARG_BASE + mtype.parameterCount();
         final int INARG_LIMIT  = OUTARG_LIMIT + 1;
         int nameCursor = OUTARG_LIMIT;
-        final int CSITE_ARG    = nameCursor++;  // the last in-argument
-        final int CALL_MH      = nameCursor++;  // result of getTarget
+        final int APPENDIX_ARG = nameCursor++;  // the last in-argument
+        final int CSITE_ARG    = skipCallSite ? -1 : APPENDIX_ARG;
+        final int CALL_MH      = skipCallSite ? APPENDIX_ARG : nameCursor++;  // result of getTarget
         final int LINKER_CALL  = nameCursor++;
-        MethodType invokerFormType = mtype.appendParameterTypes(CallSite.class);
+        MethodType invokerFormType = mtype.appendParameterTypes(skipCallSite ? MethodHandle.class : CallSite.class);
         Name[] names = arguments(nameCursor - INARG_LIMIT, invokerFormType);
         assert(names.length == nameCursor);
-        assert(names[CSITE_ARG] != null);
-        names[CALL_MH] = new Name(NF_getCallSiteTarget, names[CSITE_ARG]);
+        assert(names[APPENDIX_ARG] != null);
+        if (!skipCallSite)
+            names[CALL_MH] = new Name(NF_getCallSiteTarget, names[CSITE_ARG]);
         // (site.)invokedynamic(a*):R => mh = site.getTarget(); mh.invokeBasic(a*)
         final int PREPEND_MH = 0, PREPEND_COUNT = 1;
         Object[] outArgs = Arrays.copyOfRange(names, ARG_BASE, OUTARG_LIMIT + PREPEND_COUNT, Object[].class);
         // prepend MH argument:
         System.arraycopy(outArgs, 0, outArgs, PREPEND_COUNT, outArgs.length - PREPEND_COUNT);
         outArgs[PREPEND_MH] = names[CALL_MH];
-        names[LINKER_CALL] = new Name(invokeBasicMethod(mtype), outArgs);
-        lform = new LambdaForm("linkToCallSite", INARG_LIMIT, names);
+        names[LINKER_CALL] = new Name(mtype, outArgs);
+        lform = new LambdaForm((skipCallSite ? "linkToTargetMethod" : "linkToCallSite"), INARG_LIMIT, names);
         lform.compileToBytecode();  // JVM needs a real methodOop
-        lform = mtype.form().setCachedLambdaForm(MethodTypeForm.LF_CS_LINKER, lform);
+        lform = mtype.form().setCachedLambdaForm(which, lform);
         return lform;
     }
 
--- a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java	Fri Oct 11 09:17:18 2013 -0400
@@ -50,7 +50,7 @@
  * The result of the lambda is defined as one of the names, often the last one.
  * <p>
  * Here is an approximate grammar:
- * <pre>
+ * <blockquote><pre>{@code
  * LambdaForm = "(" ArgName* ")=>{" TempName* Result "}"
  * ArgName = "a" N ":" T
  * TempName = "t" N ":" T "=" Function "(" Argument* ");"
@@ -60,7 +60,7 @@
  * NameRef = "a" N | "t" N
  * N = (any whole number)
  * T = "L" | "I" | "J" | "F" | "D" | "V"
- * </pre>
+ * }</pre></blockquote>
  * Names are numbered consecutively from left to right starting at zero.
  * (The letters are merely a taste of syntax sugar.)
  * Thus, the first temporary (if any) is always numbered N (where N=arity).
@@ -69,7 +69,7 @@
  * A lambda has a void result if and only if its result index is -1.
  * If a temporary has the type "V", it cannot be the subject of a NameRef,
  * even though possesses a number.
- * Note that all reference types are erased to "L", which stands for {@code Object).
+ * Note that all reference types are erased to "L", which stands for {@code Object}.
  * All subword types (boolean, byte, short, char) are erased to "I" which is {@code int}.
  * The other types stand for the usual primitive types.
  * <p>
@@ -89,7 +89,7 @@
  * encoded by using temporary expressions which call type-transformed identity functions.
  * <p>
  * Examples:
- * <pre>
+ * <blockquote><pre>{@code
  * (a0:J)=>{ a0 }
  *     == identity(long)
  * (a0:I)=>{ t1:V = System.out#println(a0); void }
@@ -113,7 +113,7 @@
  * (a0:L, a1:L)=>{ t2:L = BoundMethodHandle#argument(a0);
  *                 t3:L = Class#cast(t2,a1); t3 }
  *     == invoker for identity method handle which performs cast
- * </pre>
+ * }</pre></blockquote>
  * <p>
  * @author John Rose, JSR 292 EG
  */
@@ -457,7 +457,7 @@
             isCompiled = true;
             return vmentry;
         } catch (Error | Exception ex) {
-            throw newInternalError(this.toString(), ex);
+            throw newInternalError("compileToBytecode", ex);
         }
     }
 
@@ -683,8 +683,9 @@
     */
 
     static void traceInterpreter(String event, Object obj, Object... args) {
-        if (!TRACE_INTERPRETER)  return;
-        System.out.println("LFI: "+event+" "+(obj != null ? obj : "")+(args != null && args.length != 0 ? Arrays.asList(args) : ""));
+        if (TRACE_INTERPRETER) {
+            System.out.println("LFI: "+event+" "+(obj != null ? obj : "")+(args != null && args.length != 0 ? Arrays.asList(args) : ""));
+        }
     }
     static void traceInterpreter(String event, Object obj) {
         traceInterpreter(event, obj, (Object[])null);
@@ -982,6 +983,16 @@
             //resolvedHandle = eraseSubwordTypes(resolvedHandle);
             this.resolvedHandle = resolvedHandle;
         }
+        NamedFunction(MethodType basicInvokerType) {
+            assert(basicInvokerType == basicInvokerType.basicType()) : basicInvokerType;
+            if (basicInvokerType.parameterSlotCount() < MethodType.MAX_MH_INVOKER_ARITY) {
+                this.resolvedHandle = basicInvokerType.invokers().basicInvoker();
+                this.member = resolvedHandle.internalMemberName();
+            } else {
+                // necessary to pass BigArityTest
+                this.member = Invokers.invokeBasicMethod(basicInvokerType);
+            }
+        }
 
         // The next 3 constructors are used to break circular dependencies on MH.invokeStatic, etc.
         // Any LambdaForm containing such a member is not interpretable.
@@ -1229,7 +1240,7 @@
         }
 
         public String toString() {
-            if (member == null)  return resolvedHandle.toString();
+            if (member == null)  return String.valueOf(resolvedHandle);
             return member.getDeclaringClass().getSimpleName()+"."+member.getName();
         }
     }
@@ -1279,6 +1290,10 @@
         Name(MethodHandle function, Object... arguments) {
             this(new NamedFunction(function), arguments);
         }
+        Name(MethodType functionType, Object... arguments) {
+            this(new NamedFunction(functionType), arguments);
+            assert(arguments[0] instanceof Name && ((Name)arguments[0]).type == 'L');
+        }
         Name(MemberName function, Object... arguments) {
             this(new NamedFunction(function), arguments);
         }
@@ -1426,8 +1441,6 @@
          * Does this Name precede the given binding node in some canonical order?
          * This predicate is used to order data bindings (via insertion sort)
          * with some stability.
-         * @param binding
-         * @return
          */
         boolean isSiblingBindingBefore(Name binding) {
             assert(!binding.isParam());
@@ -1622,4 +1635,12 @@
  */
 
     static { NamedFunction.initializeInvokers(); }
+
+    // The following hack is necessary in order to suppress TRACE_INTERPRETER
+    // during execution of the static initializes of this class.
+    // Turning on TRACE_INTERPRETER too early will cause
+    // stack overflows and other misbehavior during attempts to trace events
+    // that occur during LambdaForm.<clinit>.
+    // Therefore, do not move this line higher in this file, and do not remove.
+    private static final boolean TRACE_INTERPRETER = MethodHandleStatics.TRACE_INTERPRETER;
 }
--- a/jdk/src/share/classes/java/lang/invoke/MemberName.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MemberName.java	Fri Oct 11 09:17:18 2013 -0400
@@ -556,6 +556,9 @@
         }
         throw new IllegalArgumentException(this.toString());
     }
+    /** If this MN is not REF_newInvokeSpecial, return a clone with that ref. kind.
+     *  In that case it must already be REF_invokeSpecial.
+     */
     public MemberName asConstructor() {
         switch (getReferenceKind()) {
         case REF_invokeSpecial:     return clone().changeReferenceKind(REF_newInvokeSpecial, REF_invokeSpecial);
@@ -563,6 +566,32 @@
         }
         throw new IllegalArgumentException(this.toString());
     }
+    /** If this MN is a REF_invokeSpecial, return a clone with the "normal" kind
+     *  REF_invokeVirtual; also switch either to REF_invokeInterface if clazz.isInterface.
+     *  The end result is to get a fully virtualized version of the MN.
+     *  (Note that resolving in the JVM will sometimes devirtualize, changing
+     *  REF_invokeVirtual of a final to REF_invokeSpecial, and REF_invokeInterface
+     *  in some corner cases to either of the previous two; this transform
+     *  undoes that change under the assumption that it occurred.)
+     */
+    public MemberName asNormalOriginal() {
+        byte normalVirtual = clazz.isInterface() ? REF_invokeInterface : REF_invokeVirtual;
+        byte refKind = getReferenceKind();
+        byte newRefKind = refKind;
+        MemberName result = this;
+        switch (refKind) {
+        case REF_invokeInterface:
+        case REF_invokeVirtual:
+        case REF_invokeSpecial:
+            newRefKind = normalVirtual;
+            break;
+        }
+        if (newRefKind == refKind)
+            return this;
+        result = clone().changeReferenceKind(newRefKind, refKind);
+        assert(this.referenceKindIsConsistentWith(result.getReferenceKind()));
+        return result;
+    }
     /** Create a name for the given reflected constructor.  The resulting name will be in a resolved state. */
     @SuppressWarnings("LeakingThisInConstructor")
     public MemberName(Constructor<?> ctor) {
@@ -660,7 +689,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(clazz, flags, name, getType());
+        return Objects.hash(clazz, getReferenceKind(), name, getType());
     }
     @Override
     public boolean equals(Object that) {
@@ -676,13 +705,14 @@
         if (this == that)  return true;
         if (that == null)  return false;
         return this.clazz == that.clazz
-                && this.flags == that.flags
+                && this.getReferenceKind() == that.getReferenceKind()
                 && Objects.equals(this.name, that.name)
                 && Objects.equals(this.getType(), that.getType());
     }
 
     // Construction from symbolic parts, for queries:
-    /** Create a field or type name from the given components:  Declaring class, name, type, reference kind.
+    /** Create a field or type name from the given components:
+     *  Declaring class, name, type, reference kind.
      *  The declaring class may be supplied as null if this is to be a bare name and type.
      *  The resulting name will in an unresolved state.
      */
@@ -706,21 +736,34 @@
      *  The resulting name will in an unresolved state.
      */
     public MemberName(Class<?> defClass, String name, MethodType type, byte refKind) {
-        @SuppressWarnings("LocalVariableHidesMemberVariable")
-        int flags = (name != null && name.equals(CONSTRUCTOR_NAME) ? IS_CONSTRUCTOR : IS_METHOD);
-        init(defClass, name, type, flagsMods(flags, 0, refKind));
+        int initFlags = (name != null && name.equals(CONSTRUCTOR_NAME) ? IS_CONSTRUCTOR : IS_METHOD);
+        init(defClass, name, type, flagsMods(initFlags, 0, refKind));
         initResolved(false);
     }
-//    /** Create a method or constructor name from the given components:  Declaring class, name, type, modifiers.
-//     *  It will be a constructor if and only if the name is {@code "&lt;init&gt;"}.
-//     *  The declaring class may be supplied as null if this is to be a bare name and type.
-//     *  The modifier flags default to zero.
-//     *  The resulting name will in an unresolved state.
-//     */
-//    public MemberName(Class<?> defClass, String name, MethodType type, Void unused) {
-//        this(defClass, name, type, REF_NONE);
-//    }
-
+    /** Create a method, constructor, or field name from the given components:
+     *  Reference kind, declaring class, name, type.
+     */
+    public MemberName(byte refKind, Class<?> defClass, String name, Object type) {
+        int kindFlags;
+        if (MethodHandleNatives.refKindIsField(refKind)) {
+            kindFlags = IS_FIELD;
+            if (!(type instanceof Class))
+                throw newIllegalArgumentException("not a field type");
+        } else if (MethodHandleNatives.refKindIsMethod(refKind)) {
+            kindFlags = IS_METHOD;
+            if (!(type instanceof MethodType))
+                throw newIllegalArgumentException("not a method type");
+        } else if (refKind == REF_newInvokeSpecial) {
+            kindFlags = IS_CONSTRUCTOR;
+            if (!(type instanceof MethodType) ||
+                !CONSTRUCTOR_NAME.equals(name))
+                throw newIllegalArgumentException("not a constructor type or name");
+        } else {
+            throw newIllegalArgumentException("bad reference kind "+refKind);
+        }
+        init(defClass, name, type, flagsMods(kindFlags, 0, refKind));
+        initResolved(false);
+    }
     /** Query whether this member name is resolved to a non-static, non-final method.
      */
     public boolean hasReceiverTypeDispatch() {
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Fri Oct 11 09:17:18 2013 -0400
@@ -292,7 +292,7 @@
  * generates a single invokevirtual instruction with
  * the symbolic type descriptor indicated in the following comment.
  * In these examples, the helper method {@code assertEquals} is assumed to
- * be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals }
+ * be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals}
  * on its arguments, and asserts that the result is true.
  *
  * <h1>Exceptions</h1>
@@ -392,7 +392,7 @@
  * Java types.
  * <ul>
  * <li>Method types range over all possible arities,
- * from no arguments to up to 255 of arguments (a limit imposed by the JVM).
+ * from no arguments to up to the  <a href="MethodHandle.html#maxarity">maximum number</a> of allowed arguments.
  * Generics are not variadic, and so cannot represent this.</li>
  * <li>Method types can specify arguments of primitive types,
  * which Java generic types cannot range over.</li>
@@ -402,6 +402,22 @@
  * genericity with a Java type parameter.</li>
  * </ul>
  *
+ * <h1><a name="maxarity"></a>Arity limits</h1>
+ * The JVM imposes on all methods and constructors of any kind an absolute
+ * limit of 255 stacked arguments.  This limit can appear more restrictive
+ * in certain cases:
+ * <ul>
+ * <li>A {@code long} or {@code double} argument counts (for purposes of arity limits) as two argument slots.
+ * <li>A non-static method consumes an extra argument for the object on which the method is called.
+ * <li>A constructor consumes an extra argument for the object which is being constructed.
+ * <li>Since a method handle&rsquo;s {@code invoke} method (or other signature-polymorphic method) is non-virtual,
+ *     it consumes an extra argument for the method handle itself, in addition to any non-virtual receiver object.
+ * </ul>
+ * These limits imply that certain method handles cannot be created, solely because of the JVM limit on stacked arguments.
+ * For example, if a static JVM method accepts exactly 255 arguments, a method handle cannot be created for it.
+ * Attempts to create method handles with impossible method types lead to an {@link IllegalArgumentException}.
+ * In particular, a method handle&rsquo;s type must not have an arity of the exact maximum 255.
+ *
  * @see MethodType
  * @see MethodHandles
  * @author John Rose, JSR 292 EG
@@ -420,6 +436,8 @@
     private final MethodType type;
     /*private*/ final LambdaForm form;
     // form is not private so that invokers can easily fetch it
+    /*private*/ MethodHandle asTypeCache;
+    // asTypeCache is not private so that invokers can easily fetch it
 
     /**
      * Reports the type of this method handle.
@@ -557,10 +575,10 @@
     /*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable;
 
     /**
-     * Performs a variable arity invocation, passing the arguments in the given array
+     * Performs a variable arity invocation, passing the arguments in the given list
      * to the method handle, as if via an inexact {@link #invoke invoke} from a call site
      * which mentions only the type {@code Object}, and whose arity is the length
-     * of the argument array.
+     * of the argument list.
      * <p>
      * Specifically, execution proceeds as if by the following steps,
      * although the methods are not guaranteed to be called if the JVM
@@ -590,10 +608,10 @@
      * or forced to null if the return type is void.
      * <p>
      * This call is equivalent to the following code:
-     * <p><blockquote><pre>
+     * <p><blockquote><pre>{@code
      * MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0);
      * Object result = invoker.invokeExact(this, arguments);
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * <p>
      * Unlike the signature polymorphic methods {@code invokeExact} and {@code invoke},
      * {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.
@@ -626,7 +644,7 @@
      * <p>
      * This method is also equivalent to the following code:
      * <p><blockquote><pre>
-     * {@link #invokeWithArguments(Object...) invokeWithArguments}(arguments.toArray())
+     * {@link #invokeWithArguments(Object...) invokeWithArguments}{@code(arguments.toArray())}
      * </pre></blockquote>
      *
      * @param arguments the arguments to pass to the target
@@ -739,10 +757,24 @@
      * @see MethodHandles#explicitCastArguments
      */
     public MethodHandle asType(MethodType newType) {
-        if (!type.isConvertibleTo(newType)) {
+        // Fast path alternative to a heavyweight {@code asType} call.
+        // Return 'this' if the conversion will be a no-op.
+        if (newType == type) {
+            return this;
+        }
+        // Return 'this.asTypeCache' if the conversion is already memoized.
+        MethodHandle atc = asTypeCache;
+        if (atc != null && newType == atc.type) {
+            return atc;
+        }
+        return asTypeUncached(newType);
+    }
+
+    /** Override this to change asType behavior. */
+    /*non-public*/ MethodHandle asTypeUncached(MethodType newType) {
+        if (!type.isConvertibleTo(newType))
             throw new WrongMethodTypeException("cannot convert "+this+" to "+newType);
-        }
-        return convertArguments(newType);
+        return asTypeCache = convertArguments(newType);
     }
 
     /**
@@ -772,6 +804,10 @@
      * to the target method handle.
      * (The array may also be null when zero elements are required.)
      * <p>
+     * If, when the adapter is called, the supplied array argument does
+     * not have the correct number of elements, the adapter will throw
+     * an {@link IllegalArgumentException} instead of invoking the target.
+     * <p>
      * Here are some simple examples of array-spreading method handles:
      * <blockquote><pre>{@code
 MethodHandle equals = publicLookup()
@@ -782,6 +818,12 @@
 MethodHandle eq2 = equals.asSpreader(Object[].class, 2);
 assert( (boolean) eq2.invokeExact(new Object[]{ "me", "me" }));
 assert(!(boolean) eq2.invokeExact(new Object[]{ "me", "thee" }));
+// try to spread from anything but a 2-array:
+for (int n = 0; n <= 10; n++) {
+  Object[] badArityArgs = (n == 2 ? null : new Object[n]);
+  try { assert((boolean) eq2.invokeExact(badArityArgs) && false); }
+  catch (IllegalArgumentException ex) { } // OK
+}
 // spread both arguments from a String array:
 MethodHandle eq2s = equals.asSpreader(String[].class, 2);
 assert( (boolean) eq2s.invokeExact(new String[]{ "me", "me" }));
@@ -815,10 +857,12 @@
      * @return a new method handle which spreads its final array argument,
      *         before calling the original method handle
      * @throws NullPointerException if {@code arrayType} is a null reference
-     * @throws IllegalArgumentException if {@code arrayType} is not an array type
-     * @throws IllegalArgumentException if target does not have at least
+     * @throws IllegalArgumentException if {@code arrayType} is not an array type,
+     *         or if target does not have at least
      *         {@code arrayLength} parameter types,
-     *         or if {@code arrayLength} is negative
+     *         or if {@code arrayLength} is negative,
+     *         or if the resulting method handle's type would have
+     *         <a href="MethodHandle.html#maxarity">too many parameters</a>
      * @throws WrongMethodTypeException if the implied {@code asType} call fails
      * @see #asCollector
      */
@@ -931,7 +975,9 @@
      * @throws NullPointerException if {@code arrayType} is a null reference
      * @throws IllegalArgumentException if {@code arrayType} is not an array type
      *         or {@code arrayType} is not assignable to this method handle's trailing parameter type,
-     *         or {@code arrayLength} is not a legal array size
+     *         or {@code arrayLength} is not a legal array size,
+     *         or the resulting method handle's type would have
+     *         <a href="MethodHandle.html#maxarity">too many parameters</a>
      * @throws WrongMethodTypeException if the implied {@code asType} call fails
      * @see #asSpreader
      * @see #asVarargsCollector
@@ -1226,9 +1272,9 @@
      * starting with the string {@code "MethodHandle"} and
      * ending with the string representation of the method handle's type.
      * In other words, this method returns a string equal to the value of:
-     * <blockquote><pre>
+     * <blockquote><pre>{@code
      * "MethodHandle" + type().toString()
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * <p>
      * (<em>Note:</em>  Future releases of this API may add further information
      * to the string representation.
@@ -1285,6 +1331,11 @@
     }
 
     /*non-public*/
+    Class<?> internalCallerClass() {
+        return null;  // caller-bound MH for @CallerSensitive method returns caller
+    }
+
+    /*non-public*/
     MethodHandle withInternalMemberName(MemberName member) {
         if (member != null) {
             return MethodHandleImpl.makeWrappedMember(this, member);
@@ -1434,7 +1485,6 @@
      * Threads may continue running the old form indefinitely,
      * but it is likely that the new one will be preferred for new executions.
      * Use with discretion.
-     * @param newForm
      */
     /*non-public*/
     void updateForm(LambdaForm newForm) {
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -314,13 +314,13 @@
     static class AsVarargsCollector extends MethodHandle {
         private final MethodHandle target;
         private final Class<?> arrayType;
-        private MethodHandle cache;
+        private /*@Stable*/ MethodHandle asCollectorCache;
 
         AsVarargsCollector(MethodHandle target, MethodType type, Class<?> arrayType) {
             super(type, reinvokerForm(target));
             this.target = target;
             this.arrayType = arrayType;
-            this.cache = target.asCollector(arrayType, 0);
+            this.asCollectorCache = target.asCollector(arrayType, 0);
         }
 
         @Override MethodHandle reinvokerTarget() { return target; }
@@ -336,18 +336,19 @@
         }
 
         @Override
-        public MethodHandle asType(MethodType newType) {
+        public MethodHandle asTypeUncached(MethodType newType) {
             MethodType type = this.type();
             int collectArg = type.parameterCount() - 1;
             int newArity = newType.parameterCount();
             if (newArity == collectArg+1 &&
                 type.parameterType(collectArg).isAssignableFrom(newType.parameterType(collectArg))) {
                 // if arity and trailing parameter are compatible, do normal thing
-                return asFixedArity().asType(newType);
+                return asTypeCache = asFixedArity().asType(newType);
             }
             // check cache
-            if (cache.type().parameterCount() == newArity)
-                return cache.asType(newType);
+            MethodHandle acc = asCollectorCache;
+            if (acc != null && acc.type().parameterCount() == newArity)
+                return asTypeCache = acc.asType(newType);
             // build and cache a collector
             int arrayLength = newArity - collectArg;
             MethodHandle collector;
@@ -357,8 +358,8 @@
             } catch (IllegalArgumentException ex) {
                 throw new WrongMethodTypeException("cannot build collector", ex);
             }
-            cache = collector;
-            return collector.asType(newType);
+            asCollectorCache = collector;
+            return asTypeCache = collector.asType(newType);
         }
 
         @Override
@@ -380,6 +381,10 @@
         MemberName internalMemberName() {
             return asFixedArity().internalMemberName();
         }
+        @Override
+        Class<?> internalCallerClass() {
+            return asFixedArity().internalCallerClass();
+        }
 
         /*non-public*/
         @Override
@@ -459,14 +464,8 @@
     }
 
     static void checkSpreadArgument(Object av, int n) {
-        // FIXME: regression test for bug 7141637 erroneously expects an NPE, and other tests may expect IAE
-        // but the actual exception raised by an arity mismatch should be WMTE
-        final boolean RAISE_RANDOM_EXCEPTIONS = true;  // FIXME: delete in JSR 292 M1
         if (av == null) {
             if (n == 0)  return;
-            int len;
-            if (RAISE_RANDOM_EXCEPTIONS)
-                len = ((Object[])av).length;  // throw NPE; but delete this after tests are fixed
         } else if (av instanceof Object[]) {
             int len = ((Object[])av).length;
             if (len == n)  return;
@@ -475,9 +474,7 @@
             if (len == n)  return;
         }
         // fall through to error:
-        if (RAISE_RANDOM_EXCEPTIONS)
-            throw newIllegalArgumentException("Array is not of length "+n);
-        throw new WrongMethodTypeException("Array is not of length "+n);
+        throw newIllegalArgumentException("array is not of length "+n);
     }
 
     /**
@@ -838,7 +835,7 @@
             MethodHandle vamh = prepareForInvoker(mh);
             // Cache the result of makeInjectedInvoker once per argument class.
             MethodHandle bccInvoker = CV_makeInjectedInvoker.get(hostClass);
-            return restoreToType(bccInvoker.bindTo(vamh), mh.type(), mh.internalMemberName());
+            return restoreToType(bccInvoker.bindTo(vamh), mh.type(), mh.internalMemberName(), hostClass);
         }
 
         private static MethodHandle makeInjectedInvoker(Class<?> hostClass) {
@@ -893,10 +890,12 @@
         }
 
         // Undo the adapter effect of prepareForInvoker:
-        private static MethodHandle restoreToType(MethodHandle vamh, MethodType type, MemberName member) {
+        private static MethodHandle restoreToType(MethodHandle vamh, MethodType type,
+                                                  MemberName member,
+                                                  Class<?> hostClass) {
             MethodHandle mh = vamh.asCollector(Object[].class, type.parameterCount());
             mh = mh.asType(type);
-            mh = mh.withInternalMemberName(member);
+            mh = new WrappedMember(mh, type, member, hostClass);
             return mh;
         }
 
@@ -965,11 +964,13 @@
     static class WrappedMember extends MethodHandle {
         private final MethodHandle target;
         private final MemberName member;
+        private final Class<?> callerClass;
 
-        private WrappedMember(MethodHandle target, MethodType type, MemberName member) {
+        private WrappedMember(MethodHandle target, MethodType type, MemberName member, Class<?> callerClass) {
             super(type, reinvokerForm(target));
             this.target = target;
             this.member = member;
+            this.callerClass = callerClass;
         }
 
         @Override
@@ -977,23 +978,33 @@
             return target;
         }
         @Override
+        public MethodHandle asTypeUncached(MethodType newType) {
+            // This MH is an alias for target, except for the MemberName
+            // Drop the MemberName if there is any conversion.
+            return asTypeCache = target.asType(newType);
+        }
+        @Override
         MemberName internalMemberName() {
             return member;
         }
         @Override
+        Class<?> internalCallerClass() {
+            return callerClass;
+        }
+        @Override
         boolean isInvokeSpecial() {
             return target.isInvokeSpecial();
         }
         @Override
         MethodHandle viewAsType(MethodType newType) {
-            return new WrappedMember(target, newType, member);
+            return new WrappedMember(target, newType, member, callerClass);
         }
     }
 
     static MethodHandle makeWrappedMember(MethodHandle target, MemberName member) {
         if (member.equals(target.internalMemberName()))
             return target;
-        return new WrappedMember(target, target.type(), member);
+        return new WrappedMember(target, target.type(), member, null);
     }
 
 }
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleInfo.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleInfo.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,9 +32,10 @@
 import static java.lang.invoke.MethodHandleStatics.*;
 
 /**
- * A symbolic reference obtained by cracking a method handle into its consitutent symbolic parts.
+ * A symbolic reference obtained by cracking a direct method handle
+ * into its consitutent symbolic parts.
  * To crack a direct method handle, call {@link Lookup#revealDirect Lookup.revealDirect}.
- * <p>
+ * <h1><a name="directmh"></a>Direct Method Handles</h1>
  * A <em>direct method handle</em> represents a method, constructor, or field without
  * any intervening argument bindings or other transformations.
  * The method, constructor, or field referred to by a direct method handle is called
@@ -56,11 +57,25 @@
  *     or {@link Lookup#unreflectSetter Lookup.unreflectSetter}
  *     to convert a {@link Field} into a method handle.
  * </ul>
- * In all of these cases, it is possible to crack the resulting direct method handle
+ *
+ * <h1>Restrictions on Cracking</h1>
+ * Given a suitable {@code Lookup} object, it is possible to crack any direct method handle
  * to recover a symbolic reference for the underlying method, constructor, or field.
  * Cracking must be done via a {@code Lookup} object equivalent to that which created
  * the target method handle, or which has enough access permissions to recreate
  * an equivalent method handle.
+ * <p>
+ * If the underlying method is <a href="MethodHandles.Lookup.html#callsens">caller sensitive</a>,
+ * the direct method handle will have been "bound" to a particular caller class, the
+ * {@linkplain java.lang.invoke.MethodHandles.Lookup#lookupClass() lookup class}
+ * of the lookup object used to create it.
+ * Cracking this method handle with a different lookup class will fail
+ * even if the underlying method is public (like {@code Class.forName}).
+ * <p>
+ * The requirement of lookup object matching provides a "fast fail" behavior
+ * for programs which may otherwise trust erroneous revelation of a method
+ * handle with symbolic information (or caller binding) from an unexpected scope.
+ * Use {@link java.lang.invoke.MethodHandles#reflectAs} to override this limitation.
  *
  * <h1><a name="refkinds"></a>Reference kinds</h1>
  * The <a href="MethodHandles.Lookup.html#lookups">Lookup Factory Methods</a>
@@ -190,7 +205,7 @@
      * @return the Java language modifiers for underlying member,
      *         or -1 if the member cannot be accessed
      * @see Modifier
-     * @see reflectAs
+     * @see #reflectAs
      */
     public int getModifiers();
 
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Fri Oct 11 09:17:18 2013 -0400
@@ -233,20 +233,19 @@
     }
     static String refKindName(byte refKind) {
         assert(refKindIsValid(refKind));
-        return REFERENCE_KIND_NAME[refKind];
+        switch (refKind) {
+        case REF_getField:          return "getField";
+        case REF_getStatic:         return "getStatic";
+        case REF_putField:          return "putField";
+        case REF_putStatic:         return "putStatic";
+        case REF_invokeVirtual:     return "invokeVirtual";
+        case REF_invokeStatic:      return "invokeStatic";
+        case REF_invokeSpecial:     return "invokeSpecial";
+        case REF_newInvokeSpecial:  return "newInvokeSpecial";
+        case REF_invokeInterface:   return "invokeInterface";
+        default:                    return "REF_???";
+        }
     }
-    private static String[] REFERENCE_KIND_NAME = {
-            null,
-            "getField",
-            "getStatic",
-            "putField",
-            "putStatic",
-            "invokeVirtual",
-            "invokeStatic",
-            "invokeSpecial",
-            "newInvokeSpecial",
-            "invokeInterface"
-    };
 
     private static native int getNamedCon(int which, Object[] name);
     static boolean verifyConstants() {
@@ -294,12 +293,18 @@
         Class<?> caller = (Class<?>)callerObj;
         String name = nameObj.toString().intern();
         MethodType type = (MethodType)typeObj;
-        appendixResult[0] = CallSite.makeSite(bootstrapMethod,
+        CallSite callSite = CallSite.makeSite(bootstrapMethod,
                                               name,
                                               type,
                                               staticArguments,
                                               caller);
-        return Invokers.linkToCallSiteMethod(type);
+        if (callSite instanceof ConstantCallSite) {
+            appendixResult[0] = callSite.dynamicInvoker();
+            return Invokers.linkToTargetMethod(type);
+        } else {
+            appendixResult[0] = callSite;
+            return Invokers.linkToCallSiteMethod(type);
+        }
     }
 
     /**
@@ -388,12 +393,7 @@
                                      Object[] appendixResult) {
         try {
             if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
-                switch (name) {
-                case "invoke":
-                    return Invokers.genericInvokerMethod(fixMethodType(callerClass, type), appendixResult);
-                case "invokeExact":
-                    return Invokers.exactInvokerMethod(fixMethodType(callerClass, type), appendixResult);
-                }
+                return Invokers.methodHandleInvokeLinkerMethod(name, fixMethodType(callerClass, type), appendixResult);
             }
         } catch (Throwable ex) {
             if (ex instanceof LinkageError)
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java	Fri Oct 11 09:17:18 2013 -0400
@@ -107,6 +107,11 @@
      * such as abstract classes with single abstract methods.
      * Future versions of this API may also equip wrapper instances
      * with one or more additional public "marker" interfaces.
+     * <p>
+     * If a security manager is installed, this method is caller sensitive.
+     * During any invocation of the target method handle via the returned wrapper,
+     * the original creator of the wrapper (the caller) will be visible
+     * to context checks requested by the security manager.
      *
      * @param <T> the desired type of the wrapper, a single-method interface
      * @param intfc a class object representing {@code T}
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
 import sun.security.util.SecurityConstants;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import java.util.concurrent.ConcurrentHashMap;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -48,7 +49,6 @@
  * <li>Lookup methods which help create method handles for methods and fields.
  * <li>Combinator methods, which combine or transform pre-existing method handles into new ones.
  * <li>Other factory methods to create method handles that emulate other common JVM operations or control flow patterns.
- * <li>Wrapper methods which can convert between method handles and interface types.
  * </ul>
  * <p>
  * @author John Rose, JSR 292 EG
@@ -65,12 +65,25 @@
     //// Method handle creation from ordinary methods.
 
     /**
-     * Returns a {@link Lookup lookup object} on the caller,
-     * which has the capability to access any method handle that the caller has access to,
-     * including direct method handles to private fields and methods.
+     * Returns a {@link Lookup lookup object} with
+     * full capabilities to emulate all supported bytecode behaviors of the caller.
+     * These capabilities include <a href="MethodHandles.Lookup.html#privacc">private access</a> to the caller.
+     * Factory methods on the lookup object can create
+     * <a href="MethodHandleInfo.html#directmh">direct method handles</a>
+     * for any member that the caller has access to via bytecodes,
+     * including protected and private fields and methods.
      * This lookup object is a <em>capability</em> which may be delegated to trusted agents.
      * Do not store it in place where untrusted code can access it.
-     * @return a lookup object for the caller of this method
+     * <p>
+     * This method is caller sensitive, which means that it may return different
+     * values to different callers.
+     * <p>
+     * For any given caller class {@code C}, the lookup object returned by this call
+     * has equivalent capabilities to any lookup object
+     * supplied by the JVM to the bootstrap method of an
+     * <a href="package-summary.html#indyinsn">invokedynamic instruction</a>
+     * executing in the same caller class {@code C}.
+     * @return a lookup object for the caller of this method, with private access
      */
     @CallerSensitive
     public static Lookup lookup() {
@@ -84,11 +97,17 @@
      * <p>
      * As a matter of pure convention, the {@linkplain Lookup#lookupClass lookup class}
      * of this lookup object will be {@link java.lang.Object}.
-     * <p>
+     *
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
      * The lookup class can be changed to any other class {@code C} using an expression of the form
-     * {@linkplain Lookup#in <code>publicLookup().in(C.class)</code>}.
+     * {@link Lookup#in publicLookup().in(C.class)}.
      * Since all classes have equal access to public names,
      * such a change would confer no new access rights.
+     * A public lookup object is always subject to
+     * <a href="MethodHandles.Lookup.html#secmgr">security manager checks</a>.
+     * Also, it cannot access
+     * <a href="MethodHandles.Lookup.html#callsens">caller sensitive methods</a>.
      * @return a lookup object which is trusted minimally
      */
     public static Lookup publicLookup() {
@@ -96,7 +115,8 @@
     }
 
     /**
-     * Performs an unchecked "crack" of a direct method handle.
+     * Performs an unchecked "crack" of a
+     * <a href="MethodHandleInfo.html#directmh">direct method handle</a>.
      * The result is as if the user had obtained a lookup object capable enough
      * to crack the target method handle, called
      * {@link java.lang.invoke.MethodHandles.Lookup#revealDirect Lookup.revealDirect}
@@ -149,10 +169,17 @@
      * <h1><a name="lookups"></a>Lookup Factory Methods</h1>
      * The factory methods on a {@code Lookup} object correspond to all major
      * use cases for methods, constructors, and fields.
+     * Each method handle created by a factory method is the functional
+     * equivalent of a particular <em>bytecode behavior</em>.
+     * (Bytecode behaviors are described in section 5.4.3.5 of the Java Virtual Machine Specification.)
      * Here is a summary of the correspondence between these factory methods and
      * the behavior the resulting method handles:
      * <table border=1 cellpadding=5 summary="lookup method behaviors">
-     * <tr><th>lookup expression</th><th>member</th><th>behavior</th></tr>
+     * <tr>
+     *     <th><a name="equiv"></a>lookup expression</th>
+     *     <th>member</th>
+     *     <th>bytecode behavior</th>
+     * </tr>
      * <tr>
      *     <td>{@link java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}</td>
      *     <td>{@code FT f;}</td><td>{@code (T) this.f;}</td>
@@ -228,10 +255,12 @@
      * In cases where the given member is of variable arity (i.e., a method or constructor)
      * the returned method handle will also be of {@linkplain MethodHandle#asVarargsCollector variable arity}.
      * In all other cases, the returned method handle will be of fixed arity.
-     * <p>
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
      * The equivalence between looked-up method handles and underlying
-     * class members can break down in a few ways:
-     * <ul>
+     * class members and bytecode behaviors
+     * can break down in a few ways:
+     * <ul style="font-size:smaller;">
      * <li>If {@code C} is not symbolically accessible from the lookup class's loader,
      * the lookup can still succeed, even when there is no equivalent
      * Java expression or bytecoded constant.
@@ -241,9 +270,13 @@
      * For example, lookups for {@code MethodHandle.invokeExact} and
      * {@code MethodHandle.invoke} will always succeed, regardless of requested type.
      * <li>If there is a security manager installed, it can forbid the lookup
-     * on various grounds (<a href="#secmgr">see below</a>).
-     * By contrast, the {@code ldc} instruction is not subject to
-     * security manager checks.
+     * on various grounds (<a href="MethodHandles.Lookup.html#secmgr">see below</a>).
+     * By contrast, the {@code ldc} instruction on a {@code CONSTANT_MethodHandle}
+     * constant is not subject to security manager checks.
+     * <li>If the looked-up method has a
+     * <a href="MethodHandle.html#maxarity">very large arity</a>,
+     * the method handle creation may fail, due to the method handle
+     * type having too many parameters.
      * </ul>
      *
      * <h1><a name="access"></a>Access checking</h1>
@@ -271,7 +304,8 @@
      * A lookup can fail, because
      * the containing class is not accessible to the lookup class, or
      * because the desired class member is missing, or because the
-     * desired class member is not accessible to the lookup class.
+     * desired class member is not accessible to the lookup class, or
+     * because the lookup object is not trusted enough to access the member.
      * In any of these cases, a {@code ReflectiveOperationException} will be
      * thrown from the attempted lookup.  The exact class will be one of
      * the following:
@@ -282,11 +316,23 @@
      * </ul>
      * <p>
      * In general, the conditions under which a method handle may be
-     * looked up for a method {@code M} are exactly equivalent to the conditions
-     * under which the lookup class could have compiled and resolved a call to {@code M}.
+     * looked up for a method {@code M} are no more restrictive than the conditions
+     * under which the lookup class could have compiled, verified, and resolved a call to {@code M}.
+     * Where the JVM would raise exceptions like {@code NoSuchMethodError},
+     * a method handle lookup will generally raise a corresponding
+     * checked exception, such as {@code NoSuchMethodException}.
      * And the effect of invoking the method handle resulting from the lookup
-     * is exactly equivalent to executing the compiled and resolved call to {@code M}.
+     * is <a href="MethodHandles.Lookup.html#equiv">exactly equivalent</a>
+     * to executing the compiled, verified, and resolved call to {@code M}.
      * The same point is true of fields and constructors.
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
+     * Access checks only apply to named and reflected methods,
+     * constructors, and fields.
+     * Other method handle creation methods, such as
+     * {@link MethodHandle#asType MethodHandle.asType},
+     * do not require any access checks, and are used
+     * independently of any {@code Lookup} object.
      * <p>
      * If the desired member is {@code protected}, the usual JVM rules apply,
      * including the requirement that the lookup class must be either be in the
@@ -300,6 +346,18 @@
      * (which will necessarily be a superclass of the lookup class)
      * to the lookup class itself.
      * <p>
+     * The JVM imposes a similar requirement on {@code invokespecial} instruction,
+     * that the receiver argument must match both the resolved method <em>and</em>
+     * the current class.  Again, this requirement is enforced by narrowing the
+     * type of the leading parameter to the resulting method handle.
+     * (See the Java Virtual Machine Specification, section 4.10.1.9.)
+     * <p>
+     * The JVM represents constructors and static initializer blocks as internal methods
+     * with special names ({@code "<init>"} and {@code "<clinit>"}).
+     * The internal syntax of invocation instructions allows them to refer to such internal
+     * methods as if they were normal methods, but the JVM bytecode verifier rejects them.
+     * A lookup of such an internal method will produce a {@code NoSuchMethodException}.
+     * <p>
      * In some cases, access between nested classes is obtained by the Java compiler by creating
      * an wrapper method to access a private method of another class
      * in the same top-level declaration.
@@ -313,6 +371,43 @@
      * which can transform a lookup on {@code C.E} into one on any of those other
      * classes, without special elevation of privilege.
      * <p>
+     * The accesses permitted to a given lookup object may be limited,
+     * according to its set of {@link #lookupModes lookupModes},
+     * to a subset of members normally accessible to the lookup class.
+     * For example, the {@link MethodHandles#publicLookup publicLookup}
+     * method produces a lookup object which is only allowed to access
+     * public members in public classes.
+     * The caller sensitive method {@link MethodHandles#lookup lookup}
+     * produces a lookup object with full capabilities relative to
+     * its caller class, to emulate all supported bytecode behaviors.
+     * Also, the {@link Lookup#in Lookup.in} method may produce a lookup object
+     * with fewer access modes than the original lookup object.
+     *
+     * <p style="font-size:smaller;">
+     * <a name="privacc"></a>
+     * <em>Discussion of private access:</em>
+     * We say that a lookup has <em>private access</em>
+     * if its {@linkplain #lookupModes lookup modes}
+     * include the possibility of accessing {@code private} members.
+     * As documented in the relevant methods elsewhere,
+     * only lookups with private access possess the following capabilities:
+     * <ul style="font-size:smaller;">
+     * <li>access private fields, methods, and constructors of the lookup class
+     * <li>create method handles which invoke <a href="MethodHandles.Lookup.html#callsens">caller sensitive</a> methods,
+     *     such as {@code Class.forName}
+     * <li>create method handles which {@link Lookup#findSpecial emulate invokespecial} instructions
+     * <li>avoid <a href="MethodHandles.Lookup.html#secmgr">package access checks</a>
+     *     for classes accessible to the lookup class
+     * <li>create {@link Lookup#in delegated lookup objects} which have private access to other classes
+     *     within the same package member
+     * </ul>
+     * <p style="font-size:smaller;">
+     * Each of these permissions is a consequence of the fact that a lookup object
+     * with private access can be securely traced back to an originating class,
+     * whose <a href="MethodHandles.Lookup.html#equiv">bytecode behaviors</a> and Java language access permissions
+     * can be reliably determined and emulated by method handles.
+     *
+     * <h1><a name="secmgr"></a>Security manager interactions</h1>
      * Although bytecode instructions can only refer to classes in
      * a related class loader, this API can search for methods in any
      * class, as long as a reference to its {@code Class} object is
@@ -325,16 +420,6 @@
      * and the Core Reflection API
      * (as found on {@link java.lang.Class Class}).
      * <p>
-     * Access checks only apply to named and reflected methods,
-     * constructors, and fields.
-     * Other method handle creation methods, such as
-     * {@link MethodHandle#asType MethodHandle.asType},
-     * do not require any access checks, and are done
-     * with static methods of {@link MethodHandles},
-     * independently of any {@code Lookup} object.
-     *
-     * <h1>Security manager interactions</h1>
-     * <a name="secmgr"></a>
      * If a security manager is present, member lookups are subject to
      * additional checks.
      * From one to three calls are made to the security manager.
@@ -347,26 +432,79 @@
      * member is actually defined.
      * The value {@code lookc} is defined as <em>not present</em>
      * if the current lookup object does not have
-     * {@linkplain java.lang.invoke.MethodHandles.Lookup#PRIVATE private access}.
+     * <a href="MethodHandles.Lookup.html#privacc">private access</a>.
      * The calls are made according to the following rules:
      * <ul>
-     * <li>If {@code lookc} is not present, or if its class loader is not
+     * <li><b>Step 1:</b>
+     *     If {@code lookc} is not present, or if its class loader is not
      *     the same as or an ancestor of the class loader of {@code refc},
      *     then {@link SecurityManager#checkPackageAccess
      *     smgr.checkPackageAccess(refcPkg)} is called,
      *     where {@code refcPkg} is the package of {@code refc}.
-     * <li>If the retrieved member is not public and
+     * <li><b>Step 2:</b>
+     *     If the retrieved member is not public and
      *     {@code lookc} is not present, then
      *     {@link SecurityManager#checkPermission smgr.checkPermission}
      *     with {@code RuntimePermission("accessDeclaredMembers")} is called.
-     * <li>If the retrieved member is not public,
+     * <li><b>Step 3:</b>
+     *     If the retrieved member is not public,
+     *     and if {@code lookc} is not present,
      *     and if {@code defc} and {@code refc} are different,
      *     then {@link SecurityManager#checkPackageAccess
      *     smgr.checkPackageAccess(defcPkg)} is called,
      *     where {@code defcPkg} is the package of {@code defc}.
      * </ul>
+     * Security checks are performed after other access checks have passed.
+     * Therefore, the above rules presuppose a member that is public,
+     * or else that is being accessed from a lookup class that has
+     * rights to access the member.
+     *
+     * <h1><a name="callsens"></a>Caller sensitive methods</h1>
+     * A small number of Java methods have a special property called caller sensitivity.
+     * A <em>caller-sensitive</em> method can behave differently depending on the
+     * identity of its immediate caller.
+     * <p>
+     * If a method handle for a caller-sensitive method is requested,
+     * the general rules for <a href="MethodHandles.Lookup.html#equiv">bytecode behaviors</a> apply,
+     * but they take account of the lookup class in a special way.
+     * The resulting method handle behaves as if it were called
+     * from an instruction contained in the lookup class,
+     * so that the caller-sensitive method detects the lookup class.
+     * (By contrast, the invoker of the method handle is disregarded.)
+     * Thus, in the case of caller-sensitive methods,
+     * different lookup classes may give rise to
+     * differently behaving method handles.
+     * <p>
+     * In cases where the lookup object is
+     * {@link MethodHandles#publicLookup() publicLookup()},
+     * or some other lookup object without
+     * <a href="MethodHandles.Lookup.html#privacc">private access</a>,
+     * the lookup class is disregarded.
+     * In such cases, no caller-sensitive method handle can be created,
+     * access is forbidden, and the lookup fails with an
+     * {@code IllegalAccessException}.
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
+     * For example, the caller-sensitive method
+     * {@link java.lang.Class#forName(String) Class.forName(x)}
+     * can return varying classes or throw varying exceptions,
+     * depending on the class loader of the class that calls it.
+     * A public lookup of {@code Class.forName} will fail, because
+     * there is no reasonable way to determine its bytecode behavior.
+     * <p style="font-size:smaller;">
+     * If an application caches method handles for broad sharing,
+     * it should use {@code publicLookup()} to create them.
+     * If there is a lookup of {@code Class.forName}, it will fail,
+     * and the application must take appropriate action in that case.
+     * It may be that a later lookup, perhaps during the invocation of a
+     * bootstrap method, can incorporate the specific identity
+     * of the caller, making the method accessible.
+     * <p style="font-size:smaller;">
+     * The function {@code MethodHandles.lookup} is caller sensitive
+     * so that there can be a secure foundation for lookups.
+     * Nearly all other methods in the JSR 292 API rely on lookup
+     * objects to check access requests.
      */
-    // FIXME in MR1: clarify that the bytecode behavior of a caller-ID method (like Class.forName) is relative to the lookupClass used to create the method handle, not the dynamic caller of the method handle
     public static final
     class Lookup {
         /** The class on behalf of whom the lookup is being performed. */
@@ -592,13 +730,23 @@
          * (Since static methods do not take receivers, there is no
          * additional receiver argument inserted into the method handle type,
          * as there would be with {@link #findVirtual findVirtual} or {@link #findSpecial findSpecial}.)
-         * The method and all its argument types must be accessible to the lookup class.
-         * If the method's class has not yet been initialized, that is done
-         * immediately, before the method handle is returned.
+         * The method and all its argument types must be accessible to the lookup object.
          * <p>
          * The returned method handle will have
          * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
          * the method's variable arity modifier bit ({@code 0x0080}) is set.
+         * <p>
+         * If the returned method handle is invoked, the method's class will
+         * be initialized, if it has not already been initialized.
+         * <p><b>Example:</b>
+         * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle MH_asList = publicLookup().findStatic(Arrays.class,
+  "asList", methodType(List.class, Object[].class));
+assertEquals("[x, y]", MH_asList.invoke("x", "y").toString());
+         * }</pre></blockquote>
          * @param refc the class from which the method is accessed
          * @param name the name of the method
          * @param type the type of the method
@@ -615,7 +763,6 @@
         public
         MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
             MemberName method = resolveOrFail(REF_invokeStatic, refc, name, type);
-            checkSecurityManager(refc, method);
             return getDirectMethod(REF_invokeStatic, refc, method, findBoundCallerClass(method));
         }
 
@@ -623,7 +770,7 @@
          * Produces a method handle for a virtual method.
          * The type of the method handle will be that of the method,
          * with the receiver type (usually {@code refc}) prepended.
-         * The method and all its argument types must be accessible to the lookup class.
+         * The method and all its argument types must be accessible to the lookup object.
          * <p>
          * When called, the handle will treat the first argument as a receiver
          * and dispatch on the receiver's type to determine which method
@@ -640,7 +787,7 @@
          * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
          * the method's variable arity modifier bit ({@code 0x0080}) is set.
          * <p>
-         * Because of the general equivalence between {@code invokevirtual}
+         * Because of the general <a href="MethodHandles.Lookup.html#equiv">equivalence</a> between {@code invokevirtual}
          * instructions and method handles produced by {@code findVirtual},
          * if the class is {@code MethodHandle} and the name string is
          * {@code invokeExact} or {@code invoke}, the resulting
@@ -649,6 +796,34 @@
          * {@link java.lang.invoke.MethodHandles#invoker MethodHandles.invoker}
          * with the same {@code type} argument.
          *
+         * <b>Example:</b>
+         * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle MH_concat = publicLookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+MethodHandle MH_hashCode = publicLookup().findVirtual(Object.class,
+  "hashCode", methodType(int.class));
+MethodHandle MH_hashCode_String = publicLookup().findVirtual(String.class,
+  "hashCode", methodType(int.class));
+assertEquals("xy", (String) MH_concat.invokeExact("x", "y"));
+assertEquals("xy".hashCode(), (int) MH_hashCode.invokeExact((Object)"xy"));
+assertEquals("xy".hashCode(), (int) MH_hashCode_String.invokeExact("xy"));
+// interface method:
+MethodHandle MH_subSequence = publicLookup().findVirtual(CharSequence.class,
+  "subSequence", methodType(CharSequence.class, int.class, int.class));
+assertEquals("def", MH_subSequence.invoke("abcdefghi", 3, 6).toString());
+// constructor "internal method" must be accessed differently:
+MethodType MT_newString = methodType(void.class); //()V for new String()
+try { assertEquals("impossible", lookup()
+        .findVirtual(String.class, "<init>", MT_newString));
+ } catch (NoSuchMethodException ex) { } // OK
+MethodHandle MH_newString = publicLookup()
+  .findConstructor(String.class, MT_newString);
+assertEquals("", (String) MH_newString.invokeExact());
+         * }</pre></blockquote>
+         *
          * @param refc the class or interface from which the method is accessed
          * @param name the name of the method
          * @param type the type of the method, with the receiver argument omitted
@@ -669,7 +844,6 @@
             }
             byte refKind = (refc.isInterface() ? REF_invokeInterface : REF_invokeVirtual);
             MemberName method = resolveOrFail(refKind, refc, name, type);
-            checkSecurityManager(refc, method);
             return getDirectMethod(refKind, refc, method, findBoundCallerClass(method));
         }
         private MethodHandle findVirtualForMH(String name, MethodType type) {
@@ -687,16 +861,35 @@
          * the constructor of the specified type.
          * The parameter types of the method handle will be those of the constructor,
          * while the return type will be a reference to the constructor's class.
-         * The constructor and all its argument types must be accessible to the lookup class.
-         * If the constructor's class has not yet been initialized, that is done
-         * immediately, before the method handle is returned.
+         * The constructor and all its argument types must be accessible to the lookup object.
          * <p>
-         * Note:  The requested type must have a return type of {@code void}.
-         * This is consistent with the JVM's treatment of constructor type descriptors.
+         * The requested type must have a return type of {@code void}.
+         * (This is consistent with the JVM's treatment of constructor type descriptors.)
          * <p>
          * The returned method handle will have
          * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
          * the constructor's variable arity modifier bit ({@code 0x0080}) is set.
+         * <p>
+         * If the returned method handle is invoked, the constructor's class will
+         * be initialized, if it has not already been initialized.
+         * <p><b>Example:</b>
+         * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle MH_newArrayList = publicLookup().findConstructor(
+  ArrayList.class, methodType(void.class, Collection.class));
+Collection orig = Arrays.asList("x", "y");
+Collection copy = (ArrayList) MH_newArrayList.invokeExact(orig);
+assert(orig != copy);
+assertEquals(orig, copy);
+// a variable-arity constructor:
+MethodHandle MH_newProcessBuilder = publicLookup().findConstructor(
+  ProcessBuilder.class, methodType(void.class, String[].class));
+ProcessBuilder pb = (ProcessBuilder)
+  MH_newProcessBuilder.invoke("x", "y", "z");
+assertEquals("[x, y, z]", pb.command().toString());
+         * }</pre></blockquote>
          * @param refc the class or interface from which the method is accessed
          * @param type the type of the method, with the receiver argument omitted, and a void return type
          * @return the desired method handle
@@ -711,31 +904,68 @@
         public MethodHandle findConstructor(Class<?> refc, MethodType type) throws NoSuchMethodException, IllegalAccessException {
             String name = "<init>";
             MemberName ctor = resolveOrFail(REF_newInvokeSpecial, refc, name, type);
-            checkSecurityManager(refc, ctor);
             return getDirectConstructor(refc, ctor);
         }
 
         /**
-         * Produces an early-bound method handle for a virtual method,
-         * as if called from an {@code invokespecial}
-         * instruction from {@code caller}.
+         * Produces an early-bound method handle for a virtual method.
+         * It will bypass checks for overriding methods on the receiver,
+         * <a href="MethodHandles.Lookup.html#equiv">as if called</a> from an {@code invokespecial}
+         * instruction from within the explicitly specified {@code specialCaller}.
          * The type of the method handle will be that of the method,
-         * with a suitably restricted receiver type (such as {@code caller}) prepended.
+         * with a suitably restricted receiver type prepended.
+         * (The receiver type will be {@code specialCaller} or a subtype.)
          * The method and all its argument types must be accessible
-         * to the caller.
+         * to the lookup object.
          * <p>
-         * When called, the handle will treat the first argument as a receiver,
-         * but will not dispatch on the receiver's type.
-         * (This direct invocation action is identical with that performed by an
-         * {@code invokespecial} instruction.)
-         * <p>
-         * If the explicitly specified caller class is not identical with the
-         * lookup class, or if this lookup object does not have private access
+         * Before method resolution,
+         * if the explicitly specified caller class is not identical with the
+         * lookup class, or if this lookup object does not have
+         * <a href="MethodHandles.Lookup.html#privacc">private access</a>
          * privileges, the access fails.
          * <p>
          * The returned method handle will have
          * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
          * the method's variable arity modifier bit ({@code 0x0080}) is set.
+         * <p style="font-size:smaller;">
+         * <em>(Note:  JVM internal methods named {@code "<init>"} are not visible to this API,
+         * even though the {@code invokespecial} instruction can refer to them
+         * in special circumstances.  Use {@link #findConstructor findConstructor}
+         * to access instance initialization methods in a safe manner.)</em>
+         * <p><b>Example:</b>
+         * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+static class Listie extends ArrayList {
+  public String toString() { return "[wee Listie]"; }
+  static Lookup lookup() { return MethodHandles.lookup(); }
+}
+...
+// no access to constructor via invokeSpecial:
+MethodHandle MH_newListie = Listie.lookup()
+  .findConstructor(Listie.class, methodType(void.class));
+Listie l = (Listie) MH_newListie.invokeExact();
+try { assertEquals("impossible", Listie.lookup().findSpecial(
+        Listie.class, "<init>", methodType(void.class), Listie.class));
+ } catch (NoSuchMethodException ex) { } // OK
+// access to super and self methods via invokeSpecial:
+MethodHandle MH_super = Listie.lookup().findSpecial(
+  ArrayList.class, "toString" , methodType(String.class), Listie.class);
+MethodHandle MH_this = Listie.lookup().findSpecial(
+  Listie.class, "toString" , methodType(String.class), Listie.class);
+MethodHandle MH_duper = Listie.lookup().findSpecial(
+  Object.class, "toString" , methodType(String.class), Listie.class);
+assertEquals("[]", (String) MH_super.invokeExact(l));
+assertEquals(""+l, (String) MH_this.invokeExact(l));
+assertEquals("[]", (String) MH_duper.invokeExact(l)); // ArrayList method
+try { assertEquals("inaccessible", Listie.lookup().findSpecial(
+        String.class, "toString", methodType(String.class), Listie.class));
+ } catch (IllegalAccessException ex) { } // OK
+Listie subl = new Listie() { public String toString() { return "[subclass]"; } };
+assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method
+         * }</pre></blockquote>
+         *
          * @param refc the class or interface from which the method is accessed
          * @param name the name of the method (which must not be "&lt;init&gt;")
          * @param type the type of the method, with the receiver argument omitted
@@ -754,7 +984,6 @@
             checkSpecialCaller(specialCaller);
             Lookup specialLookup = this.in(specialCaller);
             MemberName method = specialLookup.resolveOrFail(REF_invokeSpecial, refc, name, type);
-            checkSecurityManager(refc, method);
             return specialLookup.getDirectMethod(REF_invokeSpecial, refc, method, findBoundCallerClass(method));
         }
 
@@ -777,7 +1006,6 @@
          */
         public MethodHandle findGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
             MemberName field = resolveOrFail(REF_getField, refc, name, type);
-            checkSecurityManager(refc, field);
             return getDirectField(REF_getField, refc, field);
         }
 
@@ -800,7 +1028,6 @@
          */
         public MethodHandle findSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
             MemberName field = resolveOrFail(REF_putField, refc, name, type);
-            checkSecurityManager(refc, field);
             return getDirectField(REF_putField, refc, field);
         }
 
@@ -810,6 +1037,9 @@
          * value type.
          * The method handle will take no arguments.
          * Access checking is performed immediately on behalf of the lookup class.
+         * <p>
+         * If the returned method handle is invoked, the field's class will
+         * be initialized, if it has not already been initialized.
          * @param refc the class or interface from which the method is accessed
          * @param name the field's name
          * @param type the field's type
@@ -822,7 +1052,6 @@
          */
         public MethodHandle findStaticGetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
             MemberName field = resolveOrFail(REF_getStatic, refc, name, type);
-            checkSecurityManager(refc, field);
             return getDirectField(REF_getStatic, refc, field);
         }
 
@@ -832,6 +1061,9 @@
          * The method handle will take a single
          * argument, of the field's value type, the value to be stored.
          * Access checking is performed immediately on behalf of the lookup class.
+         * <p>
+         * If the returned method handle is invoked, the field's class will
+         * be initialized, if it has not already been initialized.
          * @param refc the class or interface from which the method is accessed
          * @param name the field's name
          * @param type the field's type
@@ -844,7 +1076,6 @@
          */
         public MethodHandle findStaticSetter(Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
             MemberName field = resolveOrFail(REF_putStatic, refc, name, type);
-            checkSecurityManager(refc, field);
             return getDirectField(REF_putStatic, refc, field);
         }
 
@@ -852,7 +1083,7 @@
          * Produces an early-bound method handle for a non-static method.
          * The receiver must have a supertype {@code defc} in which a method
          * of the given name and type is accessible to the lookup class.
-         * The method and all its argument types must be accessible to the lookup class.
+         * The method and all its argument types must be accessible to the lookup object.
          * The type of the method handle will be that of the method,
          * without any insertion of an additional receiver parameter.
          * The given receiver will be bound into the method handle,
@@ -867,17 +1098,17 @@
          * the given receiver value will be bound to it.)
          * <p>
          * This is equivalent to the following code:
-         * <blockquote><pre>
+         * <blockquote><pre>{@code
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 ...
-MethodHandle mh0 = lookup().{@link #findVirtual findVirtual}(defc, name, type);
-MethodHandle mh1 = mh0.{@link MethodHandle#bindTo bindTo}(receiver);
+MethodHandle mh0 = lookup().findVirtual(defc, name, type);
+MethodHandle mh1 = mh0.bindTo(receiver);
 MethodType mt1 = mh1.type();
 if (mh0.isVarargsCollector())
   mh1 = mh1.asVarargsCollector(mt1.parameterType(mt1.parameterCount()-1));
 return mh1;
-         * </pre></blockquote>
+         * }</pre></blockquote>
          * where {@code defc} is either {@code receiver.getClass()} or a super
          * type of that class, in which the requested method is accessible
          * to the lookup class.
@@ -893,17 +1124,19 @@
          * @exception SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws NullPointerException if any argument is null
+         * @see MethodHandle#bindTo
+         * @see #findVirtual
          */
         public MethodHandle bind(Object receiver, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
             Class<? extends Object> refc = receiver.getClass(); // may get NPE
             MemberName method = resolveOrFail(REF_invokeSpecial, refc, name, type);
-            checkSecurityManager(refc, method);
             MethodHandle mh = getDirectMethodNoRestrict(REF_invokeSpecial, refc, method, findBoundCallerClass(method));
             return mh.bindReceiver(receiver).setVarargs(method);
         }
 
         /**
-         * Makes a direct method handle to <i>m</i>, if the lookup class has permission.
+         * Makes a <a href="MethodHandleInfo.html#directmh">direct method handle</a>
+         * to <i>m</i>, if the lookup class has permission.
          * If <i>m</i> is non-static, the receiver argument is treated as an initial argument.
          * If <i>m</i> is virtual, overriding is respected on every call.
          * Unlike the Core Reflection API, exceptions are <em>not</em> wrapped.
@@ -916,6 +1149,10 @@
          * The returned method handle will have
          * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
          * the method's variable arity modifier bit ({@code 0x0080}) is set.
+         * <p>
+         * If <i>m</i> is static, and
+         * if the returned method handle is invoked, the method's class will
+         * be initialized, if it has not already been initialized.
          * @param m the reflected method
          * @return a method handle which can invoke the reflected method
          * @throws IllegalAccessException if access checking fails
@@ -934,7 +1171,7 @@
                 refKind = REF_invokeVirtual;
             assert(method.isMethod());
             Lookup lookup = m.isAccessible() ? IMPL_LOOKUP : this;
-            return lookup.getDirectMethod(refKind, method.getDeclaringClass(), method, findBoundCallerClass(method));
+            return lookup.getDirectMethodNoSecurityManager(refKind, method.getDeclaringClass(), method, findBoundCallerClass(method));
         }
         private MethodHandle unreflectForMH(Method m) {
             // these names require special lookups because they throw UnsupportedOperationException
@@ -946,13 +1183,21 @@
         /**
          * Produces a method handle for a reflected method.
          * It will bypass checks for overriding methods on the receiver,
-         * as if by a {@code invokespecial} instruction from within the {@code specialCaller}.
+         * <a href="MethodHandles.Lookup.html#equiv">as if called</a> from an {@code invokespecial}
+         * instruction from within the explicitly specified {@code specialCaller}.
          * The type of the method handle will be that of the method,
-         * with the special caller type prepended (and <em>not</em> the receiver of the method).
+         * with a suitably restricted receiver type prepended.
+         * (The receiver type will be {@code specialCaller} or a subtype.)
          * If the method's {@code accessible} flag is not set,
          * access checking is performed immediately on behalf of the lookup class,
          * as if {@code invokespecial} instruction were being linked.
          * <p>
+         * Before method resolution,
+         * if the explicitly specified caller class is not identical with the
+         * lookup class, or if this lookup object does not have
+         * <a href="MethodHandles.Lookup.html#privacc">private access</a>
+         * privileges, the access fails.
+         * <p>
          * The returned method handle will have
          * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
          * the method's variable arity modifier bit ({@code 0x0080}) is set.
@@ -970,7 +1215,7 @@
             MemberName method = new MemberName(m, true);
             assert(method.isMethod());
             // ignore m.isAccessible:  this is a new kind of access
-            return specialLookup.getDirectMethod(REF_invokeSpecial, method.getDeclaringClass(), method, findBoundCallerClass(method));
+            return specialLookup.getDirectMethodNoSecurityManager(REF_invokeSpecial, method.getDeclaringClass(), method, findBoundCallerClass(method));
         }
 
         /**
@@ -987,6 +1232,9 @@
          * The returned method handle will have
          * {@linkplain MethodHandle#asVarargsCollector variable arity} if and only if
          * the constructor's variable arity modifier bit ({@code 0x0080}) is set.
+         * <p>
+         * If the returned method handle is invoked, the constructor's class will
+         * be initialized, if it has not already been initialized.
          * @param c the reflected constructor
          * @return a method handle which can invoke the reflected constructor
          * @throws IllegalAccessException if access checking fails
@@ -994,12 +1242,11 @@
          *                                is set and {@code asVarargsCollector} fails
          * @throws NullPointerException if the argument is null
          */
-        @SuppressWarnings("rawtypes")  // Will be Constructor<?> after JSR 292 MR
-        public MethodHandle unreflectConstructor(Constructor c) throws IllegalAccessException {
+        public MethodHandle unreflectConstructor(Constructor<?> c) throws IllegalAccessException {
             MemberName ctor = new MemberName(c);
             assert(ctor.isConstructor());
             Lookup lookup = c.isAccessible() ? IMPL_LOOKUP : this;
-            return lookup.getDirectConstructor(ctor.getDeclaringClass(), ctor);
+            return lookup.getDirectConstructorNoSecurityManager(ctor.getDeclaringClass(), ctor);
         }
 
         /**
@@ -1011,6 +1258,10 @@
          * the field.
          * If the field's {@code accessible} flag is not set,
          * access checking is performed immediately on behalf of the lookup class.
+         * <p>
+         * If the field is static, and
+         * if the returned method handle is invoked, the field's class will
+         * be initialized, if it has not already been initialized.
          * @param f the reflected field
          * @return a method handle which can load values from the reflected field
          * @throws IllegalAccessException if access checking fails
@@ -1025,7 +1276,7 @@
                     ? MethodHandleNatives.refKindIsSetter(field.getReferenceKind())
                     : MethodHandleNatives.refKindIsGetter(field.getReferenceKind()));
             Lookup lookup = f.isAccessible() ? IMPL_LOOKUP : this;
-            return lookup.getDirectField(field.getReferenceKind(), f.getDeclaringClass(), field);
+            return lookup.getDirectFieldNoSecurityManager(field.getReferenceKind(), f.getDeclaringClass(), field);
         }
 
         /**
@@ -1037,6 +1288,10 @@
          * the field, and the value to be stored.
          * If the field's {@code accessible} flag is not set,
          * access checking is performed immediately on behalf of the lookup class.
+         * <p>
+         * If the field is static, and
+         * if the returned method handle is invoked, the field's class will
+         * be initialized, if it has not already been initialized.
          * @param f the reflected field
          * @return a method handle which can store values into the reflected field
          * @throws IllegalAccessException if access checking fails
@@ -1047,17 +1302,21 @@
         }
 
         /**
-         * Cracks a direct method handle created by this lookup object or a similar one.
+         * Cracks a <a href="MethodHandleInfo.html#directmh">direct method handle</a>
+         * created by this lookup object or a similar one.
          * Security and access checks are performed to ensure that this lookup object
          * is capable of reproducing the target method handle.
          * This means that the cracking may fail if target is a direct method handle
          * but was created by an unrelated lookup object.
+         * This can happen if the method handle is <a href="MethodHandles.Lookup.html#callsens">caller sensitive</a>
+         * and was created by a lookup object for a different class.
          * @param target a direct method handle to crack into symbolic reference components
          * @return a symbolic reference which can be used to reconstruct this method handle from this lookup object
          * @exception SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
          * @throws IllegalArgumentException if the target is not a direct method handle or if access checking fails
          * @exception NullPointerException if the target is {@code null}
+         * @see MethodHandleInfo
          * @since 1.8
          */
         public MethodHandleInfo revealDirect(MethodHandle target) {
@@ -1077,11 +1336,16 @@
                 refKind = REF_invokeInterface;
             // Check SM permissions and member access before cracking.
             try {
+                checkAccess(refKind, defc, member);
                 checkSecurityManager(defc, member);
-                checkAccess(refKind, defc, member);
             } catch (IllegalAccessException ex) {
                 throw new IllegalArgumentException(ex);
             }
+            if (allowedModes != TRUSTED && member.isCallerSensitive()) {
+                Class<?> callerClass = target.internalCallerClass();
+                if (!hasPrivateAccess() || callerClass != lookupClass())
+                    throw new IllegalArgumentException("method handle is caller sensitive: "+callerClass);
+            }
             // Produce the handle to the results.
             return new InfoFromMemberName(this, member, refKind);
         }
@@ -1090,24 +1354,43 @@
 
         MemberName resolveOrFail(byte refKind, Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
             checkSymbolicClass(refc);  // do this before attempting to resolve
-            name.getClass(); type.getClass();  // NPE
+            name.getClass();  // NPE
+            type.getClass();  // NPE
             return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(),
                                             NoSuchFieldException.class);
         }
 
         MemberName resolveOrFail(byte refKind, Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
             checkSymbolicClass(refc);  // do this before attempting to resolve
-            name.getClass(); type.getClass();  // NPE
+            name.getClass();  // NPE
+            type.getClass();  // NPE
+            checkMethodName(refKind, name);  // NPE check on name
             return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(),
                                             NoSuchMethodException.class);
         }
 
+        MemberName resolveOrFail(byte refKind, MemberName member) throws ReflectiveOperationException {
+            checkSymbolicClass(member.getDeclaringClass());  // do this before attempting to resolve
+            member.getName().getClass();  // NPE
+            member.getType().getClass();  // NPE
+            return IMPL_NAMES.resolveOrFail(refKind, member, lookupClassOrNull(),
+                                            ReflectiveOperationException.class);
+        }
+
         void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
+            refc.getClass();  // NPE
             Class<?> caller = lookupClassOrNull();
             if (caller != null && !VerifyAccess.isClassAccessible(refc, caller, allowedModes))
                 throw new MemberName(refc).makeAccessException("symbolic reference class is not public", this);
         }
 
+        /** Check name for an illegal leading "&lt;" character. */
+        void checkMethodName(byte refKind, String name) throws NoSuchMethodException {
+            if (name.startsWith("<") && refKind != REF_newInvokeSpecial)
+                throw new NoSuchMethodException("illegal method name: "+name);
+        }
+
+
         /**
          * Find my trustable caller class if m is a caller sensitive method.
          * If this lookup object has private access, then the caller class is the lookupClass.
@@ -1116,8 +1399,8 @@
         Class<?> findBoundCallerClass(MemberName m) throws IllegalAccessException {
             Class<?> callerClass = null;
             if (MethodHandleNatives.isCallerSensitive(m)) {
-                // Only full-power lookup is allowed to resolve caller-sensitive methods
-                if (isFullPowerLookup()) {
+                // Only lookups with private access are allowed to resolve caller-sensitive methods
+                if (hasPrivateAccess()) {
                     callerClass = lookupClass;
                 } else {
                     throw new IllegalAccessException("Attempt to lookup caller-sensitive method using restricted lookup object");
@@ -1126,7 +1409,7 @@
             return callerClass;
         }
 
-        private boolean isFullPowerLookup() {
+        private boolean hasPrivateAccess() {
             return (allowedModes & PRIVATE) != 0;
         }
 
@@ -1141,22 +1424,21 @@
             if (allowedModes == TRUSTED)  return;
 
             // Step 1:
-            if (!isFullPowerLookup() ||
+            boolean fullPowerLookup = hasPrivateAccess();
+            if (!fullPowerLookup ||
                 !VerifyAccess.classLoaderIsAncestor(lookupClass, refc)) {
                 ReflectUtil.checkPackageAccess(refc);
             }
 
             // Step 2:
             if (m.isPublic()) return;
-            Class<?> defc = m.getDeclaringClass();
-            {
-                if (!isFullPowerLookup()) {
-                    smgr.checkPermission(SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION);
-                }
+            if (!fullPowerLookup) {
+                smgr.checkPermission(SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION);
             }
 
             // Step 3:
-            if (defc != refc) {
+            Class<?> defc = m.getDeclaringClass();
+            if (!fullPowerLookup && defc != refc) {
                 ReflectUtil.checkPackageAccess(defc);
             }
         }
@@ -1185,6 +1467,7 @@
             throw m.makeAccessException(message, this);
         }
 
+        /** Check public/protected/private bits on the symbolic reference class and its member. */
         void checkAccess(byte refKind, Class<?> refc, MemberName m) throws IllegalAccessException {
             assert(m.referenceKindIsConsistentWith(refKind) &&
                    MethodHandleNatives.refKindIsValid(refKind) &&
@@ -1192,6 +1475,26 @@
             int allowedModes = this.allowedModes;
             if (allowedModes == TRUSTED)  return;
             int mods = m.getModifiers();
+            if (Modifier.isProtected(mods) &&
+                    refKind == REF_invokeVirtual &&
+                    m.getDeclaringClass() == Object.class &&
+                    m.getName().equals("clone") &&
+                    refc.isArray()) {
+                // The JVM does this hack also.
+                // (See ClassVerifier::verify_invoke_instructions
+                // and LinkResolver::check_method_accessability.)
+                // Because the JVM does not allow separate methods on array types,
+                // there is no separate method for int[].clone.
+                // All arrays simply inherit Object.clone.
+                // But for access checking logic, we make Object.clone
+                // (normally protected) appear to be public.
+                // Later on, when the DirectMethodHandle is created,
+                // its leading argument will be restricted to the
+                // requested array type.
+                // N.B. The return type is not adjusted, because
+                // that is *not* the bytecode behavior.
+                mods ^= Modifier.PROTECTED | Modifier.PUBLIC;
+            }
             if (Modifier.isFinal(mods) &&
                     MethodHandleNatives.refKindIsSetter(refKind))
                 throw m.makeAccessException("unexpected set of a final field", this);
@@ -1239,7 +1542,7 @@
         private void checkSpecialCaller(Class<?> specialCaller) throws IllegalAccessException {
             int allowedModes = this.allowedModes;
             if (allowedModes == TRUSTED)  return;
-            if ((allowedModes & PRIVATE) == 0
+            if (!hasPrivateAccess()
                 || (specialCaller != lookupClass()
                     && !(ALLOW_NESTMATE_ACCESS &&
                          VerifyAccess.isSamePackageMember(specialCaller, lookupClass()))))
@@ -1271,18 +1574,32 @@
             return mh.viewAsType(narrowType);
         }
 
+        /** Check access and get the requested method. */
         private MethodHandle getDirectMethod(byte refKind, Class<?> refc, MemberName method, Class<?> callerClass) throws IllegalAccessException {
-            return getDirectMethodCommon(refKind, refc, method,
-                    (refKind == REF_invokeSpecial ||
-                        (MethodHandleNatives.refKindHasReceiver(refKind) &&
-                            restrictProtectedReceiver(method))), callerClass);
+            final boolean doRestrict    = true;
+            final boolean checkSecurity = true;
+            return getDirectMethodCommon(refKind, refc, method, checkSecurity, doRestrict, callerClass);
+        }
+        /** Check access and get the requested method, eliding receiver narrowing rules. */
+        private MethodHandle getDirectMethodNoRestrict(byte refKind, Class<?> refc, MemberName method, Class<?> callerClass) throws IllegalAccessException {
+            final boolean doRestrict    = false;
+            final boolean checkSecurity = true;
+            return getDirectMethodCommon(refKind, refc, method, checkSecurity, doRestrict, callerClass);
         }
-        private MethodHandle getDirectMethodNoRestrict(byte refKind, Class<?> refc, MemberName method, Class<?> callerClass) throws IllegalAccessException {
-            return getDirectMethodCommon(refKind, refc, method, false, callerClass);
+        /** Check access and get the requested method, eliding security manager checks. */
+        private MethodHandle getDirectMethodNoSecurityManager(byte refKind, Class<?> refc, MemberName method, Class<?> callerClass) throws IllegalAccessException {
+            final boolean doRestrict    = true;
+            final boolean checkSecurity = false;  // not needed for reflection or for linking CONSTANT_MH constants
+            return getDirectMethodCommon(refKind, refc, method, checkSecurity, doRestrict, callerClass);
         }
+        /** Common code for all methods; do not call directly except from immediately above. */
         private MethodHandle getDirectMethodCommon(byte refKind, Class<?> refc, MemberName method,
+                                                   boolean checkSecurity,
                                                    boolean doRestrict, Class<?> callerClass) throws IllegalAccessException {
             checkMethod(refKind, refc, method);
+            // Optionally check with the security manager; this isn't needed for unreflect* calls.
+            if (checkSecurity)
+                checkSecurityManager(refc, method);
             assert(!method.isMethodHandleInvoke());
 
             Class<?> refcAsSuper;
@@ -1312,7 +1629,11 @@
             MethodHandle mh = DirectMethodHandle.make(refKind, refc, method);
             mh = maybeBindCaller(method, mh, callerClass);
             mh = mh.setVarargs(method);
-            if (doRestrict)
+            // Optionally narrow the receiver argument to refc using restrictReceiver.
+            if (doRestrict &&
+                   (refKind == REF_invokeSpecial ||
+                       (MethodHandleNatives.refKindHasReceiver(refKind) &&
+                           restrictProtectedReceiver(method))))
                 mh = restrictReceiver(method, mh, lookupClass());
             return mh;
         }
@@ -1322,14 +1643,29 @@
             if (allowedModes == TRUSTED || !MethodHandleNatives.isCallerSensitive(method))
                 return mh;
             Class<?> hostClass = lookupClass;
-            if ((allowedModes & PRIVATE) == 0)  // caller must use full-power lookup
+            if (!hasPrivateAccess())  // caller must have private access
                 hostClass = callerClass;  // callerClass came from a security manager style stack walk
             MethodHandle cbmh = MethodHandleImpl.bindCaller(mh, hostClass);
             // Note: caller will apply varargs after this step happens.
             return cbmh;
         }
+        /** Check access and get the requested field. */
         private MethodHandle getDirectField(byte refKind, Class<?> refc, MemberName field) throws IllegalAccessException {
+            final boolean checkSecurity = true;
+            return getDirectFieldCommon(refKind, refc, field, checkSecurity);
+        }
+        /** Check access and get the requested field, eliding security manager checks. */
+        private MethodHandle getDirectFieldNoSecurityManager(byte refKind, Class<?> refc, MemberName field) throws IllegalAccessException {
+            final boolean checkSecurity = false;  // not needed for reflection or for linking CONSTANT_MH constants
+            return getDirectFieldCommon(refKind, refc, field, checkSecurity);
+        }
+        /** Common code for all fields; do not call directly except from immediately above. */
+        private MethodHandle getDirectFieldCommon(byte refKind, Class<?> refc, MemberName field,
+                                                  boolean checkSecurity) throws IllegalAccessException {
             checkField(refKind, refc, field);
+            // Optionally check with the security manager; this isn't needed for unreflect* calls.
+            if (checkSecurity)
+                checkSecurityManager(refc, field);
             MethodHandle mh = DirectMethodHandle.make(refc, field);
             boolean doRestrict = (MethodHandleNatives.refKindHasReceiver(refKind) &&
                                     restrictProtectedReceiver(field));
@@ -1337,9 +1673,24 @@
                 mh = restrictReceiver(field, mh, lookupClass());
             return mh;
         }
+        /** Check access and get the requested constructor. */
         private MethodHandle getDirectConstructor(Class<?> refc, MemberName ctor) throws IllegalAccessException {
+            final boolean checkSecurity = true;
+            return getDirectConstructorCommon(refc, ctor, checkSecurity);
+        }
+        /** Check access and get the requested constructor, eliding security manager checks. */
+        private MethodHandle getDirectConstructorNoSecurityManager(Class<?> refc, MemberName ctor) throws IllegalAccessException {
+            final boolean checkSecurity = false;  // not needed for reflection or for linking CONSTANT_MH constants
+            return getDirectConstructorCommon(refc, ctor, checkSecurity);
+        }
+        /** Common code for all constructors; do not call directly except from immediately above. */
+        private MethodHandle getDirectConstructorCommon(Class<?> refc, MemberName ctor,
+                                                  boolean checkSecurity) throws IllegalAccessException {
             assert(ctor.isConstructor());
             checkAccess(REF_newInvokeSpecial, refc, ctor);
+            // Optionally check with the security manager; this isn't needed for unreflect* calls.
+            if (checkSecurity)
+                checkSecurityManager(refc, ctor);
             assert(!MethodHandleNatives.isCallerSensitive(ctor));  // maybeBindCaller not relevant here
             return DirectMethodHandle.make(ctor).setVarargs(ctor);
         }
@@ -1348,29 +1699,75 @@
          */
         /*non-public*/
         MethodHandle linkMethodHandleConstant(byte refKind, Class<?> defc, String name, Object type) throws ReflectiveOperationException {
-            MemberName resolved = null;
-            if (type instanceof MemberName) {
-                resolved = (MemberName) type;
-                if (!resolved.isResolved())  throw new InternalError("unresolved MemberName");
-                assert(name == null || name.equals(resolved.getName()));
+            if (!(type instanceof Class || type instanceof MethodType))
+                throw new InternalError("unresolved MemberName");
+            MemberName member = new MemberName(refKind, defc, name, type);
+            MethodHandle mh = LOOKASIDE_TABLE.get(member);
+            if (mh != null) {
+                checkSymbolicClass(defc);
+                return mh;
+            }
+            MemberName resolved = resolveOrFail(refKind, member);
+            mh = getDirectMethodForConstant(refKind, defc, resolved);
+            if (mh instanceof DirectMethodHandle
+                    && canBeCached(refKind, defc, resolved)) {
+                MemberName key = mh.internalMemberName();
+                if (key != null) {
+                    key = key.asNormalOriginal();
+                }
+                if (member.equals(key)) {  // better safe than sorry
+                    LOOKASIDE_TABLE.put(key, (DirectMethodHandle) mh);
+                }
+            }
+            return mh;
+        }
+        private
+        boolean canBeCached(byte refKind, Class<?> defc, MemberName member) {
+            if (refKind == REF_invokeSpecial) {
+                return false;
             }
+            if (!Modifier.isPublic(defc.getModifiers()) ||
+                    !Modifier.isPublic(member.getDeclaringClass().getModifiers()) ||
+                    !member.isPublic() ||
+                    member.isCallerSensitive()) {
+                return false;
+            }
+            ClassLoader loader = defc.getClassLoader();
+            if (!sun.misc.VM.isSystemDomainLoader(loader)) {
+                ClassLoader sysl = ClassLoader.getSystemClassLoader();
+                boolean found = false;
+                while (sysl != null) {
+                    if (loader == sysl) { found = true; break; }
+                    sysl = sysl.getParent();
+                }
+                if (!found) {
+                    return false;
+                }
+            }
+            try {
+                MemberName resolved2 = publicLookup().resolveOrFail(refKind,
+                    new MemberName(refKind, defc, member.getName(), member.getType()));
+                checkSecurityManager(defc, resolved2);
+            } catch (ReflectiveOperationException | SecurityException ex) {
+                return false;
+            }
+            return true;
+        }
+        private
+        MethodHandle getDirectMethodForConstant(byte refKind, Class<?> defc, MemberName member)
+                throws ReflectiveOperationException {
             if (MethodHandleNatives.refKindIsField(refKind)) {
-                MemberName field = (resolved != null) ? resolved
-                        : resolveOrFail(refKind, defc, name, (Class<?>) type);
-                return getDirectField(refKind, defc, field);
+                return getDirectFieldNoSecurityManager(refKind, defc, member);
             } else if (MethodHandleNatives.refKindIsMethod(refKind)) {
-                MemberName method = (resolved != null) ? resolved
-                        : resolveOrFail(refKind, defc, name, (MethodType) type);
-                return getDirectMethod(refKind, defc, method, lookupClass);
+                return getDirectMethodNoSecurityManager(refKind, defc, member, lookupClass);
             } else if (refKind == REF_newInvokeSpecial) {
-                assert(name == null || name.equals("<init>"));
-                MemberName ctor = (resolved != null) ? resolved
-                        : resolveOrFail(REF_newInvokeSpecial, defc, name, (MethodType) type);
-                return getDirectConstructor(defc, ctor);
+                return getDirectConstructorNoSecurityManager(defc, member);
             }
             // oops
-            throw new ReflectiveOperationException("bad MethodHandle constant #"+refKind+" "+name+" : "+type);
+            throw newIllegalArgumentException("bad MethodHandle constant #"+member);
         }
+
+        static ConcurrentHashMap<MemberName, DirectMethodHandle> LOOKASIDE_TABLE = new ConcurrentHashMap<>();
     }
 
     /**
@@ -1430,22 +1827,26 @@
      * <p>
      * Before invoking its target, the invoker will spread the final array, apply
      * reference casts as necessary, and unbox and widen primitive arguments.
+     * If, when the invoker is called, the supplied array argument does
+     * not have the correct number of elements, the invoker will throw
+     * an {@link IllegalArgumentException} instead of invoking the target.
      * <p>
      * This method is equivalent to the following code (though it may be more efficient):
-     * <p><blockquote><pre>
+     * <blockquote><pre>{@code
 MethodHandle invoker = MethodHandles.invoker(type);
 int spreadArgCount = type.parameterCount() - leadingArgCount;
 invoker = invoker.asSpreader(Object[].class, spreadArgCount);
 return invoker;
-     * </pre></blockquote>
-     * <p>
+     * }</pre></blockquote>
      * This method throws no reflective or security exceptions.
      * @param type the desired target type
      * @param leadingArgCount number of fixed arguments, to be passed unchanged to the target
      * @return a method handle suitable for invoking any method handle of the given type
      * @throws NullPointerException if {@code type} is null
      * @throws IllegalArgumentException if {@code leadingArgCount} is not in
-     *                  the range from 0 to {@code type.parameterCount()} inclusive
+     *                  the range from 0 to {@code type.parameterCount()} inclusive,
+     *                  or if the resulting method handle's type would have
+     *          <a href="MethodHandle.html#maxarity">too many parameters</a>
      */
     static public
     MethodHandle spreadInvoker(MethodType type, int leadingArgCount) {
@@ -1462,9 +1863,7 @@
      * an additional leading argument of type {@code MethodHandle}.
      * <p>
      * This method is equivalent to the following code (though it may be more efficient):
-     * <p><blockquote><pre>
-publicLookup().findVirtual(MethodHandle.class, "invokeExact", type)
-     * </pre></blockquote>
+     * {@code publicLookup().findVirtual(MethodHandle.class, "invokeExact", type)}
      *
      * <p style="font-size:smaller;">
      * <em>Discussion:</em>
@@ -1479,7 +1878,7 @@
      * If spreading, collecting, or other argument transformations are required,
      * they can be applied once to the invoker {@code X} and reused on many {@code M}
      * method handle values, as long as they are compatible with the type of {@code X}.
-     * <p>
+     * <p style="font-size:smaller;">
      * <em>(Note:  The invoker method is not available via the Core Reflection API.
      * An attempt to call {@linkplain java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}
      * on the declared {@code invokeExact} or {@code invoke} method will raise an
@@ -1488,6 +1887,8 @@
      * This method throws no reflective or security exceptions.
      * @param type the desired target type
      * @return a method handle suitable for invoking any method handle of the given type
+     * @throws IllegalArgumentException if the resulting method handle's type would have
+     *          <a href="MethodHandle.html#maxarity">too many parameters</a>
      */
     static public
     MethodHandle exactInvoker(MethodType type) {
@@ -1508,19 +1909,25 @@
      * If the target is a {@linkplain MethodHandle#asVarargsCollector variable arity method handle},
      * the required arity conversion will be made, again as if by {@link MethodHandle#asType asType}.
      * <p>
-     * A {@linkplain MethodType#genericMethodType general method type},
+     * This method is equivalent to the following code (though it may be more efficient):
+     * {@code publicLookup().findVirtual(MethodHandle.class, "invoke", type)}
+     * <p style="font-size:smaller;">
+     * <em>Discussion:</em>
+     * A {@linkplain MethodType#genericMethodType general method type} is one which
      * mentions only {@code Object} arguments and return values.
      * An invoker for such a type is capable of calling any method handle
      * of the same arity as the general type.
-     * <p>
-     * This method is equivalent to the following code (though it may be more efficient):
-     * <p><blockquote><pre>
-publicLookup().findVirtual(MethodHandle.class, "invoke", type)
-     * </pre></blockquote>
+     * <p style="font-size:smaller;">
+     * <em>(Note:  The invoker method is not available via the Core Reflection API.
+     * An attempt to call {@linkplain java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}
+     * on the declared {@code invokeExact} or {@code invoke} method will raise an
+     * {@link java.lang.UnsupportedOperationException UnsupportedOperationException}.)</em>
      * <p>
      * This method throws no reflective or security exceptions.
      * @param type the desired target type
      * @return a method handle suitable for invoking any method handle convertible to the given type
+     * @throws IllegalArgumentException if the resulting method handle's type would have
+     *          <a href="MethodHandle.html#maxarity">too many parameters</a>
      */
     static public
     MethodHandle invoker(MethodType type) {
@@ -1801,7 +2208,7 @@
      * they will come after.
      * <p>
      * <b>Example:</b>
-     * <p><blockquote><pre>
+     * <p><blockquote><pre>{@code
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 ...
@@ -1812,11 +2219,11 @@
 MethodHandle d0 = dropArguments(cat, 0, bigType.parameterList().subList(0,2));
 assertEquals(bigType, d0.type());
 assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * <p>
      * This method is also equivalent to the following code:
      * <p><blockquote><pre>
-     * {@link #dropArguments(MethodHandle,int,Class...) dropArguments}(target, pos, valueTypes.toArray(new Class[0]))
+     * {@link #dropArguments(MethodHandle,int,Class...) dropArguments}{@code (target, pos, valueTypes.toArray(new Class[0]))}
      * </pre></blockquote>
      * @param target the method handle to invoke after the arguments are dropped
      * @param valueTypes the type(s) of the argument(s) to drop
@@ -1859,7 +2266,7 @@
      * they will come after.
      * <p>
      * <b>Example:</b>
-     * <p><blockquote><pre>
+     * <p><blockquote><pre>{@code
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 ...
@@ -1874,11 +2281,11 @@
 assertEquals("xy", (String) d2.invokeExact("x", "y", "z"));
 MethodHandle d12 = dropArguments(cat, 1, int.class, boolean.class);
 assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * <p>
      * This method is also equivalent to the following code:
      * <p><blockquote><pre>
-     * {@link #dropArguments(MethodHandle,int,List) dropArguments}(target, pos, Arrays.asList(valueTypes))
+     * {@link #dropArguments(MethodHandle,int,List) dropArguments}{@code (target, pos, Arrays.asList(valueTypes))}
      * </pre></blockquote>
      * @param target the method handle to invoke after the arguments are dropped
      * @param valueTypes the type(s) of the argument(s) to drop
@@ -1889,7 +2296,8 @@
      *                              or if the {@code valueTypes} array or any of its elements is null
      * @throws IllegalArgumentException if any element of {@code valueTypes} is {@code void.class},
      *                  or if {@code pos} is negative or greater than the arity of the target,
-     *                  or if the new method handle's type would have too many parameters
+     *                  or if the new method handle's type would have
+     *                  <a href="MethodHandle.html#maxarity">too many parameters</a>
      */
     public static
     MethodHandle dropArguments(MethodHandle target, int pos, Class<?>... valueTypes) {
@@ -1923,8 +2331,8 @@
      * It is an error if there are elements of {@code filters}
      * (null or not)
      * which do not correspond to argument positions in the target.
-     * <b>Example:</b>
-     * <p><blockquote><pre>
+     * <p><b>Example:</b>
+     * <p><blockquote><pre>{@code
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 ...
@@ -1939,15 +2347,15 @@
 assertEquals("xY", (String) f1.invokeExact("x", "y")); // xY
 MethodHandle f2 = filterArguments(cat, 0, upcase, upcase);
 assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * <p> Here is pseudocode for the resulting adapter:
-     * <blockquote><pre>
+     * <blockquote><pre>{@code
      * V target(P... p, A[i]... a[i], B... b);
      * A[i] filter[i](V[i]);
      * T adapter(P... p, V[i]... v[i], B... b) {
      *   return target(p..., f[i](v[i])..., b...);
      * }
-     * </pre></blockquote>
+     * }</pre></blockquote>
      *
      * @param target the method handle to invoke after arguments are filtered
      * @param pos the position of the first argument to filter
@@ -1957,7 +2365,9 @@
      *                              or if the {@code filters} array is null
      * @throws IllegalArgumentException if a non-null element of {@code filters}
      *          does not match a corresponding argument type of target as described above,
-     *          or if the {@code pos+filters.length} is greater than {@code target.type().parameterCount()}
+     *          or if the {@code pos+filters.length} is greater than {@code target.type().parameterCount()},
+     *          or if the resulting method handle's type would have
+     *          <a href="MethodHandle.html#maxarity">too many parameters</a>
      */
     public static
     MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
@@ -1989,15 +2399,120 @@
         return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
     }
 
-    // FIXME: Make this public in M1.
-    /*non-public*/ static
-    MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle collector) {
+    /**
+     * Adapts a target method handle by pre-processing
+     * a sub-sequence of its arguments with a filter (another method handle).
+     * The pre-processed arguments are replaced by the result (if any) of the
+     * filter function.
+     * The target is then called on the modified (usually shortened) argument list.
+     * <p>
+     * If the filter returns a value, the target must accept that value as
+     * its argument in position {@code pos}, preceded and/or followed by
+     * any arguments not passed to the filter.
+     * If the filter returns void, the target must accept all arguments
+     * not passed to the filter.
+     * No arguments are reordered, and a result returned from the filter
+     * replaces (in order) the whole subsequence of arguments originally
+     * passed to the adapter.
+     * <p>
+     * The argument types (if any) of the filter
+     * replace zero or one argument types of the target, at position {@code pos},
+     * in the resulting adapted method handle.
+     * The return type of the filter (if any) must be identical to the
+     * argument type of the target at position {@code pos}, and that target argument
+     * is supplied by the return value of the filter.
+     * <p>
+     * In all cases, {@code pos} must be greater than or equal to zero, and
+     * {@code pos} must also be less than or equal to the target's arity.
+     * <p><b>Example:</b>
+     * <p><blockquote><pre>{@code
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+...
+MethodHandle deepToString = publicLookup()
+  .findStatic(Arrays.class, "deepToString", methodType(String.class, Object[].class));
+
+MethodHandle ts1 = deepToString.asCollector(String[].class, 1);
+assertEquals("[strange]", (String) ts1.invokeExact("strange"));
+
+MethodHandle ts2 = deepToString.asCollector(String[].class, 2);
+assertEquals("[up, down]", (String) ts2.invokeExact("up", "down"));
+
+MethodHandle ts3 = deepToString.asCollector(String[].class, 3);
+MethodHandle ts3_ts2 = collectArguments(ts3, 1, ts2);
+assertEquals("[top, [up, down], strange]",
+             (String) ts3_ts2.invokeExact("top", "up", "down", "strange"));
+
+MethodHandle ts3_ts2_ts1 = collectArguments(ts3_ts2, 3, ts1);
+assertEquals("[top, [up, down], [strange]]",
+             (String) ts3_ts2_ts1.invokeExact("top", "up", "down", "strange"));
+
+MethodHandle ts3_ts2_ts3 = collectArguments(ts3_ts2, 1, ts3);
+assertEquals("[top, [[up, down, strange], charm], bottom]",
+             (String) ts3_ts2_ts3.invokeExact("top", "up", "down", "strange", "charm", "bottom"));
+     * }</pre></blockquote>
+     * <p> Here is pseudocode for the resulting adapter:
+     * <blockquote><pre>{@code
+     * T target(A...,V,C...);
+     * V filter(B...);
+     * T adapter(A... a,B... b,C... c) {
+     *   V v = filter(b...);
+     *   return target(a...,v,c...);
+     * }
+     * // and if the filter has no arguments:
+     * T target2(A...,V,C...);
+     * V filter2();
+     * T adapter2(A... a,C... c) {
+     *   V v = filter2();
+     *   return target2(a...,v,c...);
+     * }
+     * // and if the filter has a void return:
+     * T target3(A...,C...);
+     * void filter3(B...);
+     * void adapter3(A... a,B... b,C... c) {
+     *   filter3(b...);
+     *   return target3(a...,c...);
+     * }
+     * }</pre></blockquote>
+     * <p>
+     * A collection adapter {@code collectArguments(mh, 0, coll)} is equivalent to
+     * one which first "folds" the affected arguments, and then drops them, in separate
+     * steps as follows:
+     * <blockquote><pre>{@code
+     * mh = MethodHandles.dropArguments(mh, 1, coll.type().parameterList()); //step 2
+     * mh = MethodHandles.foldArguments(mh, coll); //step 1
+     * }</pre></blockquote>
+     * If the target method handle consumes no arguments besides than the result
+     * (if any) of the filter {@code coll}, then {@code collectArguments(mh, 0, coll)}
+     * is equivalent to {@code filterReturnValue(coll, mh)}.
+     * If the filter method handle {@code coll} consumes one argument and produces
+     * a non-void result, then {@code collectArguments(mh, N, coll)}
+     * is equivalent to {@code filterArguments(mh, N, coll)}.
+     * Other equivalences are possible but would require argument permutation.
+     *
+     * @param target the method handle to invoke after filtering the subsequence of arguments
+     * @param pos the position of the first adapter argument to pass to the filter,
+     *            and/or the target argument which receives the result of the filter
+     * @param filter method handle to call on the subsequence of arguments
+     * @return method handle which incorporates the specified argument subsequence filtering logic
+     * @throws NullPointerException if either argument is null
+     * @throws IllegalArgumentException if the return type of {@code filter}
+     *          is non-void and is not the same as the {@code pos} argument of the target,
+     *          or if {@code pos} is not between 0 and the target's arity, inclusive,
+     *          or if the resulting method handle's type would have
+     *          <a href="MethodHandle.html#maxarity">too many parameters</a>
+     * @see MethodHandles#foldArguments
+     * @see MethodHandles#filterArguments
+     * @see MethodHandles#filterReturnValue
+     */
+    public static
+    MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle filter) {
         MethodType targetType = target.type();
-        MethodType filterType = collector.type();
+        MethodType filterType = filter.type();
         if (filterType.returnType() != void.class &&
             filterType.returnType() != targetType.parameterType(pos))
             throw newIllegalArgumentException("target and filter types do not match", targetType, filterType);
-        return MethodHandleImpl.makeCollectArguments(target, collector, pos, false);
+        return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
     }
 
     /**
@@ -2014,8 +2529,8 @@
      * in the resulting adapted method handle.
      * The argument type of the filter (if any) must be identical to the
      * return type of the target.
-     * <b>Example:</b>
-     * <p><blockquote><pre>
+     * <p><b>Example:</b>
+     * <p><blockquote><pre>{@code
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 ...
@@ -2026,9 +2541,9 @@
 System.out.println((String) cat.invokeExact("x", "y")); // xy
 MethodHandle f0 = filterReturnValue(cat, length);
 System.out.println((int) f0.invokeExact("x", "y")); // 2
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * <p> Here is pseudocode for the resulting adapter:
-     * <blockquote><pre>
+     * <blockquote><pre>{@code
      * V target(A...);
      * T filter(V);
      * T adapter(A... a) {
@@ -2049,7 +2564,7 @@
      *   V v = target3(a...);
      *   filter3(v);
      * }
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * @param target the method handle to invoke before filtering the return value
      * @param filter method handle to call on the return value
      * @return method handle which incorporates the specified return value filtering logic
@@ -2105,8 +2620,8 @@
      * consider using {@link MethodHandle#asCollector asCollector} instead, since those
      * arguments will not need to be live on the stack on entry to the
      * target.)
-     * <b>Example:</b>
-     * <p><blockquote><pre>
+     * <p><b>Example:</b>
+     * <p><blockquote><pre>{@code
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 ...
@@ -2119,9 +2634,9 @@
 MethodHandle catTrace = foldArguments(cat, trace);
 // also prints "boo":
 assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * <p> Here is pseudocode for the resulting adapter:
-     * <blockquote><pre>
+     * <blockquote><pre>{@code
      * // there are N arguments in A...
      * T target(V, A[N]..., B...);
      * V combiner(A...);
@@ -2136,7 +2651,7 @@
      *   combiner2(a...);
      *   return target2(a..., b...);
      * }
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * @param target the method handle to invoke after arguments are combined
      * @param combiner method handle to call initially on the incoming arguments
      * @return method handle which incorporates the specified argument folding logic
@@ -2179,7 +2694,7 @@
      * of the test must be boolean, and the test is allowed
      * to have fewer arguments than the other two method handles.
      * <p> Here is pseudocode for the resulting adapter:
-     * <blockquote><pre>
+     * <blockquote><pre>{@code
      * boolean test(A...);
      * T target(A...,B...);
      * T fallback(A...,B...);
@@ -2189,7 +2704,7 @@
      *   else
      *     return fallback(a..., b...);
      * }
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * Note that the test arguments ({@code a...} in the pseudocode) cannot
      * be modified by execution of the test, and so are passed unchanged
      * from the caller to the target or fallback as appropriate.
@@ -2241,7 +2756,7 @@
      * (similarly to the predicate in {@link #guardWithTest guardWithTest}).
      * Also, the handler must have an extra leading parameter of {@code exType} or a supertype.
      * <p> Here is pseudocode for the resulting adapter:
-     * <blockquote><pre>
+     * <blockquote><pre>{@code
      * T target(A..., B...);
      * T handler(ExType, A...);
      * T adapter(A... a, B... b) {
@@ -2251,7 +2766,7 @@
      *     return handler(ex, a...);
      *   }
      * }
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * Note that the saved arguments ({@code a...} in the pseudocode) cannot
      * be modified by execution of the target, and so are passed unchanged
      * from the caller to the handler, if the handler is invoked.
--- a/jdk/src/share/classes/java/lang/invoke/MethodType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -77,7 +77,8 @@
  * A method type may be loaded by an {@code ldc} instruction which refers
  * to a suitable {@code CONSTANT_MethodType} constant pool entry.
  * The entry refers to a {@code CONSTANT_Utf8} spelling for the descriptor string.
- * For more details, see the <a href="package-summary.html#mtcon">package summary</a>.
+ * (For full details on method type constants,
+ * see sections 4.4.8 and 5.4.3.5 of the Java Virtual Machine Specification.)
  * <p>
  * When the JVM materializes a {@code MethodType} from a descriptor string,
  * all classes named in the descriptor must be accessible, and will be loaded.
@@ -940,10 +941,10 @@
      * Instead, the return type and parameter type arrays are written directly
      * from the {@code writeObject} method, using two calls to {@code s.writeObject}
      * as follows:
-     * <blockquote><pre>
+     * <blockquote><pre>{@code
 s.writeObject(this.returnType());
 s.writeObject(this.parameterArray());
-     * </pre></blockquote>
+     * }</pre></blockquote>
      * <p>
      * The deserialized field values are checked as if they were
      * provided to the factory method {@link #methodType(Class,Class[]) methodType}.
--- a/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodTypeForm.java	Fri Oct 11 09:17:18 2013 -0400
@@ -28,6 +28,7 @@
 import sun.invoke.util.Wrapper;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
+ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
 
 /**
  * Shared information for a group of method types, which differ
@@ -74,7 +75,8 @@
             LF_GEN_LINKER     = 11,
             LF_GEN_INVOKER    = 12,
             LF_CS_LINKER      = 13,  // linkToCallSite_CS
-            LF_LIMIT          = 14;
+            LF_MH_LINKER      = 14,  // linkToCallSite_MH
+            LF_LIMIT          = 15;
 
     public MethodType erasedType() {
         return erasedType;
@@ -97,11 +99,24 @@
         assert(erasedType == basicType) : "erasedType: " + erasedType + " != basicType: " + basicType;  // primitives must be flattened also
         MethodHandle invoker = basicInvoker;
         if (invoker != null)  return invoker;
-        invoker = basicType.invokers().makeBasicInvoker();
+        invoker = DirectMethodHandle.make(invokeBasicMethod(basicType));
         basicInvoker = invoker;
         return invoker;
     }
 
+    // This next one is called from LambdaForm.NamedFunction.<init>.
+    /*non-public*/ static MemberName invokeBasicMethod(MethodType basicType) {
+        assert(basicType == basicType.basicType());
+        try {
+            // Do approximately the same as this public API call:
+            //   Lookup.findVirtual(MethodHandle.class, name, type);
+            // But bypass access and corner case checks, since we know exactly what we need.
+            return IMPL_LOOKUP.resolveOrFail(REF_invokeVirtual, MethodHandle.class, "invokeBasic", basicType);
+         } catch (ReflectiveOperationException ex) {
+            throw newInternalError("JVM cannot find invoker for "+basicType, ex);
+        }
+    }
+
     /**
      * Build an MTF for a given type, which must have all references erased to Object.
      * This MTF will stand for that type and all un-erased variations.
--- a/jdk/src/share/classes/java/lang/invoke/MutableCallSite.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/MutableCallSite.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,7 +38,7 @@
  * Here is an example of a mutable call site which introduces a
  * state variable into a method handle chain.
  * <!-- JavaDocExamplesTest.testMutableCallSite -->
- * <blockquote><pre>
+ * <blockquote><pre>{@code
 MutableCallSite name = new MutableCallSite(MethodType.methodType(String.class));
 MethodHandle MH_name = name.dynamicInvoker();
 MethodType MT_str1 = MethodType.methodType(String.class);
@@ -50,10 +50,10 @@
 name.setTarget(MethodHandles.constant(String.class, "Fred"));
 assertEquals("FRED", (String) worker1.invokeExact());
 // (mutation can be continued indefinitely)
- * </pre></blockquote>
+ * }</pre></blockquote>
  * <p>
  * The same call site may be used in several places at once.
- * <blockquote><pre>
+ * <blockquote><pre>{@code
 MethodType MT_str2 = MethodType.methodType(String.class, String.class);
 MethodHandle MH_cat = lookup().findVirtual(String.class,
   "concat", methodType(String.class, String.class));
@@ -63,7 +63,7 @@
 name.setTarget(MethodHandles.constant(String.class, "Wilma"));
 assertEquals("WILMA", (String) worker1.invokeExact());
 assertEquals("Wilma, dear?", (String) worker2.invokeExact());
- * </pre></blockquote>
+ * }</pre></blockquote>
  * <p>
  * <em>Non-synchronization of target values:</em>
  * A write to a mutable call site's target does not force other threads
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/invoke/ProxyClassesDumper.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,147 @@
+/*
+ * 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 java.lang.invoke;
+
+import sun.util.logging.PlatformLogger;
+
+import java.io.FilePermission;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * Helper class used by InnerClassLambdaMetafactory to log generated classes
+ *
+ * @implNote
+ * <p> Because this class is called by LambdaMetafactory, make use
+ * of lambda lead to recursive calls cause stack overflow.
+ */
+final class ProxyClassesDumper {
+    private static final char[] HEX = {
+        '0', '1', '2', '3', '4', '5', '6', '7',
+        '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+    };
+    private static final char[] BAD_CHARS = {
+        '\\', ':', '*', '?', '"', '<', '>', '|'
+    };
+    private static final String[] REPLACEMENT = {
+        "%5C", "%3A", "%2A", "%3F", "%22", "%3C", "%3E", "%7C"
+    };
+
+    private final Path dumpDir;
+
+    public static ProxyClassesDumper getInstance(String path) {
+        if (null == path) {
+            return null;
+        }
+        try {
+            path = path.trim();
+            final Path dir = Paths.get(path.length() == 0 ? "." : path);
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                    @Override
+                    public Void run() {
+                        validateDumpDir(dir);
+                        return null;
+                    }
+                }, null, new FilePermission("<<ALL FILES>>", "read, write"));
+            return new ProxyClassesDumper(dir);
+        } catch (InvalidPathException ex) {
+            PlatformLogger.getLogger(ProxyClassesDumper.class.getName())
+                          .warning("Path " + path + " is not valid - dumping disabled", ex);
+        } catch (IllegalArgumentException iae) {
+            PlatformLogger.getLogger(ProxyClassesDumper.class.getName())
+                          .warning(iae.getMessage() + " - dumping disabled");
+        }
+        return null;
+    }
+
+    private ProxyClassesDumper(Path path) {
+        dumpDir = Objects.requireNonNull(path);
+    }
+
+    private static void validateDumpDir(Path path) {
+        if (!Files.exists(path)) {
+            throw new IllegalArgumentException("Directory " + path + " does not exist");
+        } else if (!Files.isDirectory(path)) {
+            throw new IllegalArgumentException("Path " + path + " is not a directory");
+        } else if (!Files.isWritable(path)) {
+            throw new IllegalArgumentException("Directory " + path + " is not writable");
+        }
+    }
+
+    public static String encodeForFilename(String className) {
+        final int len = className.length();
+        StringBuilder sb = new StringBuilder(len);
+
+        for (int i = 0; i < len; i++) {
+            char c = className.charAt(i);
+            // control characters
+            if (c <= 31) {
+                sb.append('%');
+                sb.append(HEX[c >> 4 & 0x0F]);
+                sb.append(HEX[c & 0x0F]);
+            } else {
+                int j = 0;
+                for (; j < BAD_CHARS.length; j++) {
+                    if (c == BAD_CHARS[j]) {
+                        sb.append(REPLACEMENT[j]);
+                        break;
+                    }
+                }
+                if (j >= BAD_CHARS.length) {
+                    sb.append(c);
+                }
+            }
+        }
+
+        return sb.toString();
+    }
+
+    public void dumpClass(String className, final byte[] classBytes) {
+        Path file;
+        try {
+            file = dumpDir.resolve(encodeForFilename(className) + ".class");
+        } catch (InvalidPathException ex) {
+            PlatformLogger.getLogger(ProxyClassesDumper.class.getName())
+                          .warning("Invalid path for class " + className);
+            return;
+        }
+
+        try {
+            Path dir = file.getParent();
+            Files.createDirectories(dir);
+            Files.write(file, classBytes);
+        } catch (Exception ignore) {
+            PlatformLogger.getLogger(ProxyClassesDumper.class.getName())
+                          .warning("Exception writing to path at " + file.toString());
+            // simply don't care if this operation failed
+        }
+    }
+}
--- a/jdk/src/share/classes/java/lang/invoke/SwitchPoint.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/invoke/SwitchPoint.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,7 +55,7 @@
  * At that point {@code guardWithTest} may ignore {@code T} and return {@code F}.
  * <p>
  * Here is an example of a switch point in action:
- * <blockquote><pre>
+ * <blockquote><pre>{@code
 MethodHandle MH_strcat = MethodHandles.lookup()
     .findVirtual(String.class, "concat", MethodType.methodType(String.class, String.class));
 SwitchPoint spt = new SwitchPoint();
@@ -68,7 +68,7 @@
 SwitchPoint.invalidateAll(new SwitchPoint[]{ spt });
 assert(spt.hasBeenInvalidated());
 assertEquals("hodmet", (String) worker.invokeExact("met", "hod"));
- * </pre></blockquote>
+ * }</pre></blockquote>
  * <p style="font-size:smaller;">
  * <em>Discussion:</em>
  * Switch points are useful without subclassing.  They may also be subclassed.
@@ -82,7 +82,7 @@
  * <em>Implementation Note:</em>
  * A switch point behaves as if implemented on top of {@link MutableCallSite},
  * approximately as follows:
- * <blockquote><pre>
+ * <blockquote><pre>{@code
 public class SwitchPoint {
   private static final MethodHandle
     K_true  = MethodHandles.constant(boolean.class, true),
@@ -106,7 +106,7 @@
     MutableCallSite.syncAll(mcss.toArray(new MutableCallSite[0]));
   }
 }
- * </pre></blockquote>
+ * }</pre></blockquote>
  * @author Remi Forax, JSR 292 EG
  */
 public class SwitchPoint {
--- a/jdk/src/share/classes/java/lang/reflect/Array.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/reflect/Array.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,13 +55,18 @@
      * </pre>
      * </blockquote>
      *
+     * <p>The number of dimensions of the new array must not
+     * exceed 255.
+     *
      * @param componentType the {@code Class} object representing the
      * component type of the new array
      * @param length the length of the new array
      * @return the new array
      * @exception NullPointerException if the specified
      * {@code componentType} parameter is null
-     * @exception IllegalArgumentException if componentType is {@link Void#TYPE}
+     * @exception IllegalArgumentException if componentType is {@link
+     * Void#TYPE} or if the number of dimensions of the requested array
+     * instance exceed 255.
      * @exception NegativeArraySizeException if the specified {@code length}
      * is negative
      */
@@ -85,8 +90,7 @@
      * {@code componentType}.
      *
      * <p>The number of dimensions of the new array must not
-     * exceed the number of array dimensions supported by the
-     * implementation (typically 255).
+     * exceed 255.
      *
      * @param componentType the {@code Class} object representing the component
      * type of the new array
@@ -96,10 +100,9 @@
      * @exception NullPointerException if the specified
      * {@code componentType} argument is null
      * @exception IllegalArgumentException if the specified {@code dimensions}
-     * argument is a zero-dimensional array, or if the number of
-     * requested dimensions exceeds the limit on the number of array dimensions
-     * supported by the implementation (typically 255), or if componentType
-     * is {@link Void#TYPE}.
+     * argument is a zero-dimensional array, if componentType is {@link
+     * Void#TYPE}, or if the number of dimensions of the requested array
+     * instance exceed 255.
      * @exception NegativeArraySizeException if any of the components in
      * the specified {@code dimensions} argument is negative.
      */
--- a/jdk/src/share/classes/java/lang/reflect/MalformedParametersException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/lang/reflect/MalformedParametersException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -50,10 +50,22 @@
  */
 public class MalformedParametersException extends RuntimeException {
 
+    /**
+     * Version for serialization.
+     */
     private static final long serialVersionUID = 20130919L;
 
+    /**
+     * Create a {@code MalformedParametersException} with an empty
+     * reason.
+     */
     public MalformedParametersException() {}
 
+    /**
+     * Create a {@code MalformedParametersException}.
+     *
+     * @param reason The reason for the exception.
+     */
     public MalformedParametersException(String reason) {
         super(reason);
     }
--- a/jdk/src/share/classes/java/math/BigInteger.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
 import java.io.ObjectStreamField;
 import java.util.Arrays;
 import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
 import sun.misc.DoubleConsts;
 import sun.misc.FloatConsts;
 
@@ -918,15 +919,6 @@
         return u;
     }
 
-    private static volatile Random staticRandom;
-
-    private static Random getSecureRandom() {
-        if (staticRandom == null) {
-            staticRandom = new java.security.SecureRandom();
-        }
-        return staticRandom;
-    }
-
     /**
      * Returns true iff this BigInteger passes the specified number of
      * Miller-Rabin tests. This test is taken from the DSA spec (NIST FIPS
@@ -945,7 +937,7 @@
 
         // Do the tests
         if (rnd == null) {
-            rnd = getSecureRandom();
+            rnd = ThreadLocalRandom.current();
         }
         for (int i=0; i < iterations; i++) {
             // Generate a uniform random on (1, this)
--- a/jdk/src/share/classes/java/net/ContentHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/net/ContentHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -96,6 +96,7 @@
      * @exception  IOException  if an I/O error occurs while reading the object.
      * @since 1.3
      */
+    @SuppressWarnings("rawtypes")
     public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
         Object obj = getContent(urlc);
 
--- a/jdk/src/share/classes/java/nio/file/Files.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/nio/file/Files.java	Fri Oct 11 09:17:18 2013 -0400
@@ -2128,7 +2128,7 @@
     /**
      * Tests whether a file is a symbolic link.
      *
-     * <p> Where is it required to distinguish an I/O exception from the case
+     * <p> Where it is required to distinguish an I/O exception from the case
      * that the file is not a symbolic link then the file attributes can be
      * read with the {@link #readAttributes(Path,Class,LinkOption[])
      * readAttributes} method and the file type tested with the {@link
@@ -2164,7 +2164,7 @@
      * of the link is read. If the option {@link LinkOption#NOFOLLOW_LINKS
      * NOFOLLOW_LINKS} is present then symbolic links are not followed.
      *
-     * <p> Where is it required to distinguish an I/O exception from the case
+     * <p> Where it is required to distinguish an I/O exception from the case
      * that the file is not a directory then the file attributes can be
      * read with the {@link #readAttributes(Path,Class,LinkOption[])
      * readAttributes} method and the file type tested with the {@link
@@ -2201,7 +2201,7 @@
      * of the link is read. If the option {@link LinkOption#NOFOLLOW_LINKS
      * NOFOLLOW_LINKS} is present then symbolic links are not followed.
      *
-     * <p> Where is it required to distinguish an I/O exception from the case
+     * <p> Where it is required to distinguish an I/O exception from the case
      * that the file is not a regular file then the file attributes can be
      * read with the {@link #readAttributes(Path,Class,LinkOption[])
      * readAttributes} method and the file type tested with the {@link
@@ -3082,13 +3082,13 @@
      *          method is invoked to check read access to the file.
      */
     public static byte[] readAllBytes(Path path) throws IOException {
-        try (FileChannel fc = FileChannel.open(path);
-             InputStream is = Channels.newInputStream(fc)) {
-            long size = fc.size();
+        try (SeekableByteChannel sbc = Files.newByteChannel(path);
+             InputStream in = Channels.newInputStream(sbc)) {
+            long size = sbc.size();
             if (size > (long)MAX_BUFFER_SIZE)
                 throw new OutOfMemoryError("Required array size too large");
 
-            return read(is, (int)size);
+            return read(in, (int)size);
         }
     }
 
--- a/jdk/src/share/classes/java/nio/file/Path.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/nio/file/Path.java	Fri Oct 11 09:17:18 2013 -0400
@@ -315,7 +315,7 @@
      * and parent directory. In such file systems all occurrences of "{@code .}"
      * are considered redundant. If a "{@code ..}" is preceded by a
      * non-"{@code ..}" name then both names are considered redundant (the
-     * process to identify such names is repeated until is it no longer
+     * process to identify such names is repeated until it is no longer
      * applicable).
      *
      * <p> This method does not access the file system; the path may not locate
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/security/DomainLoadStoreParameter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,171 @@
+/*
+ * 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 java.security;
+
+import java.net.URI;
+import java.util.*;
+import static java.security.KeyStore.*;
+
+/**
+ * Configuration data that specifies the keystores in a keystore domain.
+ * A keystore domain is a collection of keystores that are presented as a
+ * single logical keystore. The configuration data is used during
+ * {@code KeyStore}
+ * {@link KeyStore#load(KeyStore.LoadStoreParameter) load} and
+ * {@link KeyStore#store(KeyStore.LoadStoreParameter) store} operations.
+ * <p>
+ * The following syntax is supported for configuration data:
+ * <pre>{@code
+ *     domain <domainName> [<property> ...] {
+ *         keystore <keystoreName> [<property> ...] ;
+ *         ...
+ *     };
+ *     ...
+ * }</pre>
+ * where {@code domainName} and {@code keystoreName} are identifiers
+ * and {@code property} is a key/value pairing. The key and value are
+ * separated by an 'equals' symbol and the value is enclosed in double
+ * quotes. A property value may be either a printable string or a binary
+ * string of colon-separated pairs of hexadecimal digits. Multi-valued
+ * properties are represented as a comma-separated list of values,
+ * enclosed in square brackets.
+ * See {@link Arrays#toString(java.lang.Object[])}.
+ * <p>
+ * To ensure that keystore entries are uniquely identified, each
+ * entry's alias is prefixed by its {@code keystoreName} followed
+ * by the entry name separator and each {@code keystoreName} must be
+ * unique within its domain. Entry name prefixes are omitted when
+ * storing a keystore.
+ * <p>
+ * Properties are context-sensitive: properties that apply to
+ * all the keystores in a domain are located in the domain clause,
+ * and properties that apply only to a specific keystore are located
+ * in that keystore's clause.
+ * Unless otherwise specified, a property in a keystore clause overrides
+ * a property of the same name in the domain clause. All property names
+ * are case-insensitive. The following properties are supported:
+ * <dl>
+ * <dt> {@code keystoreType="<type>"} </dt>
+ *     <dd> The keystore type. </dd>
+ * <dt> {@code keystoreURI="<url>"} </dt>
+ *     <dd> The keystore location. </dd>
+ * <dt> {@code keystoreProviderName="<name>"} </dt>
+ *     <dd> The name of the keystore's JCE provider. </dd>
+ * <dt> {@code keystorePasswordEnv="<environment-variable>"} </dt>
+ *     <dd> The environment variable that stores a keystore password.
+ *          Alternatively, passwords may be supplied to the constructor
+ *          method in a {@code Map<String, ProtectionParameter>}. </dd>
+ * <dt> {@code entryNameSeparator="<separator>"} </dt>
+ *     <dd> The separator between a keystore name prefix and an entry name.
+ *          When specified, it applies to all the entries in a domain.
+ *          Its default value is a space. </dd>
+ * </dl>
+ * <p>
+ * For example, configuration data for a simple keystore domain
+ * comprising three keystores is shown below:
+ * <pre>
+ *
+ * domain app1 {
+ *     keystore app1-truststore
+ *         keystoreURI="file:///app1/etc/truststore.jks";
+ *
+ *     keystore system-truststore
+ *         keystoreURI="${java.home}/lib/security/cacerts";
+ *
+ *     keystore app1-keystore
+ *         keystoreType="PKCS12"
+ *         keystoreURI="file:///app1/etc/keystore.p12";
+ * };
+ *
+ * </pre>
+ * @since 1.8
+ */
+public final class DomainLoadStoreParameter implements LoadStoreParameter {
+
+    private final URI configuration;
+    private final Map<String,ProtectionParameter> protectionParams;
+
+    /**
+     * Constructs a DomainLoadStoreParameter for a keystore domain with
+     * the parameters used to protect keystore data.
+     *
+     * @param configuration identifier for the domain configuration data.
+     *     The name of the target domain should be specified in the
+     *     {@code java.net.URI} fragment component when it is necessary
+     *     to distinguish between several domain configurations at the
+     *     same location.
+     *
+     * @param protectionParams the map from keystore name to the parameter
+     *     used to protect keystore data.
+     *     A {@code java.util.Collections.EMPTY_MAP} should be used
+     *     when protection parameters are not required or when they have
+     *     been specified by properties in the domain configuration data.
+     *     It is cloned to prevent subsequent modification.
+     *
+     * @exception NullPointerException if {@code configuration} or
+     *     {@code protectionParams} is {@code null}
+     */
+    public DomainLoadStoreParameter(URI configuration,
+        Map<String,ProtectionParameter> protectionParams) {
+        if (configuration == null || protectionParams == null) {
+            throw new NullPointerException("invalid null input");
+        }
+        this.configuration = configuration;
+        this.protectionParams =
+            Collections.unmodifiableMap(new HashMap<>(protectionParams));
+    }
+
+    /**
+     * Gets the identifier for the domain configuration data.
+     *
+     * @return the identifier for the configuration data
+     */
+    public URI getConfiguration() {
+        return configuration;
+    }
+
+    /**
+     * Gets the keystore protection parameters for keystores in this
+     * domain.
+     *
+     * @return an unmodifiable map of keystore names to protection
+     *     parameters
+     */
+    public Map<String,ProtectionParameter> getProtectionParams() {
+        return protectionParams;
+    }
+
+    /**
+     * Gets the keystore protection parameters for this domain.
+     * Keystore domains do not support a protection parameter.
+     *
+     * @return always returns {@code null}
+     */
+    @Override
+    public KeyStore.ProtectionParameter getProtectionParameter() {
+        return null;
+    }
+}
--- a/jdk/src/share/classes/java/security/KeyStore.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/security/KeyStore.java	Fri Oct 11 09:17:18 2013 -0400
@@ -219,148 +219,6 @@
     }
 
     /**
-     * Configuration data that specifies the keystores in a keystore domain.
-     * A keystore domain is a collection of keystores that are presented as a
-     * single logical keystore. The configuration data is used during
-     * {@code KeyStore}
-     * {@link #load(KeyStore.LoadStoreParameter) load} and
-     * {@link #store(KeyStore.LoadStoreParameter) store} operations.
-     * <p>
-     * The following syntax is supported for configuration data:
-     * <pre>{@code
-     *     domain <domainName> [<property> ...] {
-     *         keystore <keystoreName> [<property> ...] ;
-     *         ...
-     *     };
-     *     ...
-     * }</pre>
-     * where {@code domainName} and {@code keystoreName} are identifiers
-     * and {@code property} is a key/value pairing. The key and value are
-     * separated by an 'equals' symbol and the value is enclosed in double
-     * quotes. A property value may be either a printable string or a binary
-     * string of colon-separated pairs of hexadecimal digits. Multi-valued
-     * properties are represented as a comma-separated list of values,
-     * enclosed in square brackets.
-     * See {@link Arrays#toString(java.lang.Object[])}.
-     * <p>
-     * To ensure that keystore entries are uniquely identified, each
-     * entry's alias is prefixed by its {@code keystoreName} followed
-     * by the entry name separator and each {@code keystoreName} must be
-     * unique within its domain. Entry name prefixes are omitted when
-     * storing a keystore.
-     * <p>
-     * Properties are context-sensitive: properties that apply to
-     * all the keystores in a domain are located in the domain clause,
-     * and properties that apply only to a specific keystore are located
-     * in that keystore's clause.
-     * Unless otherwise specified, a property in a keystore clause overrides
-     * a property of the same name in the domain clause. All property names
-     * are case-insensitive. The following properties are supported:
-     * <dl>
-     * <dt> {@code keystoreType="<type>"} </dt>
-     *     <dd> The keystore type. </dd>
-     * <dt> {@code keystoreURI="<url>"} </dt>
-     *     <dd> The keystore location. </dd>
-     * <dt> {@code keystoreProviderName="<name>"} </dt>
-     *     <dd> The name of the keystore's JCE provider. </dd>
-     * <dt> {@code keystorePasswordEnv="<environment-variable>"} </dt>
-     *     <dd> The environment variable that stores a keystore password.
-     *          Alternatively, passwords may be supplied to the constructor
-     *          method in a {@code Map<String, ProtectionParameter>}. </dd>
-     * <dt> {@code entryNameSeparator="<separator>"} </dt>
-     *     <dd> The separator between a keystore name prefix and an entry name.
-     *          When specified, it applies to all the entries in a domain.
-     *          Its default value is a space. </dd>
-     * </dl>
-     * <p>
-     * For example, configuration data for a simple keystore domain
-     * comprising three keystores is shown below:
-     * <pre>
-     *
-     * domain app1 {
-     *     keystore app1-truststore
-     *         keystoreURI="file:///app1/etc/truststore.jks"
-     *
-     *     keystore system-truststore
-     *         keystoreURI="${java.home}/lib/security/cacerts"
-     *
-     *     keystore app1-keystore
-     *         keystoreType="PKCS12"
-     *         keystoreURI="file:///app1/etc/keystore.p12"
-     * };
-     *
-     * </pre>
-     * @since 1.8
-     */
-    public static final class DomainLoadStoreParameter
-        implements LoadStoreParameter {
-
-        private final URI configuration;
-        private final Map<String,ProtectionParameter> protectionParams;
-
-        /**
-         * Constructs a DomainLoadStoreParameter for a keystore domain with
-         * the parameters used to protect keystore data.
-         *
-         * @param configuration identifier for the domain configuration data.
-         *     The name of the target domain should be specified in the
-         *     {@code java.net.URI} fragment component when it is necessary
-         *     to distinguish between several domain configurations at the
-         *     same location.
-         *
-         * @param protectionParams the map from keystore name to the parameter
-         *     used to protect keystore data.
-         *     A {@code java.util.Collections.EMPTY_MAP} should be used
-         *     when protection parameters are not required or when they have
-         *     been specified by properties in the domain configuration data.
-         *     It is cloned to prevent subsequent modification.
-         *
-         * @exception NullPointerException if {@code configuration} or
-         *     {@code protectionParams} is {@code null}
-         */
-        public DomainLoadStoreParameter(URI configuration,
-            Map<String,ProtectionParameter> protectionParams) {
-            if (configuration == null || protectionParams == null) {
-                throw new NullPointerException("invalid null input");
-            }
-            this.configuration = configuration;
-            this.protectionParams =
-                Collections.unmodifiableMap(new HashMap<>(protectionParams));
-        }
-
-        /**
-         * Gets the identifier for the domain configuration data.
-         *
-         * @return the identifier for the configuration data
-         */
-        public URI getConfiguration() {
-            return configuration;
-        }
-
-        /**
-         * Gets the keystore protection parameters for keystores in this
-         * domain.
-         *
-         * @return an unmodifiable map of keystore names to protection
-         *     parameters
-         */
-        public Map<String,ProtectionParameter> getProtectionParams() {
-            return protectionParams;
-        }
-
-        /**
-         * Gets the keystore protection parameters for this domain.
-         * Keystore domains do not support a protection parameter.
-         *
-         * @return always returns {@code null}
-         */
-        @Override
-        public KeyStore.ProtectionParameter getProtectionParameter() {
-            return null;
-        }
-    }
-
-    /**
      * A marker interface for keystore protection parameters.
      *
      * <p> The information stored in a {@code ProtectionParameter}
--- a/jdk/src/share/classes/java/time/DayOfWeek.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/DayOfWeek.java	Fri Oct 11 09:17:18 2013 -0400
@@ -187,7 +187,12 @@
         if (temporal instanceof DayOfWeek) {
             return (DayOfWeek) temporal;
         }
-        return of(temporal.get(DAY_OF_WEEK));
+        try {
+            return of(temporal.get(DAY_OF_WEEK));
+        } catch (DateTimeException ex) {
+            throw new DateTimeException("Unable to obtain DayOfWeek from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
+        }
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/src/share/classes/java/time/Duration.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/Duration.java	Fri Oct 11 09:17:18 2013 -0400
@@ -441,9 +441,13 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Obtains a {@code Duration} representing the duration between two instants.
+     * Obtains a {@code Duration} representing the duration between two temporal objects.
      * <p>
-     * This calculates the duration between two temporal objects of the same type.
+     * This calculates the duration between two temporal objects. If the objects
+     * are of different types, then the duration is calculated based on the type
+     * of the first object. For example, if the first argument is a {@code LocalTime}
+     * then the second argument is converted to a {@code LocalTime}.
+     * <p>
      * The specified temporal objects must support the {@link ChronoUnit#SECONDS SECONDS} unit.
      * For full accuracy, either the {@link ChronoUnit#NANOS NANOS} unit or the
      * {@link ChronoField#NANO_OF_SECOND NANO_OF_SECOND} field should be supported.
--- a/jdk/src/share/classes/java/time/Instant.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/Instant.java	Fri Oct 11 09:17:18 2013 -0400
@@ -362,15 +362,24 @@
      * @throws DateTimeException if unable to convert to an {@code Instant}
      */
     public static Instant from(TemporalAccessor temporal) {
-        long instantSecs = temporal.getLong(INSTANT_SECONDS);
-        int nanoOfSecond = temporal.get(NANO_OF_SECOND);
-        return Instant.ofEpochSecond(instantSecs, nanoOfSecond);
+        if (temporal instanceof Instant) {
+            return (Instant) temporal;
+        }
+        Objects.requireNonNull(temporal, "temporal");
+        try {
+            long instantSecs = temporal.getLong(INSTANT_SECONDS);
+            int nanoOfSecond = temporal.get(NANO_OF_SECOND);
+            return Instant.ofEpochSecond(instantSecs, nanoOfSecond);
+        } catch (DateTimeException ex) {
+            throw new DateTimeException("Unable to obtain Instant from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName());
+        }
     }
 
     //-----------------------------------------------------------------------
     /**
      * Obtains an instance of {@code Instant} from a text string such as
-     * {@code 2007-12-03T10:15:30:00}.
+     * {@code 2007-12-03T10:15:30.00Z}.
      * <p>
      * The string must represent a valid instant in UTC and is parsed using
      * {@link DateTimeFormatter#ISO_INSTANT}.
@@ -1091,7 +1100,8 @@
      * The result will be negative if the end is before the start.
      * The calculation returns a whole number, representing the number of
      * complete units between the two instants.
-     * The {@code Temporal} passed to this method must be an {@code Instant}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code Instant} using {@link #from(TemporalAccessor)}.
      * For example, the amount in days between two dates can be calculated
      * using {@code startInstant.until(endInstant, SECONDS)}.
      * <p>
@@ -1112,25 +1122,22 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endInstant  the end date, which must be an {@code Instant}, not null
+     * @param endExclusive  the end date, exclusive, which is converted to an {@code Instant}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this instant and the end instant
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to an {@code Instant}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endInstant, TemporalUnit unit) {
-        if (endInstant instanceof Instant == false) {
-            Objects.requireNonNull(endInstant, "endInstant");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
-        Instant end = (Instant) endInstant;
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        Instant end = Instant.from(endExclusive);
         if (unit instanceof ChronoUnit) {
             ChronoUnit f = (ChronoUnit) unit;
             switch (f) {
@@ -1145,7 +1152,7 @@
             }
             throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return unit.between(this, endInstant);
+        return unit.between(this, end);
     }
 
     private long nanosUntil(Instant end) {
--- a/jdk/src/share/classes/java/time/LocalDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/LocalDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -353,9 +353,11 @@
      * @throws DateTimeException if unable to convert to a {@code LocalDate}
      */
     public static LocalDate from(TemporalAccessor temporal) {
+        Objects.requireNonNull(temporal, "temporal");
         LocalDate date = temporal.query(TemporalQuery.localDate());
         if (date == null) {
-            throw new DateTimeException("Unable to obtain LocalDate from TemporalAccessor: " + temporal.getClass());
+            throw new DateTimeException("Unable to obtain LocalDate from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName());
         }
         return date;
     }
@@ -1125,6 +1127,11 @@
      */
     @Override
     public LocalDate plus(TemporalAmount amountToAdd) {
+        if (amountToAdd instanceof Period) {
+            Period periodToAdd = (Period) amountToAdd;
+            return plusMonths(periodToAdd.toTotalMonths()).plusDays(periodToAdd.getDays());
+        }
+        Objects.requireNonNull(amountToAdd, "amountToAdd");
         return (LocalDate) amountToAdd.addTo(this);
     }
 
@@ -1353,6 +1360,11 @@
      */
     @Override
     public LocalDate minus(TemporalAmount amountToSubtract) {
+        if (amountToSubtract instanceof Period) {
+            Period periodToSubtract = (Period) amountToSubtract;
+            return minusMonths(periodToSubtract.toTotalMonths()).minusDays(periodToSubtract.getDays());
+        }
+        Objects.requireNonNull(amountToSubtract, "amountToSubtract");
         return (LocalDate) amountToSubtract.subtractFrom(this);
     }
 
@@ -1531,7 +1543,8 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified date.
      * The result will be negative if the end is before the start.
-     * The {@code Temporal} passed to this method must be a {@code LocalDate}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code LocalDate} using {@link #from(TemporalAccessor)}.
      * For example, the amount in days between two dates can be calculated
      * using {@code startDate.until(endDate, DAYS)}.
      * <p>
@@ -1557,26 +1570,22 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endDate  the end date, which must be a {@code LocalDate}, not null
+     * @param endExclusive  the end date, exclusive, which is converted to a {@code LocalDate}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this date and the end date
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to a {@code LocalDate}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endDate, TemporalUnit unit) {
-        Objects.requireNonNull(unit, "unit");
-        if (endDate instanceof LocalDate == false) {
-            Objects.requireNonNull(endDate, "endDate");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
-        LocalDate end = (LocalDate) endDate;
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        LocalDate end = LocalDate.from(endExclusive);
         if (unit instanceof ChronoUnit) {
             switch ((ChronoUnit) unit) {
                 case DAYS: return daysUntil(end);
@@ -1590,7 +1599,7 @@
             }
             throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return unit.between(this, endDate);
+        return unit.between(this, end);
     }
 
     long daysUntil(LocalDate end) {
@@ -1632,12 +1641,12 @@
      * </pre>
      * The choice should be made based on which makes the code more readable.
      *
-     * @param endDate  the end date, exclusive, which may be in any chronology, not null
+     * @param endDateExclusive  the end date, exclusive, which may be in any chronology, not null
      * @return the period between this date and the end date, not null
      */
     @Override
-    public Period until(ChronoLocalDate endDate) {
-        LocalDate end = LocalDate.from(endDate);
+    public Period until(ChronoLocalDate endDateExclusive) {
+        LocalDate end = LocalDate.from(endDateExclusive);
         long totalMonths = end.getProlepticMonth() - this.getProlepticMonth();  // safe
         int days = end.day - this.day;
         if (totalMonths > 0 && days < 0) {
--- a/jdk/src/share/classes/java/time/LocalDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -449,7 +449,8 @@
             LocalTime time = LocalTime.from(temporal);
             return new LocalDateTime(date, time);
         } catch (DateTimeException ex) {
-            throw new DateTimeException("Unable to obtain LocalDateTime from TemporalAccessor: " + temporal.getClass(), ex);
+            throw new DateTimeException("Unable to obtain LocalDateTime from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
         }
     }
 
@@ -1129,6 +1130,11 @@
      */
     @Override
     public LocalDateTime plus(TemporalAmount amountToAdd) {
+        if (amountToAdd instanceof Period) {
+            Period periodToAdd = (Period) amountToAdd;
+            return with(date.plus(periodToAdd), time);
+        }
+        Objects.requireNonNull(amountToAdd, "amountToAdd");
         return (LocalDateTime) amountToAdd.addTo(this);
     }
 
@@ -1343,6 +1349,11 @@
      */
     @Override
     public LocalDateTime minus(TemporalAmount amountToSubtract) {
+        if (amountToSubtract instanceof Period) {
+            Period periodToSubtract = (Period) amountToSubtract;
+            return with(date.minus(periodToSubtract), time);
+        }
+        Objects.requireNonNull(amountToSubtract, "amountToSubtract");
         return (LocalDateTime) amountToSubtract.subtractFrom(this);
     }
 
@@ -1611,7 +1622,8 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified date-time.
      * The result will be negative if the end is before the start.
-     * The {@code Temporal} passed to this method must be a {@code LocalDateTime}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code LocalDateTime} using {@link #from(TemporalAccessor)}.
      * For example, the amount in days between two date-times can be calculated
      * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
@@ -1639,25 +1651,22 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endDateTime  the end date-time, which must be a {@code LocalDateTime}, not null
+     * @param endExclusive  the end date, exclusive, which is converted to a {@code LocalDateTime}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this date-time and the end date-time
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to a {@code LocalDateTime}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endDateTime, TemporalUnit unit) {
-        if (endDateTime instanceof LocalDateTime == false) {
-            Objects.requireNonNull(endDateTime, "endDateTime");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
-        LocalDateTime end = (LocalDateTime) endDateTime;
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        LocalDateTime end = LocalDateTime.from(endExclusive);
         if (unit instanceof ChronoUnit) {
             if (unit.isTimeBased()) {
                 long amount = date.daysUntil(end.date);
@@ -1711,7 +1720,7 @@
             }
             return date.until(endDate, unit);
         }
-        return unit.between(this, endDateTime);
+        return unit.between(this, end);
     }
 
     /**
--- a/jdk/src/share/classes/java/time/LocalTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/LocalTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -394,9 +394,11 @@
      * @throws DateTimeException if unable to convert to a {@code LocalTime}
      */
     public static LocalTime from(TemporalAccessor temporal) {
+        Objects.requireNonNull(temporal, "temporal");
         LocalTime time = temporal.query(TemporalQuery.localTime());
         if (time == null) {
-            throw new DateTimeException("Unable to obtain LocalTime from TemporalAccessor: " + temporal.getClass());
+            throw new DateTimeException("Unable to obtain LocalTime from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName());
         }
         return time;
     }
@@ -1330,7 +1332,8 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified time.
      * The result will be negative if the end is before the start.
-     * The {@code Temporal} passed to this method must be a {@code LocalTime}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code LocalTime} using {@link #from(TemporalAccessor)}.
      * For example, the amount in hours between two times can be calculated
      * using {@code startTime.until(endTime, HOURS)}.
      * <p>
@@ -1356,25 +1359,22 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endTime  the end time, which must be a {@code LocalTime}, not null
+     * @param endExclusive  the end time, exclusive, which is converted to a {@code LocalTime}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this time and the end time
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to a {@code LocalTime}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endTime, TemporalUnit unit) {
-        if (endTime instanceof LocalTime == false) {
-            Objects.requireNonNull(endTime, "endTime");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
-        LocalTime end = (LocalTime) endTime;
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        LocalTime end = LocalTime.from(endExclusive);
         if (unit instanceof ChronoUnit) {
             long nanosUntil = end.toNanoOfDay() - toNanoOfDay();  // no overflow
             switch ((ChronoUnit) unit) {
@@ -1388,7 +1388,7 @@
             }
             throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return unit.between(this, endTime);
+        return unit.between(this, end);
     }
 
     /**
--- a/jdk/src/share/classes/java/time/Month.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/Month.java	Fri Oct 11 09:17:18 2013 -0400
@@ -217,7 +217,8 @@
             }
             return of(temporal.get(MONTH_OF_YEAR));
         } catch (DateTimeException ex) {
-            throw new DateTimeException("Unable to obtain Month from TemporalAccessor: " + temporal.getClass(), ex);
+            throw new DateTimeException("Unable to obtain Month from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
         }
     }
 
--- a/jdk/src/share/classes/java/time/MonthDay.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/MonthDay.java	Fri Oct 11 09:17:18 2013 -0400
@@ -246,7 +246,8 @@
      * <p>
      * The conversion extracts the {@link ChronoField#MONTH_OF_YEAR MONTH_OF_YEAR} and
      * {@link ChronoField#DAY_OF_MONTH DAY_OF_MONTH} fields.
-     * The extraction is only permitted if the date-time has an ISO chronology.
+     * The extraction is only permitted if the temporal object has an ISO
+     * chronology, or can be converted to a {@code LocalDate}.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
      * allowing it to be used in queries via method reference, {@code MonthDay::from}.
@@ -265,7 +266,8 @@
             }
             return of(temporal.get(MONTH_OF_YEAR), temporal.get(DAY_OF_MONTH));
         } catch (DateTimeException ex) {
-            throw new DateTimeException("Unable to obtain MonthDay from TemporalAccessor: " + temporal.getClass(), ex);
+            throw new DateTimeException("Unable to obtain MonthDay from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
         }
     }
 
--- a/jdk/src/share/classes/java/time/OffsetDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -347,8 +347,8 @@
         if (temporal instanceof OffsetDateTime) {
             return (OffsetDateTime) temporal;
         }
-        ZoneOffset offset = ZoneOffset.from(temporal);
         try {
+            ZoneOffset offset = ZoneOffset.from(temporal);
             try {
                 LocalDateTime ldt = LocalDateTime.from(temporal);
                 return OffsetDateTime.of(ldt, offset);
@@ -357,7 +357,8 @@
                 return OffsetDateTime.ofInstant(instant, offset);
             }
         } catch (DateTimeException ex) {
-            throw new DateTimeException("Unable to obtain OffsetDateTime from TemporalAccessor: " + temporal.getClass(), ex);
+            throw new DateTimeException("Unable to obtain OffsetDateTime from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
         }
     }
 
@@ -1592,7 +1593,8 @@
      * For example, the period in days between two date-times can be calculated
      * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
-     * The {@code Temporal} passed to this method must be an {@code OffsetDateTime}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code OffsetDateTime} using {@link #from(TemporalAccessor)}.
      * If the offset differs between the two date-times, the specified
      * end date-time is normalized to have the same offset as this date-time.
      * <p>
@@ -1620,30 +1622,27 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endDateTime  the end date-time, which must be an {@code OffsetDateTime}, not null
+     * @param endExclusive  the end date, exclusive, which is converted to an {@code OffsetDateTime}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this date-time and the end date-time
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to an {@code OffsetDateTime}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endDateTime, TemporalUnit unit) {
-        if (endDateTime instanceof OffsetDateTime == false) {
-            Objects.requireNonNull(endDateTime, "endDateTime");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        OffsetDateTime end = OffsetDateTime.from(endExclusive);
         if (unit instanceof ChronoUnit) {
-            OffsetDateTime end = (OffsetDateTime) endDateTime;
             end = end.withOffsetSameInstant(offset);
             return dateTime.until(end.dateTime, unit);
         }
-        return unit.between(this, endDateTime);
+        return unit.between(this, end);
     }
 
     /**
--- a/jdk/src/share/classes/java/time/OffsetTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/OffsetTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -284,7 +284,8 @@
             ZoneOffset offset = ZoneOffset.from(temporal);
             return new OffsetTime(time, offset);
         } catch (DateTimeException ex) {
-            throw new DateTimeException("Unable to obtain OffsetTime from TemporalAccessor: " + temporal.getClass(), ex);
+            throw new DateTimeException("Unable to obtain OffsetTime from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
         }
     }
 
@@ -1124,7 +1125,8 @@
      * For example, the period in hours between two times can be calculated
      * using {@code startTime.until(endTime, HOURS)}.
      * <p>
-     * The {@code Temporal} passed to this method must be an {@code OffsetTime}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code OffsetTime} using {@link #from(TemporalAccessor)}.
      * If the offset differs between the two times, then the specified
      * end time is normalized to have the same offset as this time.
      * <p>
@@ -1150,26 +1152,23 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endTime  the end time, which must be an {@code OffsetTime}, not null
+     * @param endExclusive  the end date, exclusive, which is converted to an {@code OffsetTime}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this time and the end time
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to an {@code OffsetTime}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endTime, TemporalUnit unit) {
-        if (endTime instanceof OffsetTime == false) {
-            Objects.requireNonNull(endTime, "endTime");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        OffsetTime end = OffsetTime.from(endExclusive);
         if (unit instanceof ChronoUnit) {
-            OffsetTime end = (OffsetTime) endTime;
             long nanosUntil = end.toEpochNano() - toEpochNano();  // no overflow
             switch ((ChronoUnit) unit) {
                 case NANOS: return nanosUntil;
@@ -1182,7 +1181,7 @@
             }
             throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return unit.between(this, endTime);
+        return unit.between(this, end);
     }
 
     /**
--- a/jdk/src/share/classes/java/time/Period.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/Period.java	Fri Oct 11 09:17:18 2013 -0400
@@ -61,7 +61,6 @@
  */
 package java.time;
 
-import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoUnit.DAYS;
 import static java.time.temporal.ChronoUnit.MONTHS;
 import static java.time.temporal.ChronoUnit.YEARS;
@@ -70,17 +69,19 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InvalidObjectException;
-import java.io.InvalidObjectException;
 import java.io.Serializable;
 import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoPeriod;
 import java.time.chrono.Chronology;
+import java.time.chrono.IsoChronology;
 import java.time.format.DateTimeParseException;
 import java.time.temporal.ChronoUnit;
 import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalAmount;
+import java.time.temporal.TemporalQuery;
 import java.time.temporal.TemporalUnit;
 import java.time.temporal.UnsupportedTemporalTypeException;
-import java.time.temporal.ValueRange;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -89,12 +90,13 @@
 import java.util.regex.Pattern;
 
 /**
- * A date-based amount of time, such as '2 years, 3 months and 4 days'.
+ * A date-based amount of time in the ISO-8601 calendar system,
+ * such as '2 years, 3 months and 4 days'.
  * <p>
  * This class models a quantity or amount of time in terms of years, months and days.
  * See {@link Duration} for the time-based equivalent to this class.
  * <p>
- * Durations and period differ in their treatment of daylight savings time
+ * Durations and periods differ in their treatment of daylight savings time
  * when added to {@link ZonedDateTime}. A {@code Duration} will add an exact
  * number of seconds, thus a duration of one day is always exactly 24 hours.
  * By contrast, a {@code Period} will add a conceptual day, trying to maintain
@@ -110,14 +112,12 @@
  * {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}.
  * All three fields are always present, but may be set to zero.
  * <p>
- * The period may be used with any calendar system.
- * The meaning of a "year" or "month" is only applied when the object is added to a date.
+ * The ISO-8601 calendar system is the modern civil calendar system used today
+ * in most of the world. It is equivalent to the proleptic Gregorian calendar
+ * system, in which today's rules for leap years are applied for all time.
  * <p>
  * The period is modeled as a directed amount of time, meaning that individual parts of the
  * period may be negative.
- * <p>
- * The months and years fields may be {@linkplain #normalized() normalized}.
- * The normalization assumes a 12 month year, so is not appropriate for all calendar systems.
  *
  * @implSpec
  * This class is immutable and thread-safe.
@@ -125,7 +125,7 @@
  * @since 1.8
  */
 public final class Period
-        implements TemporalAmount, Serializable {
+        implements ChronoPeriod, Serializable {
 
     /**
      * A constant for a period of zero.
@@ -140,6 +140,7 @@
      */
     private final static Pattern PATTERN =
             Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)W)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE);
+
     /**
      * The set of supported units.
      */
@@ -234,12 +235,14 @@
      * <p>
      * This obtains a period based on the specified amount.
      * A {@code TemporalAmount} represents an  amount of time, which may be
-     * date-based or time-based, which this factory extracts to a period.
+     * date-based or time-based, which this factory extracts to a {@code Period}.
      * <p>
      * The conversion loops around the set of units from the amount and uses
      * the {@link ChronoUnit#YEARS YEARS}, {@link ChronoUnit#MONTHS MONTHS}
      * and {@link ChronoUnit#DAYS DAYS} units to create a period.
      * If any other units are found then an exception is thrown.
+     * <p>
+     * If the amount is a {@code ChronoPeriod} then it must use the ISO chronology.
      *
      * @param amount  the temporal amount to convert, not null
      * @return the equivalent period, not null
@@ -247,6 +250,14 @@
      * @throws ArithmeticException if the amount of years, months or days exceeds an int
      */
     public static Period from(TemporalAmount amount) {
+        if (amount instanceof Period) {
+            return (Period) amount;
+        }
+        if (amount instanceof ChronoPeriod) {
+            if (IsoChronology.INSTANCE.equals(((ChronoPeriod) amount).getChronology()) == false) {
+                throw new DateTimeException("Period requires ISO chronology: " + amount);
+            }
+        }
         Objects.requireNonNull(amount, "amount");
         int years = 0;
         int months = 0;
@@ -358,13 +369,13 @@
      * The result of this method can be a negative period if the end is before the start.
      * The negative sign will be the same in each of year, month and day.
      *
-     * @param startDate  the start date, inclusive, not null
-     * @param endDate  the end date, exclusive, not null
+     * @param startDateInclusive  the start date, inclusive, not null
+     * @param endDateExclusive  the end date, exclusive, not null
      * @return the period between this date and the end date, not null
      * @see ChronoLocalDate#until(ChronoLocalDate)
      */
-    public static Period between(LocalDate startDate, LocalDate endDate) {
-        return startDate.until(endDate);
+    public static Period between(LocalDate startDateInclusive, LocalDate endDateExclusive) {
+        return startDateInclusive.until(endDateExclusive);
     }
 
     //-----------------------------------------------------------------------
@@ -439,6 +450,21 @@
         return SUPPORTED_UNITS;
     }
 
+    /**
+     * Gets the chronology of this period, which is the ISO calendar system.
+     * <p>
+     * The {@code Chronology} represents the calendar system in use.
+     * The ISO-8601 calendar system is the modern civil calendar system used today
+     * in most of the world. It is equivalent to the proleptic Gregorian calendar
+     * system, in which today's rules for leap years are applied for all time.
+     *
+     * @return the ISO chronology, not null
+     */
+    @Override
+    public IsoChronology getChronology() {
+        return IsoChronology.INSTANCE;
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Checks if all three units of this period are zero.
@@ -468,7 +494,7 @@
      * <p>
      * This returns the years unit.
      * <p>
-     * The months unit is not normalized with the years unit.
+     * The months unit is not automatically normalized with the years unit.
      * This means that a period of "15 months" is different to a period
      * of "1 year and 3 months".
      *
@@ -483,7 +509,7 @@
      * <p>
      * This returns the months unit.
      * <p>
-     * The months unit is not normalized with the years unit.
+     * The months unit is not automatically normalized with the years unit.
      * This means that a period of "15 months" is different to a period
      * of "1 year and 3 months".
      *
@@ -511,7 +537,7 @@
      * This sets the amount of the years unit in a copy of this period.
      * The months and days units are unaffected.
      * <p>
-     * The months unit is not normalized with the years unit.
+     * The months unit is not automatically normalized with the years unit.
      * This means that a period of "15 months" is different to a period
      * of "1 year and 3 months".
      * <p>
@@ -533,7 +559,7 @@
      * This sets the amount of the months unit in a copy of this period.
      * The years and days units are unaffected.
      * <p>
-     * The months unit is not normalized with the years unit.
+     * The months unit is not automatically normalized with the years unit.
      * This means that a period of "15 months" is different to a period
      * of "1 year and 3 months".
      * <p>
@@ -572,21 +598,28 @@
      * Returns a copy of this period with the specified period added.
      * <p>
      * This operates separately on the years, months and days.
+     * No normalization is performed.
      * <p>
      * For example, "1 year, 6 months and 3 days" plus "2 years, 2 months and 2 days"
      * returns "3 years, 8 months and 5 days".
      * <p>
+     * The specified amount is typically an instance of {@code Period}.
+     * Other types are interpreted using {@link Period#from(TemporalAmount)}.
+     * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @param amountToAdd  the period to add, not null
      * @return a {@code Period} based on this period with the requested period added, not null
+     * @throws DateTimeException if the specified amount has a non-ISO chronology or
+     *  contains an invalid unit
      * @throws ArithmeticException if numeric overflow occurs
      */
-    public Period plus(Period amountToAdd) {
+    public Period plus(TemporalAmount amountToAdd) {
+        Period isoAmount = Period.from(amountToAdd);
         return create(
-                Math.addExact(years, amountToAdd.years),
-                Math.addExact(months, amountToAdd.months),
-                Math.addExact(days, amountToAdd.days));
+                Math.addExact(years, isoAmount.years),
+                Math.addExact(months, isoAmount.months),
+                Math.addExact(days, isoAmount.days));
     }
 
     /**
@@ -654,21 +687,28 @@
      * Returns a copy of this period with the specified period subtracted.
      * <p>
      * This operates separately on the years, months and days.
+     * No normalization is performed.
      * <p>
      * For example, "1 year, 6 months and 3 days" minus "2 years, 2 months and 2 days"
      * returns "-1 years, 4 months and 1 day".
      * <p>
+     * The specified amount is typically an instance of {@code Period}.
+     * Other types are interpreted using {@link Period#from(TemporalAmount)}.
+     * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @param amountToSubtract  the period to subtract, not null
      * @return a {@code Period} based on this period with the requested period subtracted, not null
+     * @throws DateTimeException if the specified amount has a non-ISO chronology or
+     *  contains an invalid unit
      * @throws ArithmeticException if numeric overflow occurs
      */
-    public Period minus(Period amountToSubtract) {
+    public Period minus(TemporalAmount amountToSubtract) {
+        Period isoAmount = Period.from(amountToSubtract);
         return create(
-                Math.subtractExact(years, amountToSubtract.years),
-                Math.subtractExact(months, amountToSubtract.months),
-                Math.subtractExact(days, amountToSubtract.days));
+                Math.subtractExact(years, isoAmount.years),
+                Math.subtractExact(months, isoAmount.months),
+                Math.subtractExact(days, isoAmount.days));
     }
 
     /**
@@ -766,8 +806,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this period with the years and months normalized
-     * using a 12 month year.
+     * Returns a copy of this period with the years and months normalized.
      * <p>
      * This normalizes the years and months units, leaving the days unit unchanged.
      * The months unit is adjusted to have an absolute value less than 11,
@@ -778,8 +817,6 @@
      * For example, a period of "1 year and -25 months" will be normalized to
      * "-1 year and -1 month".
      * <p>
-     * This normalization uses a 12 month year which is not valid for all calendar systems.
-     * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @return a {@code Period} based on this period with excess months normalized to years, not null
@@ -796,13 +833,11 @@
     }
 
     /**
-     * Gets the total number of months in this period using a 12 month year.
+     * Gets the total number of months in this period.
      * <p>
      * This returns the total number of months in the period by multiplying the
      * number of years by 12 and adding the number of months.
      * <p>
-     * This uses a 12 month year which is not valid for all calendar systems.
-     * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @return the total number of months in the period, may be negative
@@ -817,6 +852,7 @@
      * <p>
      * This returns a temporal object of the same observable type as the input
      * with this period added.
+     * If the temporal has a chronology, it must be the ISO chronology.
      * <p>
      * In most cases, it is clearer to reverse the calling pattern by using
      * {@link Temporal#plus(TemporalAmount)}.
@@ -826,10 +862,17 @@
      *   dateTime = dateTime.plus(thisPeriod);
      * </pre>
      * <p>
-     * The calculation will add the years, then months, then days.
-     * Only non-zero amounts will be added.
-     * If the date-time has a calendar system with a fixed number of months in a
-     * year, then the years and months will be combined before being added.
+     * The calculation operates as follows.
+     * First, the chronology of the temporal is checked to ensure it is ISO chronology or null.
+     * Second, if the months are zero, the years are added if non-zero, otherwise
+     * the combination of years and months is added if non-zero.
+     * Finally, any days are added.
+     * <p>
+     * This approach ensures that a partial period can be added to a partial date.
+     * For example, a period of years and/or months can be added to a {@code YearMonth},
+     * but a period including days cannot.
+     * The approach also adds years and months together when necessary, which ensures
+     * correct behaviour at the end of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -840,18 +883,15 @@
      */
     @Override
     public Temporal addTo(Temporal temporal) {
-        Objects.requireNonNull(temporal, "temporal");
-        if ((years | months) != 0) {
-            long monthRange = monthRange(temporal);
-            if (monthRange >= 0) {
-                temporal = temporal.plus(years * monthRange + months, MONTHS);
-            } else {
-                if (years != 0) {
-                    temporal = temporal.plus(years, YEARS);
-                }
-                if (months != 0) {
-                    temporal = temporal.plus(months, MONTHS);
-                }
+        validateChrono(temporal);
+        if (months == 0) {
+            if (years != 0) {
+                temporal = temporal.plus(years, YEARS);
+            }
+        } else {
+            long totalMonths = toTotalMonths();
+            if (totalMonths != 0) {
+                temporal = temporal.plus(totalMonths, MONTHS);
             }
         }
         if (days != 0) {
@@ -865,6 +905,7 @@
      * <p>
      * This returns a temporal object of the same observable type as the input
      * with this period subtracted.
+     * If the temporal has a chronology, it must be the ISO chronology.
      * <p>
      * In most cases, it is clearer to reverse the calling pattern by using
      * {@link Temporal#minus(TemporalAmount)}.
@@ -874,10 +915,17 @@
      *   dateTime = dateTime.minus(thisPeriod);
      * </pre>
      * <p>
-     * The calculation will subtract the years, then months, then days.
-     * Only non-zero amounts will be subtracted.
-     * If the date-time has a calendar system with a fixed number of months in a
-     * year, then the years and months will be combined before being subtracted.
+     * The calculation operates as follows.
+     * First, the chronology of the temporal is checked to ensure it is ISO chronology or null.
+     * Second, if the months are zero, the years are subtracted if non-zero, otherwise
+     * the combination of years and months is subtracted if non-zero.
+     * Finally, any days are subtracted.
+     * <p>
+     * This approach ensures that a partial period can be subtracted from a partial date.
+     * For example, a period of years and/or months can be subtracted from a {@code YearMonth},
+     * but a period including days cannot.
+     * The approach also subtracts years and months together when necessary, which ensures
+     * correct behaviour at the end of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -888,18 +936,15 @@
      */
     @Override
     public Temporal subtractFrom(Temporal temporal) {
-        Objects.requireNonNull(temporal, "temporal");
-        if ((years | months) != 0) {
-            long monthRange = monthRange(temporal);
-            if (monthRange >= 0) {
-                temporal = temporal.minus(years * monthRange + months, MONTHS);
-            } else {
-                if (years != 0) {
-                    temporal = temporal.minus(years, YEARS);
-                }
-                if (months != 0) {
-                    temporal = temporal.minus(months, MONTHS);
-                }
+        validateChrono(temporal);
+        if (months == 0) {
+            if (years != 0) {
+                temporal = temporal.minus(years, YEARS);
+            }
+        } else {
+            long totalMonths = toTotalMonths();
+            if (totalMonths != 0) {
+                temporal = temporal.minus(totalMonths, MONTHS);
             }
         }
         if (days != 0) {
@@ -909,26 +954,21 @@
     }
 
     /**
-     * Calculates the range of months based on the temporal.
-     *
-     * @param temporal  the temporal, not null
-     * @return the month range, negative if not fixed range
+     * Validates that the temporal has the correct chronology.
      */
-    private long monthRange(Temporal temporal) {
-        if (temporal.isSupported(MONTH_OF_YEAR)) {
-            ValueRange startRange = Chronology.from(temporal).range(MONTH_OF_YEAR);
-            if (startRange.isFixed() && startRange.isIntValue()) {
-                return startRange.getMaximum() - startRange.getMinimum() + 1;
-            }
+    private void validateChrono(TemporalAccessor temporal) {
+        Objects.requireNonNull(temporal, "temporal");
+        Chronology temporalChrono = temporal.query(TemporalQuery.chronology());
+        if (temporalChrono != null && IsoChronology.INSTANCE.equals(temporalChrono) == false) {
+            throw new DateTimeException("Chronology mismatch, expected: ISO, actual: " + temporalChrono.getId());
         }
-        return -1;
     }
 
     //-----------------------------------------------------------------------
     /**
      * Checks if this period is equal to another period.
      * <p>
-     * The comparison is based on the amounts held in the period.
+     * The comparison is based on the type {@code Period} and each of the three amounts.
      * To be equal, the years, months and days units must be individually equal.
      * Note that this means that a period of "15 Months" is not equal to a period
      * of "1 Year and 3 Months".
--- a/jdk/src/share/classes/java/time/Year.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/Year.java	Fri Oct 11 09:17:18 2013 -0400
@@ -242,13 +242,15 @@
         if (temporal instanceof Year) {
             return (Year) temporal;
         }
+        Objects.requireNonNull(temporal, "temporal");
         try {
             if (IsoChronology.INSTANCE.equals(Chronology.from(temporal)) == false) {
                 temporal = LocalDate.from(temporal);
             }
             return of(temporal.get(YEAR));
         } catch (DateTimeException ex) {
-            throw new DateTimeException("Unable to obtain Year from TemporalAccessor: " + temporal.getClass(), ex);
+            throw new DateTimeException("Unable to obtain Year from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
         }
     }
 
@@ -859,7 +861,8 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified year.
      * The result will be negative if the end is before the start.
-     * The {@code Temporal} passed to this method must be a {@code Year}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code Year} using {@link #from(TemporalAccessor)}.
      * For example, the period in decades between two year can be calculated
      * using {@code startYear.until(endYear, DECADES)}.
      * <p>
@@ -885,25 +888,22 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endYear  the end year, which must be a {@code Year}, not null
+     * @param endExclusive  the end date, exclusive, which is converted to a {@code Year}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this year and the end year
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to a {@code Year}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endYear, TemporalUnit unit) {
-        if (endYear instanceof Year == false) {
-            Objects.requireNonNull(endYear, "endYear");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
-        Year end = (Year) endYear;
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        Year end = Year.from(endExclusive);
         if (unit instanceof ChronoUnit) {
             long yearsUntil = ((long) end.year) - year;  // no overflow
             switch ((ChronoUnit) unit) {
@@ -915,7 +915,7 @@
             }
             throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return unit.between(this, endYear);
+        return unit.between(this, end);
     }
 
     /**
--- a/jdk/src/share/classes/java/time/YearMonth.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/YearMonth.java	Fri Oct 11 09:17:18 2013 -0400
@@ -245,13 +245,15 @@
         if (temporal instanceof YearMonth) {
             return (YearMonth) temporal;
         }
+        Objects.requireNonNull(temporal, "temporal");
         try {
             if (IsoChronology.INSTANCE.equals(Chronology.from(temporal)) == false) {
                 temporal = LocalDate.from(temporal);
             }
             return of(temporal.get(YEAR), temporal.get(MONTH_OF_YEAR));
         } catch (DateTimeException ex) {
-            throw new DateTimeException("Unable to obtain YearMonth from TemporalAccessor: " + temporal.getClass(), ex);
+            throw new DateTimeException("Unable to obtain YearMonth from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
         }
     }
 
@@ -992,7 +994,8 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified year-month.
      * The result will be negative if the end is before the start.
-     * The {@code Temporal} passed to this method must be a {@code YearMonth}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code YearMonth} using {@link #from(TemporalAccessor)}.
      * For example, the period in years between two year-months can be calculated
      * using {@code startYearMonth.until(endYearMonth, YEARS)}.
      * <p>
@@ -1018,25 +1021,22 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endYearMonth  the end year-month, which must be a {@code YearMonth}, not null
+     * @param endExclusive  the end date, exclusive, which is converted to a {@code YearMonth}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this year-month and the end year-month
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to a {@code YearMonth}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endYearMonth, TemporalUnit unit) {
-        if (endYearMonth instanceof YearMonth == false) {
-            Objects.requireNonNull(endYearMonth, "endYearMonth");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
-        YearMonth end = (YearMonth) endYearMonth;
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        YearMonth end = YearMonth.from(endExclusive);
         if (unit instanceof ChronoUnit) {
             long monthsUntil = end.getProlepticMonth() - getProlepticMonth();  // no overflow
             switch ((ChronoUnit) unit) {
@@ -1049,7 +1049,7 @@
             }
             throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return unit.between(this, endYearMonth);
+        return unit.between(this, end);
     }
 
     /**
--- a/jdk/src/share/classes/java/time/ZoneId.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/ZoneId.java	Fri Oct 11 09:17:18 2013 -0400
@@ -504,7 +504,8 @@
     public static ZoneId from(TemporalAccessor temporal) {
         ZoneId obj = temporal.query(TemporalQuery.zone());
         if (obj == null) {
-            throw new DateTimeException("Unable to obtain ZoneId from TemporalAccessor: " + temporal.getClass());
+            throw new DateTimeException("Unable to obtain ZoneId from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName());
         }
         return obj;
     }
--- a/jdk/src/share/classes/java/time/ZoneOffset.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/ZoneOffset.java	Fri Oct 11 09:17:18 2013 -0400
@@ -333,9 +333,11 @@
      * @throws DateTimeException if unable to convert to an {@code ZoneOffset}
      */
     public static ZoneOffset from(TemporalAccessor temporal) {
+        Objects.requireNonNull(temporal, "temporal");
         ZoneOffset offset = temporal.query(TemporalQuery.offset());
         if (offset == null) {
-            throw new DateTimeException("Unable to obtain ZoneOffset from TemporalAccessor: " + temporal.getClass());
+            throw new DateTimeException("Unable to obtain ZoneOffset from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName());
         }
         return offset;
     }
--- a/jdk/src/share/classes/java/time/ZonedDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/ZonedDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -553,7 +553,8 @@
                 return of(ldt, zone);
             }
         } catch (DateTimeException ex) {
-            throw new DateTimeException("Unable to create ZonedDateTime from TemporalAccessor: " + temporal.getClass(), ex);
+            throw new DateTimeException("Unable to obtain ZonedDateTime from TemporalAccessor: " +
+                    temporal + " of type " + temporal.getClass().getName(), ex);
         }
     }
 
@@ -1540,6 +1541,11 @@
      */
     @Override
     public ZonedDateTime plus(TemporalAmount amountToAdd) {
+        if (amountToAdd instanceof Period) {
+            Period periodToAdd = (Period) amountToAdd;
+            return resolveLocal(dateTime.plus(periodToAdd));
+        }
+        Objects.requireNonNull(amountToAdd, "amountToAdd");
         return (ZonedDateTime) amountToAdd.addTo(this);
     }
 
@@ -1787,6 +1793,11 @@
      */
     @Override
     public ZonedDateTime minus(TemporalAmount amountToSubtract) {
+        if (amountToSubtract instanceof Period) {
+            Period periodToSubtract = (Period) amountToSubtract;
+            return resolveLocal(dateTime.minus(periodToSubtract));
+        }
+        Objects.requireNonNull(amountToSubtract, "amountToSubtract");
         return (ZonedDateTime) amountToSubtract.subtractFrom(this);
     }
 
@@ -2034,7 +2045,8 @@
      * For example, the period in days between two date-times can be calculated
      * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
-     * The {@code Temporal} passed to this method must be a {@code ZonedDateTime}.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code ZonedDateTime} using {@link #from(TemporalAccessor)}.
      * If the time-zone differs between the two zoned date-times, the specified
      * end date-time is normalized to have the same zone as this date-time.
      * <p>
@@ -2076,26 +2088,23 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
-     * the second argument.
+     * passing {@code this} as the first argument and the converted input temporal
+     * as the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endDateTime  the end date-time, which must be a {@code ZonedDateTime}, not null
+     * @param endExclusive  the end date, exclusive, which is converted to a {@code ZonedDateTime}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this date-time and the end date-time
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to a {@code ZonedDateTime}
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long until(Temporal endDateTime, TemporalUnit unit) {
-        if (endDateTime instanceof ZonedDateTime == false) {
-            Objects.requireNonNull(endDateTime, "endDateTime");
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        ZonedDateTime end = ZonedDateTime.from(endExclusive);
         if (unit instanceof ChronoUnit) {
-            ZonedDateTime end = (ZonedDateTime) endDateTime;
             end = end.withZoneSameInstant(zone);
             if (unit.isDateBased()) {
                 return dateTime.until(end.dateTime, unit);
@@ -2103,7 +2112,7 @@
                 return toOffsetDateTime().until(end.toOffsetDateTime(), unit);
             }
         }
-        return unit.between(this, endDateTime);
+        return unit.between(this, end);
     }
 
     /**
--- a/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,455 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Copyright (c) 2012, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package java.time.chrono;
-
-import static java.time.temporal.ChronoField.DAY_OF_MONTH;
-import static java.time.temporal.ChronoField.ERA;
-import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
-import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
-import static java.time.temporal.ChronoField.YEAR_OF_ERA;
-
-import java.io.Serializable;
-import java.time.DateTimeException;
-import java.time.temporal.ChronoUnit;
-import java.time.temporal.Temporal;
-import java.time.temporal.TemporalAdjuster;
-import java.time.temporal.TemporalAmount;
-import java.time.temporal.TemporalField;
-import java.time.temporal.TemporalUnit;
-import java.time.temporal.UnsupportedTemporalTypeException;
-import java.time.temporal.ValueRange;
-import java.util.Objects;
-
-/**
- * A date expressed in terms of a standard year-month-day calendar system.
- * <p>
- * This class is used by applications seeking to handle dates in non-ISO calendar systems.
- * For example, the Japanese, Minguo, Thai Buddhist and others.
- * <p>
- * {@code ChronoLocalDate} is built on the generic concepts of year, month and day.
- * The calendar system, represented by a {@link java.time.chrono.Chronology}, expresses the relationship between
- * the fields and this class allows the resulting date to be manipulated.
- * <p>
- * Note that not all calendar systems are suitable for use with this class.
- * For example, the Mayan calendar uses a system that bears no relation to years, months and days.
- * <p>
- * The API design encourages the use of {@code LocalDate} for the majority of the application.
- * This includes code to read and write from a persistent data store, such as a database,
- * and to send dates and times across a network. The {@code ChronoLocalDate} instance is then used
- * at the user interface level to deal with localized input/output.
- *
- * <P>Example: </p>
- * <pre>
- *        System.out.printf("Example()%n");
- *        // Enumerate the list of available calendars and print today for each
- *        Set&lt;Chronology&gt; chronos = Chronology.getAvailableChronologies();
- *        for (Chronology chrono : chronos) {
- *            ChronoLocalDate date = chrono.dateNow();
- *            System.out.printf("   %20s: %s%n", chrono.getID(), date.toString());
- *        }
- *
- *        // Print the Hijrah date and calendar
- *        ChronoLocalDate date = Chronology.of("Hijrah").dateNow();
- *        int day = date.get(ChronoField.DAY_OF_MONTH);
- *        int dow = date.get(ChronoField.DAY_OF_WEEK);
- *        int month = date.get(ChronoField.MONTH_OF_YEAR);
- *        int year = date.get(ChronoField.YEAR);
- *        System.out.printf("  Today is %s %s %d-%s-%d%n", date.getChronology().getID(),
- *                dow, day, month, year);
-
- *        // Print today's date and the last day of the year
- *        ChronoLocalDate now1 = Chronology.of("Hijrah").dateNow();
- *        ChronoLocalDate first = now1.with(ChronoField.DAY_OF_MONTH, 1)
- *                .with(ChronoField.MONTH_OF_YEAR, 1);
- *        ChronoLocalDate last = first.plus(1, ChronoUnit.YEARS)
- *                .minus(1, ChronoUnit.DAYS);
- *        System.out.printf("  Today is %s: start: %s; end: %s%n", last.getChronology().getID(),
- *                first, last);
- * </pre>
- *
- * <h3>Adding Calendars</h3>
- * <p> The set of calendars is extensible by defining a subclass of {@link ChronoLocalDate}
- * to represent a date instance and an implementation of {@code Chronology}
- * to be the factory for the ChronoLocalDate subclass.
- * </p>
- * <p> To permit the discovery of the additional calendar types the implementation of
- * {@code Chronology} must be registered as a Service implementing the {@code Chronology} interface
- * in the {@code META-INF/Services} file as per the specification of {@link java.util.ServiceLoader}.
- * The subclass must function according to the {@code Chronology} class description and must provide its
- * {@link java.time.chrono.Chronology#getId() chronlogy ID} and {@link Chronology#getCalendarType() calendar type}. </p>
- *
- * @implSpec
- * This abstract class must be implemented with care to ensure other classes operate correctly.
- * All implementations that can be instantiated must be final, immutable and thread-safe.
- * Subclasses should be Serializable wherever possible.
- *
- * @param <D> the ChronoLocalDate of this date-time
- * @since 1.8
- */
-abstract class ChronoDateImpl<D extends ChronoLocalDate>
-        implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable {
-
-    /**
-     * Serialization version.
-     */
-    private static final long serialVersionUID = 6282433883239719096L;
-
-    /**
-     * Casts the {@code Temporal} to {@code ChronoLocalDate} ensuring it bas the specified chronology.
-     *
-     * @param chrono  the chronology to check for, not null
-     * @param temporal  a date-time to cast, not null
-     * @return the date-time checked and cast to {@code ChronoLocalDate}, not null
-     * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDate
-     *  or the chronology is not equal this Chronology
-     */
-    static <D extends ChronoLocalDate> D ensureValid(Chronology chrono, Temporal temporal) {
-        @SuppressWarnings("unchecked")
-        D other = (D) temporal;
-        if (chrono.equals(other.getChronology()) == false) {
-            throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + other.getChronology().getId());
-        }
-        return other;
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Creates an instance.
-     */
-    ChronoDateImpl() {
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public D with(TemporalAdjuster adjuster) {
-        return (D) ChronoLocalDate.super.with(adjuster);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public D with(TemporalField field, long value) {
-        return (D) ChronoLocalDate.super.with(field, value);
-    }
-
-    //-----------------------------------------------------------------------
-    @Override
-    @SuppressWarnings("unchecked")
-    public D plus(TemporalAmount amount) {
-        return (D) ChronoLocalDate.super.plus(amount);
-    }
-
-    //-----------------------------------------------------------------------
-    @Override
-    @SuppressWarnings("unchecked")
-    public D plus(long amountToAdd, TemporalUnit unit) {
-        if (unit instanceof ChronoUnit) {
-            ChronoUnit f = (ChronoUnit) unit;
-            switch (f) {
-                case DAYS: return plusDays(amountToAdd);
-                case WEEKS: return plusDays(Math.multiplyExact(amountToAdd, 7));
-                case MONTHS: return plusMonths(amountToAdd);
-                case YEARS: return plusYears(amountToAdd);
-                case DECADES: return plusYears(Math.multiplyExact(amountToAdd, 10));
-                case CENTURIES: return plusYears(Math.multiplyExact(amountToAdd, 100));
-                case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
-                case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
-            }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
-        }
-        return (D) ChronoLocalDate.super.plus(amountToAdd, unit);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public D minus(TemporalAmount amount) {
-        return (D) ChronoLocalDate.super.minus(amount);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public D minus(long amountToSubtract, TemporalUnit unit) {
-        return (D) ChronoLocalDate.super.minus(amountToSubtract, unit);
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Returns a copy of this date with the specified period in years added.
-     * <p>
-     * This adds the specified period in years to the date.
-     * In some cases, adding years can cause the resulting date to become invalid.
-     * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure
-     * that the result is valid. Typically this will select the last valid day of the month.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param yearsToAdd  the years to add, may be negative
-     * @return a date based on this one with the years added, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    abstract D plusYears(long yearsToAdd);
-
-    /**
-     * Returns a copy of this date with the specified period in months added.
-     * <p>
-     * This adds the specified period in months to the date.
-     * In some cases, adding months can cause the resulting date to become invalid.
-     * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure
-     * that the result is valid. Typically this will select the last valid day of the month.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param monthsToAdd  the months to add, may be negative
-     * @return a date based on this one with the months added, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    abstract D plusMonths(long monthsToAdd);
-
-    /**
-     * Returns a copy of this date with the specified period in weeks added.
-     * <p>
-     * This adds the specified period in weeks to the date.
-     * In some cases, adding weeks can cause the resulting date to become invalid.
-     * If this occurs, then other fields will be adjusted to ensure that the result is valid.
-     * <p>
-     * The default implementation uses {@link #plusDays(long)} using a 7 day week.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param weeksToAdd  the weeks to add, may be negative
-     * @return a date based on this one with the weeks added, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    D plusWeeks(long weeksToAdd) {
-        return plusDays(Math.multiplyExact(weeksToAdd, 7));
-    }
-
-    /**
-     * Returns a copy of this date with the specified number of days added.
-     * <p>
-     * This adds the specified period in days to the date.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param daysToAdd  the days to add, may be negative
-     * @return a date based on this one with the days added, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    abstract D plusDays(long daysToAdd);
-
-    //-----------------------------------------------------------------------
-    /**
-     * Returns a copy of this date with the specified period in years subtracted.
-     * <p>
-     * This subtracts the specified period in years to the date.
-     * In some cases, subtracting years can cause the resulting date to become invalid.
-     * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure
-     * that the result is valid. Typically this will select the last valid day of the month.
-     * <p>
-     * The default implementation uses {@link #plusYears(long)}.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param yearsToSubtract  the years to subtract, may be negative
-     * @return a date based on this one with the years subtracted, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    @SuppressWarnings("unchecked")
-    D minusYears(long yearsToSubtract) {
-        return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract));
-    }
-
-    /**
-     * Returns a copy of this date with the specified period in months subtracted.
-     * <p>
-     * This subtracts the specified period in months to the date.
-     * In some cases, subtracting months can cause the resulting date to become invalid.
-     * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure
-     * that the result is valid. Typically this will select the last valid day of the month.
-     * <p>
-     * The default implementation uses {@link #plusMonths(long)}.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param monthsToSubtract  the months to subtract, may be negative
-     * @return a date based on this one with the months subtracted, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    @SuppressWarnings("unchecked")
-    D minusMonths(long monthsToSubtract) {
-        return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract));
-    }
-
-    /**
-     * Returns a copy of this date with the specified period in weeks subtracted.
-     * <p>
-     * This subtracts the specified period in weeks to the date.
-     * In some cases, subtracting weeks can cause the resulting date to become invalid.
-     * If this occurs, then other fields will be adjusted to ensure that the result is valid.
-     * <p>
-     * The default implementation uses {@link #plusWeeks(long)}.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param weeksToSubtract  the weeks to subtract, may be negative
-     * @return a date based on this one with the weeks subtracted, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    @SuppressWarnings("unchecked")
-    D minusWeeks(long weeksToSubtract) {
-        return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract));
-    }
-
-    /**
-     * Returns a copy of this date with the specified number of days subtracted.
-     * <p>
-     * This subtracts the specified period in days to the date.
-     * <p>
-     * The default implementation uses {@link #plusDays(long)}.
-     * <p>
-     * This instance is immutable and unaffected by this method call.
-     *
-     * @param daysToSubtract  the days to subtract, may be negative
-     * @return a date based on this one with the days subtracted, not null
-     * @throws DateTimeException if the result exceeds the supported date range
-     */
-    @SuppressWarnings("unchecked")
-    D minusDays(long daysToSubtract) {
-        return (daysToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract));
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * {@inheritDoc}
-     * @throws DateTimeException {@inheritDoc}
-     * @throws ArithmeticException {@inheritDoc}
-     */
-    @Override
-    public long until(Temporal endDateTime, TemporalUnit unit) {
-        Objects.requireNonNull(endDateTime, "endDateTime");
-        Objects.requireNonNull(unit, "unit");
-        if (endDateTime instanceof ChronoLocalDate == false) {
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
-        ChronoLocalDate end = (ChronoLocalDate) endDateTime;
-        if (getChronology().equals(end.getChronology()) == false) {
-            throw new DateTimeException("Unable to calculate amount as objects have different chronologies");
-        }
-        if (unit instanceof ChronoUnit) {
-            switch ((ChronoUnit) unit) {
-                case DAYS: return daysUntil(end);
-                case WEEKS: return daysUntil(end) / 7;
-                case MONTHS: return monthsUntil(end);
-                case YEARS: return monthsUntil(end) / 12;
-                case DECADES: return monthsUntil(end) / 120;
-                case CENTURIES: return monthsUntil(end) / 1200;
-                case MILLENNIA: return monthsUntil(end) / 12000;
-                case ERAS: return end.getLong(ERA) - getLong(ERA);
-            }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
-        }
-        return unit.between(this, endDateTime);
-    }
-
-    private long daysUntil(ChronoLocalDate end) {
-        return end.toEpochDay() - toEpochDay();  // no overflow
-    }
-
-    private long monthsUntil(ChronoLocalDate end) {
-        ValueRange range = getChronology().range(MONTH_OF_YEAR);
-        if (range.getMaximum() != 12) {
-            throw new IllegalStateException("ChronoDateImpl only supports Chronologies with 12 months per year");
-        }
-        long packed1 = getLong(PROLEPTIC_MONTH) * 32L + get(DAY_OF_MONTH);  // no overflow
-        long packed2 = end.getLong(PROLEPTIC_MONTH) * 32L + end.get(DAY_OF_MONTH);  // no overflow
-        return (packed2 - packed1) / 32;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof ChronoLocalDate) {
-            return compareTo((ChronoLocalDate) obj) == 0;
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        long epDay = toEpochDay();
-        return getChronology().hashCode() ^ ((int) (epDay ^ (epDay >>> 32)));
-    }
-
-    @Override
-    public String toString() {
-        // getLong() reduces chances of exceptions in toString()
-        long yoe = getLong(YEAR_OF_ERA);
-        long moy = getLong(MONTH_OF_YEAR);
-        long dom = getLong(DAY_OF_MONTH);
-        StringBuilder buf = new StringBuilder(30);
-        buf.append(getChronology().toString())
-                .append(" ")
-                .append(getEra())
-                .append(" ")
-                .append(yoe)
-                .append(moy < 10 ? "-0" : "-").append(moy)
-                .append(dom < 10 ? "-0" : "-").append(dom);
-        return buf.toString();
-    }
-
-}
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -69,7 +69,6 @@
 import java.time.DateTimeException;
 import java.time.LocalDate;
 import java.time.LocalTime;
-import java.time.Period;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoField;
 import java.time.temporal.ChronoUnit;
@@ -292,6 +291,7 @@
         if (temporal instanceof ChronoLocalDate) {
             return (ChronoLocalDate) temporal;
         }
+        Objects.requireNonNull(temporal, "temporal");
         Chronology chrono = temporal.query(TemporalQuery.chronology());
         if (chrono == null) {
             throw new DateTimeException("Unable to obtain ChronoLocalDate from TemporalAccessor: " + temporal.getClass());
@@ -428,7 +428,7 @@
      */
     @Override
     default ChronoLocalDate with(TemporalAdjuster adjuster) {
-        return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.with(adjuster));
+        return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.with(adjuster));
     }
 
     /**
@@ -442,7 +442,7 @@
         if (field instanceof ChronoField) {
             throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
-        return ChronoDateImpl.ensureValid(getChronology(), field.adjustInto(this, newValue));
+        return ChronoLocalDateImpl.ensureValid(getChronology(), field.adjustInto(this, newValue));
     }
 
     /**
@@ -452,7 +452,7 @@
      */
     @Override
     default ChronoLocalDate plus(TemporalAmount amount) {
-        return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount));
+        return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount));
     }
 
     /**
@@ -465,7 +465,7 @@
         if (unit instanceof ChronoUnit) {
             throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return ChronoDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd));
+        return ChronoLocalDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd));
     }
 
     /**
@@ -475,7 +475,7 @@
      */
     @Override
     default ChronoLocalDate minus(TemporalAmount amount) {
-        return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount));
+        return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount));
     }
 
     /**
@@ -486,7 +486,7 @@
      */
     @Override
     default ChronoLocalDate minus(long amountToSubtract, TemporalUnit unit) {
-        return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit));
+        return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit));
     }
 
     //-----------------------------------------------------------------------
@@ -561,8 +561,8 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified date.
      * The result will be negative if the end is before the start.
-     * The {@code Temporal} passed to this method must be a
-     * {@code ChronoLocalDate} in the same chronology.
+     * The {@code Temporal} passed to this method is converted to a
+     * {@code ChronoLocalDate} using {@link Chronology#date(TemporalAccessor)}.
      * The calculation returns a whole number, representing the number of
      * complete units between the two dates.
      * For example, the amount in days between two dates can be calculated
@@ -586,25 +586,30 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
+     * passing {@code this} as the first argument and the converted input temporal as
      * the second argument.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endDate  the end date, which must be a {@code ChronoLocalDate}
-     *  in the same chronology, not null
+     * @param endExclusive  the end date, exclusive, which is converted to a
+     *  {@code ChronoLocalDate} in the same chronology, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this date and the end date
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to a {@code ChronoLocalDate}
+     * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override  // override for Javadoc
-    long until(Temporal endDate, TemporalUnit unit);
+    long until(Temporal endExclusive, TemporalUnit unit);
 
     /**
-     * Calculates the period between this date and another date as a {@code Period}.
+     * Calculates the period between this date and another date as a {@code ChronoPeriod}.
      * <p>
-     * This calculates the period between two dates in terms of years, months and days.
+     * This calculates the period between two dates. All supplied chronologies
+     * calculate the period using years, months and days, however the
+     * {@code ChronoPeriod} API allows the period to be represented using other units.
+     * <p>
      * The start and end points are {@code this} and the specified date.
      * The result will be negative if the end is before the start.
      * The negative sign will be the same in each of year, month and day.
@@ -614,12 +619,12 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endDate  the end date, exclusive, which may be in any chronology, not null
+     * @param endDateExclusive  the end date, exclusive, which may be in any chronology, not null
      * @return the period between this date and the end date, not null
      * @throws DateTimeException if the period cannot be calculated
      * @throws ArithmeticException if numeric overflow occurs
      */
-    Period until(ChronoLocalDate endDate);
+    ChronoPeriod until(ChronoLocalDate endDateExclusive);
 
     /**
      * Formats this date using the specified formatter.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,444 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package java.time.chrono;
+
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.ERA;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
+import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+
+import java.io.Serializable;
+import java.time.DateTimeException;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAdjuster;
+import java.time.temporal.TemporalAmount;
+import java.time.temporal.TemporalField;
+import java.time.temporal.TemporalUnit;
+import java.time.temporal.UnsupportedTemporalTypeException;
+import java.time.temporal.ValueRange;
+import java.util.Objects;
+
+/**
+ * A date expressed in terms of a standard year-month-day calendar system.
+ * <p>
+ * This class is used by applications seeking to handle dates in non-ISO calendar systems.
+ * For example, the Japanese, Minguo, Thai Buddhist and others.
+ * <p>
+ * {@code ChronoLocalDate} is built on the generic concepts of year, month and day.
+ * The calendar system, represented by a {@link java.time.chrono.Chronology}, expresses the relationship between
+ * the fields and this class allows the resulting date to be manipulated.
+ * <p>
+ * Note that not all calendar systems are suitable for use with this class.
+ * For example, the Mayan calendar uses a system that bears no relation to years, months and days.
+ * <p>
+ * The API design encourages the use of {@code LocalDate} for the majority of the application.
+ * This includes code to read and write from a persistent data store, such as a database,
+ * and to send dates and times across a network. The {@code ChronoLocalDate} instance is then used
+ * at the user interface level to deal with localized input/output.
+ *
+ * <P>Example: </p>
+ * <pre>
+ *        System.out.printf("Example()%n");
+ *        // Enumerate the list of available calendars and print today for each
+ *        Set&lt;Chronology&gt; chronos = Chronology.getAvailableChronologies();
+ *        for (Chronology chrono : chronos) {
+ *            ChronoLocalDate date = chrono.dateNow();
+ *            System.out.printf("   %20s: %s%n", chrono.getID(), date.toString());
+ *        }
+ *
+ *        // Print the Hijrah date and calendar
+ *        ChronoLocalDate date = Chronology.of("Hijrah").dateNow();
+ *        int day = date.get(ChronoField.DAY_OF_MONTH);
+ *        int dow = date.get(ChronoField.DAY_OF_WEEK);
+ *        int month = date.get(ChronoField.MONTH_OF_YEAR);
+ *        int year = date.get(ChronoField.YEAR);
+ *        System.out.printf("  Today is %s %s %d-%s-%d%n", date.getChronology().getID(),
+ *                dow, day, month, year);
+
+ *        // Print today's date and the last day of the year
+ *        ChronoLocalDate now1 = Chronology.of("Hijrah").dateNow();
+ *        ChronoLocalDate first = now1.with(ChronoField.DAY_OF_MONTH, 1)
+ *                .with(ChronoField.MONTH_OF_YEAR, 1);
+ *        ChronoLocalDate last = first.plus(1, ChronoUnit.YEARS)
+ *                .minus(1, ChronoUnit.DAYS);
+ *        System.out.printf("  Today is %s: start: %s; end: %s%n", last.getChronology().getID(),
+ *                first, last);
+ * </pre>
+ *
+ * <h3>Adding Calendars</h3>
+ * <p> The set of calendars is extensible by defining a subclass of {@link ChronoLocalDate}
+ * to represent a date instance and an implementation of {@code Chronology}
+ * to be the factory for the ChronoLocalDate subclass.
+ * </p>
+ * <p> To permit the discovery of the additional calendar types the implementation of
+ * {@code Chronology} must be registered as a Service implementing the {@code Chronology} interface
+ * in the {@code META-INF/Services} file as per the specification of {@link java.util.ServiceLoader}.
+ * The subclass must function according to the {@code Chronology} class description and must provide its
+ * {@link java.time.chrono.Chronology#getId() chronlogy ID} and {@link Chronology#getCalendarType() calendar type}. </p>
+ *
+ * @implSpec
+ * This abstract class must be implemented with care to ensure other classes operate correctly.
+ * All implementations that can be instantiated must be final, immutable and thread-safe.
+ * Subclasses should be Serializable wherever possible.
+ *
+ * @param <D> the ChronoLocalDate of this date-time
+ * @since 1.8
+ */
+abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
+        implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable {
+
+    /**
+     * Serialization version.
+     */
+    private static final long serialVersionUID = 6282433883239719096L;
+
+    /**
+     * Casts the {@code Temporal} to {@code ChronoLocalDate} ensuring it bas the specified chronology.
+     *
+     * @param chrono  the chronology to check for, not null
+     * @param temporal  a date-time to cast, not null
+     * @return the date-time checked and cast to {@code ChronoLocalDate}, not null
+     * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDate
+     *  or the chronology is not equal this Chronology
+     */
+    static <D extends ChronoLocalDate> D ensureValid(Chronology chrono, Temporal temporal) {
+        @SuppressWarnings("unchecked")
+        D other = (D) temporal;
+        if (chrono.equals(other.getChronology()) == false) {
+            throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + other.getChronology().getId());
+        }
+        return other;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Creates an instance.
+     */
+    ChronoLocalDateImpl() {
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public D with(TemporalAdjuster adjuster) {
+        return (D) ChronoLocalDate.super.with(adjuster);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public D with(TemporalField field, long value) {
+        return (D) ChronoLocalDate.super.with(field, value);
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    @SuppressWarnings("unchecked")
+    public D plus(TemporalAmount amount) {
+        return (D) ChronoLocalDate.super.plus(amount);
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    @SuppressWarnings("unchecked")
+    public D plus(long amountToAdd, TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            ChronoUnit f = (ChronoUnit) unit;
+            switch (f) {
+                case DAYS: return plusDays(amountToAdd);
+                case WEEKS: return plusDays(Math.multiplyExact(amountToAdd, 7));
+                case MONTHS: return plusMonths(amountToAdd);
+                case YEARS: return plusYears(amountToAdd);
+                case DECADES: return plusYears(Math.multiplyExact(amountToAdd, 10));
+                case CENTURIES: return plusYears(Math.multiplyExact(amountToAdd, 100));
+                case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
+                case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
+            }
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
+        }
+        return (D) ChronoLocalDate.super.plus(amountToAdd, unit);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public D minus(TemporalAmount amount) {
+        return (D) ChronoLocalDate.super.minus(amount);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public D minus(long amountToSubtract, TemporalUnit unit) {
+        return (D) ChronoLocalDate.super.minus(amountToSubtract, unit);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Returns a copy of this date with the specified period in years added.
+     * <p>
+     * This adds the specified period in years to the date.
+     * In some cases, adding years can cause the resulting date to become invalid.
+     * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure
+     * that the result is valid. Typically this will select the last valid day of the month.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param yearsToAdd  the years to add, may be negative
+     * @return a date based on this one with the years added, not null
+     * @throws DateTimeException if the result exceeds the supported date range
+     */
+    abstract D plusYears(long yearsToAdd);
+
+    /**
+     * Returns a copy of this date with the specified period in months added.
+     * <p>
+     * This adds the specified period in months to the date.
+     * In some cases, adding months can cause the resulting date to become invalid.
+     * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure
+     * that the result is valid. Typically this will select the last valid day of the month.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param monthsToAdd  the months to add, may be negative
+     * @return a date based on this one with the months added, not null
+     * @throws DateTimeException if the result exceeds the supported date range
+     */
+    abstract D plusMonths(long monthsToAdd);
+
+    /**
+     * Returns a copy of this date with the specified period in weeks added.
+     * <p>
+     * This adds the specified period in weeks to the date.
+     * In some cases, adding weeks can cause the resulting date to become invalid.
+     * If this occurs, then other fields will be adjusted to ensure that the result is valid.
+     * <p>
+     * The default implementation uses {@link #plusDays(long)} using a 7 day week.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param weeksToAdd  the weeks to add, may be negative
+     * @return a date based on this one with the weeks added, not null
+     * @throws DateTimeException if the result exceeds the supported date range
+     */
+    D plusWeeks(long weeksToAdd) {
+        return plusDays(Math.multiplyExact(weeksToAdd, 7));
+    }
+
+    /**
+     * Returns a copy of this date with the specified number of days added.
+     * <p>
+     * This adds the specified period in days to the date.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param daysToAdd  the days to add, may be negative
+     * @return a date based on this one with the days added, not null
+     * @throws DateTimeException if the result exceeds the supported date range
+     */
+    abstract D plusDays(long daysToAdd);
+
+    //-----------------------------------------------------------------------
+    /**
+     * Returns a copy of this date with the specified period in years subtracted.
+     * <p>
+     * This subtracts the specified period in years to the date.
+     * In some cases, subtracting years can cause the resulting date to become invalid.
+     * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure
+     * that the result is valid. Typically this will select the last valid day of the month.
+     * <p>
+     * The default implementation uses {@link #plusYears(long)}.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param yearsToSubtract  the years to subtract, may be negative
+     * @return a date based on this one with the years subtracted, not null
+     * @throws DateTimeException if the result exceeds the supported date range
+     */
+    @SuppressWarnings("unchecked")
+    D minusYears(long yearsToSubtract) {
+        return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract));
+    }
+
+    /**
+     * Returns a copy of this date with the specified period in months subtracted.
+     * <p>
+     * This subtracts the specified period in months to the date.
+     * In some cases, subtracting months can cause the resulting date to become invalid.
+     * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure
+     * that the result is valid. Typically this will select the last valid day of the month.
+     * <p>
+     * The default implementation uses {@link #plusMonths(long)}.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param monthsToSubtract  the months to subtract, may be negative
+     * @return a date based on this one with the months subtracted, not null
+     * @throws DateTimeException if the result exceeds the supported date range
+     */
+    @SuppressWarnings("unchecked")
+    D minusMonths(long monthsToSubtract) {
+        return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract));
+    }
+
+    /**
+     * Returns a copy of this date with the specified period in weeks subtracted.
+     * <p>
+     * This subtracts the specified period in weeks to the date.
+     * In some cases, subtracting weeks can cause the resulting date to become invalid.
+     * If this occurs, then other fields will be adjusted to ensure that the result is valid.
+     * <p>
+     * The default implementation uses {@link #plusWeeks(long)}.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param weeksToSubtract  the weeks to subtract, may be negative
+     * @return a date based on this one with the weeks subtracted, not null
+     * @throws DateTimeException if the result exceeds the supported date range
+     */
+    @SuppressWarnings("unchecked")
+    D minusWeeks(long weeksToSubtract) {
+        return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract));
+    }
+
+    /**
+     * Returns a copy of this date with the specified number of days subtracted.
+     * <p>
+     * This subtracts the specified period in days to the date.
+     * <p>
+     * The default implementation uses {@link #plusDays(long)}.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param daysToSubtract  the days to subtract, may be negative
+     * @return a date based on this one with the days subtracted, not null
+     * @throws DateTimeException if the result exceeds the supported date range
+     */
+    @SuppressWarnings("unchecked")
+    D minusDays(long daysToSubtract) {
+        return (daysToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract));
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        Objects.requireNonNull(endExclusive, "endExclusive");
+        ChronoLocalDate end = getChronology().date(endExclusive);
+        if (unit instanceof ChronoUnit) {
+            switch ((ChronoUnit) unit) {
+                case DAYS: return daysUntil(end);
+                case WEEKS: return daysUntil(end) / 7;
+                case MONTHS: return monthsUntil(end);
+                case YEARS: return monthsUntil(end) / 12;
+                case DECADES: return monthsUntil(end) / 120;
+                case CENTURIES: return monthsUntil(end) / 1200;
+                case MILLENNIA: return monthsUntil(end) / 12000;
+                case ERAS: return end.getLong(ERA) - getLong(ERA);
+            }
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
+        }
+        Objects.requireNonNull(unit, "unit");
+        return unit.between(this, end);
+    }
+
+    private long daysUntil(ChronoLocalDate end) {
+        return end.toEpochDay() - toEpochDay();  // no overflow
+    }
+
+    private long monthsUntil(ChronoLocalDate end) {
+        ValueRange range = getChronology().range(MONTH_OF_YEAR);
+        if (range.getMaximum() != 12) {
+            throw new IllegalStateException("ChronoLocalDateImpl only supports Chronologies with 12 months per year");
+        }
+        long packed1 = getLong(PROLEPTIC_MONTH) * 32L + get(DAY_OF_MONTH);  // no overflow
+        long packed2 = end.getLong(PROLEPTIC_MONTH) * 32L + end.get(DAY_OF_MONTH);  // no overflow
+        return (packed2 - packed1) / 32;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof ChronoLocalDate) {
+            return compareTo((ChronoLocalDate) obj) == 0;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        long epDay = toEpochDay();
+        return getChronology().hashCode() ^ ((int) (epDay ^ (epDay >>> 32)));
+    }
+
+    @Override
+    public String toString() {
+        // getLong() reduces chances of exceptions in toString()
+        long yoe = getLong(YEAR_OF_ERA);
+        long moy = getLong(MONTH_OF_YEAR);
+        long dom = getLong(DAY_OF_MONTH);
+        StringBuilder buf = new StringBuilder(30);
+        buf.append(getChronology().toString())
+                .append(" ")
+                .append(getEra())
+                .append(" ")
+                .append(yoe)
+                .append(moy < 10 ? "-0" : "-").append(moy)
+                .append(dom < 10 ? "-0" : "-").append(dom);
+        return buf.toString();
+    }
+
+}
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -165,6 +165,7 @@
         if (temporal instanceof ChronoLocalDateTime) {
             return (ChronoLocalDateTime<?>) temporal;
         }
+        Objects.requireNonNull(temporal, "temporal");
         Chronology chrono = temporal.query(TemporalQuery.chronology());
         if (chrono == null) {
             throw new DateTimeException("Unable to obtain ChronoLocalDateTime from TemporalAccessor: " + temporal.getClass());
@@ -174,6 +175,18 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Gets the chronology of this date-time.
+     * <p>
+     * The {@code Chronology} represents the calendar system in use.
+     * The era and other fields in {@link ChronoField} are defined by the chronology.
+     *
+     * @return the chronology, not null
+     */
+    default Chronology getChronology() {
+        return toLocalDate().getChronology();
+    }
+
+    /**
      * Gets the local date part of this date-time.
      * <p>
      * This returns a local date with the same year, month and day
@@ -250,7 +263,7 @@
      */
     @Override
     default ChronoLocalDateTime<D> with(TemporalAdjuster adjuster) {
-        return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.with(adjuster));
+        return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.with(adjuster));
     }
 
     /**
@@ -268,7 +281,7 @@
      */
     @Override
     default ChronoLocalDateTime<D> plus(TemporalAmount amount) {
-        return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.plus(amount));
+        return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.plus(amount));
     }
 
     /**
@@ -286,7 +299,7 @@
      */
     @Override
     default ChronoLocalDateTime<D> minus(TemporalAmount amount) {
-        return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amount));
+        return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amount));
     }
 
     /**
@@ -296,7 +309,7 @@
      */
     @Override
     default ChronoLocalDateTime<D> minus(long amountToSubtract, TemporalUnit unit) {
-        return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amountToSubtract, unit));
+        return ChronoLocalDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit));
     }
 
     //-----------------------------------------------------------------------
@@ -326,7 +339,7 @@
         } else if (query == TemporalQuery.localTime()) {
             return (R) toLocalTime();
         } else if (query == TemporalQuery.chronology()) {
-            return (R) toLocalDate().getChronology();
+            return (R) getChronology();
         } else if (query == TemporalQuery.precision()) {
             return (R) NANOS;
         }
@@ -488,7 +501,7 @@
         if (cmp == 0) {
             cmp = toLocalTime().compareTo(other.toLocalTime());
             if (cmp == 0) {
-                cmp = toLocalDate().getChronology().compareTo(other.toLocalDate().getChronology());
+                cmp = getChronology().compareTo(other.getChronology());
             }
         }
         return cmp;
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -69,7 +69,6 @@
 import java.io.ObjectOutput;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
-import java.time.DateTimeException;
 import java.time.LocalTime;
 import java.time.ZoneId;
 import java.time.temporal.ChronoField;
@@ -187,9 +186,9 @@
     static <R extends ChronoLocalDate> ChronoLocalDateTimeImpl<R> ensureValid(Chronology chrono, Temporal temporal) {
         @SuppressWarnings("unchecked")
         ChronoLocalDateTimeImpl<R> other = (ChronoLocalDateTimeImpl<R>) temporal;
-        if (chrono.equals(other.toLocalDate().getChronology()) == false) {
+        if (chrono.equals(other.getChronology()) == false) {
             throw new ClassCastException("Chronology mismatch, required: " + chrono.getId()
-                    + ", actual: " + other.toLocalDate().getChronology().getId());
+                    + ", actual: " + other.getChronology().getId());
         }
         return other;
     }
@@ -220,7 +219,7 @@
             return this;
         }
         // Validate that the new Temporal is a ChronoLocalDate (and not something else)
-        D cd = ChronoDateImpl.ensureValid(date.getChronology(), newDate);
+        D cd = ChronoLocalDateImpl.ensureValid(date.getChronology(), newDate);
         return new ChronoLocalDateTimeImpl<>(cd, newTime);
     }
 
@@ -369,15 +368,10 @@
 
     //-----------------------------------------------------------------------
     @Override
-    public long until(Temporal endDateTime, TemporalUnit unit) {
-        if (endDateTime instanceof ChronoLocalDateTime == false) {
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        Objects.requireNonNull(endExclusive, "endExclusive");
         @SuppressWarnings("unchecked")
-        ChronoLocalDateTime<D> end = (ChronoLocalDateTime<D>) endDateTime;
-        if (toLocalDate().getChronology().equals(end.toLocalDate().getChronology()) == false) {
-            throw new DateTimeException("Unable to calculate amount as objects have different chronologies");
-        }
+        ChronoLocalDateTime<D> end = (ChronoLocalDateTime<D>) getChronology().localDateTime(endExclusive);
         if (unit instanceof ChronoUnit) {
             if (unit.isTimeBased()) {
                 long amount = end.getLong(EPOCH_DAY) - date.getLong(EPOCH_DAY);
@@ -398,7 +392,8 @@
             }
             return date.until(endDate, unit);
         }
-        return unit.between(this, endDateTime);
+        Objects.requireNonNull(unit, "unit");
+        return unit.between(this, end);
     }
 
     //-----------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/time/chrono/ChronoPeriod.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,365 @@
+/*
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2013, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package java.time.chrono;
+
+import java.time.DateTimeException;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAmount;
+import java.time.temporal.TemporalUnit;
+import java.time.temporal.UnsupportedTemporalTypeException;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * A date-based amount of time, such as '3 years, 4 months and 5 days' in an
+ * arbitrary chronology, intended for advanced globalization use cases.
+ * <p>
+ * This interface models a date-based amount of time in a calendar system.
+ * While most calendar systems use years, months and days, some do not.
+ * Therefore, this interface operates solely in terms of a set of supported
+ * units that are defined by the {@code Chronology}.
+ * The set of supported units is fixed for a given chronology.
+ * The amount of a supported unit may be set to zero.
+ * <p>
+ * The period is modeled as a directed amount of time, meaning that individual
+ * parts of the period may be negative.
+ *
+ * @implSpec
+ * This interface must be implemented with care to ensure other classes operate correctly.
+ * All implementations that can be instantiated must be final, immutable and thread-safe.
+ * Subclasses should be Serializable wherever possible.
+ *
+ * @since 1.8
+ */
+public interface ChronoPeriod
+        extends TemporalAmount {
+
+    /**
+     * Obtains a {@code ChronoPeriod} consisting of amount of time between two dates.
+     * <p>
+     * The start date is included, but the end date is not.
+     * The period is calculated using {@link ChronoLocalDate#until(ChronoLocalDate)}.
+     * As such, the calculation is chronology specific.
+     * <p>
+     * The chronology of the first date is used.
+     * The chronology of the second date is ignored, with the date being converted
+     * to the target chronology system before the calculation starts.
+     * <p>
+     * The result of this method can be a negative period if the end is before the start.
+     * In most cases, the positive/negative sign will be the same in each of the supported fields.
+     *
+     * @param startDateInclusive  the start date, inclusive, specifying the chronology of the calculation, not null
+     * @param endDateExclusive  the end date, exclusive, in any chronology, not null
+     * @return the period between this date and the end date, not null
+     * @see ChronoLocalDate#until(ChronoLocalDate)
+     */
+    public static ChronoPeriod between(ChronoLocalDate startDateInclusive, ChronoLocalDate endDateExclusive) {
+        Objects.requireNonNull(startDateInclusive, "startDateInclusive");
+        Objects.requireNonNull(endDateExclusive, "endDateExclusive");
+        return startDateInclusive.until(endDateExclusive);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the value of the requested unit.
+     * <p>
+     * The supported units are chronology specific.
+     * They will typically be {@link ChronoUnit#YEARS YEARS},
+     * {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}.
+     * Requesting an unsupported unit will throw an exception.
+     *
+     * @param unit the {@code TemporalUnit} for which to return the value
+     * @return the long value of the unit
+     * @throws DateTimeException if the unit is not supported
+     * @throws UnsupportedTemporalTypeException if the unit is not supported
+     */
+    @Override
+    long get(TemporalUnit unit);
+
+    /**
+     * Gets the set of units supported by this period.
+     * <p>
+     * The supported units are chronology specific.
+     * They will typically be {@link ChronoUnit#YEARS YEARS},
+     * {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}.
+     * They are returned in order from largest to smallest.
+     * <p>
+     * This set can be used in conjunction with {@link #get(TemporalUnit)}
+     * to access the entire state of the period.
+     *
+     * @return a list containing the supported units, not null
+     */
+    @Override
+    List<TemporalUnit> getUnits();
+
+    /**
+     * Gets the chronology that defines the meaning of the supported units.
+     * <p>
+     * The period is defined by the chronology.
+     * It controls the supported units and restricts addition/subtraction
+     * to {@code ChronoLocalDate} instances of the same chronology.
+     *
+     * @return the chronology defining the period, not null
+     */
+    Chronology getChronology();
+
+    //-----------------------------------------------------------------------
+    /**
+     * Checks if all the supported units of this period are zero.
+     *
+     * @return true if this period is zero-length
+     */
+    default boolean isZero() {
+        for (TemporalUnit unit : getUnits()) {
+            if (get(unit) != 0) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Checks if any of the supported units of this period are negative.
+     *
+     * @return true if any unit of this period is negative
+     */
+    default boolean isNegative() {
+        for (TemporalUnit unit : getUnits()) {
+            if (get(unit) < 0) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Returns a copy of this period with the specified period added.
+     * <p>
+     * If the specified amount is a {@code ChronoPeriod} then it must have
+     * the same chronology as this period. Implementations may choose to
+     * accept or reject other {@code TemporalAmount} implementations.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param amountToAdd  the period to add, not null
+     * @return a {@code ChronoPeriod} based on this period with the requested period added, not null
+     * @throws ArithmeticException if numeric overflow occurs
+     */
+    ChronoPeriod plus(TemporalAmount amountToAdd);
+
+    /**
+     * Returns a copy of this period with the specified period subtracted.
+     * <p>
+     * If the specified amount is a {@code ChronoPeriod} then it must have
+     * the same chronology as this period. Implementations may choose to
+     * accept or reject other {@code TemporalAmount} implementations.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param amountToSubtract  the period to subtract, not null
+     * @return a {@code ChronoPeriod} based on this period with the requested period subtracted, not null
+     * @throws ArithmeticException if numeric overflow occurs
+     */
+    ChronoPeriod minus(TemporalAmount amountToSubtract);
+
+    //-----------------------------------------------------------------------
+    /**
+     * Returns a new instance with each amount in this period in this period
+     * multiplied by the specified scalar.
+     * <p>
+     * This returns a period with each supported unit individually multiplied.
+     * For example, a period of "2 years, -3 months and 4 days" multiplied by
+     * 3 will return "6 years, -9 months and 12 days".
+     * No normalization is performed.
+     *
+     * @param scalar  the scalar to multiply by, not null
+     * @return a {@code ChronoPeriod} based on this period with the amounts multiplied
+     *  by the scalar, not null
+     * @throws ArithmeticException if numeric overflow occurs
+     */
+    ChronoPeriod multipliedBy(int scalar);
+
+    /**
+     * Returns a new instance with each amount in this period negated.
+     * <p>
+     * This returns a period with each supported unit individually negated.
+     * For example, a period of "2 years, -3 months and 4 days" will be
+     * negated to "-2 years, 3 months and -4 days".
+     * No normalization is performed.
+     *
+     * @return a {@code ChronoPeriod} based on this period with the amounts negated, not null
+     * @throws ArithmeticException if numeric overflow occurs, which only happens if
+     *  one of the units has the value {@code Long.MIN_VALUE}
+     */
+    default ChronoPeriod negated() {
+        return multipliedBy(-1);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Returns a copy of this period with the amounts of each unit normalized.
+     * <p>
+     * The process of normalization is specific to each calendar system.
+     * For example, in the ISO calendar system, the years and months are
+     * normalized but the days are not, such that "15 months" would be
+     * normalized to "1 year and 3 months".
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @return a {@code ChronoPeriod} based on this period with the amounts of each
+     *  unit normalized, not null
+     * @throws ArithmeticException if numeric overflow occurs
+     */
+    ChronoPeriod normalized();
+
+    //-------------------------------------------------------------------------
+    /**
+     * Adds this period to the specified temporal object.
+     * <p>
+     * This returns a temporal object of the same observable type as the input
+     * with this period added.
+     * <p>
+     * In most cases, it is clearer to reverse the calling pattern by using
+     * {@link Temporal#plus(TemporalAmount)}.
+     * <pre>
+     *   // these two lines are equivalent, but the second approach is recommended
+     *   dateTime = thisPeriod.addTo(dateTime);
+     *   dateTime = dateTime.plus(thisPeriod);
+     * </pre>
+     * <p>
+     * The specified temporal must have the same chronology as this period.
+     * This returns a temporal with the non-zero supported units added.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param temporal  the temporal object to adjust, not null
+     * @return an object of the same type with the adjustment made, not null
+     * @throws DateTimeException if unable to add
+     * @throws ArithmeticException if numeric overflow occurs
+     */
+    @Override
+    Temporal addTo(Temporal temporal);
+
+    /**
+     * Subtracts this period from the specified temporal object.
+     * <p>
+     * This returns a temporal object of the same observable type as the input
+     * with this period subtracted.
+     * <p>
+     * In most cases, it is clearer to reverse the calling pattern by using
+     * {@link Temporal#minus(TemporalAmount)}.
+     * <pre>
+     *   // these two lines are equivalent, but the second approach is recommended
+     *   dateTime = thisPeriod.subtractFrom(dateTime);
+     *   dateTime = dateTime.minus(thisPeriod);
+     * </pre>
+     * <p>
+     * The specified temporal must have the same chronology as this period.
+     * This returns a temporal with the non-zero supported units subtracted.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @param temporal  the temporal object to adjust, not null
+     * @return an object of the same type with the adjustment made, not null
+     * @throws DateTimeException if unable to subtract
+     * @throws ArithmeticException if numeric overflow occurs
+     */
+    @Override
+    Temporal subtractFrom(Temporal temporal);
+
+    //-----------------------------------------------------------------------
+    /**
+     * Checks if this period is equal to another period, including the chronology.
+     * <p>
+     * Compares this period with another ensuring that the type, each amount and
+     * the chronology are the same.
+     * Note that this means that a period of "15 Months" is not equal to a period
+     * of "1 Year and 3 Months".
+     *
+     * @param obj  the object to check, null returns false
+     * @return true if this is equal to the other period
+     */
+    @Override
+    boolean equals(Object obj);
+
+    /**
+     * A hash code for this period.
+     *
+     * @return a suitable hash code
+     */
+    @Override
+    int hashCode();
+
+    //-----------------------------------------------------------------------
+    /**
+     * Outputs this period as a {@code String}.
+     * <p>
+     * The output will include the period amounts and chronology.
+     *
+     * @return a string representation of this period, not null
+     */
+    @Override
+    String toString();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,399 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2013, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package java.time.chrono;
+
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.YEARS;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.time.DateTimeException;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAccessor;
+import java.time.temporal.TemporalAmount;
+import java.time.temporal.TemporalQuery;
+import java.time.temporal.TemporalUnit;
+import java.time.temporal.UnsupportedTemporalTypeException;
+import java.time.temporal.ValueRange;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * A period expressed in terms of a standard year-month-day calendar system.
+ * <p>
+ * This class is used by applications seeking to handle dates in non-ISO calendar systems.
+ * For example, the Japanese, Minguo, Thai Buddhist and others.
+ *
+ * @implSpec
+ * This class is immutable nad thread-safe.
+ *
+ * @since 1.8
+ */
+final class ChronoPeriodImpl
+        implements ChronoPeriod, Serializable {
+    // this class is only used by JDK chronology implementations and makes assumptions based on that fact
+
+    /**
+     * Serialization version.
+     */
+    private static final long serialVersionUID = 57387258289L;
+
+    /**
+     * The set of supported units.
+     */
+    private final static List<TemporalUnit> SUPPORTED_UNITS =
+            Collections.unmodifiableList(Arrays.<TemporalUnit>asList(YEARS, MONTHS, DAYS));
+
+    /**
+     * The chronology.
+     */
+    private final Chronology chrono;
+    /**
+     * The number of years.
+     */
+    final int years;
+    /**
+     * The number of months.
+     */
+    final int months;
+    /**
+     * The number of days.
+     */
+    final int days;
+
+    /**
+     * Creates an instance.
+     */
+    ChronoPeriodImpl(Chronology chrono, int years, int months, int days) {
+        Objects.requireNonNull(chrono, "chrono");
+        this.chrono = chrono;
+        this.years = years;
+        this.months = months;
+        this.days = days;
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    public long get(TemporalUnit unit) {
+        if (unit == ChronoUnit.YEARS) {
+            return years;
+        } else if (unit == ChronoUnit.MONTHS) {
+            return months;
+        } else if (unit == ChronoUnit.DAYS) {
+            return days;
+        } else {
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
+        }
+    }
+
+    @Override
+    public List<TemporalUnit> getUnits() {
+        return ChronoPeriodImpl.SUPPORTED_UNITS;
+    }
+
+    @Override
+    public Chronology getChronology() {
+        return chrono;
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    public boolean isZero() {
+        return years == 0 && months == 0 && days == 0;
+    }
+
+    @Override
+    public boolean isNegative() {
+        return years < 0 || months < 0 || days < 0;
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    public ChronoPeriod plus(TemporalAmount amountToAdd) {
+        ChronoPeriodImpl amount = validateAmount(amountToAdd);
+        return new ChronoPeriodImpl(
+                chrono,
+                Math.addExact(years, amount.years),
+                Math.addExact(months, amount.months),
+                Math.addExact(days, amount.days));
+    }
+
+    @Override
+    public ChronoPeriod minus(TemporalAmount amountToSubtract) {
+        ChronoPeriodImpl amount = validateAmount(amountToSubtract);
+        return new ChronoPeriodImpl(
+                chrono,
+                Math.subtractExact(years, amount.years),
+                Math.subtractExact(months, amount.months),
+                Math.subtractExact(days, amount.days));
+    }
+
+    /**
+     * Obtains an instance of {@code ChronoPeriodImpl} from a temporal amount.
+     *
+     * @param amount  the temporal amount to convert, not null
+     * @return the period, not null
+     */
+    private ChronoPeriodImpl validateAmount(TemporalAmount amount) {
+        Objects.requireNonNull(amount, "amount");
+        if (amount instanceof ChronoPeriodImpl == false) {
+            throw new DateTimeException("Unable to obtain ChronoPeriod from TemporalAmount: " + amount.getClass());
+        }
+        ChronoPeriodImpl period = (ChronoPeriodImpl) amount;
+        if (chrono.equals(period.getChronology()) == false) {
+            throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + period.getChronology().getId());
+        }
+        return period;
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    public ChronoPeriod multipliedBy(int scalar) {
+        if (this.isZero() || scalar == 1) {
+            return this;
+        }
+        return new ChronoPeriodImpl(
+                chrono,
+                Math.multiplyExact(years, scalar),
+                Math.multiplyExact(months, scalar),
+                Math.multiplyExact(days, scalar));
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    public ChronoPeriod normalized() {
+        long monthRange = monthRange();
+        if (monthRange > 0) {
+            long totalMonths = years * monthRange + months;
+            long splitYears = totalMonths / monthRange;
+            int splitMonths = (int) (totalMonths % monthRange);  // no overflow
+            if (splitYears == years && splitMonths == months) {
+                return this;
+            }
+            return new ChronoPeriodImpl(chrono, Math.toIntExact(splitYears), splitMonths, days);
+
+        }
+        return this;
+    }
+
+    /**
+     * Calculates the range of months.
+     *
+     * @return the month range, -1 if not fixed range
+     */
+    private long monthRange() {
+        ValueRange startRange = chrono.range(MONTH_OF_YEAR);
+        if (startRange.isFixed() && startRange.isIntValue()) {
+            return startRange.getMaximum() - startRange.getMinimum() + 1;
+        }
+        return -1;
+    }
+
+    //-------------------------------------------------------------------------
+    @Override
+    public Temporal addTo(Temporal temporal) {
+        validateChrono(temporal);
+        if (months == 0) {
+            if (years != 0) {
+                temporal = temporal.plus(years, YEARS);
+            }
+        } else {
+            long monthRange = monthRange();
+            if (monthRange > 0) {
+                temporal = temporal.plus(years * monthRange + months, MONTHS);
+            } else {
+                if (years != 0) {
+                    temporal = temporal.plus(years, YEARS);
+                }
+                temporal = temporal.plus(months, MONTHS);
+            }
+        }
+        if (days != 0) {
+            temporal = temporal.plus(days, DAYS);
+        }
+        return temporal;
+    }
+
+
+
+    @Override
+    public Temporal subtractFrom(Temporal temporal) {
+        validateChrono(temporal);
+        if (months == 0) {
+            if (years != 0) {
+                temporal = temporal.minus(years, YEARS);
+            }
+        } else {
+            long monthRange = monthRange();
+            if (monthRange > 0) {
+                temporal = temporal.minus(years * monthRange + months, MONTHS);
+            } else {
+                if (years != 0) {
+                    temporal = temporal.minus(years, YEARS);
+                }
+                temporal = temporal.minus(months, MONTHS);
+            }
+        }
+        if (days != 0) {
+            temporal = temporal.minus(days, DAYS);
+        }
+        return temporal;
+    }
+
+    /**
+     * Validates that the temporal has the correct chronology.
+     */
+    private void validateChrono(TemporalAccessor temporal) {
+        Objects.requireNonNull(temporal, "temporal");
+        Chronology temporalChrono = temporal.query(TemporalQuery.chronology());
+        if (temporalChrono != null && chrono.equals(temporalChrono) == false) {
+            throw new DateTimeException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + temporalChrono.getId());
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof ChronoPeriodImpl) {
+            ChronoPeriodImpl other = (ChronoPeriodImpl) obj;
+            return years == other.years && months == other.months &&
+                    days == other.days && chrono.equals(other.chrono);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return (years + Integer.rotateLeft(months, 8) + Integer.rotateLeft(days, 16)) ^ chrono.hashCode();
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    public String toString() {
+        if (isZero()) {
+            return getChronology().toString() + " P0D";
+        } else {
+            StringBuilder buf = new StringBuilder();
+            buf.append(getChronology().toString()).append(' ').append('P');
+            if (years != 0) {
+                buf.append(years).append('Y');
+            }
+            if (months != 0) {
+                buf.append(months).append('M');
+            }
+            if (days != 0) {
+                buf.append(days).append('D');
+            }
+            return buf.toString();
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Writes the Chronology using a
+     * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
+     * <pre>
+     *  out.writeByte(12);  // identifies this as a ChronoPeriodImpl
+     *  out.writeUTF(getId());  // the chronology
+     *  out.writeInt(years);
+     *  out.writeInt(months);
+     *  out.writeInt(days);
+     * </pre>
+     *
+     * @return the instance of {@code Ser}, not null
+     */
+    protected Object writeReplace() {
+        return new Ser(Ser.CHRONO_PERIOD_TYPE, this);
+    }
+
+    /**
+     * Defend against malicious streams.
+     * @return never
+     * @throws InvalidObjectException always
+     */
+    private Object readResolve() throws ObjectStreamException {
+        throw new InvalidObjectException("Deserialization via serialization delegate");
+    }
+
+    void writeExternal(DataOutput out) throws IOException {
+        out.writeUTF(chrono.getId());
+        out.writeInt(years);
+        out.writeInt(months);
+        out.writeInt(days);
+    }
+
+    static ChronoPeriodImpl readExternal(DataInput in) throws IOException {
+        Chronology chrono = Chronology.of(in.readUTF());
+        int years = in.readInt();
+        int months = in.readInt();
+        int days = in.readInt();
+        return new ChronoPeriodImpl(chrono, years, months, days);
+    }
+
+}
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -166,6 +166,7 @@
         if (temporal instanceof ChronoZonedDateTime) {
             return (ChronoZonedDateTime<?>) temporal;
         }
+        Objects.requireNonNull(temporal, "temporal");
         Chronology chrono = temporal.query(TemporalQuery.chronology());
         if (chrono == null) {
             throw new DateTimeException("Unable to obtain ChronoZonedDateTime from TemporalAccessor: " + temporal.getClass());
@@ -246,6 +247,18 @@
     ChronoLocalDateTime<D> toLocalDateTime();
 
     /**
+     * Gets the chronology of this date-time.
+     * <p>
+     * The {@code Chronology} represents the calendar system in use.
+     * The era and other fields in {@link ChronoField} are defined by the chronology.
+     *
+     * @return the chronology, not null
+     */
+    default Chronology getChronology() {
+        return toLocalDate().getChronology();
+    }
+
+    /**
      * Gets the zone offset, such as '+01:00'.
      * <p>
      * This is the offset of the local date-time from UTC/Greenwich.
@@ -397,7 +410,7 @@
      */
     @Override
     default ChronoZonedDateTime<D> with(TemporalAdjuster adjuster) {
-        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.with(adjuster));
+        return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.with(adjuster));
     }
 
     /**
@@ -415,7 +428,7 @@
      */
     @Override
     default ChronoZonedDateTime<D> plus(TemporalAmount amount) {
-        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.plus(amount));
+        return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.plus(amount));
     }
 
     /**
@@ -433,7 +446,7 @@
      */
     @Override
     default ChronoZonedDateTime<D> minus(TemporalAmount amount) {
-        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amount));
+        return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amount));
     }
 
     /**
@@ -443,7 +456,7 @@
      */
     @Override
     default ChronoZonedDateTime<D> minus(long amountToSubtract, TemporalUnit unit) {
-        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amountToSubtract, unit));
+        return ChronoZonedDateTimeImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit));
     }
 
     //-----------------------------------------------------------------------
@@ -475,7 +488,7 @@
         } else if (query == TemporalQuery.localTime()) {
             return (R) toLocalTime();
         } else if (query == TemporalQuery.chronology()) {
-            return (R) toLocalDate().getChronology();
+            return (R) getChronology();
         } else if (query == TemporalQuery.precision()) {
             return (R) NANOS;
         }
@@ -562,7 +575,7 @@
                 if (cmp == 0) {
                     cmp = getZone().getId().compareTo(other.getZone().getId());
                     if (cmp == 0) {
-                        cmp = toLocalDate().getChronology().compareTo(other.toLocalDate().getChronology());
+                        cmp = getChronology().compareTo(other.getChronology());
                     }
                 }
             }
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -69,7 +69,6 @@
 import java.io.ObjectOutput;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
-import java.time.DateTimeException;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
@@ -186,7 +185,7 @@
      */
     @SuppressWarnings("unchecked")
     private ChronoZonedDateTimeImpl<D> create(Instant instant, ZoneId zone) {
-        return (ChronoZonedDateTimeImpl<D>)ofInstant(toLocalDate().getChronology(), instant, zone);
+        return (ChronoZonedDateTimeImpl<D>)ofInstant(getChronology(), instant, zone);
     }
 
     /**
@@ -201,9 +200,9 @@
     static <R extends ChronoLocalDate> ChronoZonedDateTimeImpl<R> ensureValid(Chronology chrono, Temporal temporal) {
         @SuppressWarnings("unchecked")
         ChronoZonedDateTimeImpl<R> other = (ChronoZonedDateTimeImpl<R>) temporal;
-        if (chrono.equals(other.toLocalDate().getChronology()) == false) {
+        if (chrono.equals(other.getChronology()) == false) {
             throw new ClassCastException("Chronology mismatch, required: " + chrono.getId()
-                    + ", actual: " + other.toLocalDate().getChronology().getId());
+                    + ", actual: " + other.getChronology().getId());
         }
         return other;
     }
@@ -234,7 +233,7 @@
         if (trans != null && trans.isOverlap()) {
             ZoneOffset earlierOffset = trans.getOffsetBefore();
             if (earlierOffset.equals(offset) == false) {
-                return new ChronoZonedDateTimeImpl<D>(dateTime, earlierOffset, zone);
+                return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
             }
         }
         return this;
@@ -246,7 +245,7 @@
         if (trans != null) {
             ZoneOffset offset = trans.getOffsetAfter();
             if (offset.equals(getOffset()) == false) {
-                return new ChronoZonedDateTimeImpl<D>(dateTime, offset, zone);
+                return new ChronoZonedDateTimeImpl<>(dateTime, offset, zone);
             }
         }
         return this;
@@ -294,7 +293,7 @@
             }
             return ofBest(dateTime.with(field, newValue), zone, offset);
         }
-        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), field.adjustInto(this, newValue));
+        return ChronoZonedDateTimeImpl.ensureValid(getChronology(), field.adjustInto(this, newValue));
     }
 
     //-----------------------------------------------------------------------
@@ -303,25 +302,21 @@
         if (unit instanceof ChronoUnit) {
             return with(dateTime.plus(amountToAdd, unit));
         }
-        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), unit.addTo(this, amountToAdd));   /// TODO: Generics replacement Risk!
+        return ChronoZonedDateTimeImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd));   /// TODO: Generics replacement Risk!
     }
 
     //-----------------------------------------------------------------------
     @Override
-    public long until(Temporal endDateTime, TemporalUnit unit) {
-        if (endDateTime instanceof ChronoZonedDateTime == false) {
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        Objects.requireNonNull(endExclusive, "endExclusive");
         @SuppressWarnings("unchecked")
-        ChronoZonedDateTime<D> end = (ChronoZonedDateTime<D>) endDateTime;
-        if (toLocalDate().getChronology().equals(end.toLocalDate().getChronology()) == false) {
-            throw new DateTimeException("Unable to calculate amount as objects have different chronologies");
-        }
+        ChronoZonedDateTime<D> end = (ChronoZonedDateTime<D>) getChronology().zonedDateTime(endExclusive);
         if (unit instanceof ChronoUnit) {
             end = end.withZoneSameInstant(offset);
             return dateTime.until(end.toLocalDateTime(), unit);
         }
-        return unit.between(this, endDateTime);
+        Objects.requireNonNull(unit, "unit");
+        return unit.between(this, end);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/src/share/classes/java/time/chrono/Chronology.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/Chronology.java	Fri Oct 11 09:17:18 2013 -0400
@@ -91,14 +91,11 @@
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalTime;
-import java.time.Month;
-import java.time.Year;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.ResolverStyle;
 import java.time.format.TextStyle;
 import java.time.temporal.ChronoField;
-import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.TemporalField;
@@ -1192,6 +1189,38 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Obtains a period for this chronology based on years, months and days.
+     * <p>
+     * This returns a period tied to this chronology using the specified
+     * years, months and days.  All supplied chronologies use periods
+     * based on years, months and days, however the {@code ChronoPeriod} API
+     * allows the period to be represented using other units.
+     *
+     * @implSpec
+     * The default implementation returns an implementation class suitable
+     * for most calendar systems. It is based solely on the three units.
+     * Normalization, addition and subtraction derive the number of months
+     * in a year from the {@link #range(ChronoField)}. If the number of
+     * months within a year is fixed, then the calculation approach for
+     * addition, subtraction and normalization is slightly different.
+     * <p>
+     * If implementing an unusual calendar system that is not based on
+     * years, months and days, or where you want direct control, then
+     * the {@code ChronoPeriod} interface must be directly implemented.
+     * <p>
+     * The returned period is immutable and thread-safe.
+     *
+     * @param years  the number of years, may be negative
+     * @param months  the number of years, may be negative
+     * @param days  the number of years, may be negative
+     * @return the period in terms of this chronology, not null
+     */
+    public ChronoPeriod period(int years, int months, int days) {
+        return new ChronoPeriodImpl(this, years, months, days);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Compares this chronology to another chronology.
      * <p>
      * The comparison order first by the chronology ID string, then by any
--- a/jdk/src/share/classes/java/time/chrono/HijrahDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/HijrahDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -73,7 +73,6 @@
 import java.time.DateTimeException;
 import java.time.LocalDate;
 import java.time.LocalTime;
-import java.time.Period;
 import java.time.ZoneId;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalAccessor;
@@ -109,7 +108,7 @@
  * @since 1.8
  */
 public final class HijrahDate
-        extends ChronoDateImpl<HijrahDate>
+        extends ChronoLocalDateImpl<HijrahDate>
         implements ChronoLocalDate, Serializable {
 
     /**
@@ -582,7 +581,7 @@
     }
 
     @Override
-    public Period until(ChronoLocalDate endDate) {
+    public ChronoPeriod until(ChronoLocalDate endDate) {
         // TODO: untested
         HijrahDate end = getChronology().date(endDate);
         long totalMonths = (end.prolepticYear - this.prolepticYear) * 12 + (end.monthOfYear - this.monthOfYear);  // safe
@@ -597,7 +596,7 @@
         }
         long years = totalMonths / 12;  // safe
         int months = (int) (totalMonths % 12);  // safe
-        return Period.of(Math.toIntExact(years), months, days);
+        return getChronology().period(Math.toIntExact(years), months, days);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Fri Oct 11 09:17:18 2013 -0400
@@ -77,6 +77,7 @@
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.Month;
+import java.time.Period;
 import java.time.Year;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
@@ -567,6 +568,24 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Obtains a period for this chronology based on years, months and days.
+     * <p>
+     * This returns a period tied to the ISO chronology using the specified
+     * years, months and days. See {@link Period} for further details.
+     *
+     * @param years  the number of years, may be negative
+     * @param months  the number of years, may be negative
+     * @param days  the number of years, may be negative
+     * @return the period in terms of this chronology, not null
+     * @return the ISO period, not null
+     */
+    @Override  // override with covariant return type
+    public Period period(int years, int months, int days) {
+        return Period.of(years, months, days);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Writes the Chronology using a
      * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
      * @serialData
--- a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -61,10 +61,8 @@
 import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH;
 import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR;
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
-import static java.time.temporal.ChronoField.DAY_OF_YEAR;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.YEAR;
-import static java.time.temporal.ChronoField.YEAR_OF_ERA;
 
 import java.io.DataInput;
 import java.io.DataOutput;
@@ -76,7 +74,6 @@
 import java.time.LocalDate;
 import java.time.LocalTime;
 import java.time.Period;
-import java.time.Year;
 import java.time.ZoneId;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalAccessor;
@@ -119,7 +116,7 @@
  * @since 1.8
  */
 public final class JapaneseDate
-        extends ChronoDateImpl<JapaneseDate>
+        extends ChronoLocalDateImpl<JapaneseDate>
         implements ChronoLocalDate, Serializable {
 
     /**
@@ -662,8 +659,9 @@
     }
 
     @Override
-    public Period until(ChronoLocalDate endDate) {
-        return isoDate.until(endDate);
+    public ChronoPeriod until(ChronoLocalDate endDate) {
+        Period period = isoDate.until(endDate);
+        return getChronology().period(period.getYears(), period.getMonths(), period.getDays());
     }
 
     @Override  // override for performance
--- a/jdk/src/share/classes/java/time/chrono/MinguoDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/MinguoDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -96,7 +96,7 @@
  * @since 1.8
  */
 public final class MinguoDate
-        extends ChronoDateImpl<MinguoDate>
+        extends ChronoLocalDateImpl<MinguoDate>
         implements ChronoLocalDate, Serializable {
 
     /**
@@ -421,8 +421,9 @@
     }
 
     @Override
-    public Period until(ChronoLocalDate endDate) {
-        return isoDate.until(endDate);
+    public ChronoPeriod until(ChronoLocalDate endDate) {
+        Period period = isoDate.until(endDate);
+        return getChronology().period(period.getYears(), period.getMonths(), period.getDays());
     }
 
     @Override  // override for performance
--- a/jdk/src/share/classes/java/time/chrono/Ser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/Ser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -104,6 +104,7 @@
     static final byte HIJRAH_DATE_TYPE = 6;
     static final byte MINGUO_DATE_TYPE = 7;
     static final byte THAIBUDDHIST_DATE_TYPE = 8;
+    static final byte CHRONO_PERIOD_TYPE = 9;
 
     /** The type being serialized. */
     private byte type;
@@ -183,6 +184,9 @@
             case THAIBUDDHIST_DATE_TYPE:
                 ((ThaiBuddhistDate) object).writeExternal(out);
                 break;
+            case CHRONO_PERIOD_TYPE:
+                ((ChronoPeriodImpl) object).writeExternal(out);
+                break;
             default:
                 throw new InvalidClassException("Unknown serialized type");
         }
@@ -235,6 +239,7 @@
             case HIJRAH_DATE_TYPE: return HijrahDate.readExternal(in);
             case MINGUO_DATE_TYPE: return MinguoDate.readExternal(in);
             case THAIBUDDHIST_DATE_TYPE: return ThaiBuddhistDate.readExternal(in);
+            case CHRONO_PERIOD_TYPE: return ChronoPeriodImpl.readExternal(in);
             default: throw new StreamCorruptedException("Unknown serialized type");
         }
     }
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -96,7 +96,7 @@
  * @since 1.8
  */
 public final class ThaiBuddhistDate
-        extends ChronoDateImpl<ThaiBuddhistDate>
+        extends ChronoLocalDateImpl<ThaiBuddhistDate>
         implements ChronoLocalDate, Serializable {
 
     /**
@@ -421,8 +421,9 @@
     }
 
     @Override
-    public Period until(ChronoLocalDate endDate) {
-        return isoDate.until(endDate);
+    public ChronoPeriod until(ChronoLocalDate endDate) {
+        Period period = isoDate.until(endDate);
+        return getChronology().period(period.getYears(), period.getMonths(), period.getDays());
     }
 
     @Override  // override for performance
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Oct 11 09:17:18 2013 -0400
@@ -78,9 +78,11 @@
 import java.text.ParsePosition;
 import java.time.DateTimeException;
 import java.time.Instant;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
+import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.Chronology;
 import java.time.chrono.IsoChronology;
 import java.time.format.DateTimeTextProvider.LocaleStore;
@@ -499,51 +501,16 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Appends the reduced value of a date-time field with fixed width to the formatter.
-     * <p>
-     * This is typically used for formatting and parsing a two digit year.
-     * The {@code width} is the printed and parsed width.
-     * The {@code baseValue} is used during parsing to determine the valid range.
-     * <p>
-     * For formatting, the width is used to determine the number of characters to format.
-     * The rightmost characters are output to match the width, left padding with zero.
-     * <p>
-     * For strict parsing, the number of characters allowed by the width are parsed.
-     * For lenient parsing, the number of characters must be at least 1 and less than 10.
-     * If the number of digits parsed is equal to {@code width} and the value is positive,
-     * the value of the field is computed to be the first number greater than
-     * or equal to the {@code baseValue} with the same least significant characters,
-     * otherwise the value parsed is the field value.
-     * This allows a reduced value to be entered for values in range of the baseValue
-     * and width and absolute values can be entered for values outside the range.
+     * Appends the reduced value of a date-time field to the formatter.
      * <p>
-     * For example, a base value of {@code 1980} and a width of {@code 2} will have
-     * valid values from {@code 1980} to {@code 2079}.
-     * During parsing, the text {@code "12"} will result in the value {@code 2012} as that
-     * is the value within the range where the last two characters are "12".
-     * Compare with lenient parsing the text {@code "1915"} that will result in the
-     * value {@code 1915}.
-     *
-     * @param field  the field to append, not null
-     * @param width  the field width of the printed and parsed field, from 1 to 10
-     * @param baseValue  the base value of the range of valid values
-     * @return this, for chaining, not null
-     * @throws IllegalArgumentException if the width or base value is invalid
-     * @see #appendValueReduced(java.time.temporal.TemporalField, int, int, int)
-     */
-    public DateTimeFormatterBuilder appendValueReduced(TemporalField field,
-            int width, int baseValue) {
-        return appendValueReduced(field, width, width, baseValue);
-    }
-
-    /**
-     * Appends the reduced value of a date-time field with a flexible width to the formatter.
-     * <p>
-     * This is typically used for formatting and parsing a two digit year
-     * but allowing for the year value to be up to maxWidth.
+     * Since fields such as year vary by chronology, it is recommended to use the
+     * {@link #appendValueReduced(TemporalField, int, int, ChronoLocalDate)} date}
+     * variant of this method in most cases. This variant is suitable for
+     * simple fields or working with only the ISO chronology.
      * <p>
      * For formatting, the {@code width} and {@code maxWidth} are used to
      * determine the number of characters to format.
+     * If they are equal then the format is fixed width.
      * If the value of the field is within the range of the {@code baseValue} using
      * {@code width} characters then the reduced value is formatted otherwise the value is
      * truncated to fit {@code maxWidth}.
@@ -562,8 +529,7 @@
      * valid values from {@code 1980} to {@code 2079}.
      * During parsing, the text {@code "12"} will result in the value {@code 2012} as that
      * is the value within the range where the last two characters are "12".
-     * Compare with parsing the text {@code "1915"} that will result in the
-     * value {@code 1915}.
+     * By contrast, parsing the text {@code "1915"} will result in the value {@code 1915}.
      *
      * @param field  the field to append, not null
      * @param width  the field width of the printed and parsed field, from 1 to 10
@@ -575,7 +541,67 @@
     public DateTimeFormatterBuilder appendValueReduced(TemporalField field,
             int width, int maxWidth, int baseValue) {
         Objects.requireNonNull(field, "field");
-        ReducedPrinterParser pp = new ReducedPrinterParser(field, width, maxWidth, baseValue);
+        ReducedPrinterParser pp = new ReducedPrinterParser(field, width, maxWidth, baseValue, null);
+        appendValue(pp);
+        return this;
+    }
+
+    /**
+     * Appends the reduced value of a date-time field to the formatter.
+     * <p>
+     * This is typically used for formatting and parsing a two digit year.
+     * <p>
+     * The base date is used to calculate the full value during parsing.
+     * For example, if the base date is 1950-01-01 then parsed values for
+     * a two digit year parse will be in the range 1950-01-01 to 2049-12-31.
+     * Only the year would be extracted from the date, thus a base date of
+     * 1950-08-25 would also parse to the range 1950-01-01 to 2049-12-31.
+     * This behaviour is necessary to support fields such as week-based-year
+     * or other calendar systems where the parsed value does not align with
+     * standard ISO years.
+     * <p>
+     * The exact behavior is as follows. Parse the full set of fields and
+     * determine the effective chronology. Then convert the base date to the
+     * effective chronology. Then extract the specified field from the
+     * chronology-specific base date and use it to determine the
+     * {@code baseValue} used below.
+     * <p>
+     * For formatting, the {@code width} and {@code maxWidth} are used to
+     * determine the number of characters to format.
+     * If they are equal then the format is fixed width.
+     * If the value of the field is within the range of the {@code baseValue} using
+     * {@code width} characters then the reduced value is formatted otherwise the value is
+     * truncated to fit {@code maxWidth}.
+     * The rightmost characters are output to match the width, left padding with zero.
+     * <p>
+     * For strict parsing, the number of characters allowed by {@code width} to {@code maxWidth} are parsed.
+     * For lenient parsing, the number of characters must be at least 1 and less than 10.
+     * If the number of digits parsed is equal to {@code width} and the value is positive,
+     * the value of the field is computed to be the first number greater than
+     * or equal to the {@code baseValue} with the same least significant characters,
+     * otherwise the value parsed is the field value.
+     * This allows a reduced value to be entered for values in range of the baseValue
+     * and width and absolute values can be entered for values outside the range.
+     * <p>
+     * For example, a base value of {@code 1980} and a width of {@code 2} will have
+     * valid values from {@code 1980} to {@code 2079}.
+     * During parsing, the text {@code "12"} will result in the value {@code 2012} as that
+     * is the value within the range where the last two characters are "12".
+     * By contrast, parsing the text {@code "1915"} will result in the value {@code 1915}.
+     *
+     * @param field  the field to append, not null
+     * @param width  the field width of the printed and parsed field, from 1 to 10
+     * @param maxWidth  the maximum field width of the printed field, from 1 to 10
+     * @param baseDate  the base date used to calculate the base value for the range
+     *  of valid values in the parsed chronology, not null
+     * @return this, for chaining, not null
+     * @throws IllegalArgumentException if the width or base value is invalid
+     */
+    public DateTimeFormatterBuilder appendValueReduced(
+            TemporalField field, int width, int maxWidth, ChronoLocalDate baseDate) {
+        Objects.requireNonNull(field, "field");
+        Objects.requireNonNull(baseDate, "baseDate");
+        ReducedPrinterParser pp = new ReducedPrinterParser(field, width, maxWidth, 0, baseDate);
         appendValue(pp);
         return this;
     }
@@ -1682,7 +1708,7 @@
             case 'u':
             case 'y':
                 if (count == 2) {
-                    appendValueReduced(field, 2, 2000);
+                    appendValueReduced(field, 2, 2, ReducedPrinterParser.BASE_DATE);
                 } else if (count < 4) {
                     appendValue(field, count, 19, SignStyle.NORMAL);
                 } else {
@@ -2516,7 +2542,7 @@
             if (valueLong == null) {
                 return false;
             }
-            long value = getValue(valueLong);
+            long value = getValue(context, valueLong);
             DecimalStyle decimalStyle = context.getDecimalStyle();
             String str = (value == Long.MIN_VALUE ? "9223372036854775808" : Long.toString(Math.abs(value)));
             if (str.length() > maxWidth) {
@@ -2560,10 +2586,11 @@
         /**
          * Gets the value to output.
          *
-         * @param value  the base value of the field, not null
+         * @param context  the context
+         * @param value  the value of the field, not null
          * @return the value
          */
-        long getValue(long value) {
+        long getValue(DateTimePrintContext context, long value) {
             return value;
         }
 
@@ -2703,7 +2730,13 @@
      * Prints and parses a reduced numeric date-time field.
      */
     static final class ReducedPrinterParser extends NumberPrinterParser {
+        /**
+         * The base date for reduced value parsing.
+         */
+        static final LocalDate BASE_DATE = LocalDate.of(2000, 1, 1);
+
         private final int baseValue;
+        private final ChronoLocalDate baseDate;
 
         /**
          * Constructor.
@@ -2712,10 +2745,11 @@
          * @param minWidth  the minimum field width, from 1 to 10
          * @param maxWidth  the maximum field width, from 1 to 10
          * @param baseValue  the base value
+         * @param baseDate  the base date
          */
         ReducedPrinterParser(TemporalField field, int minWidth, int maxWidth,
-                int baseValue) {
-            this(field, minWidth, maxWidth, baseValue, 0);
+                int baseValue, ChronoLocalDate baseDate) {
+            this(field, minWidth, maxWidth, baseValue, baseDate, 0);
             if (minWidth < 1 || minWidth > 10) {
                 throw new IllegalArgumentException("The minWidth must be from 1 to 10 inclusive but was " + minWidth);
             }
@@ -2726,11 +2760,13 @@
                 throw new IllegalArgumentException("Maximum width must exceed or equal the minimum width but " +
                         maxWidth + " < " + minWidth);
             }
-            if (field.range().isValidValue(baseValue) == false) {
-                throw new IllegalArgumentException("The base value must be within the range of the field");
-            }
-            if ((((long) baseValue) + EXCEED_POINTS[maxWidth]) > Integer.MAX_VALUE) {
-                throw new DateTimeException("Unable to add printer-parser as the range exceeds the capacity of an int");
+            if (baseDate == null) {
+                if (field.range().isValidValue(baseValue) == false) {
+                    throw new IllegalArgumentException("The base value must be within the range of the field");
+                }
+                if ((((long) baseValue) + EXCEED_POINTS[maxWidth]) > Integer.MAX_VALUE) {
+                    throw new DateTimeException("Unable to add printer-parser as the range exceeds the capacity of an int");
+                }
             }
         }
 
@@ -2742,17 +2778,24 @@
          * @param minWidth  the minimum field width, from 1 to 10
          * @param maxWidth  the maximum field width, from 1 to 10
          * @param baseValue  the base value
+         * @param baseDate  the base date
          * @param subsequentWidth the subsequentWidth for this instance
          */
         private ReducedPrinterParser(TemporalField field, int minWidth, int maxWidth,
-                int baseValue, int subsequentWidth) {
+                int baseValue, ChronoLocalDate baseDate, int subsequentWidth) {
             super(field, minWidth, maxWidth, SignStyle.NOT_NEGATIVE, subsequentWidth);
             this.baseValue = baseValue;
+            this.baseDate = baseDate;
         }
 
         @Override
-        long getValue(long value) {
+        long getValue(DateTimePrintContext context, long value) {
             long absValue = Math.abs(value);
+            int baseValue = this.baseValue;
+            if (baseDate != null) {
+                Chronology chrono = Chronology.from(context.getTemporal());
+                baseValue = chrono.date(baseDate).get(field);
+            }
             if (value >= baseValue && value < baseValue + EXCEED_POINTS[minWidth]) {
                 // Use the reduced value if it fits in minWidth
                 return absValue % EXCEED_POINTS[minWidth];
@@ -2763,6 +2806,12 @@
 
         @Override
         int setValue(DateTimeParseContext context, long value, int errorPos, int successPos) {
+            int baseValue = this.baseValue;
+            if (baseDate != null) {
+                // TODO: effective chrono is inaccurate at this point
+                Chronology chrono = context.getEffectiveChronology();
+                baseValue = chrono.date(baseDate).get(field);
+            }
             int parseLen = successPos - errorPos;
             if (parseLen == minWidth && value >= 0) {
                 long range = EXCEED_POINTS[minWidth];
@@ -2773,7 +2822,7 @@
                 } else {
                     value = basePart - value;
                 }
-                if (basePart != 0 && value < baseValue) {
+                if (value < baseValue) {
                     value += range;
                 }
             }
@@ -2790,7 +2839,7 @@
             if (subsequentWidth == -1) {
                 return this;
             }
-            return new ReducedPrinterParser(field, minWidth, maxWidth, baseValue, -1);
+            return new ReducedPrinterParser(field, minWidth, maxWidth, baseValue, baseDate, -1);
         }
 
         /**
@@ -2801,13 +2850,13 @@
          */
         @Override
         ReducedPrinterParser withSubsequentWidth(int subsequentWidth) {
-            return new ReducedPrinterParser(field, minWidth, maxWidth, baseValue,
+            return new ReducedPrinterParser(field, minWidth, maxWidth, baseValue, baseDate,
                     this.subsequentWidth + subsequentWidth);
         }
 
         @Override
         public String toString() {
-            return "ReducedValue(" + field + "," + minWidth + "," + maxWidth + "," + baseValue + ")";
+            return "ReducedValue(" + field + "," + minWidth + "," + maxWidth + "," + (baseDate != null ? baseDate : baseValue) + ")";
         }
     }
 
@@ -4351,7 +4400,7 @@
                 case 'Y':
                     field = weekDef.weekBasedYear();
                     if (count == 2) {
-                        return new ReducedPrinterParser(field, 2, 2, 2000, 0);
+                        return new ReducedPrinterParser(field, 2, 2, 0, ReducedPrinterParser.BASE_DATE, 0);
                     } else {
                         return new NumberPrinterParser(field, count, 19,
                                 (count < 4) ? SignStyle.NORMAL : SignStyle.EXCEEDS_PAD, -1);
@@ -4380,7 +4429,7 @@
                 if (count == 1) {
                     sb.append("WeekBasedYear");
                 } else if (count == 2) {
-                    sb.append("ReducedValue(WeekBasedYear,2,2000)");
+                    sb.append("ReducedValue(WeekBasedYear,2,2,2000-01-01)");
                 } else {
                     sb.append("WeekBasedYear,").append(count).append(",")
                             .append(19).append(",")
--- a/jdk/src/share/classes/java/time/format/Parsed.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/format/Parsed.java	Fri Oct 11 09:17:18 2013 -0400
@@ -83,6 +83,8 @@
 import java.time.Period;
 import java.time.ZoneId;
 import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.ChronoZonedDateTime;
 import java.time.chrono.Chronology;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalAccessor;
@@ -260,11 +262,34 @@
             while (changedCount < 50) {
                 for (Map.Entry<TemporalField, Long> entry : fieldValues.entrySet()) {
                     TemporalField targetField = entry.getKey();
-                    ChronoLocalDate resolvedDate = targetField.resolve(fieldValues, chrono, zone, resolverStyle);
-                    if (resolvedDate != null) {
-                        updateCheckConflict(resolvedDate);
-                        changedCount++;
-                        continue outer;  // have to restart to avoid concurrent modification
+                    TemporalAccessor resolvedObject = targetField.resolve(fieldValues, chrono, zone, resolverStyle);
+                    if (resolvedObject != null) {
+                        if (resolvedObject instanceof ChronoZonedDateTime) {
+                            ChronoZonedDateTime czdt = (ChronoZonedDateTime) resolvedObject;
+                            if (zone.equals(czdt.getZone()) == false) {
+                                throw new DateTimeException("ChronoZonedDateTime must use the effective parsed zone: " + zone);
+                            }
+                            resolvedObject = czdt.toLocalDateTime();
+                        }
+                        if (resolvedObject instanceof ChronoLocalDateTime) {
+                            ChronoLocalDateTime cldt = (ChronoLocalDateTime) resolvedObject;
+                            updateCheckConflict(cldt.toLocalTime(), Period.ZERO);
+                            updateCheckConflict(cldt.toLocalDate());
+                            changedCount++;
+                            continue outer;  // have to restart to avoid concurrent modification
+                        }
+                        if (resolvedObject instanceof ChronoLocalDate) {
+                            updateCheckConflict((ChronoLocalDate) resolvedObject);
+                            changedCount++;
+                            continue outer;  // have to restart to avoid concurrent modification
+                        }
+                        if (resolvedObject instanceof LocalTime) {
+                            updateCheckConflict((LocalTime) resolvedObject, Period.ZERO);
+                            changedCount++;
+                            continue outer;  // have to restart to avoid concurrent modification
+                        }
+                        throw new DateTimeException("Method resolveFields() can only return ChronoZonedDateTime," +
+                                "ChronoLocalDateTime, ChronoLocalDate or LocalTime");
                     } else if (fieldValues.containsKey(targetField) == false) {
                         changedCount++;
                         continue outer;  // have to restart to avoid concurrent modification
@@ -302,7 +327,10 @@
             if (cld != null && date.equals(cld) == false) {
                 throw new DateTimeException("Conflict found: Fields resolved to two different dates: " + date + " " + cld);
             }
-        } else {
+        } else if (cld != null) {
+            if (chrono.equals(cld.getChronology()) == false) {
+                throw new DateTimeException("ChronoLocalDate must use the effective parsed chronology: " + chrono);
+            }
             date = cld;
         }
     }
@@ -560,11 +588,23 @@
     //-----------------------------------------------------------------------
     @Override
     public String toString() {
-        String str = fieldValues.toString() + "," + chrono + "," + zone;
+        StringBuilder buf = new StringBuilder(64);
+        buf.append(fieldValues).append(',').append(chrono);
+        if (zone != null) {
+            buf.append(',').append(zone);
+        }
         if (date != null || time != null) {
-            str += " resolved to " + date + "," + time;
+            buf.append(" resolved to ");
+            if (date != null) {
+                buf.append(date);
+                if (time != null) {
+                    buf.append('T').append(time);
+                }
+            } else {
+                buf.append(time);
+            }
         }
-        return str;
+        return buf.toString();
     }
 
 }
--- a/jdk/src/share/classes/java/time/temporal/ChronoUnit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/temporal/ChronoUnit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -268,8 +268,8 @@
 
     //-----------------------------------------------------------------------
     @Override
-    public long between(Temporal temporal1, Temporal temporal2) {
-        return temporal1.until(temporal2, this);
+    public long between(Temporal temporal1Inclusive, Temporal temporal2Exclusive) {
+        return temporal1Inclusive.until(temporal2Exclusive, this);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/src/share/classes/java/time/temporal/IsoFields.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/temporal/IsoFields.java	Fri Oct 11 09:17:18 2013 -0400
@@ -684,13 +684,16 @@
         }
 
         @Override
-        public long between(Temporal temporal1, Temporal temporal2) {
+        public long between(Temporal temporal1Inclusive, Temporal temporal2Exclusive) {
+            if (temporal1Inclusive.getClass() != temporal2Exclusive.getClass()) {
+                return temporal1Inclusive.until(temporal2Exclusive, this);
+            }
             switch(this) {
                 case WEEK_BASED_YEARS:
-                    return Math.subtractExact(temporal2.getLong(WEEK_BASED_YEAR),
-                            temporal1.getLong(WEEK_BASED_YEAR));
+                    return Math.subtractExact(temporal2Exclusive.getLong(WEEK_BASED_YEAR),
+                            temporal1Inclusive.getLong(WEEK_BASED_YEAR));
                 case QUARTER_YEARS:
-                    return temporal1.until(temporal2, MONTHS) / 3;
+                    return temporal1Inclusive.until(temporal2Exclusive, MONTHS) / 3;
                 default:
                     throw new IllegalStateException("Unreachable");
             }
--- a/jdk/src/share/classes/java/time/temporal/Temporal.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/temporal/Temporal.java	Fri Oct 11 09:17:18 2013 -0400
@@ -170,7 +170,8 @@
      * </pre>
      *
      * @implSpec
-     * Implementations must not alter either this object.
+     * <p>
+     * Implementations must not alter either this object or the specified temporal object.
      * Instead, an adjusted copy of the original must be returned.
      * This provides equivalent, safe behavior for immutable and mutable implementations.
      * <p>
@@ -209,7 +210,7 @@
      * is obtained by invoking {@code TemporalField.adjustInto(Temporal, long)}
      * passing {@code this} as the first argument.
      * <p>
-     * Implementations must not alter either this object or the specified temporal object.
+     * Implementations must not alter this object.
      * Instead, an adjusted copy of the original must be returned.
      * This provides equivalent, safe behavior for immutable and mutable implementations.
      *
@@ -232,16 +233,17 @@
      * <p>
      * Some example code indicating how and why this method is used:
      * <pre>
-     *  date = date.plus(period);                      // add a Period instance
-     *  date = date.plus(duration);                    // add a Duration instance
-     *  date = date.plus(workingDays(6));              // example user-written workingDays method
+     *  date = date.plus(period);                // add a Period instance
+     *  date = date.plus(duration);              // add a Duration instance
+     *  date = date.plus(workingDays(6));        // example user-written workingDays method
      * </pre>
      * <p>
      * Note that calling {@code plus} followed by {@code minus} is not guaranteed to
      * return the same date-time.
      *
      * @implSpec
-     * Implementations must not alter either this object.
+     * <p>
+     * Implementations must not alter either this object or the specified temporal object.
      * Instead, an adjusted copy of the original must be returned.
      * This provides equivalent, safe behavior for immutable and mutable implementations.
      * <p>
@@ -280,7 +282,7 @@
      * is obtained by invoking {@code TemporalUnit.addTo(Temporal, long)}
      * passing {@code this} as the first argument.
      * <p>
-     * Implementations must not alter either this object or the specified temporal object.
+     * Implementations must not alter this object.
      * Instead, an adjusted copy of the original must be returned.
      * This provides equivalent, safe behavior for immutable and mutable implementations.
      *
@@ -303,16 +305,17 @@
      * <p>
      * Some example code indicating how and why this method is used:
      * <pre>
-     *  date = date.minus(period);                      // subtract a Period instance
-     *  date = date.minus(duration);                    // subtract a Duration instance
-     *  date = date.minus(workingDays(6));              // example user-written workingDays method
+     *  date = date.minus(period);               // subtract a Period instance
+     *  date = date.minus(duration);             // subtract a Duration instance
+     *  date = date.minus(workingDays(6));       // example user-written workingDays method
      * </pre>
      * <p>
      * Note that calling {@code plus} followed by {@code minus} is not guaranteed to
      * return the same date-time.
      *
      * @implSpec
-     * Implementations must not alter either this object.
+     * <p>
+     * Implementations must not alter either this object or the specified temporal object.
      * Instead, an adjusted copy of the original must be returned.
      * This provides equivalent, safe behavior for immutable and mutable implementations.
      * <p>
@@ -345,7 +348,7 @@
      * @implSpec
      * Implementations must behave in a manor equivalent to the default method behavior.
      * <p>
-     * Implementations must not alter either this object or the specified temporal object.
+     * Implementations must not alter this object.
      * Instead, an adjusted copy of the original must be returned.
      * This provides equivalent, safe behavior for immutable and mutable implementations.
      * <p>
@@ -371,8 +374,9 @@
      * Calculates the amount of time until another temporal in terms of the specified unit.
      * <p>
      * This calculates the amount of time between two temporal objects
-     * of the same type in terms of a single {@code TemporalUnit}.
+     * in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified temporal.
+     * The end point is converted to be of the same type as the start point if different.
      * The result will be negative if the end is before the start.
      * For example, the period in hours between two temporal objects can be
      * calculated using {@code startTime.until(endTime, HOURS)}.
@@ -409,31 +413,36 @@
      * <p>
      * If the unit is not a {@code ChronoUnit}, then the result of this method
      * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
-     * passing {@code this} as the first argument and the input temporal as
+     * passing {@code this} as the first argument and the converted input temporal as
      * the second argument.
      * <p>
-     * In summary, implementations must behave in a manner equivalent to this code:
+     * In summary, implementations must behave in a manner equivalent to this pseudo-code:
      * <pre>
-     *  // check input temporal is the same type as this class
+     *  // convert the end temporal to the same type as this class
      *  if (unit instanceof ChronoUnit) {
      *    // if unit is supported, then calculate and return result
      *    // else throw UnsupportedTemporalTypeException for unsupported units
      *  }
-     *  return unit.between(this, endTemporal);
+     *  return unit.between(this, convertedEndTemporal);
      * </pre>
      * <p>
+     * Note that the unit's {@code between} method must only be invoked if the
+     * two temporal objects have exactly the same type evaluated by {@code getClass()}.
+     * <p>
      * Implementations must ensure that no observable state is altered when this
      * read-only method is invoked.
      *
-     * @param endTemporal  the end temporal, of the same type as this object, not null
+     * @param endExclusive  the end temporal, exclusive, converted to be of the
+     *  same type as this object, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this temporal object and the specified one
      *  in terms of the unit; positive if the specified object is later than this one,
      *  negative if it is earlier than this one
-     * @throws DateTimeException if the amount cannot be calculated
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to the same type as this temporal
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
-    long until(Temporal endTemporal, TemporalUnit unit);
+    long until(Temporal endExclusive, TemporalUnit unit);
 
 }
--- a/jdk/src/share/classes/java/time/temporal/TemporalField.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/temporal/TemporalField.java	Fri Oct 11 09:17:18 2013 -0400
@@ -63,7 +63,6 @@
 
 import java.time.DateTimeException;
 import java.time.ZoneId;
-import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.Chronology;
 import java.time.format.ResolverStyle;
 import java.util.Locale;
@@ -350,6 +349,10 @@
      * be acceptable for the date fields to be resolved into other {@code ChronoField}
      * instances that can produce a date, such as {@code EPOCH_DAY}.
      * <p>
+     * Not all {@code TemporalAccessor} implementations are accepted as return values.
+     * Implementations must accept {@code ChronoLocalDate}, {@code ChronoLocalDateTime},
+     * {@code ChronoZonedDateTime} and {@code LocalTime}.
+     * <p>
      * The zone is not normally required for resolution, but is provided for completeness.
      * <p>
      * The default implementation must return null.
@@ -358,13 +361,13 @@
      * @param chronology  the effective chronology, not null
      * @param zone  the effective zone, not null
      * @param resolverStyle  the requested type of resolve, not null
-     * @return the resolved date; null if resolving only changed the map,
-     *  or no resolve occurred
+     * @return the resolved temporal object; null if resolving only
+     *  changed the map, or no resolve occurred
      * @throws ArithmeticException if numeric overflow occurs
      * @throws DateTimeException if resolving results in an error. This must not be thrown
      *  by querying a field on the temporal without first checking if it is supported
      */
-    default ChronoLocalDate resolve(
+    default TemporalAccessor resolve(
             Map<TemporalField, Long> fieldValues, Chronology chronology,
             ZoneId zone, ResolverStyle resolverStyle) {
         return null;
--- a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -231,7 +231,9 @@
      * Calculates the amount of time between two temporal objects.
      * <p>
      * This calculates the amount in terms of this unit. The start and end
-     * points are supplied as temporal objects and must be of the same type.
+     * points are supplied as temporal objects and must be of compatible types.
+     * The implementation will convert the second type to be an instance of the
+     * first type before the calculating the amount.
      * The result will be negative if the end is before the start.
      * For example, the amount in hours between two temporal objects can be
      * calculated using {@code HOURS.between(startTime, endTime)}.
@@ -264,15 +266,22 @@
      * If the unit is not supported an {@code UnsupportedTemporalTypeException} must be thrown.
      * Implementations must not alter the specified temporal objects.
      *
-     * @param temporal1  the base temporal object, not null
-     * @param temporal2  the other temporal object, not null
-     * @return the amount of time between temporal1 and temporal2 in terms of this unit;
-     *  positive if temporal2 is later than temporal1, negative if earlier
-     * @throws DateTimeException if the amount cannot be calculated
+     * @implSpec
+     * Implementations must begin by checking to if the two temporals have the
+     * same type using {@code getClass()}. If they do not, then the result must be
+     * obtained by calling {@code temporal1Inclusive.until(temporal2Exclusive, this)}.
+     *
+     * @param temporal1Inclusive  the base temporal object, not null
+     * @param temporal2Exclusive  the other temporal object, exclusive, not null
+     * @return the amount of time between temporal1Inclusive and temporal2Exclusive
+     *  in terms of this unit; positive if temporal2Exclusive is later than
+     *  temporal1Inclusive, negative if earlier
+     * @throws DateTimeException if the amount cannot be calculated, or the end
+     *  temporal cannot be converted to the same type as the start temporal
      * @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
      * @throws ArithmeticException if numeric overflow occurs
      */
-    long between(Temporal temporal1, Temporal temporal2);
+    long between(Temporal temporal1Inclusive, Temporal temporal2Exclusive);
 
     //-----------------------------------------------------------------------
     /**
--- a/jdk/src/share/classes/java/time/temporal/ValueRange.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/time/temporal/ValueRange.java	Fri Oct 11 09:17:18 2013 -0400
@@ -61,6 +61,7 @@
  */
 package java.time.temporal;
 
+import java.io.InvalidObjectException;
 import java.io.Serializable;
 import java.time.DateTimeException;
 
@@ -337,6 +338,21 @@
         }
     }
 
+    /**
+     * Return the ValueRange for the serialized values.
+     * The values are validated according to the constraints of the {@link #of}
+     * factory method.
+     * @return the ValueRange for the serialized fields
+     * @throws InvalidObjectException if the serialized object has invalid values
+     */
+    private Object readResolve() throws InvalidObjectException {
+        try {
+            return of(minSmallest, minLargest, maxSmallest, maxLargest);
+        } catch (IllegalArgumentException iae) {
+            throw new InvalidObjectException("Invalid serialized ValueRange: " + iae.getMessage());
+        }
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Checks if this range is equal to another range.
--- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Fri Oct 11 09:17:18 2013 -0400
@@ -111,12 +111,24 @@
 
     /**
      * Returns the sum of values recorded, or zero if no values have been
-     * recorded. The sum returned can vary depending upon the order in which
-     * values are recorded. This is due to accumulated rounding error in
-     * addition of values of differing magnitudes. Values sorted by increasing
-     * absolute magnitude tend to yield more accurate results.  If any recorded
-     * value is a {@code NaN} or the sum is at any point a {@code NaN} then the
-     * sum will be {@code NaN}.
+     * recorded.
+     *
+     * If any recorded value is a NaN or the sum is at any point a NaN
+     * then the sum will be NaN.
+     *
+     * <p> The value of a floating-point sum is a function both of the
+     * input values as well as the order of addition operations. The
+     * order of addition operations of this method is intentionally
+     * not defined to allow for implementation flexibility to improve
+     * the speed and accuracy of the computed result.
+     *
+     * In particular, this method may be implemented using compensated
+     * summation or other technique to reduce the error bound in the
+     * numerical sum compared to a simple summation of {@code double}
+     * values.
+     *
+     * @apiNote Sorting values by increasing absolute magnitude tends to yield
+     * more accurate results.
      *
      * @return the sum of values, or zero if none
      */
@@ -153,13 +165,21 @@
     }
 
     /**
-     * Returns the arithmetic mean of values recorded, or zero if no values have been
-     * recorded. The average returned can vary depending upon the order in
-     * which values are recorded. This is due to accumulated rounding error in
-     * addition of values of differing magnitudes. Values sorted by increasing
-     * absolute magnitude tend to yield more accurate results. If any recorded
-     * value is a {@code NaN} or the sum is at any point a {@code NaN} then the
-     * average will be {@code NaN}.
+     * Returns the arithmetic mean of values recorded, or zero if no
+     * values have been recorded.
+     *
+     * If any recorded value is a NaN or the sum is at any point a NaN
+     * then the average will be code NaN.
+     *
+     * <p>The average returned can vary depending upon the order in
+     * which values are recorded.
+     *
+     * This method may be implemented using compensated summation or
+     * other technique to reduce the error bound in the {@link #getSum
+     * numerical sum} used to compute the average.
+     *
+     * @apiNote Values sorted by increasing absolute magnitude tend to yield
+     * more accurate results.
      *
      * @return the arithmetic mean of values, or zero if none
      */
--- a/jdk/src/share/classes/java/util/HashSet.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/HashSet.java	Fri Oct 11 09:17:18 2013 -0400
@@ -25,6 +25,8 @@
 
 package java.util;
 
+import java.io.InvalidObjectException;
+
 /**
  * This class implements the <tt>Set</tt> interface, backed by a hash table
  * (actually a <tt>HashMap</tt> instance).  It makes no guarantees as to the
@@ -294,16 +296,37 @@
         // Read in any hidden serialization magic
         s.defaultReadObject();
 
-        // Read in HashMap capacity and load factor and create backing HashMap
+        // Read capacity and verify non-negative.
         int capacity = s.readInt();
+        if (capacity < 0) {
+            throw new InvalidObjectException("Illegal capacity: " +
+                                             capacity);
+        }
+
+        // Read load factor and verify positive and non NaN.
         float loadFactor = s.readFloat();
+        if (loadFactor <= 0 || Float.isNaN(loadFactor)) {
+            throw new InvalidObjectException("Illegal load factor: " +
+                                             loadFactor);
+        }
+
+        // Read size and verify non-negative.
+        int size = s.readInt();
+        if (size < 0) {
+            throw new InvalidObjectException("Illegal size: " +
+                                             size);
+        }
+
+        // Set the capacity according to the size and load factor ensuring that
+        // the HashMap is at least 25% full but clamping to maximum capacity.
+        capacity = (int) Math.min(size * Math.min(1 / loadFactor, 4.0f),
+                HashMap.MAXIMUM_CAPACITY);
+
+        // Create backing HashMap
         map = (((HashSet<?>)this) instanceof LinkedHashSet ?
                new LinkedHashMap<E,Object>(capacity, loadFactor) :
                new HashMap<E,Object>(capacity, loadFactor));
 
-        // Read in size
-        int size = s.readInt();
-
         // Read in all elements in the proper order.
         for (int i=0; i<size; i++) {
             @SuppressWarnings("unchecked")
--- a/jdk/src/share/classes/java/util/Random.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/Random.java	Fri Oct 11 09:17:18 2013 -0400
@@ -89,7 +89,7 @@
     private static final long addend = 0xBL;
     private static final long mask = (1L << 48) - 1;
 
-    private static final double DOUBLE_UNIT = 1.0 / (1L << 53);
+    private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53)
 
     // IllegalArgumentException messages
     static final String BadBound = "bound must be positive";
--- a/jdk/src/share/classes/java/util/Spliterator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/Spliterator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -414,13 +414,19 @@
      * #ORDERED}, {@link #DISTINCT}, {@link #SORTED}, {@link #SIZED},
      * {@link #NONNULL}, {@link #IMMUTABLE}, {@link #CONCURRENT},
      * {@link #SUBSIZED}.  Repeated calls to {@code characteristics()} on
-     * a given spliterator should always return the same result.
+     * a given spliterator, prior to or in-between calls to {@code trySplit},
+     * should always return the same result.
      *
      * <p>If a Spliterator reports an inconsistent set of
      * characteristics (either those returned from a single invocation
      * or across multiple invocations), no guarantees can be made
      * about any computation using this Spliterator.
      *
+     * @apiNote The characteristics of a given spliterator before splitting
+     * may differ from the characteristics after splitting.  For specific
+     * examples see the characteristic values {@link #SIZED}, {@link #SUBSIZED}
+     * and {@link #CONCURRENT}.
+     *
      * @return a representation of characteristics
      */
     int characteristics();
--- a/jdk/src/share/classes/java/util/SplittableRandom.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/SplittableRandom.java	Fri Oct 11 09:17:18 2013 -0400
@@ -107,29 +107,25 @@
      * Methods nextLong, nextInt, and derivatives do not return the
      * sequence (seed) values, but instead a hash-like bit-mix of
      * their bits, producing more independently distributed sequences.
-     * For nextLong, the mix64 bit-mixing function computes the same
-     * value as the "64-bit finalizer" function in Austin Appleby's
-     * MurmurHash3 algorithm.  See
-     * http://code.google.com/p/smhasher/wiki/MurmurHash3 , which
-     * comments: "The constants for the finalizers were generated by a
-     * simple simulated-annealing algorithm, and both avalanche all
-     * bits of 'h' to within 0.25% bias." The mix32 function is
-     * equivalent to (int)(mix64(seed) >>> 32), but faster because it
-     * omits a step that doesn't contribute to result.
+     * For nextLong, the mix64 function is based on David Stafford's
+     * (http://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html)
+     * "Mix13" variant of the "64-bit finalizer" function in Austin
+     * Appleby's MurmurHash3 algorithm (see
+     * http://code.google.com/p/smhasher/wiki/MurmurHash3). The mix32
+     * function is based on Stafford's Mix04 mix function, but returns
+     * the upper 32 bits cast as int.
      *
      * The split operation uses the current generator to form the seed
      * and gamma for another SplittableRandom.  To conservatively
      * avoid potential correlations between seed and value generation,
-     * gamma selection (method nextGamma) uses the "Mix13" constants
-     * for MurmurHash3 described by David Stafford
-     * (http://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html)
-     * To avoid potential weaknesses in bit-mixing transformations, we
-     * restrict gammas to odd values with at least 12 and no more than
-     * 52 bits set.  Rather than rejecting candidates with too few or
-     * too many bits set, method nextGamma flips some bits (which has
-     * the effect of mapping at most 4 to any given gamma value).
-     * This reduces the effective set of 64bit odd gamma values by
-     * about 2<sup>14</sup>, a very tiny percentage, and serves as an
+     * gamma selection (method mixGamma) uses different
+     * (Murmurhash3's) mix constants.  To avoid potential weaknesses
+     * in bit-mixing transformations, we restrict gammas to odd values
+     * with at least 24 0-1 or 1-0 bit transitions.  Rather than
+     * rejecting candidates with too few or too many bits set, method
+     * mixGamma flips some bits (which has the effect of mapping at
+     * most 4 to any given gamma value).  This reduces the effective
+     * set of 64bit odd gamma values by about 2%, and serves as an
      * automated screening for sequence constant selection that is
      * left as an empirical decision in some other hashing and crypto
      * algorithms.
@@ -140,14 +136,15 @@
      * avalanching.
      *
      * The default (no-argument) constructor, in essence, invokes
-     * split() for a common "seeder" SplittableRandom.  Unlike other
-     * cases, this split must be performed in a thread-safe manner, so
-     * we use an AtomicLong to represent the seed rather than use an
-     * explicit SplittableRandom. To bootstrap the seeder, we start
-     * off using a seed based on current time and host unless the
-     * java.util.secureRandomSeed property is set. This serves as a
-     * slimmed-down (and insecure) variant of SecureRandom that also
-     * avoids stalls that may occur when using /dev/random.
+     * split() for a common "defaultGen" SplittableRandom.  Unlike
+     * other cases, this split must be performed in a thread-safe
+     * manner, so we use an AtomicLong to represent the seed rather
+     * than use an explicit SplittableRandom. To bootstrap the
+     * defaultGen, we start off using a seed based on current time and
+     * network interface address unless the java.util.secureRandomSeed
+     * property is set. This serves as a slimmed-down (and insecure)
+     * variant of SecureRandom that also avoids stalls that may occur
+     * when using /dev/random.
      *
      * It is a relatively simple matter to apply the basic design here
      * to use 128 bit seeds. However, emulating 128bit arithmetic and
@@ -160,17 +157,16 @@
      */
 
     /**
-     * The initial gamma value for (unsplit) SplittableRandoms. Must
-     * be odd with at least 12 and no more than 52 bits set. Currently
-     * set to the golden ratio scaled to 64bits.
+     * The golden ratio scaled to 64bits, used as the initial gamma
+     * value for (unsplit) SplittableRandoms.
      */
-    private static final long INITIAL_GAMMA = 0x9e3779b97f4a7c15L;
+    private static final long GOLDEN_GAMMA = 0x9e3779b97f4a7c15L;
 
     /**
      * The least non-zero value returned by nextDouble(). This value
      * is scaled by a random value of 53 bits to produce a result.
      */
-    private static final double DOUBLE_UNIT = 1.0 / (1L << 53);
+    private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53);
 
     /**
      * The seed. Updated only via method nextSeed.
@@ -191,31 +187,31 @@
     }
 
     /**
-     * Computes MurmurHash3 64bit mix function.
+     * Computes Stafford variant 13 of 64bit mix function.
      */
     private static long mix64(long z) {
-        z = (z ^ (z >>> 33)) * 0xff51afd7ed558ccdL;
-        z = (z ^ (z >>> 33)) * 0xc4ceb9fe1a85ec53L;
-        return z ^ (z >>> 33);
+        z = (z ^ (z >>> 30)) * 0xbf58476d1ce4e5b9L;
+        z = (z ^ (z >>> 27)) * 0x94d049bb133111ebL;
+        return z ^ (z >>> 31);
     }
 
     /**
-     * Returns the 32 high bits of mix64(z) as int.
+     * Returns the 32 high bits of Stafford variant 4 mix64 function as int.
      */
     private static int mix32(long z) {
-        z = (z ^ (z >>> 33)) * 0xff51afd7ed558ccdL;
-        return (int)(((z ^ (z >>> 33)) * 0xc4ceb9fe1a85ec53L) >>> 32);
+        z = (z ^ (z >>> 33)) * 0x62a9d9ed799705f5L;
+        return (int)(((z ^ (z >>> 28)) * 0xcb24d0a5c88c35b3L) >>> 32);
     }
 
     /**
      * Returns the gamma value to use for a new split instance.
      */
-    private static long nextGamma(long z) {
-        z = (z ^ (z >>> 30)) * 0xbf58476d1ce4e5b9L; // Stafford "Mix13"
-        z = (z ^ (z >>> 27)) * 0x94d049bb133111ebL;
-        z = (z ^ (z >>> 31)) | 1L; // force to be odd
-        int n = Long.bitCount(z);  // ensure enough 0 and 1 bits
-        return (n < 12 || n > 52) ? z ^ 0xaaaaaaaaaaaaaaaaL : z;
+    private static long mixGamma(long z) {
+        z = (z ^ (z >>> 33)) * 0xff51afd7ed558ccdL; // MurmurHash3 mix constants
+        z = (z ^ (z >>> 33)) * 0xc4ceb9fe1a85ec53L;
+        z = (z ^ (z >>> 33)) | 1L;                  // force to be odd
+        int n = Long.bitCount(z ^ (z >>> 1));       // ensure enough transitions
+        return (n < 24) ? z ^ 0xaaaaaaaaaaaaaaaaL : z;
     }
 
     /**
@@ -228,7 +224,7 @@
     /**
      * The seed generator for default constructors.
      */
-    private static final AtomicLong seeder = new AtomicLong(initialSeed());
+    private static final AtomicLong defaultGen = new AtomicLong(initialSeed());
 
     private static long initialSeed() {
         String pp = java.security.AccessController.doPrivileged(
@@ -396,7 +392,7 @@
      * @param seed the initial seed
      */
     public SplittableRandom(long seed) {
-        this(seed, INITIAL_GAMMA);
+        this(seed, GOLDEN_GAMMA);
     }
 
     /**
@@ -405,8 +401,10 @@
      * of those of any other instances in the current program; and
      * may, and typically does, vary across program invocations.
      */
-    public SplittableRandom() { // emulate seeder.split()
-        this.gamma = nextGamma(this.seed = seeder.addAndGet(INITIAL_GAMMA));
+    public SplittableRandom() { // emulate defaultGen.split()
+        long s = defaultGen.getAndAdd(2 * GOLDEN_GAMMA);
+        this.seed = mix64(s);
+        this.gamma = mixGamma(s + GOLDEN_GAMMA);
     }
 
     /**
@@ -424,8 +422,7 @@
      * @return the new SplittableRandom instance
      */
     public SplittableRandom split() {
-        long s = nextSeed();
-        return new SplittableRandom(s, nextGamma(s));
+        return new SplittableRandom(nextLong(), mixGamma(nextSeed()));
     }
 
     /**
--- a/jdk/src/share/classes/java/util/TreeMap.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/TreeMap.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1269,6 +1269,15 @@
         public K next() {
             return prevEntry().key;
         }
+        public void remove() {
+            if (lastReturned == null)
+                throw new IllegalStateException();
+            if (modCount != expectedModCount)
+                throw new ConcurrentModificationException();
+            deleteEntry(lastReturned);
+            lastReturned = null;
+            expectedModCount = modCount;
+        }
     }
 
     // Little utilities
--- a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Fri Oct 11 09:17:18 2013 -0400
@@ -194,8 +194,8 @@
     private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL;
 
     // Constants from SplittableRandom
-    private static final double DOUBLE_UNIT = 1.0 / (1L << 53);
-    private static final float  FLOAT_UNIT  = 1.0f / (1 << 24);
+    private static final double DOUBLE_UNIT = 0x1.0p-53;  // 1.0  / (1L << 53)
+    private static final float  FLOAT_UNIT  = 0x1.0p-24f; // 1.0f / (1 << 24)
 
     /** Rarely-used holder for the second of a pair of Gaussians */
     private static final ThreadLocal<Double> nextLocalGaussian =
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -489,7 +489,8 @@
         /*
          * Try to signal next queued node if:
          *   Propagation was indicated by caller,
-         *     or was recorded (as h.waitStatus) by a previous operation
+         *     or was recorded (as h.waitStatus either before
+         *     or after setHead) by a previous operation
          *     (note: this uses sign-check of waitStatus because
          *      PROPAGATE status may transition to SIGNAL.)
          * and
@@ -501,7 +502,8 @@
          * racing acquires/releases, so most need signals now or soon
          * anyway.
          */
-        if (propagate > 0 || h == null || h.waitStatus < 0) {
+        if (propagate > 0 || h == null || h.waitStatus < 0 ||
+            (h = head) == null || h.waitStatus < 0) {
             Node s = node.next;
             if (s == null || s.isShared())
                 doReleaseShared();
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -711,7 +711,8 @@
         /*
          * Try to signal next queued node if:
          *   Propagation was indicated by caller,
-         *     or was recorded (as h.waitStatus) by a previous operation
+         *     or was recorded (as h.waitStatus either before
+         *     or after setHead) by a previous operation
          *     (note: this uses sign-check of waitStatus because
          *      PROPAGATE status may transition to SIGNAL.)
          * and
@@ -723,7 +724,8 @@
          * racing acquires/releases, so most need signals now or soon
          * anyway.
          */
-        if (propagate > 0 || h == null || h.waitStatus < 0) {
+        if (propagate > 0 || h == null || h.waitStatus < 0 ||
+            (h = head) == null || h.waitStatus < 0) {
             Node s = node.next;
             if (s == null || s.isShared())
                 doReleaseShared();
--- a/jdk/src/share/classes/java/util/logging/Level.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/logging/Level.java	Fri Oct 11 09:17:18 2013 -0400
@@ -204,6 +204,12 @@
      * @throws NullPointerException if the name is null
      */
     protected Level(String name, int value, String resourceBundleName) {
+        this(name, value, resourceBundleName, true);
+    }
+
+    // private constructor to specify whether this instance should be added
+    // to the KnownLevel list from which Level.parse method does its look up
+    private Level(String name, int value, String resourceBundleName, boolean visible) {
         if (name == null) {
             throw new NullPointerException();
         }
@@ -212,7 +218,9 @@
         this.resourceBundleName = resourceBundleName;
         this.localizedLevelName = resourceBundleName == null ? name : null;
         this.cachedLocale = null;
-        KnownLevel.add(this);
+        if (visible) {
+            KnownLevel.add(this);
+        }
     }
 
     /**
@@ -465,7 +473,7 @@
         // Finally, look for a known level with the given localized name,
         // in the current default locale.
         // This is relatively expensive, but not excessively so.
-        level = KnownLevel.findByLocalizedName(name);
+        level = KnownLevel.findByLocalizedLevelName(name);
         if (level != null) {
             return level.levelObject;
         }
@@ -521,13 +529,14 @@
         private static Map<String, List<KnownLevel>> nameToLevels = new HashMap<>();
         private static Map<Integer, List<KnownLevel>> intToLevels = new HashMap<>();
         final Level levelObject;     // instance of Level class or Level subclass
-        final Level mirroredLevel;   // instance of Level class
+        final Level mirroredLevel;   // mirror of the custom Level
         KnownLevel(Level l) {
             this.levelObject = l;
             if (l.getClass() == Level.class) {
                 this.mirroredLevel = l;
             } else {
-                this.mirroredLevel = new Level(l.name, l.value, l.resourceBundleName);
+                // this mirrored level object is hidden
+                this.mirroredLevel = new Level(l.name, l.value, l.resourceBundleName, false);
             }
         }
 
@@ -585,20 +594,6 @@
             return null;
         }
 
-        // Returns a KnownLevel with the given localized name matching
-        // by calling the Level.getLocalizedName() method
-        static synchronized KnownLevel findByLocalizedName(String name) {
-            for (List<KnownLevel> levels : nameToLevels.values()) {
-                for (KnownLevel l : levels) {
-                    String lname = l.levelObject.getLocalizedName();
-                    if (name.equals(lname)) {
-                        return l;
-                    }
-                }
-            }
-            return null;
-        }
-
         static synchronized KnownLevel matches(Level l) {
             List<KnownLevel> list = nameToLevels.get(l.name);
             if (list != null) {
--- a/jdk/src/share/classes/java/util/stream/DoubleStream.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java	Fri Oct 11 09:17:18 2013 -0400
@@ -502,22 +502,42 @@
                   BiConsumer<R, R> combiner);
 
     /**
-     * Returns the sum of elements in this stream.  The sum returned can vary
-     * depending upon the order in which elements are encountered.  This is due
-     * to accumulated rounding error in addition of values of differing
-     * magnitudes. Elements sorted by increasing absolute magnitude tend to
-     * yield more accurate results.  If any stream element is a {@code NaN} or
-     * the sum is at any point a {@code NaN} then the sum will be {@code NaN}.
-     * This is a special case of a
-     * <a href="package-summary.html#Reduction">reduction</a> and is
+     * Returns the sum of elements in this stream.
+     *
+     * Summation is a special case of a <a
+     * href="package-summary.html#Reduction">reduction</a>. If
+     * floating-point summation were exact, this method would be
      * equivalent to:
+     *
      * <pre>{@code
      *     return reduce(0, Double::sum);
      * }</pre>
      *
+     * However, since floating-point summation is not exact, the above
+     * code is not necessarily equivalent to the summation computation
+     * done by this method.
+     *
+     * <p>If any stream element is a NaN or the sum is at any point a NaN
+     * then the sum will be NaN.
+     *
+     * The value of a floating-point sum is a function both
+     * of the input values as well as the order of addition
+     * operations. The order of addition operations of this method is
+     * intentionally not defined to allow for implementation
+     * flexibility to improve the speed and accuracy of the computed
+     * result.
+     *
+     * In particular, this method may be implemented using compensated
+     * summation or other technique to reduce the error bound in the
+     * numerical sum compared to a simple summation of {@code double}
+     * values.
+     *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
+     * @apiNote Sorting values by increasing absolute magnitude tends to yield
+     * more accurate results.
+     *
      * @return the sum of elements in this stream
      */
     double sum();
@@ -578,19 +598,29 @@
     long count();
 
     /**
-     * Returns an {@code OptionalDouble} describing the arithmetic mean of elements of
-     * this stream, or an empty optional if this stream is empty.  The average
-     * returned can vary depending upon the order in which elements are
-     * encountered. This is due to accumulated rounding error in addition of
-     * elements of differing magnitudes. Elements sorted by increasing absolute
-     * magnitude tend to yield more accurate results. If any recorded value is
-     * a {@code NaN} or the sum is at any point a {@code NaN} then the average
-     * will be {@code NaN}. This is a special case of a
-     * <a href="package-summary.html#Reduction">reduction</a>.
+     * Returns an {@code OptionalDouble} describing the arithmetic
+     * mean of elements of this stream, or an empty optional if this
+     * stream is empty.
+     *
+     * If any recorded value is a NaN or the sum is at any point a NaN
+     * then the average will be NaN.
+     *
+     * <p>The average returned can vary depending upon the order in
+     * which values are recorded.
+     *
+     * This method may be implemented using compensated summation or
+     * other technique to reduce the error bound in the {@link #sum
+     * numerical sum} used to compute the average.
+     *
+     *  <p>The average is a special case of a <a
+     *  href="package-summary.html#Reduction">reduction</a>.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
+     * @apiNote Elements sorted by increasing absolute magnitude tend
+     * to yield more accurate results.
+     *
      * @return an {@code OptionalDouble} containing the average element of this
      * stream, or an empty optional if the stream is empty
      */
--- a/jdk/src/share/classes/javax/crypto/CipherSpi.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/crypto/CipherSpi.java	Fri Oct 11 09:17:18 2013 -0400
@@ -786,7 +786,9 @@
             int total = 0;
             do {
                 int chunk = Math.min(inLen, inArray.length);
-                input.get(inArray, 0, chunk);
+                if (chunk > 0) {
+                    input.get(inArray, 0, chunk);
+                }
                 int n;
                 if (isUpdate || (inLen != chunk)) {
                     n = engineUpdate(inArray, 0, chunk, outArray, outOfs);
@@ -814,8 +816,9 @@
             int total = 0;
             boolean resized = false;
             do {
-                int chunk = Math.min(inLen, outSize);
-                if ((a1 == false) && (resized == false)) {
+                int chunk =
+                    Math.min(inLen, (outSize == 0? inArray.length : outSize));
+                if (!a1 && !resized && chunk > 0) {
                     input.get(inArray, 0, chunk);
                     inOfs = 0;
                 }
@@ -829,8 +832,10 @@
                     resized = false;
                     inOfs += chunk;
                     inLen -= chunk;
-                    output.put(outArray, 0, n);
-                    total += n;
+                    if (n > 0) {
+                        output.put(outArray, 0, n);
+                        total += n;
+                    }
                 } catch (ShortBufferException e) {
                     if (resized) {
                         // we just resized the output buffer, but it still
@@ -840,11 +845,13 @@
                     }
                     // output buffer is too small, realloc and try again
                     resized = true;
-                    int newOut = engineGetOutputSize(chunk);
-                    outArray = new byte[newOut];
+                    outSize = engineGetOutputSize(chunk);
+                    outArray = new byte[outSize];
                 }
             } while (inLen > 0);
-            input.position(inLimit);
+            if (a1) {
+                input.position(inLimit);
+            }
             return total;
         }
     }
--- a/jdk/src/share/classes/javax/crypto/JceSecurityManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/crypto/JceSecurityManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -230,7 +230,7 @@
     // See  bug 4341369 & 4334690 for more info.
     boolean isCallerTrusted() {
         // Get the caller and its codebase.
-        Class[] context = getClassContext();
+        Class<?>[] context = getClassContext();
         URL callerCodeBase = null;
         int i;
         for (i=0; i<context.length; i++) {
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java	Fri Oct 11 09:17:18 2013 -0400
@@ -57,7 +57,7 @@
  * be used in implementations:
  *
  * <table border=1>
- *  <caption>Audio File Format Property Keys</caption>
+ *  <caption>Audio File Format Properties</caption>
  *  <tr>
  *   <th>Property key</th>
  *   <th>Value type</th>
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java	Fri Oct 11 09:17:18 2013 -0400
@@ -85,7 +85,7 @@
  * service providers should use, if applicable:
  *
  * <table border=0>
- *  <caption>Audio Format Property Keys</caption>
+ *  <caption>Audio Format Properties</caption>
  *  <tr>
  *   <th>Property key</th>
  *   <th>Value type</th>
--- a/jdk/src/share/classes/javax/swing/JButton.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JButton.java	Fri Oct 11 09:17:18 2013 -0400
@@ -149,7 +149,7 @@
 
 
     /**
-     * Returns a string that specifies the name of the L&F class
+     * Returns a string that specifies the name of the L&amp;F class
      * that renders this component.
      *
      * @return the string "ButtonUI"
@@ -157,7 +157,7 @@
      * @see UIDefaults#getUI
      * @beaninfo
      *        expert: true
-     *   description: A string that specifies the name of the L&F class.
+     *   description: A string that specifies the name of the L&amp;F class.
      */
     public String getUIClassID() {
         return uiClassID;
--- a/jdk/src/share/classes/javax/swing/JCheckBox.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JCheckBox.java	Fri Oct 11 09:17:18 2013 -0400
@@ -230,7 +230,7 @@
 
 
     /**
-     * Returns a string that specifies the name of the L&F class
+     * Returns a string that specifies the name of the L&amp;F class
      * that renders this component.
      *
      * @return the string "CheckBoxUI"
@@ -238,7 +238,7 @@
      * @see UIDefaults#getUI
      * @beaninfo
      *        expert: true
-     *   description: A string that specifies the name of the L&F class
+     *   description: A string that specifies the name of the L&amp;F class
      */
     public String getUIClassID() {
         return uiClassID;
--- a/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java	Fri Oct 11 09:17:18 2013 -0400
@@ -168,7 +168,7 @@
     }
 
     /**
-     * Returns the name of the L&F class
+     * Returns the name of the L&amp;F class
      * that renders this component.
      *
      * @return "CheckBoxMenuItemUI"
--- a/jdk/src/share/classes/javax/swing/JColorChooser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JColorChooser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -216,7 +216,7 @@
     }
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return the <code>ColorChooserUI</code> object that renders
      *          this component
@@ -226,9 +226,9 @@
     }
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui  the <code>ColorChooserUI</code> L&F object
+     * @param ui  the <code>ColorChooserUI</code> L&amp;F object
      * @see UIDefaults#getUI
      *
      * @beaninfo
@@ -241,7 +241,7 @@
     }
 
     /**
-     * Notification from the <code>UIManager</code> that the L&F has changed.
+     * Notification from the <code>UIManager</code> that the L&amp;F has changed.
      * Replaces the current UI object with the latest version from the
      * <code>UIManager</code>.
      *
@@ -252,7 +252,7 @@
     }
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "ColorChooserUI"
      * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JComboBox.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JComboBox.java	Fri Oct 11 09:17:18 2013 -0400
@@ -242,9 +242,9 @@
     }
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui  the <code>ComboBoxUI</code> L&F object
+     * @param ui  the <code>ComboBoxUI</code> L&amp;F object
      * @see UIDefaults#getUI
      *
      * @beaninfo
@@ -273,7 +273,7 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "ComboBoxUI"
      * @see JComponent#getUIClassID
@@ -285,7 +285,7 @@
 
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return the ComboBoxUI object that renders this component
      */
@@ -607,7 +607,7 @@
      *
      * @param anIndex an integer specifying the list item to select,
      *                  where 0 specifies the first item in the list and -1 indicates no selection
-     * @exception IllegalArgumentException if <code>anIndex</code> < -1 or
+     * @exception IllegalArgumentException if <code>anIndex</code> &lt; -1 or
      *                  <code>anIndex</code> is greater than or equal to size
      * @beaninfo
      *   preferred: true
--- a/jdk/src/share/classes/javax/swing/JComponent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JComponent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -86,7 +86,7 @@
  * <ul>
  * <li>The base class for both standard and custom components
  *     that use the Swing architecture.
- * <li>A "pluggable look and feel" (L&F) that can be specified by the
+ * <li>A "pluggable look and feel" (L&amp;F) that can be specified by the
  *     programmer or (optionally) selected by the user at runtime.
  *     The look and feel for each component is provided by a
  *     <em>UI delegate</em> -- an object that descends from
@@ -4523,7 +4523,7 @@
      * @param propertyName  the name of the property that was listened on
      * @param oldValue  the old value of the property
      * @param newValue  the new value of the property
-     * @exception PropertyVetoException when the attempt to set the
+     * @exception java.beans.PropertyVetoException when the attempt to set the
      *          property is vetoed by the component
      */
     protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue)
--- a/jdk/src/share/classes/javax/swing/JDesktopPane.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JDesktopPane.java	Fri Oct 11 09:17:18 2013 -0400
@@ -50,13 +50,13 @@
  * <code>JLayeredPane</code> to manage the potentially overlapping internal
  * frames. It also maintains a reference to an instance of
  * <code>DesktopManager</code> that is set by the UI
- * class for the current look and feel (L&F).  Note that <code>JDesktopPane</code>
+ * class for the current look and feel (L&amp;F).  Note that <code>JDesktopPane</code>
  * does not support borders.
  * <p>
  * This class is normally used as the parent of <code>JInternalFrames</code>
  * to provide a pluggable <code>DesktopManager</code> object to the
  * <code>JInternalFrames</code>. The <code>installUI</code> of the
- * L&F specific implementation is responsible for setting the
+ * L&amp;F specific implementation is responsible for setting the
  * <code>desktopManager</code> variable appropriately.
  * When the parent of a <code>JInternalFrame</code> is a <code>JDesktopPane</code>,
  * it should delegate most of its behavior to the <code>desktopManager</code>
@@ -146,7 +146,7 @@
     }
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return the <code>DesktopPaneUI</code> object that
      *   renders this component
@@ -156,9 +156,9 @@
     }
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui  the DesktopPaneUI L&F object
+     * @param ui  the DesktopPaneUI L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -232,7 +232,7 @@
     }
 
     /**
-     * Notification from the <code>UIManager</code> that the L&F has changed.
+     * Notification from the <code>UIManager</code> that the L&amp;F has changed.
      * Replaces the current UI object with the latest version from the
      * <code>UIManager</code>.
      *
@@ -244,7 +244,7 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "DesktopPaneUI"
      * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -362,6 +362,7 @@
      */
     protected void setup(FileSystemView view) {
         installShowFilesListener();
+        installHierarchyListener();
 
         if(view == null) {
             view = FileSystemView.getFileSystemView();
@@ -374,6 +375,22 @@
         enableEvents(AWTEvent.MOUSE_EVENT_MASK);
     }
 
+    private void installHierarchyListener() {
+        addHierarchyListener(new HierarchyListener() {
+            @Override
+            public void hierarchyChanged(HierarchyEvent e) {
+                if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED)
+                        == HierarchyEvent.PARENT_CHANGED) {
+                    JFileChooser fc = JFileChooser.this;
+                    JRootPane rootPane = SwingUtilities.getRootPane(fc);
+                    if (rootPane != null) {
+                        rootPane.setDefaultButton(fc.getUI().getDefaultButton(fc));
+                    }
+                }
+            }
+        });
+    }
+
     private void installShowFilesListener() {
         // Track native setting for showing hidden files
         Toolkit tk = Toolkit.getDefaultToolkit();
@@ -801,7 +818,6 @@
                 dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
             }
         }
-        dialog.getRootPane().setDefaultButton(ui.getDefaultButton(this));
         dialog.pack();
         dialog.setLocationRelativeTo(parent);
 
--- a/jdk/src/share/classes/javax/swing/JLayer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JLayer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,16 +44,16 @@
  * {@code JLayer} is a universal decorator for Swing components
  * which enables you to implement various advanced painting effects as well as
  * receive notifications of all {@code AWTEvent}s generated within its borders.
- * <p/>
+ * <p>
  * {@code JLayer} delegates the handling of painting and input events to a
  * {@link javax.swing.plaf.LayerUI} object, which performs the actual decoration.
- * <p/>
+ * <p>
  * The custom painting implemented in the {@code LayerUI} and events notification
  * work for the JLayer itself and all its subcomponents.
  * This combination enables you to enrich existing components
  * by adding new advanced functionality such as temporary locking of a hierarchy,
  * data tips for compound components, enhanced mouse scrolling etc and so on.
- * <p/>
+ * <p>
  * {@code JLayer} is a good solution if you only need to do custom painting
  * over compound component or catch input events from its subcomponents.
  * <pre>
@@ -202,7 +202,7 @@
 
     /**
      * Returns the {@code JLayer}'s view component or {@code null}.
-     * <br/>This is a bound property.
+     * <br>This is a bound property.
      *
      * @return the {@code JLayer}'s view component
      *         or {@code null} if none exists
@@ -215,7 +215,7 @@
 
     /**
      * Sets the {@code JLayer}'s view component, which can be {@code null}.
-     * <br/>This is a bound property.
+     * <br>This is a bound property.
      *
      * @param view the view component for this {@code JLayer}
      *
@@ -257,7 +257,7 @@
 
     /**
      * Returns the {@code JLayer}'s glassPane component or {@code null}.
-     * <br/>This is a bound property.
+     * <br>This is a bound property.
      *
      * @return the {@code JLayer}'s glassPane component
      *         or {@code null} if none exists
@@ -270,7 +270,7 @@
 
     /**
      * Sets the {@code JLayer}'s glassPane component, which can be {@code null}.
-     * <br/>This is a bound property.
+     * <br>This is a bound property.
      *
      * @param glassPane the glassPane component of this {@code JLayer}
      *
@@ -309,7 +309,7 @@
     /**
      * Sets the layout manager for this container.  This method is
      * overridden to prevent the layout manager from being set.
-     * <p/>Note:  If {@code mgr} is non-{@code null}, this
+     * <p>Note:  If {@code mgr} is non-{@code null}, this
      * method will throw an exception as layout managers are not supported on
      * a {@code JLayer}.
      *
@@ -327,7 +327,7 @@
      * of this component from becoming complex enough to inhibit
      * subclassing of {@code LayerUI} class.  To create a {@code JLayer} with a border,
      * add it to a {@code JPanel} that has a border.
-     * <p/>Note:  If {@code border} is non-{@code null}, this
+     * <p>Note:  If {@code border} is non-{@code null}, this
      * method will throw an exception as borders are not supported on
      * a {@code JLayer}.
      *
@@ -471,11 +471,11 @@
      * defined by the specified event mask parameter
      * to be delivered to the
      * {@link LayerUI#eventDispatched(AWTEvent, JLayer)} method.
-     * <p/>
+     * <p>
      * Events are delivered provided that {@code LayerUI} is set
      * for this {@code JLayer} and the {@code JLayer}
      * is displayable.
-     * <p/>
+     * <p>
      * The following example shows how to correctly use this method
      * in the {@code LayerUI} implementations:
      * <pre>
@@ -519,10 +519,10 @@
     /**
      * Returns the bitmap of event mask to receive by this {@code JLayer}
      * and its {@code LayerUI}.
-     * <p/>
+     * <p>
      * It means that {@link javax.swing.plaf.LayerUI#eventDispatched(AWTEvent, JLayer)} method
      * will only receive events that match the event mask.
-     * <p/>
+     * <p>
      * By default {@code JLayer} receives no events.
      *
      * @return the bitmask of event types to receive for this {@code JLayer}
@@ -543,7 +543,7 @@
 
     /**
      * Returns the preferred size of the viewport for a view component.
-     * <p/>
+     * <p>
      * If the view component of this layer implements {@link Scrollable}, this method delegates its
      * implementation to the view component.
      *
@@ -562,7 +562,7 @@
      * Returns a scroll increment, which is required for components
      * that display logical rows or columns in order to completely expose
      * one block of rows or columns, depending on the value of orientation.
-     * <p/>
+     * <p>
      * If the view component of this layer implements {@link Scrollable}, this method delegates its
      * implementation to the view component.
      *
@@ -584,7 +584,7 @@
      * Returns {@code false} to indicate that the height of the viewport does not
      * determine the height of the layer, unless the preferred height
      * of the layer is smaller than the height of the viewport.
-     * <p/>
+     * <p>
      * If the view component of this layer implements {@link Scrollable}, this method delegates its
      * implementation to the view component.
      *
@@ -603,7 +603,7 @@
      * Returns {@code false} to indicate that the width of the viewport does not
      * determine the width of the layer, unless the preferred width
      * of the layer is smaller than the width of the viewport.
-     * <p/>
+     * <p>
      * If the view component of this layer implements {@link Scrollable}, this method delegates its
      * implementation to the view component.
      *
@@ -624,10 +624,10 @@
      * one new row or column, depending on the value of orientation.
      * Ideally, components should handle a partially exposed row or column
      * by returning the distance required to completely expose the item.
-     * <p/>
+     * <p>
      * Scrolling containers, like {@code JScrollPane}, will use this method
      * each time the user requests a unit scroll.
-     * <p/>
+     * <p>
      * If the view component of this layer implements {@link Scrollable}, this method delegates its
      * implementation to the view component.
      *
--- a/jdk/src/share/classes/javax/swing/JMenuItem.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JMenuItem.java	Fri Oct 11 09:17:18 2013 -0400
@@ -229,7 +229,7 @@
     /**
      * Sets the look and feel object that renders this component.
      *
-     * @param ui  the <code>JMenuItemUI</code> L&F object
+     * @param ui  the <code>JMenuItemUI</code> L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -252,7 +252,7 @@
 
 
     /**
-     * Returns the suffix used to construct the name of the L&F class used to
+     * Returns the suffix used to construct the name of the L&amp;F class used to
      * render this component.
      *
      * @return the string "MenuItemUI"
--- a/jdk/src/share/classes/javax/swing/JPanel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JPanel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -127,7 +127,7 @@
     }
 
     /**
-     * Returns the look and feel (L&F) object that renders this component.
+     * Returns the look and feel (L&amp;amp;F) object that renders this component.
      *
      * @return the PanelUI object that renders this component
      * @since 1.4
@@ -138,9 +138,9 @@
 
 
     /**
-     * Sets the look and feel (L&F) object that renders this component.
+     * Sets the look and feel (L&amp;F) object that renders this component.
      *
-     * @param ui  the PanelUI L&F object
+     * @param ui  the PanelUI L&amp;F object
      * @see UIDefaults#getUI
      * @since 1.4
      * @beaninfo
@@ -154,7 +154,7 @@
     }
 
     /**
-     * Returns a string that specifies the name of the L&F class
+     * Returns a string that specifies the name of the L&amp;F class
      * that renders this component.
      *
      * @return "PanelUI"
@@ -162,7 +162,7 @@
      * @see UIDefaults#getUI
      * @beaninfo
      *        expert: true
-     *   description: A string that specifies the name of the L&F class.
+     *   description: A string that specifies the name of the L&amp;F class.
      */
     public String getUIClassID() {
         return uiClassID;
--- a/jdk/src/share/classes/javax/swing/JPasswordField.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JPasswordField.java	Fri Oct 11 09:17:18 2013 -0400
@@ -101,7 +101,7 @@
      * number of columns.  A default model is created, and the initial string
      * is set to <code>null</code>.
      *
-     * @param columns the number of columns >= 0
+     * @param columns the number of columns &gt;= 0
      */
     public JPasswordField(int columns) {
         this(null, null, columns);
@@ -113,7 +113,7 @@
      * the default.
      *
      * @param text the text to be displayed, <code>null</code> if none
-     * @param columns the number of columns >= 0
+     * @param columns the number of columns &gt;= 0
      */
     public JPasswordField(String text, int columns) {
         this(null, text, columns);
@@ -130,7 +130,7 @@
      * @param doc  the text storage to use
      * @param txt the text to be displayed, <code>null</code> if none
      * @param columns  the number of columns to use to calculate
-     *   the preferred width >= 0; if columns is set to zero, the
+     *   the preferred width &gt;= 0; if columns is set to zero, the
      *   preferred width will be whatever naturally results from
      *   the component implementation
      */
@@ -143,7 +143,7 @@
     }
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "PasswordFieldUI"
      * @see JComponent#getUIClassID
@@ -271,8 +271,8 @@
      * <code>getPassword</code> method instead.
      * @deprecated As of Java 2 platform v1.2,
      * replaced by <code>getPassword</code>.
-     * @param offs the offset >= 0
-     * @param len the length >= 0
+     * @param offs the offset &gt;= 0
+     * @param len the length &gt;= 0
      * @return the text
      * @exception BadLocationException if the offset or length are invalid
      */
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java	Fri Oct 11 09:17:18 2013 -0400
@@ -196,7 +196,7 @@
 
 
     /**
-     * Returns the look and feel (L&F) object that renders this component.
+     * Returns the look and feel (L&amp;F) object that renders this component.
      *
      * @return the <code>PopupMenuUI</code> object that renders this component
      */
@@ -205,9 +205,9 @@
     }
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui the new <code>PopupMenuUI</code> L&F object
+     * @param ui the new <code>PopupMenuUI</code> L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -230,7 +230,7 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "PopupMenuUI"
      * @see JComponent#getUIClassID
@@ -461,7 +461,7 @@
      *
      * @param       pos the position of the item to be removed
      * @exception   IllegalArgumentException if the value of
-     *                          <code>pos</code> < 0, or if the value of
+     *                          <code>pos</code> &lt; 0, or if the value of
      *                          <code>pos</code> is greater than the
      *                          number of items
      */
@@ -560,7 +560,7 @@
      * @param a  the <code>Action</code> object to insert
      * @param index      specifies the position at which to insert the
      *                   <code>Action</code>, where 0 is the first
-     * @exception IllegalArgumentException if <code>index</code> < 0
+     * @exception IllegalArgumentException if <code>index</code> &lt; 0
      * @see Action
      */
     public void insert(Action a, int index) {
@@ -576,7 +576,7 @@
      * @param component  the <code>Component</code> to insert
      * @param index      specifies the position at which
      *                   to insert the component, where 0 is the first
-     * @exception IllegalArgumentException if <code>index</code> < 0
+     * @exception IllegalArgumentException if <code>index</code> &lt; 0
      */
     public void insert(Component component, int index) {
         if (index < 0) {
@@ -1535,7 +1535,7 @@
         }
 
         /**
-         * Returns the name of the L&F class that renders this component.
+         * Returns the name of the L&amp;F class that renders this component.
          *
          * @return the string "PopupMenuSeparatorUI"
          * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JRadioButton.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JRadioButton.java	Fri Oct 11 09:17:18 2013 -0400
@@ -193,7 +193,7 @@
 
 
     /**
-     * Returns the name of the L&F class
+     * Returns the name of the L&amp;F class
      * that renders this component.
      *
      * @return String "RadioButtonUI"
@@ -201,7 +201,7 @@
      * @see UIDefaults#getUI
      * @beaninfo
      *        expert: true
-     *   description: A string that specifies the name of the L&F class.
+     *   description: A string that specifies the name of the L&amp;F class.
      */
     public String getUIClassID() {
         return uiClassID;
--- a/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JRadioButtonMenuItem.java	Fri Oct 11 09:17:18 2013 -0400
@@ -181,7 +181,7 @@
     }
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "RadioButtonMenuItemUI"
      * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JRootPane.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JRootPane.java	Fri Oct 11 09:17:18 2013 -0400
@@ -448,7 +448,7 @@
     }
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return <code>LabelUI</code> object
      * @since 1.3
@@ -458,9 +458,9 @@
     }
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui  the <code>LabelUI</code> L&F object
+     * @param ui  the <code>LabelUI</code> L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -486,7 +486,7 @@
 
 
     /**
-     * Returns a string that specifies the name of the L&F class
+     * Returns a string that specifies the name of the L&amp;F class
      * that renders this component.
      *
      * @return the string "RootPaneUI"
--- a/jdk/src/share/classes/javax/swing/JScrollBar.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JScrollBar.java	Fri Oct 11 09:17:18 2013 -0400
@@ -344,6 +344,9 @@
      * that override this method and delegate to the viewports
      * Scrollable view, if it has one.  The Scrollable interface
      * provides a more specialized version of this method.
+     * <p>
+     * Some look and feels implement custom scrolling behavior
+     * and ignore this property.
      *
      * @param direction is -1 or 1 for up/down respectively
      * @return the value of the unitIncrement property
@@ -361,6 +364,10 @@
      * <p>
      * Note, that if the argument is equal to the value of Integer.MIN_VALUE,
      * the most look and feels will not provide the scrolling to the right/down.
+     * <p>
+     * Some look and feels implement custom scrolling behavior
+     * and ignore this property.
+     *
      * @see #getUnitIncrement
      * @beaninfo
      *   preferred: true
@@ -387,6 +394,9 @@
      * that override this method and delegate to the viewports
      * Scrollable view, if it has one.  The Scrollable interface
      * provides a more specialized version of this method.
+     * <p>
+     * Some look and feels implement custom scrolling behavior
+     * and ignore this property.
      *
      * @param direction is -1 or 1 for up/down respectively
      * @return the value of the blockIncrement property
@@ -404,6 +414,10 @@
      * <p>
      * Note, that if the argument is equal to the value of Integer.MIN_VALUE,
      * the most look and feels will not provide the scrolling to the right/down.
+     * <p>
+     * Some look and feels implement custom scrolling behavior
+     * and ignore this property.
+     *
      * @see #getBlockIncrement()
      * @beaninfo
      *   preferred: true
--- a/jdk/src/share/classes/javax/swing/JScrollPane.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JScrollPane.java	Fri Oct 11 09:17:18 2013 -0400
@@ -353,7 +353,7 @@
 
 
     /**
-     * Returns the look and feel (L&F) object that renders this component.
+     * Returns the look and feel (L&amp;F) object that renders this component.
      *
      * @return the <code>ScrollPaneUI</code> object that renders this
      *                          component
@@ -371,9 +371,9 @@
 
     /**
      * Sets the <code>ScrollPaneUI</code> object that provides the
-     * look and feel (L&F) for this component.
+     * look and feel (L&amp;F) for this component.
      *
-     * @param ui the <code>ScrollPaneUI</code> L&F object
+     * @param ui the <code>ScrollPaneUI</code> L&amp;F object
      * @see #getUI
      */
     public void setUI(ScrollPaneUI ui) {
@@ -395,7 +395,7 @@
 
 
     /**
-     * Returns the suffix used to construct the name of the L&F class used to
+     * Returns the suffix used to construct the name of the L&amp;F class used to
      * render this component.
      *
      * @return the string "ScrollPaneUI"
--- a/jdk/src/share/classes/javax/swing/JSeparator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JSeparator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -108,7 +108,7 @@
     }
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return the SeparatorUI object that renders this component
      */
@@ -117,9 +117,9 @@
     }
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui  the SeparatorUI L&F object
+     * @param ui  the SeparatorUI L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -142,7 +142,7 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "SeparatorUI"
      * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JSlider.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JSlider.java	Fri Oct 11 09:17:18 2013 -0400
@@ -289,9 +289,9 @@
 
 
     /**
-     * Gets the UI object which implements the L&F for this component.
+     * Gets the UI object which implements the L&amp;F for this component.
      *
-     * @return the SliderUI object that implements the Slider L&F
+     * @return the SliderUI object that implements the Slider L&amp;F
      */
     public SliderUI getUI() {
         return(SliderUI)ui;
@@ -299,9 +299,9 @@
 
 
     /**
-     * Sets the UI object which implements the L&F for this component.
+     * Sets the UI object which implements the L&amp;F for this component.
      *
-     * @param ui the SliderUI L&F object
+     * @param ui the SliderUI L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -330,7 +330,7 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return "SliderUI"
      * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JSpinner.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JSpinner.java	Fri Oct 11 09:17:18 2013 -0400
@@ -171,7 +171,7 @@
 
 
     /**
-     * Returns the look and feel (L&F) object that renders this component.
+     * Returns the look and feel (L&amp;F) object that renders this component.
      *
      * @return the <code>SpinnerUI</code> object that renders this component
      */
@@ -181,9 +181,9 @@
 
 
     /**
-     * Sets the look and feel (L&F) object that renders this component.
+     * Sets the look and feel (L&amp;F) object that renders this component.
      *
-     * @param ui  the <code>SpinnerUI</code> L&F object
+     * @param ui  the <code>SpinnerUI</code> L&amp;F object
      * @see UIDefaults#getUI
      */
     public void setUI(SpinnerUI ui) {
@@ -193,7 +193,7 @@
 
     /**
      * Returns the suffix used to construct the name of the look and feel
-     * (L&F) class used to render this component.
+     * (L&amp;F) class used to render this component.
      *
      * @return the string "SpinnerUI"
      * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JSplitPane.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JSplitPane.java	Fri Oct 11 09:17:18 2013 -0400
@@ -359,9 +359,9 @@
 
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui  the <code>SplitPaneUI</code> L&F object
+     * @param ui  the <code>SplitPaneUI</code> L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -384,7 +384,7 @@
      * @return the <code>SplitPaneUI</code> object that renders this component
      * @beaninfo
      *       expert: true
-     *  description: The L&F object that renders this component.
+     *  description: The L&amp;F object that renders this component.
      */
     public SplitPaneUI getUI() {
         return (SplitPaneUI)ui;
@@ -392,7 +392,7 @@
 
 
     /**
-     * Notification from the <code>UIManager</code> that the L&F has changed.
+     * Notification from the <code>UIManager</code> that the L&amp;F has changed.
      * Replaces the current UI object with the latest version from the
      * <code>UIManager</code>.
      *
@@ -405,14 +405,14 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "SplitPaneUI"
      * @see JComponent#getUIClassID
      * @see UIDefaults#getUI
      * @beaninfo
      *       expert: true
-     *  description: A string that specifies the name of the L&F class.
+     *  description: A string that specifies the name of the L&amp;F class.
      */
     public String getUIClassID() {
         return uiClassID;
@@ -714,7 +714,7 @@
      * extra space.
      *
      * @param value as described above
-     * @exception IllegalArgumentException if <code>value</code> is < 0 or > 1
+     * @exception IllegalArgumentException if <code>value</code> is &lt; 0 or &gt; 1
      * @since 1.3
      * @beaninfo
      *        bound: true
@@ -769,8 +769,8 @@
      * @param proportionalLocation  a double-precision floating point value
      *        that specifies a percentage, from zero (top/left) to 1.0
      *        (bottom/right)
-     * @exception IllegalArgumentException if the specified location is < 0
-     *            or > 1.0
+     * @exception IllegalArgumentException if the specified location is &lt; 0
+     *            or &gt; 1.0
      * @beaninfo
      *  description: The location of the divider.
      */
@@ -845,7 +845,7 @@
      *          location (typically a pixel count); or -1 if the UI is
      *          <code>null</code>
      * @beaninfo
-     *  description: The minimum location of the divider from the L&F.
+     *  description: The minimum location of the divider from the L&amp;F.
      */
     public int getMinimumDividerLocation() {
         SplitPaneUI         ui = getUI();
--- a/jdk/src/share/classes/javax/swing/JTable.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JTable.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1945,7 +1945,7 @@
      * Sets the table's selection mode to allow only single selections, a single
      * contiguous interval, or multiple intervals.
      * <P>
-     * <bold>Note:</bold>
+     * <b>Note:</b>
      * <code>JTable</code> provides all the methods for handling
      * column and row selection.  When setting states,
      * such as <code>setSelectionMode</code>, it not only
@@ -2061,7 +2061,7 @@
 
     /**
      * Returns true if both row and column selection models are enabled.
-     * Equivalent to <code>getRowSelectionAllowed() &&
+     * Equivalent to <code>getRowSelectionAllowed() &amp;&amp;
      * getColumnSelectionAllowed()</code>.
      *
      * @return true if both row and column selection models are enabled
@@ -3034,7 +3034,7 @@
      * adjusted.
      * </ul>
      * <p>
-     * <bold>Note:</bold> When a <code>JTable</code> makes adjustments
+     * <b>Note:</b> When a <code>JTable</code> makes adjustments
      *   to the widths of the columns it respects their minimum and
      *   maximum values absolutely.  It is therefore possible that,
      *   even after this method is called, the total width of the columns
@@ -3086,14 +3086,14 @@
      * </pre>
      * where each individual delta[i] is calculated according to:
      * <p>
-     * If (DELTA < 0) we are in shrink mode where:
+     * If (DELTA &lt; 0) we are in shrink mode where:
      * <p>
      * <PRE>
      *                        DELTA
      *          delta[i] = ------------ * (pref[i] - min[i])
      *                     (PREF - MIN)
      * </PRE>
-     * If (DELTA > 0) we are in expand mode where:
+     * If (DELTA &gt; 0) we are in expand mode where:
      * <p>
      * <PRE>
      *                        DELTA
@@ -3368,7 +3368,7 @@
      * method in order to allow the renderer's tips to be used
      * if it has text set.
      * <p>
-     * <bold>Note:</bold> For <code>JTable</code> to properly display
+     * <b>Note:</b> For <code>JTable</code> to properly display
      * tooltips of its renderers
      * <code>JTable</code> must be a registered component with the
      * <code>ToolTipManager</code>.
@@ -3580,7 +3580,7 @@
 //
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return the <code>TableUI</code> object that renders this component
      */
@@ -3589,9 +3589,9 @@
     }
 
     /**
-     * Sets the L&F object that renders this component and repaints.
-     *
-     * @param ui  the TableUI L&F object
+     * Sets the L&amp;F object that renders this component and repaints.
+     *
+     * @param ui  the TableUI L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -3607,7 +3607,7 @@
     }
 
     /**
-     * Notification from the <code>UIManager</code> that the L&F has changed.
+     * Notification from the <code>UIManager</code> that the L&amp;F has changed.
      * Replaces the current UI object with the latest version from the
      * <code>UIManager</code>.
      *
@@ -3647,7 +3647,7 @@
     }
 
     /**
-     * Returns the suffix used to construct the name of the L&F class used to
+     * Returns the suffix used to construct the name of the L&amp;F class used to
      * render this component.
      *
      * @return the string "TableUI"
--- a/jdk/src/share/classes/javax/swing/JTextArea.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JTextArea.java	Fri Oct 11 09:17:18 2013 -0400
@@ -155,8 +155,8 @@
      * rows and columns.  A default model is created, and the initial
      * string is null.
      *
-     * @param rows the number of rows >= 0
-     * @param columns the number of columns >= 0
+     * @param rows the number of rows &gt;= 0
+     * @param columns the number of columns &gt;= 0
      * @exception IllegalArgumentException if the rows or columns
      *  arguments are negative.
      */
@@ -169,8 +169,8 @@
      * of rows and columns.  A default model is created.
      *
      * @param text the text to be displayed, or null
-     * @param rows the number of rows >= 0
-     * @param columns the number of columns >= 0
+     * @param rows the number of rows &gt;= 0
+     * @param columns the number of columns &gt;= 0
      * @exception IllegalArgumentException if the rows or columns
      *  arguments are negative.
      */
@@ -195,8 +195,8 @@
      *
      * @param doc the model to use, or create a default one if null
      * @param text the text to be displayed, null if none
-     * @param rows the number of rows >= 0
-     * @param columns the number of columns >= 0
+     * @param rows the number of rows &gt;= 0
+     * @param columns the number of columns &gt;= 0
      * @exception IllegalArgumentException if the rows or columns
      *  arguments are negative.
      */
@@ -364,8 +364,8 @@
      * Translates an offset into the components text to a
      * line number.
      *
-     * @param offset the offset >= 0
-     * @return the line number >= 0
+     * @param offset the offset &gt;= 0
+     * @return the line number &gt;= 0
      * @exception BadLocationException thrown if the offset is
      *   less than zero or greater than the document length.
      */
@@ -384,7 +384,7 @@
     /**
      * Determines the number of lines contained in the area.
      *
-     * @return the number of lines > 0
+     * @return the number of lines &gt; 0
      */
     public int getLineCount() {
         Element map = getDocument().getDefaultRootElement();
@@ -394,8 +394,8 @@
     /**
      * Determines the offset of the start of the given line.
      *
-     * @param line  the line number to translate >= 0
-     * @return the offset >= 0
+     * @param line  the line number to translate &gt;= 0
+     * @return the offset &gt;= 0
      * @exception BadLocationException thrown if the line is
      * less than zero or greater or equal to the number of
      * lines contained in the document (as reported by
@@ -417,8 +417,8 @@
     /**
      * Determines the offset of the end of the given line.
      *
-     * @param line  the line >= 0
-     * @return the offset >= 0
+     * @param line  the line &gt;= 0
+     * @return the offset &gt;= 0
      * @exception BadLocationException Thrown if the line is
      * less than zero or greater or equal to the number of
      * lines contained in the document (as reported by
@@ -446,7 +446,7 @@
      * if the model is null or if the text is null or empty.
      *
      * @param str the text to insert
-     * @param pos the position at which to insert >= 0
+     * @param pos the position at which to insert &gt;= 0
      * @exception IllegalArgumentException  if pos is an
      *  invalid position in the model
      * @see TextComponent#setText
@@ -486,8 +486,8 @@
      * does a delete if the new string is null or empty.
      *
      * @param str the text to use as the replacement
-     * @param start the start position >= 0
-     * @param end the end position >= start
+     * @param start the start position &gt;= 0
+     * @param end the end position &gt;= start
      * @exception IllegalArgumentException  if part of the range is an
      *  invalid position in the model
      * @see #insert
@@ -517,7 +517,7 @@
     /**
      * Returns the number of rows in the TextArea.
      *
-     * @return the number of rows >= 0
+     * @return the number of rows &gt;= 0
      */
     public int getRows() {
         return rows;
@@ -527,7 +527,7 @@
      * Sets the number of rows for this TextArea.  Calls invalidate() after
      * setting the new value.
      *
-     * @param rows the number of rows >= 0
+     * @param rows the number of rows &gt;= 0
      * @exception IllegalArgumentException if rows is less than 0
      * @see #getRows
      * @beaninfo
@@ -548,7 +548,7 @@
      * Defines the meaning of the height of a row.  This defaults to
      * the height of the font.
      *
-     * @return the height >= 1
+     * @return the height &gt;= 1
      */
     protected int getRowHeight() {
         if (rowHeight == 0) {
@@ -561,7 +561,7 @@
     /**
      * Returns the number of columns in the TextArea.
      *
-     * @return number of columns >= 0
+     * @return number of columns &gt;= 0
      */
     public int getColumns() {
         return columns;
@@ -571,7 +571,7 @@
      * Sets the number of columns for this TextArea.  Does an invalidate()
      * after setting the new value.
      *
-     * @param columns the number of columns >= 0
+     * @param columns the number of columns &gt;= 0
      * @exception IllegalArgumentException if columns is less than 0
      * @see #getColumns
      * @beaninfo
@@ -596,7 +596,7 @@
      * character <em>m</em> for the font used.  This method can be
      * redefined to be some alternative amount.
      *
-     * @return the column width >= 1
+     * @return the column width &gt;= 1
      */
     protected int getColumnWidth() {
         if (columnWidth == 0) {
--- a/jdk/src/share/classes/javax/swing/JTextField.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JTextField.java	Fri Oct 11 09:17:18 2013 -0400
@@ -128,7 +128,7 @@
 &nbsp;                return;
 &nbsp;            }
 &nbsp;            char[] upper = str.toCharArray();
-&nbsp;            for (int i = 0; i < upper.length; i++) {
+&nbsp;            for (int i = 0; i &lt; upper.length; i++) {
 &nbsp;                upper[i] = Character.toUpperCase(upper[i]);
 &nbsp;            }
 &nbsp;            super.insertString(offs, new String(upper), a);
@@ -223,10 +223,10 @@
      *          <code>createDefaultModel</code> method
      * @param text  the initial string to display, or <code>null</code>
      * @param columns  the number of columns to use to calculate
-     *   the preferred width >= 0; if <code>columns</code>
+     *   the preferred width &gt;= 0; if <code>columns</code>
      *   is set to zero, the preferred width will be whatever
      *   naturally results from the component implementation
-     * @exception IllegalArgumentException if <code>columns</code> < 0
+     * @exception IllegalArgumentException if <code>columns</code> &lt; 0
      */
     public JTextField(Document doc, String text, int columns) {
         if (columns < 0) {
--- a/jdk/src/share/classes/javax/swing/JToggleButton.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JToggleButton.java	Fri Oct 11 09:17:18 2013 -0400
@@ -186,14 +186,14 @@
     }
 
     /**
-     * Returns a string that specifies the name of the l&f class
+     * Returns a string that specifies the name of the l&amp;f class
      * that renders this component.
      *
      * @return String "ToggleButtonUI"
      * @see JComponent#getUIClassID
      * @see UIDefaults#getUI
      * @beaninfo
-     *  description: A string that specifies the name of the L&F class
+     *  description: A string that specifies the name of the L&amp;F class
      */
     public String getUIClassID() {
         return uiClassID;
--- a/jdk/src/share/classes/javax/swing/JToolBar.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JToolBar.java	Fri Oct 11 09:17:18 2013 -0400
@@ -167,9 +167,9 @@
     }
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui  the <code>ToolBarUI</code> L&F object
+     * @param ui  the <code>ToolBarUI</code> L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -182,7 +182,7 @@
     }
 
     /**
-     * Notification from the <code>UIFactory</code> that the L&F has changed.
+     * Notification from the <code>UIFactory</code> that the L&amp;F has changed.
      * Called to replace the UI with the latest version from the
      * <code>UIFactory</code>.
      *
@@ -202,7 +202,7 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "ToolBarUI"
      * @see JComponent#getUIClassID
@@ -613,7 +613,7 @@
         }
 
         /**
-         * Returns the name of the L&F class that renders this component.
+         * Returns the name of the L&amp;F class that renders this component.
          *
          * @return the string "ToolBarSeparatorUI"
          * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JToolTip.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JToolTip.java	Fri Oct 11 09:17:18 2013 -0400
@@ -85,7 +85,7 @@
     }
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return the <code>ToolTipUI</code> object that renders this component
      */
@@ -104,7 +104,7 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "ToolTipUI"
      * @see JComponent#getUIClassID
--- a/jdk/src/share/classes/javax/swing/JTree.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JTree.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,7 +41,7 @@
 
 
 /**
- * <a name="jtree_description">
+ * <a name="jtree_description"></a>
  * A control that displays a set of hierarchical data as an outline.
  * You can find task-oriented documentation and examples of using trees in
  * <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Trees</a>,
@@ -59,7 +59,7 @@
  * under a collapsed ancestor. All of a <i>viewable</i> nodes parents
  * are expanded, but may or may not be displayed. A <i>displayed</i> node
  * is both viewable and in the display area, where it can be seen.
- * <p>
+ * </p>
  * The following <code>JTree</code> methods use "visible" to mean "displayed":
  * <ul>
  * <li><code>isRootVisible()</code>
@@ -69,14 +69,12 @@
  * <li><code>getVisibleRowCount()</code>
  * <li><code>setVisibleRowCount()</code>
  * </ul>
- * <p>
  * The next group of <code>JTree</code> methods use "visible" to mean
  * "viewable" (under an expanded parent):
  * <ul>
  * <li><code>isVisible()</code>
  * <li><code>makeVisible()</code>
  * </ul>
- * <p>
  * If you are interested in knowing when the selection changes implement
  * the <code>TreeSelectionListener</code> interface and add the instance
  * using the method <code>addTreeSelectionListener</code>.
@@ -87,6 +85,7 @@
  * If you are interested in detecting either double-click events or when
  * a user clicks on a node, regardless of whether or not it was selected,
  * we recommend you do the following:
+ * </p>
  * <pre>
  * final JTree tree = ...;
  *
@@ -114,12 +113,13 @@
  * a graphic icon and text), subclass {@link TreeCellRenderer} and use
  * {@link #setCellRenderer} to tell the tree to use it. To edit such nodes,
  * subclass {@link TreeCellEditor} and use {@link #setCellEditor}.
+ * </p>
  * <p>
  * Like all <code>JComponent</code> classes, you can use {@link InputMap} and
  * {@link ActionMap}
  * to associate an {@link Action} object with a {@link KeyStroke}
  * and execute the action under specified conditions.
- * <p>
+ * </p>
  * <strong>Warning:</strong> Swing is not thread safe. For more
  * information see <a
  * href="package-summary.html#threading">Swing's Threading
@@ -133,7 +133,7 @@
  * of all JavaBeans<sup><font size="-2">TM</font></sup>
  * has been added to the <code>java.beans</code> package.
  * Please see {@link java.beans.XMLEncoder}.
- *
+ *</p>
  * @beaninfo
  *   attribute: isContainer false
  * description: A component that displays a set of hierarchical data as an outline.
@@ -174,7 +174,7 @@
     transient protected TreeCellRenderer  cellRenderer;
 
     /**
-     * Height to use for each display row. If this is <= 0 the renderer
+     * Height to use for each display row. If this is &lt;= 0 the renderer
      * determines the height for each row.
      */
     protected int                         rowHeight;
@@ -671,7 +671,7 @@
     }
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return the <code>TreeUI</code> object that renders this component
      */
@@ -680,11 +680,11 @@
     }
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      * <p>
      * This is a bound property.
      *
-     * @param ui  the <code>TreeUI</code> L&F object
+     * @param ui  the <code>TreeUI</code> L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -706,7 +706,7 @@
     }
 
     /**
-     * Notification from the <code>UIManager</code> that the L&F has changed.
+     * Notification from the <code>UIManager</code> that the L&amp;F has changed.
      * Replaces the current UI object with the latest version from the
      * <code>UIManager</code>.
      *
@@ -721,7 +721,7 @@
 
 
     /**
-     * Returns the name of the L&F class that renders this component.
+     * Returns the name of the L&amp;F class that renders this component.
      *
      * @return the string "TreeUI"
      * @see JComponent#getUIClassID
@@ -1701,7 +1701,7 @@
     /**
      * Selects the nodes corresponding to each of the specified rows
      * in the display. If a particular element of <code>rows</code> is
-     * < 0 or >= <code>getRowCount</code>, it will be ignored.
+     * &lt; 0 or &gt;= <code>getRowCount</code>, it will be ignored.
      * If none of the elements
      * in <code>rows</code> are valid rows, the selection will
      * be cleared. That is it will be as if <code>clearSelection</code>
@@ -2162,8 +2162,8 @@
      *
      * @param row  an integer specifying a row
      * @return the <code>TreePath</code> to the specified node,
-     *          <code>null</code> if <code>row < 0</code>
-     *          or <code>row >= getRowCount()</code>
+     *          <code>null</code> if <code>row &lt; 0</code>
+     *          or <code>row &gt;= getRowCount()</code>
      */
     public TreePath getPathForRow(int row) {
         TreeUI                  tree = getUI();
@@ -2211,7 +2211,7 @@
      * Ensures that the node in the specified row is expanded and
      * viewable.
      * <p>
-     * If <code>row</code> is < 0 or >= <code>getRowCount</code> this
+     * If <code>row</code> is &lt; 0 or &gt;= <code>getRowCount</code> this
      * will have no effect.
      *
      * @param row  an integer specifying a display row, where 0 is the
@@ -2234,7 +2234,7 @@
     /**
      * Ensures that the node in the specified row is collapsed.
      * <p>
-     * If <code>row</code> is < 0 or >= <code>getRowCount</code> this
+     * If <code>row</code> is &lt; 0 or &gt;= <code>getRowCount</code> this
      * will have no effect.
      *
      * @param row  an integer specifying a display row, where 0 is the
--- a/jdk/src/share/classes/javax/swing/JViewport.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/JViewport.java	Fri Oct 11 09:17:18 2013 -0400
@@ -25,6 +25,8 @@
 
 package javax.swing;
 
+import sun.swing.JLightweightFrame;
+
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.peer.ComponentPeer;
@@ -283,7 +285,7 @@
 
 
     /**
-     * Returns the L&F object that renders this component.
+     * Returns the L&amp;F object that renders this component.
      *
      * @return a <code>ViewportUI</code> object
      * @since 1.3
@@ -294,9 +296,9 @@
 
 
     /**
-     * Sets the L&F object that renders this component.
+     * Sets the L&amp;F object that renders this component.
      *
-     * @param ui  the <code>ViewportUI</code> L&F object
+     * @param ui  the <code>ViewportUI</code> L&amp;F object
      * @see UIDefaults#getUI
      * @beaninfo
      *        bound: true
@@ -321,7 +323,7 @@
 
 
     /**
-     * Returns a string that specifies the name of the L&F class
+     * Returns a string that specifies the name of the L&amp;F class
      * that renders this component.
      *
      * @return the string "ViewportUI"
@@ -361,6 +363,17 @@
         super.remove(child);
     }
 
+    @Override
+    public void addNotify() {
+        super.addNotify();
+        // JLightweightFrame does not support BLIT_SCROLL_MODE, so it should be replaced
+        Window rootWindow = SwingUtilities.getWindowAncestor(this);
+        if (rootWindow instanceof JLightweightFrame
+                && getScrollMode() == BLIT_SCROLL_MODE) {
+            setScrollMode(BACKINGSTORE_SCROLL_MODE);
+        }
+    }
+
 
     /**
      * Scrolls the view so that <code>Rectangle</code>
--- a/jdk/src/share/classes/javax/swing/KeyStroke.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/KeyStroke.java	Fri Oct 11 09:17:18 2013 -0400
@@ -284,11 +284,11 @@
      * If typed, pressed or released is not specified, pressed is assumed. Here
      * are some examples:
      * <pre>
-     *     "INSERT" => getKeyStroke(KeyEvent.VK_INSERT, 0);
-     *     "control DELETE" => getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
-     *     "alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
-     *     "alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
-     *     "typed a" => getKeyStroke('a');
+     *     "INSERT" =&gt; getKeyStroke(KeyEvent.VK_INSERT, 0);
+     *     "control DELETE" =&gt; getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
+     *     "alt shift X" =&gt; getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
+     *     "alt shift released X" =&gt; getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
+     *     "typed a" =&gt; getKeyStroke('a');
      * </pre>
      *
      * In order to maintain backward-compatibility, specifying a null String,
--- a/jdk/src/share/classes/javax/swing/OverlayLayout.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/OverlayLayout.java	Fri Oct 11 09:17:18 2013 -0400
@@ -190,7 +190,7 @@
      * Returns the alignment along the x axis for the container.
      *
      * @param target the container
-     * @return the alignment >= 0.0f && <= 1.0f
+     * @return the alignment &gt;= 0.0f &amp;&amp; &lt;= 1.0f
      */
     public float getLayoutAlignmentX(Container target) {
         checkContainer(target);
@@ -202,7 +202,7 @@
      * Returns the alignment along the y axis for the container.
      *
      * @param target the container
-     * @return the alignment >= 0.0f && <= 1.0f
+     * @return the alignment &gt;= 0.0f &amp;&amp; &lt;= 1.0f
      */
     public float getLayoutAlignmentY(Container target) {
         checkContainer(target);
--- a/jdk/src/share/classes/javax/swing/ProgressMonitor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/ProgressMonitor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -251,7 +251,7 @@
 
     /**
      * Indicate the progress of the operation being monitored.
-     * If the specified value is >= the maximum, the progress
+     * If the specified value is &gt;= the maximum, the progress
      * monitor is closed.
      * @param nv an int specifying the current value, between the
      *        maximum and minimum specified for this component
@@ -302,7 +302,7 @@
 
     /**
      * Indicate that the operation is complete.  This happens automatically
-     * when the value set by setProgress is >= max, but it may be called
+     * when the value set by setProgress is &gt;= max, but it may be called
      * earlier if the operation ends early.
      */
     public void close() {
--- a/jdk/src/share/classes/javax/swing/RowFilter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/RowFilter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -357,7 +357,7 @@
          *
          * @param index the index of the value to get
          * @return value at the specified index
-         * @throws <code>IndexOutOfBoundsException</code> if index &lt; 0 or
+         * @throws IndexOutOfBoundsException if index &lt; 0 or
          *         &gt;= getValueCount
          */
         public abstract Object getValue(int index);
@@ -376,7 +376,7 @@
          *
          * @param index the index of the value to get
          * @return {@code non-null} string at the specified index
-         * @throws <code>IndexOutOfBoundsException</code> if index &lt; 0 ||
+         * @throws IndexOutOfBoundsException if index &lt; 0 ||
          *         &gt;= getValueCount
          */
         public String getStringValue(int index) {
--- a/jdk/src/share/classes/javax/swing/SizeRequirements.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/SizeRequirements.java	Fri Oct 11 09:17:18 2013 -0400
@@ -142,10 +142,10 @@
      * Creates a SizeRequirements object with the specified minimum, preferred,
      * and maximum sizes and the specified alignment.
      *
-     * @param min the minimum size >= 0
-     * @param pref the preferred size >= 0
-     * @param max the maximum size >= 0
-     * @param a the alignment >= 0.0f && <= 1.0f
+     * @param min the minimum size &gt;= 0
+     * @param pref the preferred size &gt;= 0
+     * @param max the maximum size &gt;= 0
+     * @param a the alignment &gt;= 0.0f &amp;&amp; &lt;= 1.0f
      */
     public SizeRequirements(int min, int pref, int max, float a) {
         minimum = min;
@@ -246,7 +246,7 @@
      * by invoking the getTiledSizeRequirements method.  The components
      * will be tiled in the forward direction with offsets increasing from 0.
      *
-     * @param allocated the total span to be allocated >= 0.
+     * @param allocated the total span to be allocated &gt;= 0.
      * @param total     the total of the children requests.  This argument
      *  is optional and may be null.
      * @param children  the size requirements for each component.
@@ -282,7 +282,7 @@
      * reverse direction represents components tiled from right to left
      * or bottom to top.
      *
-     * @param allocated the total span to be allocated >= 0.
+     * @param allocated the total span to be allocated &gt;= 0.
      * @param total     the total of the children requests.  This argument
      *  is optional and may be null.
      * @param children  the size requirements for each component.
@@ -405,7 +405,7 @@
      * Normal alignment will be done with an alignment value of 0.0f
      * representing the left/top edge of a component.
      *
-     * @param allocated the total span to be allocated >= 0.
+     * @param allocated the total span to be allocated &gt;= 0.
      * @param total     the total of the children requests.
      * @param children  the size requirements for each component.
      * @param offsets   the offset from 0 for each child where
@@ -441,7 +441,7 @@
      * to be aligned.  With reverse alignment, 0.0f represents the
      * right/bottom edge.
      *
-     * @param allocated the total span to be allocated >= 0.
+     * @param allocated the total span to be allocated &gt;= 0.
      * @param total     the total of the children requests.
      * @param children  the size requirements for each component.
      * @param offsets   the offset from 0 for each child where
--- a/jdk/src/share/classes/javax/swing/SizeSequence.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/SizeSequence.java	Fri Oct 11 09:17:18 2013 -0400
@@ -78,7 +78,7 @@
  *
  * <p>
  *
- * <h4>Implementation Notes</h4>
+ * <h3>Implementation Notes</h3>
  *
  * Normally when storing the size and position of entries,
  * one would choose between
@@ -145,7 +145,7 @@
      *
      * @param numEntries  the number of sizes to track
      * @exception NegativeArraySizeException if
-     *    <code>numEntries < 0</code>
+     *    <code>numEntries &lt; 0</code>
      */
     public SizeSequence(int numEntries) {
         this(numEntries, 0);
@@ -306,7 +306,7 @@
     /**
      * Returns the size of the specified entry.
      * If <code>index</code> is out of the range
-     * <code>(0 <= index < getSizes().length)</code>
+     * <code>(0 &lt;= index &lt; getSizes().length)</code>
      * the behavior is unspecified.
      *
      * @param index  the index corresponding to the entry
@@ -320,7 +320,7 @@
      * Sets the size of the specified entry.
      * Note that if the value of <code>index</code>
      * does not fall in the range:
-     * <code>(0 <= index < getSizes().length)</code>
+     * <code>(0 &lt;= index &lt; getSizes().length)</code>
      * the behavior is unspecified.
      *
      * @param index  the index corresponding to the entry
@@ -348,8 +348,8 @@
      * Adds a contiguous group of entries to this <code>SizeSequence</code>.
      * Note that the values of <code>start</code> and
      * <code>length</code> must satisfy the following
-     * conditions:  <code>(0 <= start < getSizes().length)
-     * AND (length >= 0)</code>.  If these conditions are
+     * conditions:  <code>(0 &lt;= start &lt; getSizes().length)
+     * AND (length &gt;= 0)</code>.  If these conditions are
      * not met, the behavior is unspecified and an exception
      * may be thrown.
      *
@@ -359,7 +359,7 @@
      * @param value   the size to be assigned to each new entry
      * @exception ArrayIndexOutOfBoundsException if the parameters
      *   are outside of the range:
-     *   (<code>0 <= start < (getSizes().length)) AND (length >= 0)</code>
+     *   (<code>0 &lt;= start &lt; (getSizes().length)) AND (length &gt;= 0)</code>
      */
     public void insertEntries(int start, int length, int value) {
         int sizes[] = getSizes();
@@ -383,8 +383,8 @@
      * from this <code>SizeSequence</code>.
      * Note that the values of <code>start</code> and
      * <code>length</code> must satisfy the following
-     * conditions:  <code>(0 <= start < getSizes().length)
-     * AND (length >= 0)</code>.  If these conditions are
+     * conditions:  <code>(0 &lt;= start &lt; getSizes().length)
+     * AND (length &gt;= 0)</code>.  If these conditions are
      * not met, the behavior is unspecified and an exception
      * may be thrown.
      *
--- a/jdk/src/share/classes/javax/swing/SpinnerDateModel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/SpinnerDateModel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -221,7 +221,7 @@
      * MyStartDate implements Comparable {
      *     long t = 12345;
      *     public int compareTo(Date d) {
-     *            return (t < d.getTime() ? -1 : (t == d.getTime() ? 0 : 1));
+     *            return (t &lt; d.getTime() ? -1 : (t == d.getTime() ? 0 : 1));
      *     }
      *     public int compareTo(Object o) {
      *            return compareTo((Date)o);
@@ -435,7 +435,7 @@
      * If <code>value</code> is <code>null</code>,
      * an <code>IllegalArgumentException</code> is thrown.  No bounds
      * checking is done here:
-     * the new value may invalidate the <code>(start &lt= value &lt end)</code>
+     * the new value may invalidate the <code>(start &lt;= value &lt; end)</code>
      * invariant enforced by the constructors.  Naturally, one should ensure
      * that the <code>(start &lt;= value &lt;= maximum)</code> invariant is true
      * before calling the <code>nextValue</code>, <code>previousValue</code>,
--- a/jdk/src/share/classes/javax/swing/SpinnerListModel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/SpinnerListModel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -71,7 +71,7 @@
      * size, an <code>IllegalArugmentException</code> is thrown.
      *
      * @param values the sequence this model represents
-     * @throws IllegalArugmentException if <code>values</code> is
+     * @throws IllegalArgumentException if <code>values</code> is
      *    <code>null</code> or zero size
      */
     public SpinnerListModel(List<?> values) {
@@ -88,10 +88,10 @@
      * is defined by the specified array.  The initial value of the model
      * will be <code>values[0]</code>.  If <code>values</code> is
      * <code>null</code> or has zero length, an
-     * <code>IllegalArugmentException</code> is thrown.
+     * <code>IllegalArgumentException</code> is thrown.
      *
      * @param values the sequence this model represents
-     * @throws IllegalArugmentException if <code>values</code> is
+     * @throws IllegalArgumentException if <code>values</code> is
      *    <code>null</code> or zero length
      */
     public SpinnerListModel(Object[] values) {
--- a/jdk/src/share/classes/javax/swing/SpinnerNumberModel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/SpinnerNumberModel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -180,7 +180,7 @@
      * If <code>minimum</code> is <code>null</code>,
      * then there is no lower bound.  No bounds checking is done here;
      * the new <code>minimum</code> value may invalidate the
-     * <code>(minimum &lt;= value &lt= maximum)</code>
+     * <code>(minimum &lt;= value &lt;= maximum)</code>
      * invariant enforced by the constructors.  This is to simplify updating
      * the model, naturally one should ensure that the invariant is true
      * before calling the <code>getNextValue</code>,
@@ -196,7 +196,7 @@
      * MyDate extends Date {  // Date already implements Comparable
      *     public int compareTo(Long o) {
      *         long t = getTime();
-     *         return (t < o.longValue() ? -1 : (t == o.longValue() ? 0 : 1));
+     *         return (t &lt; o.longValue() ? -1 : (t == o.longValue() ? 0 : 1));
      *     }
      * }
      * </pre>
@@ -235,7 +235,7 @@
      * If <code>maximum</code> is <code>null</code>, then there
      * is no upper bound.  No bounds checking is done here; the new
      * <code>maximum</code> value may invalidate the
-     * <code>(minimum <= value < maximum)</code>
+     * <code>(minimum &lt;= value &lt; maximum)</code>
      * invariant enforced by the constructors.  This is to simplify updating
      * the model, naturally one should ensure that the invariant is true
      * before calling the <code>next</code>, <code>previous</code>,
--- a/jdk/src/share/classes/javax/swing/SpringLayout.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/SpringLayout.java	Fri Oct 11 09:17:18 2013 -0400
@@ -727,7 +727,7 @@
         * For any other <code>String</code> value passed as the edge,
         * no action is taken. For a <code>null</code> edge, a
         * <code>NullPointerException</code> is thrown.
-        * <p/>
+        * <p>
         * <b>Note:</b> This method can affect {@code x} and {@code y} values
         * previously set for this {@code Constraints}.
         *
--- a/jdk/src/share/classes/javax/swing/TransferHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/TransferHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -502,7 +502,7 @@
          * the action with the source drop actions, and then compare the result
          * against the original action. For example:
          * <pre>
-         * boolean copySupported = (COPY & getSourceDropActions()) == COPY;
+         * boolean copySupported = (COPY &amp; getSourceDropActions()) == COPY;
          * </pre>
          * <p>
          * This method is only for use with drag and drop transfers.
@@ -1268,6 +1268,14 @@
                     }
                 }
             }
+            if (!isActive()) {
+                // If the Drop target is inactive the dragExit will not be dispatched to the dtListener,
+                // so make sure that we clean up the dtListener anyway.
+                DropTargetListener dtListener = getDropTargetListener();
+                    if (dtListener != null && dtListener instanceof DropHandler) {
+                        ((DropHandler)dtListener).cleanup(false);
+                    }
+            }
         }
 
         public void drop(DropTargetDropEvent e) {
--- a/jdk/src/share/classes/javax/swing/UIDefaults.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/UIDefaults.java	Fri Oct 11 09:17:18 2013 -0400
@@ -706,7 +706,7 @@
 
 
     /**
-     * Returns the L&F class that renders this component.
+     * Returns the L&amp;F class that renders this component.
      *
      * @param uiClassID a string containing the class ID
      * @return the Class object returned by
--- a/jdk/src/share/classes/javax/swing/UnsupportedLookAndFeelException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/UnsupportedLookAndFeelException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -25,7 +25,7 @@
 package javax.swing;
 
 /**
- * An exception that indicates the requested look & feel
+ * An exception that indicates the requested look &amp; feel
  * management classes are not present on the user's system.
  * <p>
  * <strong>Warning:</strong>
--- a/jdk/src/share/classes/javax/swing/ViewportLayout.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/ViewportLayout.java	Fri Oct 11 09:17:18 2013 -0400
@@ -25,6 +25,7 @@
 
 package javax.swing;
 
+import java.awt.AWTError;
 import java.awt.LayoutManager;
 import java.awt.Component;
 import java.awt.Container;
@@ -116,7 +117,7 @@
      *
      * @param parent  the container to lay out
      *
-     * @exception AWTError  if the target isn't the container specified to the
+     * @throws AWTError if the target isn't the container specified to the
      *                      <code>BoxLayout</code> constructor
      */
     public void layoutContainer(Container parent)
--- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,17 +35,17 @@
 
 /**
  * The base class for all {@link javax.swing.JLayer}'s UI delegates.
- * <p/>
+ * <p>
  * {@link #paint(java.awt.Graphics, javax.swing.JComponent)} method performs the
  * painting of the {@code JLayer}
  * and {@link #eventDispatched(AWTEvent, JLayer)} method is notified
  * about any {@code AWTEvent}s which have been generated by a {@code JLayer}
  * or any of its subcomponents.
- * <p/>
+ * <p>
  * The {@code LayerUI} differs from the UI delegates of the other components,
  * because it is LookAndFeel independent and is not updated by default when
  * the system LookAndFeel is changed.
- * <p/>
+ * <p>
  * The subclasses of {@code LayerUI} can either be stateless and shareable
  * by multiple {@code JLayer}s or not shareable.
  *
@@ -69,7 +69,7 @@
      * Subclasses should override this method and use
      * the specified {@code Graphics} object to
      * render the content of the component.
-     * <p/>
+     * <p>
      * The default implementation paints the passed component as is.
      *
      * @param g the {@code Graphics} context in which to paint
@@ -82,7 +82,7 @@
     /**
      * Processes {@code AWTEvent}s for {@code JLayer}
      * and <b>all its descendants</b> to this {@code LayerUI} instance.
-     * <p/>
+     * <p>
      * To enable the {@code AWTEvent}s of a particular type,
      * you call {@link JLayer#setLayerEventMask}
      * in {@link #installUI(javax.swing.JComponent)}
@@ -91,7 +91,7 @@
      * By default this  method calls the appropriate
      * {@code process&lt;event&nbsp;type&gt;Event}
      * method for the given class of event.
-     * <p/>
+     * <p>
      * <b>Note:</b> Events are processed only for displayable {@code JLayer}s.
      *
      * @param e the event to be dispatched
@@ -151,7 +151,7 @@
     /**
      * Processes component events occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless component events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Component events are enabled in the overridden {@link #installUI} method
@@ -183,7 +183,7 @@
     /**
      * Processes focus events occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless focus events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Focus events are enabled in the overridden {@link #installUI} method
@@ -215,7 +215,7 @@
     /**
      * Processes key events occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless key events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Key events are enabled in the overridden {@link #installUI} method
@@ -247,7 +247,7 @@
     /**
      * Processes mouse events occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless mouse events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Mouse events are enabled in the overridden {@link #installUI} method
@@ -279,7 +279,7 @@
     /**
      * Processes mouse motion event occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless mouse motion events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Mouse motion events are enabled in the overridden {@link #installUI} method
@@ -311,7 +311,7 @@
     /**
      * Processes mouse wheel event occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless mouse wheel events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Mouse wheel events are enabled in the overridden {@link #installUI} method
@@ -343,7 +343,7 @@
     /**
      * Processes input event occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless input events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Input events are enabled in the overridden {@link #installUI} method
@@ -375,7 +375,7 @@
     /**
      * Processes hierarchy event occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless hierarchy events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Hierarchy events are enabled in the overridden {@link #installUI} method
@@ -407,7 +407,7 @@
     /**
      * Processes hierarchy bounds event occurring on the {@link JLayer}
      * or any of its subcomponents.
-     * <p/>
+     * <p>
      * This method is not called unless hierarchy bounds events are
      * enabled for the {@code JLayer} objects, this {@code LayerUI} is set to.
      * Hierarchy bounds events are enabled in the overridden {@link #installUI}
@@ -471,7 +471,7 @@
     /**
      * Adds a PropertyChangeListener to the listener list. The listener is
      * registered for all bound properties of this class.
-     * <p/>
+     * <p>
      * If {@code listener} is {@code null},
      * no exception is thrown and no action is performed.
      *
@@ -488,7 +488,7 @@
      * Removes a PropertyChangeListener from the listener list. This method
      * should be used to remove PropertyChangeListeners that were registered
      * for all bound properties of this class.
-     * <p/>
+     * <p>
      * If {@code listener} is {@code null},
      * no exception is thrown and no action is performed.
      *
@@ -519,7 +519,7 @@
     /**
      * Adds a PropertyChangeListener to the listener list for a specific
      * property.
-     * <p/>
+     * <p>
      * If {@code propertyName} or {@code listener} is {@code null},
      * no exception is thrown and no action is taken.
      *
@@ -539,7 +539,7 @@
      * list for a specific property. This method should be used to remove
      * {@code PropertyChangeListener}s
      * that were registered for a specific bound property.
-     * <p/>
+     * <p>
      * If {@code propertyName} or {@code listener} is {@code null},
      * no exception is thrown and no action is taken.
      *
@@ -702,7 +702,7 @@
 
     /**
      * Paints the specified region in the {@code JLayer} this {@code LayerUI} is set to, immediately.
-     * <p/>
+     * <p>
      * This method is to be overridden when the dirty region needs to be changed.
      * The default implementation delegates its functionality to {@link JComponent#paintImmediately(int, int, int, int)}.
      *
--- a/jdk/src/share/classes/javax/swing/plaf/TextUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/TextUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,7 +42,7 @@
      * Converts the given location in the model to a place in
      * the view coordinate system.
      *
-     * @param pos  the local location in the model to translate >= 0
+     * @param pos  the local location in the model to translate &gt;= 0
      * @return the coordinates as a rectangle
      * @exception BadLocationException  if the given position does not
      *   represent a valid location in the associated document
@@ -53,7 +53,7 @@
      * Converts the given location in the model to a place in
      * the view coordinate system.
      *
-     * @param pos  the local location in the model to translate >= 0
+     * @param pos  the local location in the model to translate &gt;= 0
      * @return the coordinates as a rectangle
      * @exception BadLocationException  if the given position does not
      *   represent a valid location in the associated document
@@ -67,7 +67,7 @@
      * @param pt  the location in the view to translate.  This
      *   should be in the same coordinate system as the mouse
      *   events.
-     * @return the offset from the start of the document >= 0
+     * @return the offset from the start of the document &gt;= 0
      */
     public abstract int viewToModel(JTextComponent t, Point pt);
 
@@ -84,7 +84,7 @@
      *           character in the model
      *
      * @return the location within the model that best represents the
-     *         given point in the view >= 0
+     *         given point in the view &gt;= 0
      */
     public abstract int viewToModel(JTextComponent t, Point pt,
                                     Position.Bias[] biasReturn);
@@ -96,7 +96,7 @@
      * might not allow access to some of the locations in the model.
      *
      * @param t the text component for which this UI is installed
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param b the bias for the position
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard.
@@ -117,8 +117,8 @@
      * Causes the portion of the view responsible for the
      * given part of the model to be repainted.
      *
-     * @param p0 the beginning of the range >= 0
-     * @param p1 the end of the range >= p0
+     * @param p0 the beginning of the range &gt;= 0
+     * @param p1 the end of the range &gt;= p0
      */
     public abstract void damageRange(JTextComponent t, int p0, int p1);
 
@@ -126,8 +126,8 @@
      * Causes the portion of the view responsible for the
      * given part of the model to be repainted.
      *
-     * @param p0 the beginning of the range >= 0
-     * @param p1 the end of the range >= p0
+     * @param p0 the beginning of the range &gt;= 0
+     * @param p1 the end of the range &gt;= p0
      */
     public abstract void damageRange(JTextComponent t, int p0, int p1,
                                      Position.Bias firstBias,
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,7 +38,7 @@
 import java.awt.Graphics;
 
 /**
- * Factory object that can vend Borders appropriate for the basic L & F.
+ * Factory object that can vend Borders appropriate for the basic L &amp; F.
  * @author Georges Saab
  * @author Amy Fowler
  */
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -971,14 +971,16 @@
                     // cells, if not, this needs to loop through all.
                     value = comboBox.getModel().getElementAt(0);
                 }
-                if (value == null) {
-                    value = " ";
-                } else if (value instanceof String && "".equals(value)) {
-                    value = " ";
-                }
                 Component component = renderer.
                         getListCellRendererComponent(listBox, value, -1,
                                                      false, false);
+                if (component instanceof JLabel) {
+                    JLabel label = (JLabel) component;
+                    String text = label.getText();
+                    if ((text == null) || text.isEmpty()) {
+                        label.setText(" ");
+                    }
+                }
                 if (component instanceof JComponent) {
                     component.setFont(comboBox.getFont());
                 }
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 import java.beans.*;
 
 /**
- * Basic L&F for a minimized window on a desktop.
+ * Basic L&amp;F for a minimized window on a desktop.
  *
  * @author David Kloba
  * @author Steve Wilson
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,7 +42,7 @@
 import sun.awt.AppContext;
 
 /**
- * Basic L&F for a desktop.
+ * Basic L&amp;F for a desktop.
  *
  * @author Steve Wilson
  */
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,7 +43,7 @@
 import sun.swing.SwingUtilities2;
 
 /**
- * Basic L&F implementation of a FileChooser.
+ * Basic L&amp;F implementation of a FileChooser.
  *
  * @author Jeff Dinkins
  */
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java	Fri Oct 11 09:17:18 2013 -0400
@@ -231,7 +231,7 @@
      * just like <code>g.drawString</code> would.
      * The character at index <code>underlinedIndex</code>
      * in text will be underlined. If <code>index</code> is beyond the
-     * bounds of <code>text</code> (including < 0), nothing will be
+     * bounds of <code>text</code> (including &lt; 0), nothing will be
      * underlined.
      *
      * @param g Graphics to draw with
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,7 +35,7 @@
 import java.io.Serializable;
 
 /**
- * Factory object that can vend Icons appropriate for the basic L & F.
+ * Factory object that can vend Icons appropriate for the basic L &amp; F.
  * <p>
  * <strong>Warning:</strong>
  * Serialized objects of this class will not be compatible with
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	Fri Oct 11 09:17:18 2013 -0400
@@ -553,7 +553,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class PropertyChangeHandler implements PropertyChangeListener {
         // NOTE: This class exists only for backward compatability. All
@@ -567,7 +567,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class TitlePaneLayout implements LayoutManager {
         // NOTE: This class exists only for backward compatability. All
@@ -597,7 +597,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class CloseAction extends AbstractAction {
         public CloseAction() {
@@ -614,7 +614,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class MaximizeAction extends AbstractAction {
         public MaximizeAction() {
@@ -643,7 +643,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class IconifyAction extends AbstractAction {
         public IconifyAction() {
@@ -664,7 +664,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class RestoreAction extends AbstractAction {
         public RestoreAction() {
@@ -691,7 +691,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class MoveAction extends AbstractAction {
         public MoveAction() {
@@ -725,7 +725,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class SizeAction extends AbstractAction {
         public SizeAction() {
@@ -741,7 +741,7 @@
 
     /**
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class SystemMenuBar extends JMenuBar {
         public boolean isFocusTraversable() { return false; }
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,7 +35,7 @@
 import sun.swing.UIAction;
 
 /**
- * A basic L&F implementation of JInternalFrame.
+ * A basic L&amp;F implementation of JInternalFrame.
  *
  * @author David Kloba
  * @author Rich Schiavi
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -50,7 +50,7 @@
 import java.beans.PropertyChangeListener;
 
 /**
- * A Windows L&F implementation of LabelUI.  This implementation
+ * A Windows L&amp;F implementation of LabelUI.  This implementation
  * is completely static, i.e. there's only one UIView implementation
  * that's shared by all JLabel objects.
  *
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -537,7 +537,7 @@
      *   <td>JList.VERTICAL_WRAP
      *   <td>If the visible row count is greater than zero, the preferredHeight
      *       is the maximum cell height * visibleRowCount. If the visible row
-     *       count is <= 0, the preferred height is either the current height
+     *       count is &lt;= 0, the preferred height is either the current height
      *       of the list, or the maximum cell height, whichever is
      *       bigger. The preferred width is than the maximum cell width *
      *       number of columns needed. Where the number of columns needs is
@@ -556,7 +556,7 @@
      *       longer need 8 rows to display this, you only need 5, thus
      *       the adjustedRowCount is 5.
      *       <p>If the visible row
-     *       count is <= 0, the preferred height is dictated by the
+     *       count is &lt;= 0, the preferred height is dictated by the
      *       number of columns, which will be as many as can fit in the width
      *       of the <code>JList</code> (width / max cell width), with at
      *       least one column.  The preferred height then becomes the
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -46,7 +46,7 @@
 
 
 /**
- * A default L&F implementation of MenuBarUI.  This implementation
+ * A default L&amp;F implementation of MenuBarUI.  This implementation
  * is a "combined" view/controller.
  *
  * @author Georges Saab
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,7 +39,7 @@
 
 
 /**
- * A default L&F implementation of MenuUI.  This implementation
+ * A default L&amp;F implementation of MenuUI.  This implementation
  * is a "combined" view/controller.
  *
  * @author Georges Saab
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -131,7 +131,7 @@
     }
 
     /**
-      * Installs the receiver as the L&F for the passed in
+      * Installs the receiver as the L&amp;F for the passed in
       * <code>JOptionPane</code>.
       */
     public void installUI(JComponent c) {
@@ -144,7 +144,7 @@
     }
 
     /**
-      * Removes the receiver from the L&F controller of the passed in split
+      * Removes the receiver from the L&amp;F controller of the passed in split
       * pane.
       */
     public void uninstallUI(JComponent c) {
@@ -827,7 +827,7 @@
     }
 
     /**
-     * Returns true, basic L&F wants all the buttons to have the same
+     * Returns true, basic L&amp;F wants all the buttons to have the same
      * width.
      */
     protected boolean getSizeButtonsToSameWidth() {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 import javax.swing.plaf.ComponentUI;
 
 /**
- * A Basic L&F implementation of PopupMenuSeparatorUI.  This implementation
+ * A Basic L&amp;F implementation of PopupMenuSeparatorUI.  This implementation
  * is a "combined" view/controller.
  *
  * @author Jeff Shapiro
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -53,7 +53,7 @@
 import sun.awt.AppContext;
 
 /**
- * A Windows L&F implementation of PopupMenuUI.  This implementation
+ * A Windows L&amp;F implementation of PopupMenuUI.  This implementation
  * is a "combined" view/controller.
  *
  * @author Georges Saab
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,7 +38,7 @@
 import sun.swing.DefaultLookup;
 
 /**
- * A Basic L&F implementation of ProgressBarUI.
+ * A Basic L&amp;F implementation of ProgressBarUI.
  *
  * @author Michael C. Albers
  * @author Kathy Walrath
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,7 +45,7 @@
 import java.awt.event.*;
 
 /**
- * A default L&F implementation of ScrollPaneUI.
+ * A default L&amp;F implementation of ScrollPaneUI.
  *
  * @author Hans Muller
  */
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,7 +36,7 @@
 
 
 /**
- * A Basic L&F implementation of SeparatorUI.  This implementation
+ * A Basic L&amp;F implementation of SeparatorUI.  This implementation
  * is a "combined" view/controller.
  *
  * @author Georges Saab
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,7 +39,7 @@
 
 
 /**
- * A Basic L&F implementation of SliderUI.
+ * A Basic L&amp;F implementation of SliderUI.
  *
  * @author Tom Santos
  */
@@ -1542,7 +1542,7 @@
      * Data model listener.
      *
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class ChangeHandler implements ChangeListener {
         // NOTE: This class exists only for backward compatability. All
@@ -1561,7 +1561,7 @@
      * Track mouse movements.
      *
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class TrackListener extends MouseInputAdapter {
         protected transient int offset;
@@ -1805,7 +1805,7 @@
      * Scroll-event listener.
      *
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class ScrollListener implements ActionListener {
         // changed this class to public to avoid bogus IllegalAccessException
@@ -1849,7 +1849,7 @@
      * Listener for resizing events.
      * <p>
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class ComponentHandler extends ComponentAdapter {
         // NOTE: This class exists only for backward compatability. All
@@ -1865,7 +1865,7 @@
      * Focus-change listener.
      * <p>
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class FocusHandler implements FocusListener {
         // NOTE: This class exists only for backward compatability. All
@@ -1892,7 +1892,7 @@
      * Please refer to the key bindings specification for further details.
      * <p>
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class ActionScroller extends AbstractAction {
         // NOTE: This class exists only for backward compatability. All
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,7 +44,7 @@
 
 
 /**
- * A Basic L&F implementation of the SplitPaneUI.
+ * A Basic L&amp;F implementation of the SplitPaneUI.
  *
  * @author Scott Violet
  * @author Steve Wilson
@@ -1060,7 +1060,7 @@
 
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     public void paint(Graphics g, JComponent jc) {
         if (!painted && splitPane.getDividerLocation()<0) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,7 +43,7 @@
 import sun.swing.UIAction;
 
 /**
- * A Basic L&F implementation of TabbedPaneUI.
+ * A Basic L&amp;F implementation of TabbedPaneUI.
  *
  * @author Amy Fowler
  * @author Philip Milne
@@ -669,7 +669,7 @@
      *
      * @param tab index of tab to get baseline for
      * @exception IndexOutOfBoundsException if index is out of range
-     *            (index < 0 || index >= tab count)
+     *            (index &lt; 0 || index &gt;= tab count)
      * @return baseline or a value &lt; 0 indicating there is no reasonable
      *                  baseline
      * @since 1.6
@@ -2620,7 +2620,7 @@
                     // Never move a TAB down a run if it is in the first column.
                     // Even if there isn't enough room, moving it to a fresh
                     // line won't help.
-                    if (rect.x != 2 + insets.left && rect.x + rect.width > returnAt) {
+                    if (rect.x != x && rect.x + rect.width > returnAt) {
                         if (runCount > tabRuns.length - 1) {
                             expandTabRunsArray();
                         }
@@ -2648,7 +2648,7 @@
                     // Never move a TAB over a run if it is in the first run.
                     // Even if there isn't enough room, moving it to a fresh
                     // column won't help.
-                    if (rect.y != 2 + insets.top && rect.y + rect.height > returnAt) {
+                    if (rect.y != y && rect.y + rect.height > returnAt) {
                         if (runCount > tabRuns.length - 1) {
                             expandTabRunsArray();
                         }
@@ -3350,6 +3350,7 @@
         private void updateView() {
             int tabPlacement = tabPane.getTabPlacement();
             int tabCount = tabPane.getTabCount();
+            assureRectsCreated(tabCount);
             Rectangle vpRect = viewport.getBounds();
             Dimension viewSize = viewport.getViewSize();
             Rectangle viewRect = viewport.getViewRect();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1012,7 +1012,7 @@
      * this translation to be computed.
      *
      * @param tc the text component for which this UI is installed
-     * @param pos the local location in the model to translate >= 0
+     * @param pos the local location in the model to translate &gt;= 0
      * @return the coordinates as a rectangle, null if the model is not painted
      * @exception BadLocationException  if the given position does not
      *   represent a valid location in the associated document
@@ -1029,7 +1029,7 @@
      * this translation to be computed.
      *
      * @param tc the text component for which this UI is installed
-     * @param pos the local location in the model to translate >= 0
+     * @param pos the local location in the model to translate &gt;= 0
      * @return the coordinates as a rectangle, null if the model is not painted
      * @exception BadLocationException  if the given position does not
      *   represent a valid location in the associated document
@@ -1066,7 +1066,7 @@
      * @param tc the text component for which this UI is installed
      * @param pt the location in the view to translate.  This
      *  should be in the same coordinate system as the mouse events.
-     * @return the offset from the start of the document >= 0,
+     * @return the offset from the start of the document &gt;= 0,
      *   -1 if not painted
      * @see TextUI#viewToModel
      */
@@ -1083,7 +1083,7 @@
      * @param tc the text component for which this UI is installed
      * @param pt the location in the view to translate.  This
      *  should be in the same coordinate system as the mouse events.
-     * @return the offset from the start of the document >= 0,
+     * @return the offset from the start of the document &gt;= 0,
      *   -1 if the component doesn't yet have a positive size.
      * @see TextUI#viewToModel
      */
@@ -1141,8 +1141,8 @@
      * the view is not currently painted.
      *
      * @param tc the text component for which this UI is installed
-     * @param p0 the beginning of the range >= 0
-     * @param p1 the end of the range >= p0
+     * @param p0 the beginning of the range &gt;= 0
+     * @param p1 the end of the range &gt;= p0
      * @see TextUI#damageRange
      */
     public void damageRange(JTextComponent tc, int p0, int p1) {
@@ -1153,8 +1153,8 @@
      * Causes the portion of the view responsible for the
      * given part of the model to be repainted.
      *
-     * @param p0 the beginning of the range >= 0
-     * @param p1 the end of the range >= p0
+     * @param p0 the beginning of the range &gt;= 0
+     * @param p1 the end of the range &gt;= p0
      */
     public void damageRange(JTextComponent t, int p0, int p1,
                             Position.Bias p0Bias, Position.Bias p1Bias) {
@@ -1271,8 +1271,8 @@
      * it is unable to represent the part of the element.
      *
      * @param elem the element
-     * @param p0 the starting offset >= 0
-     * @param p1 the ending offset >= p0
+     * @param p0 the starting offset &gt;= 0
+     * @param p1 the ending offset &gt;= p0
      * @return the view
      */
     public View create(Element elem, int p0, int p1) {
@@ -1471,7 +1471,7 @@
          * the model.  This is implemented to return the index of the only
          * child.
          *
-         * @param pos the position >= 0
+         * @param pos the position &gt;= 0
          * @return  index of the view representing the given position, or
          *   -1 if no view represents that position
          * @since 1.3
@@ -1515,11 +1515,11 @@
          * Provides a mapping from the document model coordinate space
          * to the coordinate space of the view mapped to it.
          *
-         * @param p0 the position to convert >= 0
+         * @param p0 the position to convert &gt;= 0
          * @param b0 the bias toward the previous character or the
          *  next character represented by p0, in case the
          *  position is a boundary of two views.
-         * @param p1 the position to convert >= 0
+         * @param p1 the position to convert &gt;= 0
          * @param b1 the bias toward the previous character or the
          *  next character represented by p1, in case the
          *  position is a boundary of two views.
@@ -1561,7 +1561,7 @@
          * they might not be in the same order found in the model, or they just
          * might not allow access to some of the locations in the model.
          *
-         * @param pos the position to convert >= 0
+         * @param pos the position to convert &gt;= 0
          * @param a the allocated region to render into
          * @param direction the direction from the current position that can
          *  be thought of as the arrow keys typically found on a keyboard.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,7 +37,7 @@
 
 
 /**
- * A Basic L&F implementation of ToolBarSeparatorUI.  This implementation
+ * A Basic L&amp;F implementation of ToolBarSeparatorUI.  This implementation
  * is a "combined" view/controller.
  * <p>
  *
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,7 +42,7 @@
 
 
 /**
- * A Basic L&F implementation of ToolBarUI.  This implementation
+ * A Basic L&amp;F implementation of ToolBarUI.  This implementation
  * is a "combined" view/controller.
  * <p>
  *
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,7 +40,7 @@
 
 
 /**
- * Standard tool tip L&F.
+ * Standard tool tip L&amp;F.
  * <p>
  *
  * @author Dave Moore
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,13 +42,14 @@
 import javax.swing.tree.*;
 import javax.swing.text.Position;
 import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag;
+import sun.awt.AWTAccessor;
 import sun.swing.SwingUtilities2;
 
 import sun.swing.DefaultLookup;
 import sun.swing.UIAction;
 
 /**
- * The basic L&F for a hierarchical data structure.
+ * The basic L&amp;F for a hierarchical data structure.
  * <p>
  *
  * @author Scott Violet
@@ -2165,11 +2166,7 @@
                                            nodeBounds.width,
                                            nodeBounds.height);
                 editingPath = path;
-                if (editingComponent instanceof JComponent) {
-                    ((JComponent)editingComponent).revalidate();
-                } else {
-                    editingComponent.validate();
-                }
+                AWTAccessor.getComponentAccessor().revalidateSynchronously(editingComponent);
                 editingComponent.repaint();
                 if(cellEditor.shouldSelectCell(event)) {
                     stopEditingInCompleteEditing = false;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 /**
  * The default layout manager for Popup menus and menubars.  This
  * class is an extension of BoxLayout which adds the UIResource tag
- * so that pluggable L&Fs can distinguish it from user-installed
+ * so that pluggable L&amp;Fs can distinguish it from user-installed
  * layout managers on menus.
  *
  * @author Georges Saab
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java	Fri Oct 11 09:17:18 2013 -0400
@@ -43,7 +43,7 @@
 
 
 /**
- * Factory object that can vend Borders appropriate for the metal L & F.
+ * Factory object that can vend Borders appropriate for the metal L &amp; F.
  * @author Steve Wilson
  */
 
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -46,7 +46,7 @@
 import sun.swing.*;
 
 /**
- * Metal L&F implementation of a FileChooser.
+ * Metal L&amp;F implementation of a FileChooser.
  *
  * @author Jeff Dinkins
  */
@@ -1067,69 +1067,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener {
-        protected FileFilter[] filters;
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if(filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if(currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if(found == false) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if(filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public Object getElementAt(int index) {
-            if(index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if(filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return MetalFileChooserUI.this.getFileChooser();
         }
     }
 
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,7 +37,7 @@
 
 
 /**
- * A Windows L&F implementation of LabelUI.  This implementation
+ * A Windows L&amp;F implementation of LabelUI.  This implementation
  * is completely static, i.e. there's only one UIView implementation
  * that's shared by all JLabel objects.
  *
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -291,8 +291,7 @@
      * Populates {@code table} with system colors. The following values are
      * added to {@code table}:
      * <table border="1" cellpadding="1" cellspacing="0"
-     *         summary="Metal's system color mapping"
-     *         valign="top" >
+     *         summary="Metal's system color mapping">
      *  <tr valign="top"  align="left">
      *    <th bgcolor="#CCCCFF" align="left">Key
      *    <th bgcolor="#CCCCFF" align="left">Value
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,7 +35,7 @@
 
 
 /**
- * A Metal L&F implementation of PopupMenuSeparatorUI.  This implementation
+ * A Metal L&amp;F implementation of PopupMenuSeparatorUI.  This implementation
  * is a "combined" view/controller.
  *
  * @author Jeff Shapiro
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,7 +37,7 @@
 
 
 /**
- * A Metal L&F implementation of ScrollPaneUI.
+ * A Metal L&amp;F implementation of ScrollPaneUI.
  * <p>
  * <strong>Warning:</strong>
  * Serialized objects of this class will not be compatible with
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,7 +36,7 @@
 
 
 /**
- * A Metal L&F implementation of SeparatorUI.  This implementation
+ * A Metal L&amp;F implementation of SeparatorUI.  This implementation
  * is a "combined" view/controller.
  * <p>
  * <strong>Warning:</strong>
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,7 +37,7 @@
 import javax.swing.plaf.*;
 
 /**
- * A Java L&F implementation of SliderUI.
+ * A Java L&amp;F implementation of SliderUI.
  * <p>
  * <strong>Warning:</strong>
  * Serialized objects of this class will not be compatible with
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -776,7 +776,7 @@
     }
 
     /**
-     * Overridden to do nothing for the Java L&F.
+     * Overridden to do nothing for the Java L&amp;F.
      */
     protected int getTabLabelShiftX( int tabPlacement, int tabIndex, boolean isSelected ) {
         return 0;
@@ -784,7 +784,7 @@
 
 
     /**
-     * Overridden to do nothing for the Java L&F.
+     * Overridden to do nothing for the Java L&amp;F.
      */
     protected int getTabLabelShiftY( int tabPlacement, int tabIndex, boolean isSelected ) {
         return 0;
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -38,7 +38,7 @@
 
 
 /**
- * A Metal L&F extension of BasicToolTipUI.
+ * A Metal L&amp;F extension of BasicToolTipUI.
  * <p>
  * <strong>Warning:</strong>
  * Serialized objects of this class will not be compatible with
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -137,7 +137,7 @@
     protected AbstractRegionPainter() { }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public final void paint(Graphics2D g, JComponent c, int w, int h) {
@@ -535,11 +535,11 @@
          * @param maxH The maximium scale in the horizontal direction to use before punting and redrawing from scratch.
          *             For example, if maxH is 2, then we will attempt to scale any cached images up to 2x the canvas
          *             width before redrawing from scratch. Reasonable maxH values may improve painting performance.
-         *             If set too high, then you may get poor looking graphics at higher zoom levels. Must be >= 1.
+         *             If set too high, then you may get poor looking graphics at higher zoom levels. Must be &gt;= 1.
          * @param maxV The maximium scale in the vertical direction to use before punting and redrawing from scratch.
          *             For example, if maxV is 2, then we will attempt to scale any cached images up to 2x the canvas
          *             height before redrawing from scratch. Reasonable maxV values may improve painting performance.
-         *             If set too high, then you may get poor looking graphics at higher zoom levels. Must be >= 1.
+         *             If set too high, then you may get poor looking graphics at higher zoom levels. Must be &gt;= 1.
          */
         public PaintContext(Insets insets, Dimension canvasSize, boolean inverted,
                             CacheMode cacheMode, double maxH, double maxV) {
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -124,7 +124,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override public UIDefaults getDefaults() {
         if (uiDefaults == null){
@@ -261,7 +261,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      * @return {@code true}
      */
     @Override public boolean shouldUpdateStyleOnAncestorChanged() {
@@ -269,7 +269,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * <p>Overridden to return {@code true} when one of the following
      * properties change:
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java	Fri Oct 11 09:17:18 2013 -0400
@@ -218,7 +218,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Overridden to cause this style to populate itself with data from
      * UIDefaults, if necessary.
@@ -472,7 +472,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Overridden to cause this style to populate itself with data from
      * UIDefaults, if necessary.
@@ -519,7 +519,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * <p>Overridden to cause this style to populate itself with data from
      * UIDefaults, if necessary.</p>
@@ -562,7 +562,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Overridden to cause this style to populate itself with data from
      * UIDefaults, if necessary. If a value named "font" is not found in
@@ -590,7 +590,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Returns the SynthPainter for this style, which ends up delegating to
      * the Painters installed in this style.
@@ -600,7 +600,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Overridden to cause this style to populate itself with data from
      * UIDefaults, if necessary. If opacity is not specified in UI defaults,
@@ -616,7 +616,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * <p>Overridden to cause this style to populate itself with data from
      * UIDefaults, if necessary.</p>
@@ -628,7 +628,7 @@
      * Button.opacity
      * Button.Enabled.foreground
      * Button.Enabled+Selected.background
-     * </pre></p>
+     * </pre>
      *
      * <p>In this example, suppose you were in the Enabled+Selected state and
      * searched for "foreground". In this case, we first check for
--- a/jdk/src/share/classes/javax/swing/plaf/synth/Region.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/Region.java	Fri Oct 11 09:17:18 2013 -0400
@@ -62,10 +62,10 @@
  * The following <a href="doc-files/synthFileFormat.html">xml</a>
  * accomplishes the same thing:
  * <pre>
- * &lt;style id="splitPaneStyle">
+ * &lt;style id="splitPaneStyle"&gt;
  *   ...
- * &lt;/style>
- * &lt;bind style="splitPaneStyle" type="region" key="SplitPane"/>
+ * &lt;/style&gt;
+ * &lt;bind style="splitPaneStyle" type="region" key="SplitPane"/&gt;
  * </pre>
  *
  * @since 1.5
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 import javax.swing.text.View;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JButton}.
  *
  * @author Scott Violet
@@ -55,7 +55,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults(AbstractButton b) {
@@ -65,7 +65,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners(AbstractButton b) {
@@ -109,7 +109,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners(AbstractButton b) {
@@ -118,7 +118,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults(AbstractButton b) {
@@ -130,7 +130,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -182,7 +182,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public int getBaseline(JComponent c, int width, int height) {
@@ -305,7 +305,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -449,7 +449,7 @@
     // ********************************
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getMinimumSize(JComponent c) {
@@ -470,7 +470,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getPreferredSize(JComponent c) {
@@ -491,7 +491,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getMaximumSize(JComponent c) {
@@ -525,7 +525,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,7 +32,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JCheckBoxMenuItem}.
  *
  * @author Leif Samuelsson
@@ -54,7 +54,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected String getPropertyPrefix() {
@@ -68,7 +68,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,7 +31,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JCheckBox}.
  *
  * @author Jeff Dinkins
@@ -53,7 +53,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected String getPropertyPrefix() {
@@ -67,7 +67,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,7 +36,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JColorChooser}.
  *
  * @author Tom Santos
@@ -58,7 +58,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected AbstractColorChooserPanel[] createDefaultChoosers() {
@@ -74,7 +74,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -89,7 +89,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -102,7 +102,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -111,7 +111,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -120,7 +120,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -188,7 +188,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -197,7 +197,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,7 +35,7 @@
 import java.beans.PropertyChangeEvent;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JComboBox}.
  *
  * @author Scott Violet
@@ -103,7 +103,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Overridden to ensure that ButtonHandler is created prior to any of
      * the other installXXX methods, since several of them reference
@@ -152,7 +152,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -163,7 +163,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void uninstallUI(JComponent c) {
@@ -175,7 +175,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -187,7 +187,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -200,7 +200,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -251,7 +251,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected ComboPopup createPopup() {
@@ -261,7 +261,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected ListCellRenderer createRenderer() {
@@ -269,7 +269,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected ComboBoxEditor createEditor() {
@@ -281,7 +281,7 @@
     //======================
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
@@ -291,7 +291,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected JButton createArrowButton() {
@@ -360,7 +360,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for a minimized internal frame on a desktop.
+ * Provides the Synth L&amp;F UI delegate for a minimized internal frame on a desktop.
  *
  * @author Joshua Outwater
  * @since 1.7
@@ -55,7 +55,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installComponents() {
@@ -82,7 +82,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -96,7 +96,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -109,7 +109,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -123,7 +123,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -134,7 +134,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -202,7 +202,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 import java.awt.*;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JDesktopPane}.
  *
  * @author Joshua Outwater
@@ -58,7 +58,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -73,7 +73,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -123,7 +123,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -136,7 +136,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -164,7 +164,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDesktopManager() {
@@ -180,7 +180,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDesktopManager() {
@@ -422,7 +422,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -489,7 +489,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -498,7 +498,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent evt) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,7 +33,7 @@
 import java.beans.PropertyChangeEvent;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JEditorPane}.
  *
  * @author  Shannon Hickey
@@ -58,7 +58,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -74,7 +74,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -131,7 +131,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -181,7 +181,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void paintBackground(Graphics g) {
@@ -194,7 +194,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -29,7 +29,7 @@
 import javax.swing.plaf.ComponentUI;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JFormattedTextField}.
  *
  * @since 1.7
@@ -58,7 +58,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
@@ -67,7 +67,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JInternalFrame}.
  *
  * @author David Kloba
@@ -61,7 +61,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void installDefaults() {
@@ -70,7 +70,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -79,7 +79,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallComponents() {
@@ -90,7 +90,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -118,7 +118,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -133,7 +133,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -150,7 +150,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected JComponent createNorthPane(JInternalFrame w) {
@@ -160,7 +160,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected ComponentListener createComponentListener() {
@@ -244,7 +244,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -254,7 +254,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent evt) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,7 +37,7 @@
 import java.beans.PropertyChangeEvent;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JLabel}.
  *
  * @author Scott Violet
@@ -57,7 +57,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults(JLabel c) {
@@ -71,7 +71,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults(JLabel c){
@@ -83,7 +83,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -105,7 +105,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public int getBaseline(JComponent c, int width, int height) {
@@ -218,7 +218,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -227,7 +227,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getPreferredSize(JComponent c) {
@@ -248,7 +248,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getMinimumSize(JComponent c) {
@@ -269,7 +269,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getMaximumSize(JComponent c) {
@@ -290,7 +290,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 import java.beans.PropertyChangeEvent;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JList}.
  *
  * @author Scott Violet
@@ -80,7 +80,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -89,7 +89,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -98,7 +98,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
@@ -108,7 +108,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -117,7 +117,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -166,7 +166,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -180,7 +180,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,7 +32,7 @@
 import javax.swing.plaf.basic.*;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JMenuBar}.
  *
  * @author Scott Violet
@@ -53,7 +53,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -65,7 +65,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -87,7 +87,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -99,7 +99,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -108,7 +108,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -175,7 +175,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -184,7 +184,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -34,7 +34,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JMenuItem}.
  *
  * @author Georges Saab
@@ -59,7 +59,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void uninstallUI(JComponent c) {
@@ -73,7 +73,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -81,7 +81,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -134,7 +134,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -153,7 +153,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -162,7 +162,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -206,7 +206,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Dimension getPreferredMenuItemSize(JComponent c,
@@ -290,7 +290,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -299,7 +299,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,7 +31,7 @@
 import java.awt.Dimension;
 
 /**
- * @inheritDoc
+ * {@inheritDoc}
  *
  * @author Georges Saab
  */
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,7 +32,7 @@
 import sun.swing.MenuItemLayoutHelper;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JMenu}.
  *
  * @author Georges Saab
@@ -56,7 +56,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -64,7 +64,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -120,7 +120,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void uninstallUI(JComponent c) {
@@ -134,7 +134,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -153,7 +153,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -162,7 +162,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -207,7 +207,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Dimension getPreferredMenuItemSize(JComponent c,
@@ -286,7 +286,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -295,7 +295,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,7 +33,7 @@
 import sun.swing.DefaultLookup;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JOptionPane}.
  *
  * @author James Gosling
@@ -56,7 +56,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -64,7 +64,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -92,7 +92,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -104,7 +104,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -113,7 +113,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installComponents() {
@@ -132,7 +132,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -199,7 +199,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -208,7 +208,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
@@ -218,7 +218,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected boolean getSizeButtonsToSameWidth() {
@@ -273,7 +273,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Container createSeparator() {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,12 +41,12 @@
  * example registers a painter for all <code>JButton</code>s that will
  * render the image <code>myImage.png</code>:
  * <pre>
- *  &lt;style id="buttonStyle">
+ *  &lt;style id="buttonStyle"&gt;
  *    &lt;imagePainter path="myImage.png" sourceInsets="2 2 2 2"
- *                  paintCenter="true" stretch="true"/>
- *    &lt;insets top="2" bottom="2" left="2" right="2"/>
- *  &lt;/style>
- *  &lt;bind style="buttonStyle" type="REGION" key="button"/>
+ *                  paintCenter="true" stretch="true"/&gt;
+ *    &lt;insets top="2" bottom="2" left="2" right="2"/&gt;
+ *  &lt;/style&gt;
+ *  &lt;bind style="buttonStyle" type="REGION" key="button"/&gt;
  *</pre>
  * <p>
  * <code>SynthPainter</code> is abstract in so far as it does no painting,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,7 +32,7 @@
 import java.beans.*;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JPanel}.
  *
  * @author Steve Wilson
@@ -53,7 +53,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void installUI(JComponent c) {
@@ -64,7 +64,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void uninstallUI(JComponent c) {
@@ -93,7 +93,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults(JPanel p) {
@@ -101,7 +101,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults(JPanel p) {
@@ -119,7 +119,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -187,7 +187,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -196,7 +196,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent pce) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,7 +31,7 @@
 import javax.swing.plaf.ComponentUI;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JPasswordField}.
  *
  * @author  Shannon Hickey
@@ -73,7 +73,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
@@ -82,7 +82,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -91,7 +91,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installKeyboardActions() {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,7 +33,7 @@
 import java.beans.PropertyChangeEvent;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JPopupMenu}.
  *
  * @author Georges Saab
@@ -56,7 +56,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void installDefaults() {
@@ -81,7 +81,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -90,7 +90,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -106,7 +106,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -115,7 +115,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -182,7 +182,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -191,7 +191,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,7 +35,7 @@
 import sun.swing.SwingUtilities2;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JProgressBar}.
  *
  * @author Joshua Outwater
@@ -61,7 +61,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -70,7 +70,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -79,7 +79,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -118,7 +118,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -130,7 +130,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -147,7 +147,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public int getBaseline(JComponent c, int width, int height) {
@@ -165,7 +165,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Rectangle getBox(Rectangle r) {
@@ -177,7 +177,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void setAnimationIndex(int newValue) {
@@ -386,7 +386,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -396,7 +396,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
@@ -407,7 +407,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getPreferredSize(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,7 +30,7 @@
 import javax.swing.plaf.*;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JRadioButtonMenuItem}.
  *
  * @author Georges Saab
@@ -50,7 +50,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected String getPropertyPrefix() {
@@ -64,7 +64,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,7 +30,7 @@
 import javax.swing.plaf.*;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JRadioButton}.
  *
  * @author Jeff Dinkins
@@ -52,7 +52,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected String getPropertyPrefix() {
@@ -75,7 +75,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,7 +32,7 @@
 import javax.swing.plaf.basic.BasicRootPaneUI;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JRootPane}.
  *
  * @author Scott Violet
@@ -52,7 +52,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults(JRootPane c){
@@ -60,7 +60,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults(JRootPane root) {
@@ -72,7 +72,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -152,7 +152,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,7 +33,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JScrollBar}.
  *
  * @author Scott Violet
@@ -53,7 +53,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -68,7 +68,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void configureScrollBarColors() {
@@ -136,7 +136,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -145,7 +145,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -154,7 +154,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults(){
@@ -177,7 +177,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -212,7 +212,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public boolean getSupportsAbsolutePositioning() {
@@ -283,7 +283,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -354,7 +354,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Dimension getMinimumThumbSize() {
@@ -371,7 +371,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected JButton createDecreaseButton(int orientation)  {
@@ -400,7 +400,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected JButton createIncreaseButton(int orientation)  {
@@ -431,7 +431,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void setThumbRollover(boolean active) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,7 +41,7 @@
 import java.awt.event.FocusEvent;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JScrollPane}.
  *
  * @author Scott Violet
@@ -119,7 +119,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -128,7 +128,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults(JScrollPane scrollpane) {
@@ -154,7 +154,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners(JScrollPane c) {
@@ -171,7 +171,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults(JScrollPane c) {
@@ -186,7 +186,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners(JComponent c) {
@@ -203,7 +203,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,7 +36,7 @@
 import javax.swing.plaf.DimensionUIResource;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JSeparator}.
  *
  * @author Shannon Hickey
@@ -58,7 +58,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void installUI(JComponent c) {
@@ -67,7 +67,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void uninstallUI(JComponent c) {
@@ -191,7 +191,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -202,7 +202,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getPreferredSize(JComponent c) {
@@ -224,7 +224,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getMinimumSize(JComponent c) {
@@ -232,7 +232,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getMaximumSize(JComponent c) {
@@ -240,7 +240,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,7 +42,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link JSlider}.
  *
  * @author Joshua Outwater
@@ -98,7 +98,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults(JSlider slider) {
@@ -127,7 +127,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners(JSlider slider) {
@@ -136,7 +136,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners(JSlider slider) {
@@ -200,7 +200,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected TrackListener createTrackListener(JSlider s) {
@@ -231,7 +231,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public int getBaseline(JComponent c, int width, int height) {
@@ -302,7 +302,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getPreferredSize(JComponent c)  {
@@ -320,7 +320,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getMinimumSize(JComponent c) {
@@ -335,7 +335,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void calculateGeometry() {
@@ -534,7 +534,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void calculateThumbLocation() {
@@ -551,7 +551,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void setThumbLocation(int x, int y) {
@@ -564,7 +564,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int xPositionForValue(int value) {
@@ -593,7 +593,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int yPositionForValue(int value, int trackY, int trackHeight) {
@@ -622,7 +622,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public int valueForYPosition(int yPos) {
@@ -651,7 +651,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public int valueForXPosition(int xPos) {
@@ -680,7 +680,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Dimension getThumbSize() {
@@ -697,7 +697,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void recalculateIfInsetsChanged() {
@@ -714,7 +714,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -851,7 +851,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -899,7 +899,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,7 +32,7 @@
 import java.beans.*;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JSpinner}.
  *
  * @author Hans Muller
@@ -65,7 +65,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -81,7 +81,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -156,7 +156,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected LayoutManager createLayout() {
@@ -165,7 +165,7 @@
 
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Component createPreviousButton() {
@@ -177,7 +177,7 @@
 
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Component createNextButton() {
@@ -270,7 +270,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -334,7 +334,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -439,7 +439,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,7 +36,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JSplitPane}.
  *
  * @author Scott Violet
@@ -201,7 +201,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -236,7 +236,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
@@ -257,7 +257,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Component createDefaultNonContinuousLayoutDivider() {
@@ -322,7 +322,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -343,7 +343,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void finishedPaintingChildren(JSplitPane jc, Graphics g) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,7 +37,7 @@
 import sun.swing.SwingUtilities2;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JTabbedPane}.
  *
  * <p>Looks up the {@code selectedTabPadInsets} property from the Style,
@@ -120,7 +120,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -183,7 +183,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -192,7 +192,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -201,7 +201,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -227,7 +227,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -256,7 +256,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected JButton createScrollButton(int direction) {
@@ -272,7 +272,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
@@ -282,7 +282,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Overridden to keep track of whether the selected tab is also pressed.
      */
@@ -333,7 +333,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) {
@@ -345,7 +345,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) {
@@ -380,7 +380,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int getBaseline(int tab) {
@@ -404,7 +404,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -556,7 +556,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void setRolloverTab(int index) {
@@ -750,7 +750,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int calculateMaxTabHeight(int tabPlacement) {
@@ -766,7 +766,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int calculateTabWidth(int tabPlacement, int tabIndex,
@@ -797,7 +797,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int calculateMaxTabWidth(int tabPlacement) {
@@ -813,7 +813,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected Insets getTabInsets(int tabPlacement, int tabIndex) {
@@ -823,7 +823,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected FontMetrics getFontMetrics() {
@@ -867,7 +867,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Overridden to create a TabbedPaneLayout subclass which takes into
      * account tabOverlap.
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,7 +35,7 @@
 import sun.swing.table.*;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.table.JTableHeader}.
  *
  * @author Alan Chung
@@ -64,7 +64,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -89,7 +89,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -98,7 +98,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -114,7 +114,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -174,7 +174,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -185,7 +185,7 @@
 // SynthUI
 //
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -198,7 +198,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void rolloverColumnUpdated(int oldColumn, int newColumn) {
@@ -207,7 +207,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent evt) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -54,7 +54,7 @@
 import javax.swing.table.TableColumnModel;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JTable}.
  *
  * @author Philip Milne
@@ -202,7 +202,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -225,7 +225,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -238,7 +238,7 @@
     //
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -278,7 +278,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -696,7 +696,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent event) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -66,7 +66,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -77,7 +77,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -110,7 +110,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -157,7 +157,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      *
      * Overridden to do nothing.
      */
@@ -167,7 +167,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,7 +36,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for {@link javax.swing.JTextField}.
+ * Provides the Synth L&amp;F UI delegate for {@link javax.swing.JTextField}.
  * <p>
  * <strong>Warning:</strong>
  * Serialized objects of this class will not be compatible with
@@ -148,7 +148,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -204,7 +204,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -213,7 +213,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      * Overridden to do nothing.
      */
     @Override
@@ -241,7 +241,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -252,7 +252,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -185,7 +185,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,7 +31,7 @@
 import javax.swing.plaf.ComponentUI;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JToggleButton}.
  *
  * @author Jeff Dinkins
@@ -53,7 +53,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected String getPropertyPrefix() {
@@ -70,7 +70,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,7 +44,7 @@
 import sun.swing.plaf.synth.SynthIcon;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JToolBar}.
  *
  * @since 1.7
@@ -69,7 +69,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -78,7 +78,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -87,7 +87,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -121,7 +121,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -149,13 +149,13 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installComponents() {}
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallComponents() {}
@@ -170,7 +170,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -239,7 +239,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -314,7 +314,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void paintDragWindow(Graphics g) {
@@ -337,7 +337,7 @@
     //
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,7 +37,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JToolTip}.
  *
  * @author Joshua Outwater
@@ -58,7 +58,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults(JComponent c) {
@@ -72,7 +72,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults(JComponent c) {
@@ -83,7 +83,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners(JComponent c) {
@@ -91,7 +91,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners(JComponent c) {
@@ -99,7 +99,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -144,7 +144,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -196,7 +196,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Dimension getPreferredSize(JComponent c) {
@@ -224,7 +224,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -50,7 +50,7 @@
 import sun.swing.plaf.synth.SynthIcon;
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JTree}.
  *
  * @author Scott Violet
@@ -85,7 +85,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public Icon getExpandedIcon() {
@@ -93,7 +93,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installDefaults() {
@@ -156,7 +156,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void installListeners() {
@@ -165,7 +165,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -193,7 +193,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected TreeCellEditor createDefaultCellEditor() {
@@ -211,7 +211,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected TreeCellRenderer createDefaultCellRenderer() {
@@ -219,7 +219,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallDefaults() {
@@ -241,7 +241,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void uninstallListeners() {
@@ -273,7 +273,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
@@ -472,7 +472,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
@@ -489,7 +489,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void paintHorizontalLine(Graphics g, JComponent c, int y,
@@ -499,7 +499,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void paintVerticalPartOfLeg(Graphics g,
@@ -511,7 +511,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void paintVerticalLine(Graphics g, JComponent c, int x, int top,
@@ -586,7 +586,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void paintExpandControl(Graphics g, Rectangle clipBounds,
@@ -607,7 +607,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void drawCentered(Component c, Graphics graphics, Icon icon,
@@ -621,7 +621,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent event) {
@@ -637,7 +637,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected void paintDropLine(Graphics g) {
@@ -677,7 +677,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     protected int getRowX(int row, int depth) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Fri Oct 11 09:17:18 2013 -0400
@@ -32,7 +32,7 @@
 
 
 /**
- * Provides the Synth L&F UI delegate for
+ * Provides the Synth L&amp;F UI delegate for
  * {@link javax.swing.JViewport}.
  *
  * @since 1.7
@@ -52,7 +52,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void installUI(JComponent c) {
@@ -62,7 +62,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void uninstallUI(JComponent c) {
@@ -133,7 +133,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public SynthContext getContext(JComponent c) {
@@ -217,7 +217,7 @@
     }
 
     /**
-     * @inheritDoc
+     * {@inheritDoc}
      */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java	Fri Oct 11 09:17:18 2013 -0400
@@ -934,16 +934,18 @@
      * Returns true if the text in the range <code>p0</code> to
      * <code>p1</code> is left to right.
      */
-    boolean isLeftToRight(int p0, int p1) {
-        if(!getProperty(I18NProperty).equals(Boolean.TRUE)) {
-            return true;
-        }
-        Element bidiRoot = getBidiRootElement();
-        int index = bidiRoot.getElementIndex(p0);
-        Element bidiElem = bidiRoot.getElement(index);
-        if(bidiElem.getEndOffset() >= p1) {
-            AttributeSet bidiAttrs = bidiElem.getAttributes();
-            return ((StyleConstants.getBidiLevel(bidiAttrs) % 2) == 0);
+    static boolean isLeftToRight(Document doc, int p0, int p1) {
+        if (Boolean.TRUE.equals(doc.getProperty(I18NProperty))) {
+            if (doc instanceof AbstractDocument) {
+                AbstractDocument adoc = (AbstractDocument) doc;
+                Element bidiRoot = adoc.getBidiRootElement();
+                int index = bidiRoot.getElementIndex(p0);
+                Element bidiElem = bidiRoot.getElement(index);
+                if (bidiElem.getEndOffset() >= p1) {
+                    AttributeSet bidiAttrs = bidiElem.getAttributes();
+                    return ((StyleConstants.getBidiLevel(bidiAttrs) % 2) == 0);
+                }
+            }
         }
         return true;
     }
--- a/jdk/src/share/classes/javax/swing/text/AttributeSet.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/AttributeSet.java	Fri Oct 11 09:17:18 2013 -0400
@@ -71,7 +71,7 @@
      * This interface is the type signature that is expected
      * to be present on any attribute key that contributes to
      * character level presentation.  This would be any attribute
-     * that applies to a so-called <term>run</term> of
+     * that applies to a so-called <i>run</i> of
      * style.
      */
     public interface CharacterAttribute {
--- a/jdk/src/share/classes/javax/swing/text/BadLocationException.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/BadLocationException.java	Fri Oct 11 09:17:18 2013 -0400
@@ -46,7 +46,7 @@
      * Creates a new BadLocationException object.
      *
      * @param s         a string indicating what was wrong with the arguments
-     * @param offs      offset within the document that was requested >= 0
+     * @param offs      offset within the document that was requested &gt;= 0
      */
     public BadLocationException(String s, int offs) {
         super(s);
@@ -56,7 +56,7 @@
     /**
      * Returns the offset into the document that was not legal.
      *
-     * @return the offset >= 0
+     * @return the offset &gt;= 0
      */
     public int offsetRequested() {
         return offs;
--- a/jdk/src/share/classes/javax/swing/text/BoxView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/BoxView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -154,7 +154,7 @@
      *
      * @param g the graphics context
      * @param alloc the allocated region to paint into
-     * @param index the child index, >= 0 && < getViewCount()
+     * @param index the child index, &gt;= 0 &amp;&amp; &lt; getViewCount()
      */
     protected void paintChild(Graphics g, Rectangle alloc, int index) {
         View child = getView(index);
@@ -170,9 +170,9 @@
      * will have an offset and span of 0.
      *
      * @param index the starting index into the child views to insert
-     *   the new views; this should be a value >= 0 and <= getViewCount
+     *   the new views; this should be a value &gt;= 0 and &lt;= getViewCount
      * @param length the number of existing child views to remove;
-     *   This should be a value >= 0 and <= (getViewCount() - offset)
+     *   This should be a value &gt;= 0 and &lt;= (getViewCount() - offset)
      * @param elems the child views to add; this value can be
      *   <code>null</code>to indicate no children are being added
      *   (useful to remove)
@@ -390,8 +390,8 @@
      * information.  This is implemented to call the
      * layout method with the sizes inside of the insets.
      *
-     * @param width the width >= 0
-     * @param height the height >= 0
+     * @param width the width &gt;= 0
+     * @param height the height &gt;= 0
      */
     public void setSize(float width, float height) {
         layout(Math.max(0, (int)(width - getLeftInset() - getRightInset())),
@@ -442,7 +442,7 @@
      * <code>null</code> if the layout is invalid,
      * otherwise the superclass behavior is executed.
      *
-     * @param index the index of the child, >= 0 && < getViewCount()
+     * @param index the index of the child, &gt;= 0 &amp;&amp; &gt; getViewCount()
      * @param a  the allocation to this view
      * @return the allocation to the child; or <code>null</code>
      *          if <code>a</code> is <code>null</code>;
@@ -469,7 +469,7 @@
      * to the coordinate space of the view mapped to it.  This makes
      * sure the allocation is valid before calling the superclass.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
      * @return the bounding box of the given position
      * @exception BadLocationException  if the given position does
@@ -488,11 +488,11 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param x   x coordinate of the view location to convert >= 0
-     * @param y   y coordinate of the view location to convert >= 0
+     * @param x   x coordinate of the view location to convert &gt;= 0
+     * @param y   y coordinate of the view location to convert &gt;= 0
      * @param a the allocated region to render into
      * @return the location within the model that best represents the
-     *  given point in the view >= 0
+     *  given point in the view &gt;= 0
      * @see View#viewToModel
      */
     public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) {
@@ -513,7 +513,7 @@
      *
      * @param axis may be either <code>View.X_AXIS</code>
      *   or <code>View.Y_AXIS</code>
-     * @return the desired alignment >= 0.0f && <= 1.0f; this should
+     * @return the desired alignment &gt;= 0.0f &amp;&amp; &lt;= 1.0f; this should
      *   be a value between 0.0 and 1.0 where 0 indicates alignment at the
      *   origin and 1.0 indicates alignment to the full span
      *   away from the origin; an alignment of 0.5 would be the
@@ -535,7 +535,7 @@
      *
      * @param axis may be either <code>View.X_AXIS</code>
      *           or <code>View.Y_AXIS</code>
-     * @return   the span the view would like to be rendered into >= 0;
+     * @return   the span the view would like to be rendered into &gt;= 0;
      *           typically the view is told to render into the span
      *           that is returned, although there is no guarantee;
      *           the parent may choose to resize or break the view
@@ -558,7 +558,7 @@
      *
      * @param axis may be either <code>View.X_AXIS</code>
      *           or <code>View.Y_AXIS</code>
-     * @return  the span the view would like to be rendered into >= 0;
+     * @return  the span the view would like to be rendered into &gt;= 0;
      *           typically the view is told to render into the span
      *           that is returned, although there is no guarantee;
      *           the parent may choose to resize or break the view
@@ -581,7 +581,7 @@
      *
      * @param axis may be either <code>View.X_AXIS</code>
      *           or <code>View.Y_AXIS</code>
-     * @return   the span the view would like to be rendered into >= 0;
+     * @return   the span the view would like to be rendered into &gt;= 0;
      *           typically the view is told to render into the span
      *           that is returned, although there is no guarantee;
      *           the parent may choose to resize or break the view
@@ -613,8 +613,8 @@
     /**
      * Determines if a point falls before an allocated region.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param innerAlloc the allocated region; this is the area
      *   inside of the insets
      * @return true if the point lies before the region else false
@@ -630,8 +630,8 @@
     /**
      * Determines if a point falls after an allocated region.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param innerAlloc the allocated region; this is the area
      *   inside of the insets
      * @return true if the point lies after the region else false
@@ -647,8 +647,8 @@
     /**
      * Fetches the child view at the given coordinates.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param alloc the parents inner allocation on entry, which should
      *   be changed to the childs allocation on exit
      * @return the view
@@ -688,7 +688,7 @@
      * Allocates a region for a child view.
      *
      * @param index the index of the child view to
-     *   allocate, >= 0 && < getViewCount()
+     *   allocate, &gt;= 0 &amp;&amp; &lt; getViewCount()
      * @param alloc the allocated region
      */
     protected void childAllocation(int index, Rectangle alloc) {
@@ -701,8 +701,8 @@
     /**
      * Perform layout on the box
      *
-     * @param width the width (inside of the insets) >= 0
-     * @param height the height (inside of the insets) >= 0
+     * @param width the width (inside of the insets) &gt;= 0
+     * @param height the height (inside of the insets) &gt;= 0
      */
     protected void layout(int width, int height) {
         setSpanOnAxis(X_AXIS, width);
--- a/jdk/src/share/classes/javax/swing/text/Caret.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/Caret.java	Fri Oct 11 09:17:18 2013 -0400
@@ -149,7 +149,7 @@
      * and how fast the caret blinks, commonly used as one
      * way to attract attention to the caret.
      *
-     * @param rate  the delay in milliseconds >= 0.  If this is
+     * @param rate  the delay in milliseconds &gt;=0.  If this is
      *  zero the caret will not blink.
      */
     public void setBlinkRate(int rate);
@@ -159,7 +159,7 @@
      * and how fast the caret blinks, commonly used as one
      * way to attract attention to the caret.
      *
-     * @return the delay in milliseconds >= 0.  If this is
+     * @return the delay in milliseconds &gt;=0.  If this is
      *  zero the caret will not blink.
      */
     public int getBlinkRate();
@@ -167,7 +167,7 @@
     /**
      * Fetches the current position of the caret.
      *
-     * @return the position >= 0
+     * @return the position &gt;=0
      */
     public int getDot();
 
@@ -176,7 +176,7 @@
      * is a selection, the mark will not be the same as
      * the dot.
      *
-     * @return the position >= 0
+     * @return the position &gt;=0
      */
     public int getMark();
 
@@ -197,7 +197,7 @@
      * leaving behind the mark.  This is useful for
      * making selections.
      *
-     * @param dot  the new position to move the caret to >= 0
+     * @param dot  the new position to move the caret to &gt;=0
      */
     public void moveDot(int dot);
 
--- a/jdk/src/share/classes/javax/swing/text/ComponentView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/ComponentView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -125,7 +125,7 @@
      * axis of interest.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return   the span the view would like to be rendered into >= 0.
+     * @return   the span the view would like to be rendered into &gt;=0.
      *           Typically the view is told to render into the span
      *           that is returned, although there is no guarantee.
      *           The parent may choose to resize or break the view.
@@ -153,7 +153,7 @@
      * axis of interest.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return   the span the view would like to be rendered into >= 0.
+     * @return   the span the view would like to be rendered into &gt;=0.
      *           Typically the view is told to render into the span
      *           that is returned, although there is no guarantee.
      *           The parent may choose to resize or break the view.
@@ -181,7 +181,7 @@
      * axis of interest.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return   the span the view would like to be rendered into >= 0.
+     * @return   the span the view would like to be rendered into &gt;=0.
      *           Typically the view is told to render into the span
      *           that is returned, although there is no guarantee.
      *           The parent may choose to resize or break the view.
@@ -319,7 +319,7 @@
      * Provides a mapping from the coordinate space of the model to
      * that of the view.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;=0
      * @param a the allocated region to render into
      * @return the bounding box of the given position is returned
      * @exception BadLocationException  if the given position does not
@@ -344,8 +344,8 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;=0
+     * @param y the Y coordinate &gt;=0
      * @param a the allocated region to render into
      * @return the location within the model that best represents
      *    the given point in the view
--- a/jdk/src/share/classes/javax/swing/text/CompositeView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/CompositeView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -143,7 +143,7 @@
     /**
      * Returns the number of child views of this view.
      *
-     * @return the number of views >= 0
+     * @return the number of views &gt;= 0
      * @see #getView
      */
     public int getViewCount() {
@@ -153,7 +153,7 @@
     /**
      * Returns the n-th view in this container.
      *
-     * @param n the number of the desired view, >= 0 && < getViewCount()
+     * @param n the number of the desired view, &gt;= 0 &amp;&amp; &lt; getViewCount()
      * @return the view at index <code>n</code>
      */
     public View getView(int n) {
@@ -169,9 +169,9 @@
      * may be garbage collected.
      *
      * @param offset the starting index into the child views to insert
-     *   the new views; >= 0 and <= getViewCount
+     *   the new views; &gt;= 0 and &lt;= getViewCount
      * @param length the number of existing child views to remove;
-     *   this should be a value >= 0 and <= (getViewCount() - offset)
+     *   this should be a value &gt;= 0 and &lt;= (getViewCount() - offset)
      * @param views the child views to add; this value can be
      *  <code>null</code>
      *   to indicate no children are being added (useful to remove)
@@ -223,7 +223,7 @@
      * render into. This enables finding out where various views
      * are located.
      *
-     * @param index the index of the child, >= 0 && < getViewCount()
+     * @param index the index of the child, &gt;= 0 &amp;&amp; &lt; getViewCount()
      * @param a  the allocation to this view
      * @return the allocation to the child
      */
@@ -237,7 +237,7 @@
      * Provides a mapping from the document model coordinate space
      * to the coordinate space of the view mapped to it.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
      * @param b a bias value of either <code>Position.Bias.Forward</code>
      *  or <code>Position.Bias.Backward</code>
@@ -280,13 +280,13 @@
      * Provides a mapping from the document model coordinate space
      * to the coordinate space of the view mapped to it.
      *
-     * @param p0 the position to convert >= 0
+     * @param p0 the position to convert &gt;= 0
      * @param b0 the bias toward the previous character or the
      *  next character represented by p0, in case the
      *  position is a boundary of two views; either
      *  <code>Position.Bias.Forward</code> or
      *  <code>Position.Bias.Backward</code>
-     * @param p1 the position to convert >= 0
+     * @param p1 the position to convert &gt;= 0
      * @param b1 the bias toward the previous character or the
      *  next character represented by p1, in case the
      *  position is a boundary of two views
@@ -378,13 +378,13 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param x   x coordinate of the view location to convert >= 0
-     * @param y   y coordinate of the view location to convert >= 0
+     * @param x   x coordinate of the view location to convert &gt;= 0
+     * @param y   y coordinate of the view location to convert &gt;= 0
      * @param a the allocated region to render into
      * @param bias either <code>Position.Bias.Forward</code> or
      *  <code>Position.Bias.Backward</code>
      * @return the location within the model that best represents the
-     *  given point in the view >= 0
+     *  given point in the view &gt;= 0
      * @see View#viewToModel
      */
     public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) {
@@ -436,7 +436,7 @@
      * This is a convenience method for {@link #getNextNorthSouthVisualPositionFrom}
      * and {@link #getNextEastWestVisualPositionFrom}.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param b a bias value of either <code>Position.Bias.Forward</code>
      *  or <code>Position.Bias.Backward</code>
      * @param a the allocated region to render into
@@ -484,7 +484,7 @@
      * <code>getViewIndexByPosition</code>
      * method for backward compatibility.
      *
-     * @param pos the position >= 0
+     * @param pos the position &gt;= 0
      * @return  index of the view representing the given position, or
      *   -1 if no view represents that position
      * @since 1.3
@@ -505,8 +505,8 @@
     /**
      * Tests whether a point lies before the rectangle range.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param alloc the rectangle
      * @return true if the point is before the specified range
      */
@@ -515,8 +515,8 @@
     /**
      * Tests whether a point lies after the rectangle range.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param alloc the rectangle
      * @return true if the point is after the specified range
      */
@@ -525,8 +525,8 @@
     /**
      * Fetches the child view at the given coordinates.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param alloc the parent's allocation on entry, which should
      *   be changed to the child's allocation on exit
      * @return the child view
@@ -536,7 +536,7 @@
     /**
      * Returns the allocation for a given child.
      *
-     * @param index the index of the child, >= 0 && < getViewCount()
+     * @param index the index of the child, &gt;= 0 &amp;&amp; &lt; getViewCount()
      * @param a  the allocation to the interior of the box on entry,
      *   and the allocation of the child view at the index on exit.
      */
@@ -547,7 +547,7 @@
      * the model.  This is implemented to fetch the view in the case
      * where there is a child view for each child element.
      *
-     * @param pos the position >= 0
+     * @param pos the position &gt;= 0
      * @param a  the allocation to the interior of the box on entry,
      *   and the allocation of the view containing the position on exit
      * @return  the view representing the given position, or
@@ -570,7 +570,7 @@
      * the model.  This is implemented to fetch the view in the case
      * where there is a child view for each child element.
      *
-     * @param pos the position >= 0
+     * @param pos the position &gt;= 0
      * @return  index of the view representing the given position, or
      *   -1 if no view represents that position
      */
@@ -639,10 +639,10 @@
     /**
      * Sets the insets for the view.
      *
-     * @param top the top inset >= 0
-     * @param left the left inset >= 0
-     * @param bottom the bottom inset >= 0
-     * @param right the right inset >= 0
+     * @param top the top inset &gt;= 0
+     * @param left the left inset &gt;= 0
+     * @param bottom the bottom inset &gt;= 0
+     * @param right the right inset &gt;= 0
      */
     protected void setInsets(short top, short left, short bottom, short right) {
         this.top = top;
@@ -654,7 +654,7 @@
     /**
      * Gets the left inset.
      *
-     * @return the inset >= 0
+     * @return the inset &gt;= 0
      */
     protected short getLeftInset() {
         return left;
@@ -663,7 +663,7 @@
     /**
      * Gets the right inset.
      *
-     * @return the inset >= 0
+     * @return the inset &gt;= 0
      */
     protected short getRightInset() {
         return right;
@@ -672,7 +672,7 @@
     /**
      * Gets the top inset.
      *
-     * @return the inset >= 0
+     * @return the inset &gt;= 0
      */
     protected short getTopInset() {
         return top;
@@ -681,7 +681,7 @@
     /**
      * Gets the bottom inset.
      *
-     * @return the inset >= 0
+     * @return the inset &gt;= 0
      */
     protected short getBottomInset() {
         return bottom;
@@ -691,7 +691,7 @@
      * Returns the next visual position for the cursor, in either the
      * north or south direction.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param b a bias value of either <code>Position.Bias.Forward</code>
      *  or <code>Position.Bias.Backward</code>
      * @param a the allocated region to render into
@@ -723,7 +723,7 @@
      * Returns the next visual position for the cursor, in either the
      * east or west direction.
      *
-    * @param pos the position to convert >= 0
+    * @param pos the position to convert &gt;= 0
      * @param b a bias value of either <code>Position.Bias.Forward</code>
      *  or <code>Position.Bias.Backward</code>
      * @param a the allocated region to render into
--- a/jdk/src/share/classes/javax/swing/text/DefaultCaret.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/DefaultCaret.java	Fri Oct 11 09:17:18 2013 -0400
@@ -962,8 +962,8 @@
         // focus lost notification can come in later after the
         // caret has been deinstalled, in which case the component
         // will be null.
+        active = e;
         if (component != null) {
-            active = e;
             TextUI mapper = component.getUI();
             if (visible != e) {
                 visible = e;
@@ -1211,12 +1211,9 @@
 
     boolean isPositionLTR(int position, Position.Bias bias) {
         Document doc = component.getDocument();
-        if(doc instanceof AbstractDocument ) {
-            if(bias == Position.Bias.Backward && --position < 0)
-                position = 0;
-            return ((AbstractDocument)doc).isLeftToRight(position, position);
-        }
-        return true;
+        if(bias == Position.Bias.Backward && --position < 0)
+            position = 0;
+        return AbstractDocument.isLeftToRight(doc, position, position);
     }
 
     Position.Bias guessBiasForOffset(int offset, Position.Bias lastBias,
--- a/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/DefaultEditorKit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -140,7 +140,7 @@
      * @param in  The stream to read from
      * @param doc The destination for the insertion.
      * @param pos The location in the document to place the
-     *   content >= 0.
+     *   content &gt;=0.
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos represents an invalid
      *   location within the document.
@@ -158,8 +158,8 @@
      * @param out The stream to write to
      * @param doc The source for the write.
      * @param pos The location in the document to fetch the
-     *   content >= 0.
-     * @param len The amount to write out >= 0.
+     *   content &gt;=0.
+     * @param len The amount to write out &gt;=0.
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos represents an invalid
      *   location within the document.
@@ -191,7 +191,7 @@
      * @param in  The stream to read from
      * @param doc The destination for the insertion.
      * @param pos The location in the document to place the
-     *   content >= 0.
+     *   content &gt;=0.
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos represents an invalid
      *   location within the document.
@@ -300,8 +300,8 @@
      * @param out  The stream to write to
      * @param doc The source for the write.
      * @param pos The location in the document to fetch the
-     *   content from >= 0.
-     * @param len The amount to write out >= 0.
+     *   content from &gt;=0.
+     * @param len The amount to write out &gt;=0.
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos is not within 0 and
      *   the length of the document.
--- a/jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -105,8 +105,8 @@
      * Adds a highlight to the view.  Returns a tag that can be used
      * to refer to the highlight.
      *
-     * @param p0   the start offset of the range to highlight >= 0
-     * @param p1   the end offset of the range to highlight >= p0
+     * @param p0   the start offset of the range to highlight &gt;= 0
+     * @param p1   the end offset of the range to highlight &gt;= p0
      * @param p    the painter to use to actually render the highlight
      * @return     an object that can be used as a tag
      *   to refer to the highlight
@@ -220,8 +220,8 @@
      * Changes a highlight.
      *
      * @param tag the highlight tag
-     * @param p0 the beginning of the range >= 0
-     * @param p1 the end of the range >= p0
+     * @param p0 the beginning of the range &gt;= 0
+     * @param p1 the end of the range &gt;= p0
      * @exception BadLocationException if the specified location is invalid
      */
     public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException {
@@ -395,8 +395,8 @@
          * Paints a highlight.
          *
          * @param g the graphics context
-         * @param offs0 the starting model offset >= 0
-         * @param offs1 the ending model offset >= offs1
+         * @param offs0 the starting model offset &gt;= 0
+         * @param offs1 the ending model offset &gt;= offs1
          * @param bounds the bounding box for the highlight
          * @param c the editor
          */
@@ -441,8 +441,8 @@
          * Paints a portion of a highlight.
          *
          * @param g the graphics context
-         * @param offs0 the starting model offset >= 0
-         * @param offs1 the ending model offset >= offs1
+         * @param offs0 the starting model offset &gt;= 0
+         * @param offs1 the ending model offset &gt;= offs1
          * @param bounds the bounding box of the view, which is not
          *        necessarily the region to paint.
          * @param c the editor
--- a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java	Fri Oct 11 09:17:18 2013 -0400
@@ -176,7 +176,7 @@
      * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      * in Swing</A> for more information.
      *
-     * @param offset the starting offset >= 0
+     * @param offset the starting offset &gt;= 0
      * @param data the element data
      * @exception BadLocationException for an invalid starting offset
      */
@@ -429,7 +429,7 @@
      * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      * in Swing</A> for more information.
      *
-     * @param pos the offset from the start of the document >= 0
+     * @param pos the offset from the start of the document &gt;= 0
      * @param s  the logical style to assign to the paragraph, null if none
      */
     public void setLogicalStyle(int pos, Style s) {
@@ -458,7 +458,7 @@
      * represented by the given position.
      *
      * @param p the location to translate to a paragraph
-     *  and determine the logical style assigned >= 0.  This
+     *  and determine the logical style assigned &gt;= 0.  This
      *  is an offset from the start of the document.
      * @return the style, null if none
      */
@@ -486,8 +486,8 @@
      * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      * in Swing</A> for more information.
      *
-     * @param offset the offset in the document >= 0
-     * @param length the length >= 0
+     * @param offset the offset in the document &gt;= 0
+     * @param length the length &gt;= 0
      * @param s the attributes
      * @param replace true if the previous attributes should be replaced
      *  before setting the new attributes
@@ -539,8 +539,8 @@
      * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      * in Swing</A> for more information.
      *
-     * @param offset the offset into the paragraph >= 0
-     * @param length the number of characters affected >= 0
+     * @param offset the offset into the paragraph &gt;= 0
+     * @param length the number of characters affected &gt;= 0
      * @param s the attributes
      * @param replace whether to replace existing attributes, or merge them
      */
@@ -589,7 +589,7 @@
      * A paragraph consists of at least one child Element, which is usually
      * a leaf.
      *
-     * @param pos the starting offset >= 0
+     * @param pos the starting offset &gt;= 0
      * @return the element
      */
     public Element getParagraphElement(int pos) {
@@ -606,7 +606,7 @@
     /**
      * Gets a character element based on a position.
      *
-     * @param pos the position in the document >= 0
+     * @param pos the position in the document &gt;= 0
      * @return the element
      */
     public Element getCharacterElement(int pos) {
@@ -1233,7 +1233,7 @@
          * @param a the attributes for the element
          * @param type the type of the element (StartTagType, EndTagType,
          *  ContentType)
-         * @param len the length >= 0
+         * @param len the length &gt;= 0
          */
         public ElementSpec(AttributeSet a, short type, int len) {
             this(a, type, null, 0, len);
@@ -1247,8 +1247,8 @@
          * @param type the type of the element (StartTagType, EndTagType,
          *  ContentType)
          * @param txt the text for the element
-         * @param offs the offset into the text >= 0
-         * @param len the length of the text >= 0
+         * @param offs the offset into the text &gt;= 0
+         * @param len the length of the text &gt;= 0
          */
         public ElementSpec(AttributeSet a, short type, char[] txt,
                                   int offs, int len) {
@@ -1321,7 +1321,7 @@
         /**
          * Gets the starting offset.
          *
-         * @return the offset >= 0
+         * @return the offset &gt;= 0
          */
         public int getOffset() {
             return offs;
@@ -1330,7 +1330,7 @@
         /**
          * Gets the length.
          *
-         * @return the length >= 0
+         * @return the length &gt;= 0
          */
         public int getLength() {
             return len;
@@ -1420,8 +1420,8 @@
         /**
          * Inserts new content.
          *
-         * @param offset the starting offset >= 0
-         * @param length the length >= 0
+         * @param offset the starting offset &gt;= 0
+         * @param length the length &gt;= 0
          * @param data the data to insert
          * @param de the event capturing this edit
          */
@@ -1500,8 +1500,8 @@
         /**
          * Removes content.
          *
-         * @param offset the starting offset >= 0
-         * @param length the length >= 0
+         * @param offset the starting offset &gt;= 0
+         * @param length the length &gt;= 0
          * @param de the event capturing this edit
          */
         public void remove(int offset, int length, DefaultDocumentEvent de) {
@@ -1513,8 +1513,8 @@
         /**
          * Changes content.
          *
-         * @param offset the starting offset >= 0
-         * @param length the length >= 0
+         * @param offset the starting offset &gt;= 0
+         * @param length the length &gt;= 0
          * @param de the event capturing this edit
          */
         public void change(int offset, int length, DefaultDocumentEvent de) {
--- a/jdk/src/share/classes/javax/swing/text/Document.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/Document.java	Fri Oct 11 09:17:18 2013 -0400
@@ -58,9 +58,9 @@
  * <p>The following methods give access to the character data
  * that makes up the content.
  * <ul>
- * <li><a href="#getLength()">getLength()</a>
- * <li><a href="#getText(int, int)">getText(int, int)</a>
- * <li><a href="#getText(int, int, javax.swing.text.Segment)">getText(int, int, Segment)</a>
+ * <li>{@link #getLength()}
+ * <li>{@link #getText(int, int)}
+ * <li>{@link #getText(int, int, javax.swing.text.Segment)}
  * </ul>
  * <p><b><font size=+1>Structure</font></b>
  * <p>
@@ -79,8 +79,8 @@
  * <a href="AttributeSet.html">AttributeSet</a> interface.
  * <p>The following methods give access to the document structure.
  * <ul>
- * <li><a href="#getDefaultRootElement()">getDefaultRootElement</a>
- * <li><a href="#getRootElements()">getRootElements</a>
+ * <li>{@link #getDefaultRootElement()}
+ * <li>{@link #getRootElements()}
  * </ul>
  *
  * <p><b><font size=+1>Mutations</font></b>
@@ -93,9 +93,9 @@
  * <p>The following methods are related to mutation of the
  * document content:
  * <ul>
- * <li><a href="#insertString(int, java.lang.String, javax.swing.text.AttributeSet)">insertString(int, String, AttributeSet)</a>
- * <li><a href="#remove(int, int)">remove(int, int)</a>
- * <li><a href="#createPosition(int)">createPosition(int)</a>
+ * <li>{@link #insertString(int, java.lang.String, javax.swing.text.AttributeSet)}
+ * <li>{@link #remove(int, int)}
+ * <li>{@link #createPosition(int)}
  * </ul>
  *
  * <p><b><font size=+1>Notification</font></b>
@@ -161,8 +161,8 @@
  * and the <a href="#TitleProperty">TitleProperty</a>, which can be used to
  * name the <code>Document</code>.  The methods related to the properties are:
  * <ul>
- * <li><a href="#getProperty(java.lang.Object)">getProperty(Object)</a>
- * <li><a href="#putProperty(java.lang.Object, java.lang.Object)">putProperty(Object, Object)</a>
+ * <li>{@link #getProperty(java.lang.Object)}
+ * <li>{@link #putProperty(java.lang.Object, java.lang.Object)}
  * </ul>
  *
  * <p>For more information on the <code>Document</code> class, see
--- a/jdk/src/share/classes/javax/swing/text/DocumentFilter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/DocumentFilter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -68,8 +68,8 @@
      * necessary.
      *
      * @param fb FilterBypass that can be used to mutate Document
-     * @param offset the offset from the beginning >= 0
-     * @param length the number of characters to remove >= 0
+     * @param offset the offset from the beginning &gt;= 0
+     * @param length the number of characters to remove &gt;= 0
      * @exception BadLocationException  some portion of the removal range
      *   was not a valid part of the document.  The location in the exception
      *   is the first bad position encountered.
@@ -86,7 +86,7 @@
      * necessary, or call directly into the FilterBypass.
      *
      * @param fb FilterBypass that can be used to mutate Document
-     * @param offset  the offset into the document to insert the content >= 0.
+     * @param offset  the offset into the document to insert the content &gt;= 0.
      *    All positions that track change at or after the given location
      *    will move.
      * @param string the string to insert
@@ -141,8 +141,8 @@
          * Removes the specified region of text, bypassing the
          * DocumentFilter.
          *
-         * @param offset the offset from the beginning >= 0
-         * @param length the number of characters to remove >= 0
+         * @param offset the offset from the beginning &gt;= 0
+         * @param length the number of characters to remove &gt;= 0
          * @exception BadLocationException some portion of the removal range
          *   was not a valid part of the document.  The location in the
          *   exception is the first bad position encountered.
@@ -154,7 +154,7 @@
          * Inserts the specified text, bypassing the
          * DocumentFilter.
          * @param offset  the offset into the document to insert the
-         *   content >= 0. All positions that track change at or after the
+         *   content &gt;= 0. All positions that track change at or after the
          *   given location will move.
          * @param string the string to insert
          * @param attr the attributes to associate with the inserted
--- a/jdk/src/share/classes/javax/swing/text/EditorKit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/EditorKit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,7 +55,7 @@
 
     /**
      * Creates a copy of the editor kit.  This is implemented
-     * to use Object.clone</em>.  If the kit cannot be cloned,
+     * to use <code>Object.clone()</code>.  If the kit cannot be cloned,
      * null is returned.
      *
      * @return the copy
@@ -139,7 +139,7 @@
      * @param in  The stream to read from
      * @param doc The destination for the insertion.
      * @param pos The location in the document to place the
-     *   content >= 0.
+     *   content &gt;= 0.
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos represents an invalid
      *   location within the document.
@@ -154,8 +154,8 @@
      * @param out  The stream to write to
      * @param doc The source for the write.
      * @param pos The location in the document to fetch the
-     *   content from >= 0.
-     * @param len The amount to write out >= 0.
+     *   content from &gt;= 0.
+     * @param len The amount to write out &gt;= 0.
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos represents an invalid
      *   location within the document.
@@ -176,7 +176,7 @@
      * @param in  The stream to read from
      * @param doc The destination for the insertion.
      * @param pos The location in the document to place the
-     *   content >= 0.
+     *   content &gt;= 0.
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos represents an invalid
      *   location within the document.
@@ -196,8 +196,8 @@
      * @param out  The stream to write to
      * @param doc The source for the write.
      * @param pos The location in the document to fetch the
-     *   content >= 0.
-     * @param len The amount to write out >= 0.
+     *   content &gt;= 0.
+     * @param len The amount to write out &gt;= 0.
      * @exception IOException on any I/O error
      * @exception BadLocationException if pos represents an invalid
      *   location within the document.
--- a/jdk/src/share/classes/javax/swing/text/FieldView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/FieldView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -200,7 +200,7 @@
      * axis.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return   the span the view would like to be rendered into >= 0.
+     * @return   the span the view would like to be rendered into &gt;= 0.
      *           Typically the view is told to render into the span
      *           that is returned, although there is no guarantee.
      *           The parent may choose to resize or break the view.
@@ -241,7 +241,7 @@
      * given axis.  A value of 0 or less is not resizable.
      *
      * @param axis View.X_AXIS or View.Y_AXIS
-     * @return the weight -> 1 for View.X_AXIS, else 0
+     * @return the weight -&gt; 1 for View.X_AXIS, else 0
      */
     public int getResizeWeight(int axis) {
         if (axis == View.X_AXIS) {
@@ -254,7 +254,7 @@
      * Provides a mapping from the document model coordinate space
      * to the coordinate space of the view mapped to it.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
      * @return the bounding box of the given position
      * @exception BadLocationException  if the given position does not
@@ -269,8 +269,8 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param fx the X coordinate >= 0.0f
-     * @param fy the Y coordinate >= 0.0f
+     * @param fx the X coordinate &gt;= 0.0f
+     * @param fy the Y coordinate &gt;= 0.0f
      * @param a the allocated region to render into
      * @return the location within the model that best represents the
      *  given point in the view
--- a/jdk/src/share/classes/javax/swing/text/FlowView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/FlowView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, 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
@@ -88,7 +88,7 @@
      * is returned.
      *
      * @param index the index of the row being updated.
-     *   This should be a value >= 0 and < getViewCount().
+     *   This should be a value &gt;= 0 and &lt; getViewCount().
      * @see #getFlowStart
      */
     public int getFlowSpan(int index) {
@@ -103,7 +103,7 @@
      * for the row constraints.
 
      * @param index the index of the row being updated.
-     *   This should be a value >= 0 and < getViewCount().
+     *   This should be a value &gt;= 0 and &lt; getViewCount().
      * @see #getFlowSpan
      */
     public int getFlowStart(int index) {
@@ -147,7 +147,7 @@
      * Fetches the child view index representing the given position in
      * the model.
      *
-     * @param pos the position >= 0
+     * @param pos the position &gt;= 0
      * @return  index of the view representing the given position, or
      *   -1 if no view represents that position
      */
@@ -175,9 +175,9 @@
      * a preferenceChanged is called.  Following all of that,
      * the normal box layout of the superclass is performed.
      *
-     * @param width  the width to lay out against >= 0.  This is
+     * @param width  the width to lay out against &gt;= 0.  This is
      *   the width inside of the inset area.
-     * @param height the height to lay out against >= 0 This
+     * @param height the height to lay out against &gt;= 0 This
      *   is the height inside of the inset area.
      */
     protected void layout(int width, int height) {
@@ -580,7 +580,7 @@
          *
          * @param rowIndex the row to adjust to the current layout
          *  span.
-         * @param desiredSpan the current layout span >= 0
+         * @param desiredSpan the current layout span &gt;= 0
          * @param x the location r starts at.
          */
         protected void adjustRow(FlowView fv, int rowIndex, int desiredSpan, int x) {
@@ -796,6 +796,22 @@
             v.setParent(parent);
         }
 
+        /** {@inheritDoc} */
+        @Override
+        protected void forwardUpdate(DocumentEvent.ElementChange ec,
+                                          DocumentEvent e, Shape a, ViewFactory f) {
+            calculateUpdateIndexes(e);
+            // Send update event to all views followed by the changed place.
+            lastUpdateIndex = Math.max((getViewCount() - 1), 0);
+            for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) {
+                View v = getView(i);
+                if (v != null) {
+                    Shape childAlloc = getChildAllocation(i, a);
+                    forwardUpdateToView(v, e, childAlloc, f);
+                }
+            }
+        }
+
         // The following methods don't do anything useful, they
         // simply keep the class from being abstract.
 
@@ -816,8 +832,8 @@
          * Implemented to return false, as hit detection is not
          * performed on the logical view.
          *
-         * @param x the X coordinate >= 0
-         * @param y the Y coordinate >= 0
+         * @param x the X coordinate &gt;= 0
+         * @param y the Y coordinate &gt;= 0
          * @param alloc the rectangle
          * @return true if the point is before the specified range
          */
@@ -830,8 +846,8 @@
          * Implemented to return false, as hit detection is not
          * performed on the logical view.
          *
-         * @param x the X coordinate >= 0
-         * @param y the Y coordinate >= 0
+         * @param x the X coordinate &gt;= 0
+         * @param y the Y coordinate &gt;= 0
          * @param alloc the rectangle
          * @return true if the point is after the specified range
          */
@@ -844,8 +860,8 @@
          * Implemented to return null, as hit detection is not
          * performed on the logical view.
          *
-         * @param x the X coordinate >= 0
-         * @param y the Y coordinate >= 0
+         * @param x the X coordinate &gt;= 0
+         * @param y the Y coordinate &gt;= 0
          * @param alloc the parent's allocation on entry, which should
          *   be changed to the child's allocation on exit
          * @return the child view
@@ -859,7 +875,7 @@
          * Implemented to do nothing, as the logical view doesn't
          * perform layout on the children.
          *
-         * @param index the index of the child, >= 0 && < getViewCount()
+         * @param index the index of the child, &gt;= 0 &amp;&amp; &lt; getViewCount()
          * @param a  the allocation to the interior of the box on entry,
          *   and the allocation of the child view at the index on exit.
          */
--- a/jdk/src/share/classes/javax/swing/text/GapContent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/GapContent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -107,7 +107,7 @@
     /**
      * Returns the length of the content.
      *
-     * @return the length >= 1
+     * @return the length &gt;= 1
      * @see AbstractDocument.Content#length
      */
     public int length() {
@@ -118,7 +118,7 @@
     /**
      * Inserts a string into the content.
      *
-     * @param where the starting position >= 0, < length()
+     * @param where the starting position &gt;= 0, &lt; length()
      * @param str the non-null string to insert
      * @return an UndoableEdit object for undoing
      * @exception BadLocationException if the specified position is invalid
@@ -136,8 +136,8 @@
     /**
      * Removes part of the content.
      *
-     * @param where the starting position >= 0, where + nitems < length()
-     * @param nitems the number of characters to remove >= 0
+     * @param where the starting position &gt;= 0, where + nitems &lt; length()
+     * @param nitems the number of characters to remove &gt;= 0
      * @return an UndoableEdit object for undoing
      * @exception BadLocationException if the specified position is invalid
      * @see AbstractDocument.Content#remove
@@ -156,8 +156,8 @@
     /**
      * Retrieves a portion of the content.
      *
-     * @param where the starting position >= 0
-     * @param len the length to retrieve >= 0
+     * @param where the starting position &gt;= 0
+     * @param len the length to retrieve &gt;= 0
      * @return a string representing the content
      * @exception BadLocationException if the specified position is invalid
      * @see AbstractDocument.Content#getString
@@ -174,8 +174,8 @@
      * span the gap, the actual store is returned to avoid the copy since
      * it is contiguous.
      *
-     * @param where the starting position >= 0, where + len <= length()
-     * @param len the number of characters to retrieve >= 0
+     * @param where the starting position &gt;= 0, where + len &lt;= length()
+     * @param len the number of characters to retrieve &gt;= 0
      * @param chars the Segment object to return the characters in
      * @exception BadLocationException if the specified position is invalid
      * @see AbstractDocument.Content#getChars
@@ -222,7 +222,7 @@
      * Creates a position within the content that will
      * track change as the content is mutated.
      *
-     * @param offset the offset to track >= 0
+     * @param offset the offset to track &gt;= 0
      * @return the position
      * @exception BadLocationException if the specified position is invalid
      */
@@ -705,8 +705,8 @@
      * there. The vector with the resulting Positions are returned.
      *
      * @param v the Vector to use, with a new one created on null
-     * @param offset the starting offset >= 0
-     * @param length the length >= 0
+     * @param offset the starting offset &gt;= 0
+     * @param length the length &gt;= 0
      * @return the set of instances
      */
     protected Vector getPositionsInRange(Vector v, int offset, int length) {
--- a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java	Fri Oct 11 09:17:18 2013 -0400
@@ -239,10 +239,10 @@
                                              Position.Bias[] biasRet)
             throws BadLocationException {
 
+            Document doc = v.getDocument();
             int startOffset = v.getStartOffset();
             int endOffset = v.getEndOffset();
             Segment text;
-            AbstractDocument doc;
             boolean viewIsLeftToRight;
             TextHitInfo currentHit, nextHit;
 
@@ -252,8 +252,7 @@
             case View.SOUTH:
                 break;
             case View.EAST:
-                doc = (AbstractDocument)v.getDocument();
-                viewIsLeftToRight = doc.isLeftToRight(startOffset, endOffset);
+                viewIsLeftToRight = AbstractDocument.isLeftToRight(doc, startOffset, endOffset);
 
                 if(startOffset == doc.getLength()) {
                     if(pos == -1) {
@@ -313,8 +312,7 @@
                 }
                 return pos;
             case View.WEST:
-                doc = (AbstractDocument)v.getDocument();
-                viewIsLeftToRight = doc.isLeftToRight(startOffset, endOffset);
+                viewIsLeftToRight = AbstractDocument.isLeftToRight(doc, startOffset, endOffset);
 
                 if(startOffset == doc.getLength()) {
                     if(pos == -1) {
--- a/jdk/src/share/classes/javax/swing/text/GlyphView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -121,8 +121,8 @@
      * the GlyphPainter to determine what characters
      * it should render glyphs for.
      *
-     * @param p0  the starting document offset >= 0
-     * @param p1  the ending document offset >= p0
+     * @param p0  the starting document offset &gt;= 0
+     * @param p1  the ending document offset &gt;= p0
      * @return    the <code>Segment</code> containing the text
      */
      public Segment getText(int p0, int p1) {
@@ -282,9 +282,9 @@
      * tab expansion implementation.
      *
      * @param x the position the view would be located
-     *  at for the purpose of tab expansion >= 0.
+     *  at for the purpose of tab expansion &gt;= 0.
      * @param e how to expand the tabs when encountered.
-     * @return the desired span >= 0
+     * @return the desired span &gt;= 0
      * @see TabableView#getTabbedSpan
      */
     public float getTabbedSpan(float x, TabExpander e) {
@@ -321,9 +321,9 @@
      * arrange for its own text buffer to make the
      * measurements.
      *
-     * @param p0 the starting document offset >= 0
-     * @param p1 the ending document offset >= p0
-     * @return the span >= 0
+     * @param p0 the starting document offset &gt;= 0
+     * @param p1 the ending document offset &gt;= p0
+     * @return the span &gt;= 0
      */
     public float getPartialSpan(int p0, int p1) {
         checkPainter();
@@ -572,7 +572,7 @@
      * axis.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return   the span the view would like to be rendered into >= 0.
+     * @return   the span the view would like to be rendered into &gt;= 0.
      *           Typically the view is told to render into the span
      *           that is returned, although there is no guarantee.
      *           The parent may choose to resize or break the view.
@@ -639,7 +639,7 @@
      * Provides a mapping from the document model coordinate space
      * to the coordinate space of the view mapped to it.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a   the allocated region to render into
      * @param b   either <code>Position.Bias.Forward</code>
      *                or <code>Position.Bias.Backward</code>
@@ -657,14 +657,14 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param a the allocated region to render into
      * @param biasReturn either <code>Position.Bias.Forward</code>
      *  or <code>Position.Bias.Backward</code> is returned as the
      *  zero-th element of this array
      * @return the location within the model that best represents the
-     *  given point of view >= 0
+     *  given point of view &gt;= 0
      * @see View#viewToModel
      */
     public int viewToModel(float x, float y, Shape a, Position.Bias[] biasReturn) {
@@ -702,10 +702,10 @@
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
      * @param pos the potential location of the start of the
-     *   broken view >= 0.  This may be useful for calculating tab
+     *   broken view &gt;= 0.  This may be useful for calculating tab
      *   positions.
      * @param len specifies the relative length from <em>pos</em>
-     *   where a potential break is desired >= 0.
+     *   where a potential break is desired &gt;= 0.
      * @return the weight, which should be a value between
      *   View.ForcedBreakWeight and View.BadBreakWeight.
      * @see LabelView
@@ -736,12 +736,12 @@
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
      * @param p0 the location in the model where the
-     *  fragment should start it's representation >= 0.
+     *  fragment should start it's representation &gt;= 0.
      * @param pos the position along the axis that the
-     *  broken view would occupy >= 0.  This may be useful for
+     *  broken view would occupy &gt;= 0.  This may be useful for
      *  things like tab calculations.
      * @param len specifies the distance along the axis
-     *  where a potential break is desired >= 0.
+     *  where a potential break is desired &gt;= 0.
      * @return the fragment of the view that represents the
      *  given span, if the view can be broken.  If the view
      *  doesn't support breaking behavior, the view itself is
@@ -852,10 +852,10 @@
      * to return a nested class that shares state in this view
      * representing only a portion of the view.
      *
-     * @param p0 the starting offset >= 0.  This should be a value
+     * @param p0 the starting offset &gt;= 0.  This should be a value
      *   greater or equal to the element starting offset and
      *   less than the element ending offset.
-     * @param p1 the ending offset > p0.  This should be a value
+     * @param p1 the ending offset &gt; p0.  This should be a value
      *   less than or equal to the elements end offset and
      *   greater than the elements starting offset.
      * @return the view fragment, or itself if the view doesn't
@@ -880,7 +880,7 @@
      * they just might not allow access to some of the locations in the
      * model.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard.
@@ -1196,12 +1196,12 @@
          *
          * @param v the view to find the model location to break at.
          * @param p0 the location in the model where the
-         *  fragment should start it's representation >= 0.
+         *  fragment should start it's representation &gt;= 0.
          * @param x  the graphic location along the axis that the
-         *  broken view would occupy >= 0.  This may be useful for
+         *  broken view would occupy &gt;= 0.  This may be useful for
          *  things like tab calculations.
          * @param len specifies the distance into the view
-         *  where a potential break is desired >= 0.
+         *  where a potential break is desired &gt;= 0.
          * @return the maximum model location possible for a break.
          * @see View#breakView
          */
@@ -1214,8 +1214,8 @@
          * the painter doesn't hold any significant state, it can
          * return itself.  The default behavior is to return itself.
          * @param v  the <code>GlyphView</code> to provide a painter for
-         * @param p0 the starting document offset >= 0
-         * @param p1 the ending document offset >= p0
+         * @param p0 the starting document offset &gt;= 0
+         * @param p1 the ending document offset &gt;= p0
          */
         public GlyphPainter getPainter(GlyphView v, int p0, int p1) {
             return this;
@@ -1229,7 +1229,7 @@
          * model.
          *
          * @param v the view to use
-         * @param pos the position to convert >= 0
+         * @param pos the position to convert &gt;= 0
          * @param b   either <code>Position.Bias.Forward</code>
          *                or <code>Position.Bias.Backward</code>
          * @param a the allocated region to render into
--- a/jdk/src/share/classes/javax/swing/text/Highlighter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/Highlighter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -66,8 +66,8 @@
      * Adds a highlight to the view.  Returns a tag that can be used
      * to refer to the highlight.
      *
-     * @param p0 the beginning of the range >= 0
-     * @param p1 the end of the range >= p0
+     * @param p0 the beginning of the range &gt;= 0
+     * @param p1 the end of the range &gt;= p0
      * @param p the painter to use for the actual highlighting
      * @return an object that refers to the highlight
      * @exception BadLocationException for an invalid range specification
@@ -93,8 +93,8 @@
      * with a mouse) by damaging only what changed.
      *
      * @param tag  which highlight to change
-     * @param p0 the beginning of the range >= 0
-     * @param p1 the end of the range >= p0
+     * @param p0 the beginning of the range &gt;= 0
+     * @param p1 the end of the range &gt;= p0
      * @exception BadLocationException for an invalid range specification
      */
     public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException;
@@ -115,8 +115,8 @@
          * Renders the highlight.
          *
          * @param g the graphics context
-         * @param p0 the starting offset in the model >= 0
-         * @param p1 the ending offset in the model >= p0
+         * @param p0 the starting offset in the model &gt;= 0
+         * @param p1 the ending offset in the model &gt;= p0
          * @param bounds the bounding box for the highlight
          * @param c the editor
          */
@@ -129,14 +129,14 @@
         /**
          * Gets the starting model offset for the highlight.
          *
-         * @return the starting offset >= 0
+         * @return the starting offset &gt;= 0
          */
         public int getStartOffset();
 
         /**
          * Gets the ending model offset for the highlight.
          *
-         * @return the ending offset >= 0
+         * @return the ending offset &gt;= 0
          */
         public int getEndOffset();
 
--- a/jdk/src/share/classes/javax/swing/text/IconView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/IconView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -101,7 +101,7 @@
      * along the x axis.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return the desired alignment >= 0.0f && <= 1.0f.  This should be
+     * @return the desired alignment &gt;= 0.0f &amp;&amp; &lt;= 1.0f.  This should be
      *   a value between 0.0 and 1.0 where 0 indicates alignment at the
      *   origin and 1.0 indicates alignment to the full span
      *   away from the origin.  An alignment of 0.5 would be the
@@ -120,7 +120,7 @@
      * Provides a mapping from the document model coordinate space
      * to the coordinate space of the view mapped to it.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
      * @return the bounding box of the given position
      * @exception BadLocationException  if the given position does not
@@ -145,11 +145,11 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param x the X coordinate >= 0
-     * @param y the Y coordinate >= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param a the allocated region to render into
      * @return the location within the model that best represents the
-     *  given point of view >= 0
+     *  given point of view &gt;= 0
      * @see View#viewToModel
      */
     public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) {
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1562,8 +1562,10 @@
     /**
      * Sets the key accelerator that will cause the receiving text
      * component to get the focus.  The accelerator will be the
-     * key combination of the <em>alt</em> key and the character
-     * given (converted to upper case).  By default, there is no focus
+     * key combination of the platform-specific modifier key and
+     * the character given (converted to upper case).  For example,
+     * the ALT key is used as a modifier on Windows and the CTRL+ALT
+     * combination is used on Mac.  By default, there is no focus
      * accelerator key.  Any previous key accelerator setting will be
      * superseded.  A '\0' key setting will be registered, and has the
      * effect of turning off the focus accelerator.  When the new key
--- a/jdk/src/share/classes/javax/swing/text/NavigationFilter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/NavigationFilter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -57,7 +57,7 @@
      * on the <code>FilterBypass</code>
      *
      * @param fb FilterBypass that can be used to mutate caret position
-     * @param dot the position >= 0
+     * @param dot the position &gt;= 0
      * @param bias Bias to place the dot at
      */
     public void setDot(FilterBypass fb, int dot, Position.Bias bias) {
@@ -72,7 +72,7 @@
      * methods on the <code>FilterBypass</code>.
      *
      * @param fb FilterBypass that can be used to mutate caret position
-     * @param dot the position >= 0
+     * @param dot the position &gt;= 0
      * @param bias Bias for new location
      */
     public void moveDot(FilterBypass fb, int dot, Position.Bias bias) {
@@ -131,7 +131,7 @@
         /**
          * Sets the caret location, bypassing the NavigationFilter.
          *
-         * @param dot the position >= 0
+         * @param dot the position &gt;= 0
          * @param bias Bias to place the dot at
          */
         public abstract void setDot(int dot, Position.Bias bias);
@@ -139,7 +139,7 @@
         /**
          * Moves the caret location, bypassing the NavigationFilter.
          *
-         * @param dot the position >= 0
+         * @param dot the position &gt;= 0
          * @param bias Bias for new location
          */
         public abstract void moveDot(int dot, Position.Bias bias);
--- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -267,8 +267,6 @@
               throws BadLocationException {
         JTextComponent text = (JTextComponent)getContainer();
         Document doc = getDocument();
-        AbstractDocument aDoc = (doc instanceof AbstractDocument) ?
-                                (AbstractDocument)doc : null;
         View row = getView(rowIndex);
         int lastPos = -1;
         // This could be made better to check backward positions too.
@@ -276,8 +274,7 @@
         for(int vc = 0, numViews = row.getViewCount(); vc < numViews; vc++) {
             View v = row.getView(vc);
             int start = v.getStartOffset();
-            boolean ltr = (aDoc != null) ? aDoc.isLeftToRight
-                           (start, start + 1) : true;
+            boolean ltr = AbstractDocument.isLeftToRight(doc, start, start + 1);
             if(ltr) {
                 lastPos = start;
                 for(int end = v.getEndOffset(); lastPos < end; lastPos++) {
@@ -338,12 +335,8 @@
     protected boolean flipEastAndWestAtEnds(int position,
                                             Position.Bias bias) {
         Document doc = getDocument();
-        if(doc instanceof AbstractDocument &&
-           !((AbstractDocument)doc).isLeftToRight(getStartOffset(),
-                                                  getStartOffset() + 1)) {
-            return true;
-        }
-        return false;
+        position = getStartOffset();
+        return !AbstractDocument.isLeftToRight(doc, position, position + 1);
     }
 
     // --- FlowView methods ---------------------------------------------
@@ -416,8 +409,8 @@
      *
      * @param x the X reference position
      * @param tabOffset the position within the text stream
-     *   that the tab occurred at >= 0
-     * @return the trailing end of the tab expansion >= 0
+     *   that the tab occurred at &gt;= 0
+     * @return the trailing end of the tab expansion &gt;= 0
      * @see TabSet
      * @see TabStop
      * @see LabelView
@@ -496,9 +489,9 @@
      * the <code>TabableView</code> interface,
      * the <code>preferredSpan</code> will be used.
      *
-     * @param startOffset the starting document offset >= 0
-     * @param endOffset the ending document offset >= startOffset
-     * @return the size >= 0
+     * @param startOffset the starting document offset &gt;= 0
+     * @param endOffset the ending document offset &gt;= startOffset
+     * @return the size &gt;= 0
      */
     protected float getPartialSize(int startOffset, int endOffset) {
         float size = 0.0f;
@@ -536,7 +529,7 @@
      * there are no characters found, -1 will be returned.
      *
      * @param string the string of characters
-     * @param start where to start in the model >= 0
+     * @param start where to start in the model &gt;= 0
      * @return the document offset, or -1 if no characters found
      */
     protected int findOffsetToCharactersInString(char[] string,
@@ -649,7 +642,7 @@
      * @param axis may be either <code>View.X_AXIS</code>
      *  or <code>View.Y_AXIS</code>
      * @param len specifies where a potential break is desired
-     *  along the given axis >= 0
+     *  along the given axis &gt;= 0
      * @param a the current allocation of the view
      * @return the fragment of the view that represents the
      *  given span, if the view can be broken; if the view
@@ -682,7 +675,7 @@
      *
      * @param axis may be either <code>View.X_AXIS</code>
      *  or <code>View.Y_AXIS</code>
-     * @param len specifies where a potential break is desired >= 0
+     * @param len specifies where a potential break is desired &gt;= 0
      * @return a value indicating the attractiveness of breaking here;
      *  either <code>GoodBreakWeight</code> or <code>BadBreakWeight</code>
      * @see View#getBreakWeight
@@ -1148,7 +1141,7 @@
          * Fetches the child view index representing the given position in
          * the model.
          *
-         * @param pos the position >= 0
+         * @param pos the position &gt;= 0
          * @return  index of the view representing the given position, or
          *   -1 if no view represents that position
          */
--- a/jdk/src/share/classes/javax/swing/text/PasswordView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/PasswordView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,11 +55,11 @@
      * using the value returned by getEchoChar().
      *
      * @param g the graphics context
-     * @param x the starting X coordinate >= 0
-     * @param y the starting Y coordinate >= 0
-     * @param p0 the starting offset in the model >= 0
-     * @param p1 the ending offset in the model >= p0
-     * @return the X location of the end of the range >= 0
+     * @param x the starting X coordinate &gt;= 0
+     * @param y the starting Y coordinate &gt;= 0
+     * @param p0 the starting offset in the model &gt;= 0
+     * @param p1 the ending offset in the model &gt;= p0
+     * @return the X location of the end of the range &gt;= 0
      * @exception BadLocationException if p0 or p1 are out of range
      */
     protected int drawUnselectedText(Graphics g, int x, int y,
@@ -94,11 +94,11 @@
      * display the characters.
      *
      * @param g the graphics context
-     * @param x the starting X coordinate >= 0
-     * @param y the starting Y coordinate >= 0
-     * @param p0 the starting offset in the model >= 0
-     * @param p1 the ending offset in the model >= p0
-     * @return the X location of the end of the range >= 0
+     * @param x the starting X coordinate &gt;= 0
+     * @param y the starting Y coordinate &gt;= 0
+     * @param p0 the starting offset in the model &gt;= 0
+     * @param p1 the ending offset in the model &gt;= p0
+     * @return the X location of the end of the range &gt;= 0
      * @exception BadLocationException if p0 or p1 are out of range
      */
     protected int drawSelectedText(Graphics g, int x,
@@ -126,10 +126,10 @@
      * or unselected text.
      *
      * @param g the graphics context
-     * @param x the starting X coordinate >= 0
-     * @param y the starting Y coordinate >= 0
+     * @param x the starting X coordinate &gt;= 0
+     * @param y the starting Y coordinate &gt;= 0
      * @param c the echo character
-     * @return the updated X position >= 0
+     * @return the updated X position &gt;= 0
      */
     protected int drawEchoCharacter(Graphics g, int x, int y, char c) {
         ONE[0] = c;
@@ -142,7 +142,7 @@
      * Provides a mapping from the document model coordinate space
      * to the coordinate space of the view mapped to it.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
      * @return the bounding box of the given position
      * @exception BadLocationException  if the given position does not
@@ -172,8 +172,8 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param fx the X coordinate >= 0.0f
-     * @param fy the Y coordinate >= 0.0f
+     * @param fx the X coordinate &gt;= 0.0f
+     * @param fy the Y coordinate &gt;= 0.0f
      * @param a the allocated region to render into
      * @return the location within the model that best represents the
      *  given point in the view
@@ -210,7 +210,7 @@
      * axis.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return   the span the view would like to be rendered into >= 0.
+     * @return   the span the view would like to be rendered into &gt;= 0.
      *           Typically the view is told to render into the span
      *           that is returned, although there is no guarantee.
      *           The parent may choose to resize or break the view.
--- a/jdk/src/share/classes/javax/swing/text/PlainDocument.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/PlainDocument.java	Fri Oct 11 09:17:18 2013 -0400
@@ -103,7 +103,7 @@
      * <A HREF="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency
      * in Swing</A> for more information.
      *
-     * @param offs the starting offset >= 0
+     * @param offs the starting offset &gt;= 0
      * @param str the string to insert; does nothing with null/empty strings
      * @param a the attributes for the inserted content
      * @exception BadLocationException  the given insert position is not a valid
--- a/jdk/src/share/classes/javax/swing/text/PlainView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/PlainView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -66,10 +66,10 @@
      * <code>drawSelectedText</code> so that the way selected and
      * unselected text are rendered can be customized.
      *
-     * @param lineIndex the line to draw >= 0
+     * @param lineIndex the line to draw &gt;= 0
      * @param g the <code>Graphics</code> context
-     * @param x the starting X position >= 0
-     * @param y the starting Y position >= 0
+     * @param x the starting X position &gt;= 0
+     * @param y the starting Y position &gt;= 0
      * @see #drawUnselectedText
      * @see #drawSelectedText
      */
@@ -138,11 +138,11 @@
      * text.  Uses the foreground or disabled color to render the text.
      *
      * @param g the graphics context
-     * @param x the starting X coordinate >= 0
-     * @param y the starting Y coordinate >= 0
-     * @param p0 the beginning position in the model >= 0
-     * @param p1 the ending position in the model >= 0
-     * @return the X location of the end of the range >= 0
+     * @param x the starting X coordinate &gt;= 0
+     * @param y the starting Y coordinate &gt;= 0
+     * @param p0 the beginning position in the model &gt;= 0
+     * @param p1 the ending position in the model &gt;= 0
+     * @return the X location of the end of the range &gt;= 0
      * @exception BadLocationException if the range is invalid
      */
     protected int drawUnselectedText(Graphics g, int x, int y,
@@ -163,10 +163,10 @@
      * the selected background.
      *
      * @param g the graphics context
-     * @param x the starting X coordinate >= 0
-     * @param y the starting Y coordinate >= 0
-     * @param p0 the beginning position in the model >= 0
-     * @param p1 the ending position in the model >= 0
+     * @param x the starting X coordinate &gt;= 0
+     * @param y the starting Y coordinate &gt;= 0
+     * @param p0 the beginning position in the model &gt;= 0
+     * @param p1 the ending position in the model &gt;= 0
      * @return the location of the end of the range
      * @exception BadLocationException if the range is invalid
      */
@@ -218,7 +218,7 @@
      * axis.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return   the span the view would like to be rendered into >= 0.
+     * @return   the span the view would like to be rendered into &gt;= 0.
      *           Typically the view is told to render into the span
      *           that is returned, although there is no guarantee.
      *           The parent may choose to resize or break the view.
@@ -332,7 +332,7 @@
      * Provides a mapping from the document model coordinate space
      * to the coordinate space of the view mapped to it.
      *
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
      * @return the bounding box of the given position
      * @exception BadLocationException  if the given position does not
@@ -369,11 +369,11 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param fx the X coordinate >= 0
-     * @param fy the Y coordinate >= 0
+     * @param fx the X coordinate &gt;= 0
+     * @param fy the Y coordinate &gt;= 0
      * @param a the allocated region to render into
      * @return the location within the model that best represents the
-     *  given point in the view >= 0
+     *  given point in the view &gt;= 0
      * @see View#viewToModel
      */
     public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) {
@@ -482,8 +482,8 @@
      * layout of the view along the given axis, if it
      * has any layout duties.
      *
-     * @param width the width >= 0
-     * @param height the height >= 0
+     * @param width the width &gt;= 0
+     * @param height the height &gt;= 0
      */
     public void setSize(float width, float height) {
         super.setSize(width, height);
@@ -497,10 +497,10 @@
      * This implementation does not support things like centering so it
      * ignores the tabOffset argument.
      *
-     * @param x the current position >= 0
+     * @param x the current position &gt;= 0
      * @param tabOffset the position within the text stream
-     *   that the tab occurred at >= 0.
-     * @return the tab stop, measured in points >= 0
+     *   that the tab occurred at &gt;= 0.
+     * @return the tab stop, measured in points &gt;= 0
      */
     public float nextTabStop(float x, int tabOffset) {
         if (tabSize == 0) {
--- a/jdk/src/share/classes/javax/swing/text/Position.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/Position.java	Fri Oct 11 09:17:18 2013 -0400
@@ -51,7 +51,7 @@
     /**
      * Fetches the current offset within the document.
      *
-     * @return the offset >= 0
+     * @return the offset &gt;= 0
      */
     public int getOffset();
 
--- a/jdk/src/share/classes/javax/swing/text/StringContent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/StringContent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -61,7 +61,7 @@
 
     /**
      * Creates a new StringContent object, with the initial
-     * size specified.  If the length is < 1, a size of 1 is used.
+     * size specified.  If the length is &lt; 1, a size of 1 is used.
      *
      * @param initialLength the initial size
      */
@@ -77,7 +77,7 @@
     /**
      * Returns the length of the content.
      *
-     * @return the length >= 1
+     * @return the length &gt;= 1
      * @see AbstractDocument.Content#length
      */
     public int length() {
@@ -87,7 +87,7 @@
     /**
      * Inserts a string into the content.
      *
-     * @param where the starting position >= 0 && < length()
+     * @param where the starting position &gt;= 0 &amp;&amp; &lt; length()
      * @param str the non-null string to insert
      * @return an UndoableEdit object for undoing
      * @exception BadLocationException if the specified position is invalid
@@ -106,10 +106,10 @@
     }
 
     /**
-     * Removes part of the content.  where + nitems must be < length().
+     * Removes part of the content.  where + nitems must be &lt; length().
      *
-     * @param where the starting position >= 0
-     * @param nitems the number of characters to remove >= 0
+     * @param where the starting position &gt;= 0
+     * @param nitems the number of characters to remove &gt;= 0
      * @return an UndoableEdit object for undoing
      * @exception BadLocationException if the specified position is invalid
      * @see AbstractDocument.Content#remove
@@ -129,10 +129,10 @@
     }
 
     /**
-     * Retrieves a portion of the content.  where + len must be <= length().
+     * Retrieves a portion of the content.  where + len must be &lt;= length().
      *
-     * @param where the starting position >= 0
-     * @param len the length to retrieve >= 0
+     * @param where the starting position &gt;= 0
+     * @param len the length to retrieve &gt;= 0
      * @return a string representing the content; may be empty
      * @exception BadLocationException if the specified position is invalid
      * @see AbstractDocument.Content#getString
@@ -145,10 +145,10 @@
     }
 
     /**
-     * Retrieves a portion of the content.  where + len must be <= length()
+     * Retrieves a portion of the content.  where + len must be &lt;= length()
      *
-     * @param where the starting position >= 0
-     * @param len the number of characters to retrieve >= 0
+     * @param where the starting position &gt;= 0
+     * @param len the number of characters to retrieve &gt;= 0
      * @param chars the Segment object to return the characters in
      * @exception BadLocationException if the specified position is invalid
      * @see AbstractDocument.Content#getChars
@@ -166,7 +166,7 @@
      * Creates a position within the content that will
      * track change as the content is mutated.
      *
-     * @param offset the offset to create a position for >= 0
+     * @param offset the offset to create a position for &gt;= 0
      * @return the position
      * @exception BadLocationException if the specified position is invalid
      */
@@ -266,8 +266,8 @@
      * to subclasses.
      *
      * @param v the Vector to use, with a new one created on null
-     * @param offset the starting offset >= 0
-     * @param length the length >= 0
+     * @param offset the starting offset &gt;= 0
+     * @param length the length &gt;= 0
      * @return the set of instances
      */
     protected Vector getPositionsInRange(Vector v, int offset,
--- a/jdk/src/share/classes/javax/swing/text/StyleContext.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/StyleContext.java	Fri Oct 11 09:17:18 2013 -0400
@@ -241,7 +241,7 @@
      *
      * @param family the font family (such as "Monospaced")
      * @param style the style of the font (such as Font.PLAIN)
-     * @param size the point size >= 1
+     * @param size the point size &gt;= 1
      * @return the new font
      */
     public Font getFont(String family, int style, int size) {
@@ -1387,7 +1387,7 @@
         /**
          * Gets the number of attributes that are defined.
          *
-         * @return the number of attributes >= 0
+         * @return the number of attributes &gt;= 0
          * @see AttributeSet#getAttributeCount
          */
         public int getAttributeCount() {
--- a/jdk/src/share/classes/javax/swing/text/StyledDocument.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/StyledDocument.java	Fri Oct 11 09:17:18 2013 -0400
@@ -76,8 +76,8 @@
      * giving an Attributes argument that has no attributes defined
      * and setting replace to true.
      *
-     * @param offset the start of the change >= 0
-     * @param length the length of the change >= 0
+     * @param offset the start of the change &gt;= 0
+     * @param length the length of the change &gt;= 0
      * @param s    the non-null attributes to change to.  Any attributes
      *  defined will be applied to the text for the given range.
      * @param replace indicates whether or not the previous
@@ -91,8 +91,8 @@
     /**
      * Sets paragraph attributes.
      *
-     * @param offset the start of the change >= 0
-     * @param length the length of the change >= 0
+     * @param offset the start of the change &gt;= 0
+     * @param length the length of the change &gt;= 0
      * @param s    the non-null attributes to change to.  Any attributes
      *  defined will be applied to the text for the given range.
      * @param replace indicates whether or not the previous
@@ -111,7 +111,7 @@
      * in turn may resolve through some hierarchy completely
      * independent of the element hierarchy in the document.
      *
-     * @param pos the starting position >= 0
+     * @param pos the starting position &gt;= 0
      * @param s the style to set
      */
     public void setLogicalStyle(int pos, Style s);
@@ -119,7 +119,7 @@
     /**
      * Gets a logical style for a given position in a paragraph.
      *
-     * @param p the position >= 0
+     * @param p the position &gt;= 0
      * @return the style
      */
     public Style getLogicalStyle(int p);
@@ -128,7 +128,7 @@
      * Gets the element that represents the paragraph that
      * encloses the given offset within the document.
      *
-     * @param pos the offset >= 0
+     * @param pos the offset &gt;= 0
      * @return the element
      */
     public Element getParagraphElement(int pos);
@@ -137,7 +137,7 @@
      * Gets the element that represents the character that
      * is at the given offset within the document.
      *
-     * @param pos the offset >= 0
+     * @param pos the offset &gt;= 0
      * @return the element
      */
     public Element getCharacterElement(int pos);
--- a/jdk/src/share/classes/javax/swing/text/StyledEditorKit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/StyledEditorKit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -689,7 +689,7 @@
          * Creates a new AlignmentAction.
          *
          * @param nm the action name
-         * @param a the alignment >= 0
+         * @param a the alignment &gt;= 0
          */
         public AlignmentAction(String nm, int a) {
             super(nm);
--- a/jdk/src/share/classes/javax/swing/text/TabExpander.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/TabExpander.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,10 +37,10 @@
      * Returns the next tab stop position given a reference
      * position.  Values are expressed in points.
      *
-     * @param x the position in points >= 0
+     * @param x the position in points &gt;= 0
      * @param tabOffset the position within the text stream
-     *   that the tab occurred at >= 0.
-     * @return the next tab stop >= 0
+     *   that the tab occurred at &gt;= 0.
+     * @return the next tab stop &gt;= 0
      */
     float nextTabStop(float x, int tabOffset);
 
--- a/jdk/src/share/classes/javax/swing/text/TabableView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/TabableView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -46,9 +46,9 @@
      * along the axis of tab expansion.
      *
      * @param x the position the view would be located
-     *  at for the purpose of tab expansion >= 0.
+     *  at for the purpose of tab expansion &gt;= 0.
      * @param e how to expand the tabs when encountered.
-     * @return the desired span >= 0
+     * @return the desired span &gt;= 0
      */
     float getTabbedSpan(float x, TabExpander e);
 
@@ -62,9 +62,9 @@
      * an assumption that the range given does not
      * contain tabs.
      *
-     * @param p0 the starting location in the text document >= 0
-     * @param p1 the ending location in the text document >= p0
-     * @return the span >= 0
+     * @param p0 the starting location in the text document &gt;= 0
+     * @param p1 the ending location in the text document &gt;= p0
+     * @return the span &gt;= 0
      */
     float getPartialSpan(int p0, int p1);
 }
--- a/jdk/src/share/classes/javax/swing/text/TableView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/TableView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -542,7 +542,7 @@
      * view the children do not necessarily have a one to one mapping
      * with the child elements.
      *
-     * @param pos  the search position >= 0
+     * @param pos  the search position &gt;= 0
      * @param a  the allocation to the table on entry, and the
      *   allocation of the view containing the position on exit
      * @return  the view representing the given position, or
@@ -755,7 +755,7 @@
          * view the children do not necessarily have a one to one mapping
          * with the child elements.
          *
-         * @param pos  the search position >= 0
+         * @param pos  the search position &gt;= 0
          * @param a  the allocation to the table on entry, and the
          *   allocation of the view containing the position on exit
          * @return  the view representing the given position, or
@@ -833,8 +833,8 @@
         /**
          * Sets the grid location.
          *
-         * @param row the row >= 0
-         * @param col the column >= 0
+         * @param row the row &gt;= 0
+         * @param col the column &gt;= 0
          */
         public void setGridLocation(int row, int col) {
             this.row = row;
@@ -871,8 +871,8 @@
         /**
          * Sets the grid location.
          *
-         * @param row the row >= 0
-         * @param col the column >= 0
+         * @param row the row &gt;= 0
+         * @param col the column &gt;= 0
          */
         public void setGridLocation(int row, int col);
 
--- a/jdk/src/share/classes/javax/swing/text/Utilities.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/Utilities.java	Fri Oct 11 09:17:18 2013 -0400
@@ -71,12 +71,12 @@
      * where ints are used and 72dpi is assumed.
      *
      * @param s  the source of the text
-     * @param x  the X origin >= 0
-     * @param y  the Y origin >= 0
+     * @param x  the X origin &gt;= 0
+     * @param y  the Y origin &gt;= 0
      * @param g  the graphics context
      * @param e  how to expand the tabs.  If this value is null,
      *   tabs will be expanded as a space character.
-     * @param startOffset starting offset of the text in the document >= 0
+     * @param startOffset starting offset of the text in the document &gt;= 0
      * @return  the X location at the end of the rendered text
      */
     public static final int drawTabbedText(Segment s, int x, int y, Graphics g,
@@ -92,12 +92,12 @@
      *
      * @param view View requesting rendering, may be null.
      * @param s  the source of the text
-     * @param x  the X origin >= 0
-     * @param y  the Y origin >= 0
+     * @param x  the X origin &gt;= 0
+     * @param y  the Y origin &gt;= 0
      * @param g  the graphics context
      * @param e  how to expand the tabs.  If this value is null,
      *   tabs will be expanded as a space character.
-     * @param startOffset starting offset of the text in the document >= 0
+     * @param startOffset starting offset of the text in the document &gt;= 0
      * @return  the X location at the end of the rendered text
      */
     static final int drawTabbedText(View view,
@@ -197,10 +197,10 @@
      *
      * @param s  the source of the text
      * @param metrics the font metrics to use for the calculation
-     * @param x  the X origin >= 0
+     * @param x  the X origin &gt;= 0
      * @param e  how to expand the tabs.  If this value is null,
      *   tabs will be expanded as a space character.
-     * @param startOffset starting offset of the text in the document >= 0
+     * @param startOffset starting offset of the text in the document &gt;= 0
      * @return  the width of the text
      */
     public static final int getTabbedTextWidth(Segment s, FontMetrics metrics, int x,
@@ -289,13 +289,13 @@
      * @param s  the source of the text
      * @param metrics the font metrics to use for the calculation
      * @param x0 the starting view location representing the start
-     *   of the given text >= 0.
+     *   of the given text &gt;= 0.
      * @param x  the target view location to translate to an
-     *   offset into the text >= 0.
+     *   offset into the text &gt;= 0.
      * @param e  how to expand the tabs.  If this value is null,
      *   tabs will be expanded as a space character.
-     * @param startOffset starting offset of the text in the document >= 0
-     * @return  the offset into the text >= 0
+     * @param startOffset starting offset of the text in the document &gt;= 0
+     * @return  the offset into the text &gt;= 0
      */
     public static final int getTabbedTextOffset(Segment s, FontMetrics metrics,
                                              int x0, int x, TabExpander e,
@@ -488,8 +488,8 @@
      * a value of -1 will be returned.
      *
      * @param c the editor
-     * @param offs the offset in the document >= 0
-     * @return the position >= 0 if the request can be computed, otherwise
+     * @param offs the offset in the document &gt;= 0
+     * @return the position &gt;= 0 if the request can be computed, otherwise
      *  a value of -1 will be returned.
      * @exception BadLocationException if the offset is out of range
      */
@@ -518,8 +518,8 @@
      * a value of -1 will be returned.
      *
      * @param c the editor
-     * @param offs the offset in the document >= 0
-     * @return the position >= 0 if the request can be computed, otherwise
+     * @param offs the offset in the document &gt;= 0
+     * @return the position &gt;= 0 if the request can be computed, otherwise
      *  a value of -1 will be returned.
      * @exception BadLocationException if the offset is out of range
      */
@@ -549,9 +549,9 @@
      * a value of -1 will be returned.
      *
      * @param c the editor
-     * @param offs the offset in the document >= 0
-     * @param x the X coordinate >= 0
-     * @return the position >= 0 if the request can be computed, otherwise
+     * @param offs the offset in the document &gt;= 0
+     * @param x the X coordinate &gt;= 0
+     * @return the position &gt;= 0 if the request can be computed, otherwise
      *  a value of -1 will be returned.
      * @exception BadLocationException if the offset is out of range
      */
@@ -586,9 +586,9 @@
      * a value of -1 will be returned.
      *
      * @param c the editor
-     * @param offs the offset in the document >= 0
-     * @param x the X coordinate >= 0
-     * @return the position >= 0 if the request can be computed, otherwise
+     * @param offs the offset in the document &gt;= 0
+     * @param x the X coordinate &gt;= 0
+     * @return the position &gt;= 0 if the request can be computed, otherwise
      *  a value of -1 will be returned.
      * @exception BadLocationException if the offset is out of range
      */
@@ -622,8 +622,8 @@
      * Uses BreakIterator.getWordInstance() to actually get the words.
      *
      * @param c the editor
-     * @param offs the offset in the document >= 0
-     * @return the location in the model of the word start >= 0
+     * @param offs the offset in the document &gt;= 0
+     * @return the location in the model of the word start &gt;= 0
      * @exception BadLocationException if the offset is out of range
      */
     public static final int getWordStart(JTextComponent c, int offs) throws BadLocationException {
@@ -656,8 +656,8 @@
      * Uses BreakIterator.getWordInstance() to actually get the words.
      *
      * @param c the editor
-     * @param offs the offset in the document >= 0
-     * @return the location in the model of the word end >= 0
+     * @param offs the offset in the document &gt;= 0
+     * @return the location in the model of the word end &gt;= 0
      * @exception BadLocationException if the offset is out of range
      */
     public static final int getWordEnd(JTextComponent c, int offs) throws BadLocationException {
@@ -689,8 +689,8 @@
      * Uses BreakIterator.getWordInstance() to actually get the words.
      *
      * @param c the editor
-     * @param offs the offset in the document >= 0
-     * @return the location in the model of the word start >= 0
+     * @param offs the offset in the document &gt;= 0
+     * @return the location in the model of the word start &gt;= 0
      * @exception BadLocationException if the offset is out of range
      */
     public static final int getNextWord(JTextComponent c, int offs) throws BadLocationException {
@@ -767,8 +767,8 @@
      * Uses BreakIterator.getWordInstance() to actually get the words.
      *
      * @param c the editor
-     * @param offs the offset in the document >= 0
-     * @return the location in the model of the word start >= 0
+     * @param offs the offset in the document &gt;= 0
+     * @return the location in the model of the word start &gt;= 0
      * @exception BadLocationException if the offset is out of range
      */
     public static final int getPreviousWord(JTextComponent c, int offs) throws BadLocationException {
@@ -841,7 +841,7 @@
      * Determines the element to use for a paragraph/line.
      *
      * @param c the editor
-     * @param offs the starting offset in the document >= 0
+     * @param offs the starting offset in the document &gt;= 0
      * @return the element
      */
     public static final Element getParagraphElement(JTextComponent c, int offs) {
@@ -972,7 +972,7 @@
      * must then override the <code>flipEastAndWestAtEnds</code> method.
      *
      * @param v View to query
-     * @param pos the position to convert >= 0
+     * @param pos the position to convert &gt;= 0
      * @param a the allocated region to render into
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard;
--- a/jdk/src/share/classes/javax/swing/text/View.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/View.java	Fri Oct 11 09:17:18 2013 -0400
@@ -72,12 +72,12 @@
                      alt="The above text describes this graphic.">
     <p>The minimum set of methods for layout are:
     <ul>
-    <li><a href="#getMinimumSpan(int)">getMinimumSpan</a>
-    <li><a href="#getPreferredSpan(int)">getPreferredSpan</a>
-    <li><a href="#getMaximumSpan(int)">getMaximumSpan</a>
-    <li><a href="#getAlignment(int)">getAlignment</a>
-    <li><a href="#preferenceChanged(javax.swing.text.View, boolean, boolean)">preferenceChanged</a>
-    <li><a href="#setSize(float, float)">setSize</a>
+    <li>{@link #getMinimumSpan(int) getMinimumSpan}
+    <li>{@link #getPreferredSpan(int) getPreferredSpan}
+    <li>{@link #getMaximumSpan(int) getMaximumSpan}
+    <li>{@link #getAlignment(int) getAlignment}
+    <li>{@link #preferenceChanged(javax.swing.text.View, boolean, boolean) preferenceChanged}
+    <li>{@link #setSize(float, float) setSize}
     </ul>
 
   <p>The <code>setSize</code> method should be prepared to be called a number of times
@@ -142,7 +142,7 @@
     </ul>
     <p>The methods for rendering are:
     <ul>
-    <li><a href="#paint(java.awt.Graphics, java.awt.Shape)">paint</a>
+    <li>{@link #paint(java.awt.Graphics, java.awt.Shape) paint}
     </ul>
     <p>
 
@@ -153,12 +153,12 @@
     to perform translation to properly locate spatial representation of the model.
     The methods for doing this are:
     <ul>
-    <li><a href="#modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape)">modelToView</a>
-    <li><a href="#viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])">viewToModel</a>
-    <li><a href="#getDocument()">getDocument</a>
-    <li><a href="#getElement()">getElement</a>
-    <li><a href="#getStartOffset()">getStartOffset</a>
-    <li><a href="#getEndOffset()">getEndOffset</a>
+    <li>{@link #modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) modelToView}
+    <li>{@link #viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) viewToModel}
+    <li>{@link #getDocument() getDocument}
+    <li>{@link #getElement() getElement}
+    <li>{@link #getStartOffset() getStartOffset}
+    <li>{@link #getEndOffset() getEndOffset}
     </ul>
     <p>The layout must be valid prior to attempting to make the translation.
     The translation is not valid, and must not be attempted while changes
@@ -1137,32 +1137,9 @@
      */
     protected void forwardUpdate(DocumentEvent.ElementChange ec,
                                       DocumentEvent e, Shape a, ViewFactory f) {
-        Element elem = getElement();
-        int pos = e.getOffset();
-        int index0 = getViewIndex(pos, Position.Bias.Forward);
-        if (index0 == -1 && e.getType() == DocumentEvent.EventType.REMOVE &&
-            pos >= getEndOffset()) {
-            // Event beyond our offsets. We may have represented this, that is
-            // the remove may have removed one of our child Elements that
-            // represented this, so, we should foward to last element.
-            index0 = getViewCount() - 1;
-        }
-        int index1 = index0;
-        View v = (index0 >= 0) ? getView(index0) : null;
-        if (v != null) {
-            if ((v.getStartOffset() == pos) && (pos > 0)) {
-                // If v is at a boundary, forward the event to the previous
-                // view too.
-                index0 = Math.max(index0 - 1, 0);
-            }
-        }
-        if (e.getType() != DocumentEvent.EventType.REMOVE) {
-            index1 = getViewIndex(pos + e.getLength(), Position.Bias.Forward);
-            if (index1 < 0) {
-                index1 = getViewCount() - 1;
-            }
-        }
-        int hole0 = index1 + 1;
+        calculateUpdateIndexes(e);
+
+        int hole0 = lastUpdateIndex + 1;
         int hole1 = hole0;
         Element[] addedElems = (ec != null) ? ec.getChildrenAdded() : null;
         if ((addedElems != null) && (addedElems.length > 0)) {
@@ -1173,11 +1150,9 @@
         // forward to any view not in the forwarding hole
         // formed by added elements (i.e. they will be updated
         // by initialization.
-        index0 = Math.max(index0, 0);
-        index1 = Math.max((getViewCount() - 1), 0);
-        for (int i = index0; i <= index1; i++) {
+        for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) {
             if (! ((i >= hole0) && (i <= hole1))) {
-                v = getView(i);
+                View v = getView(i);
                 if (v != null) {
                     Shape childAlloc = getChildAllocation(i, a);
                     forwardUpdateToView(v, e, childAlloc, f);
@@ -1187,6 +1162,39 @@
     }
 
     /**
+     * Calculates the first and the last indexes of the child views
+     * that need to be notified of the change to the model.
+     * @param e the change information from the associated document
+     */
+    void calculateUpdateIndexes(DocumentEvent e) {
+        int pos = e.getOffset();
+        firstUpdateIndex = getViewIndex(pos, Position.Bias.Forward);
+        if (firstUpdateIndex == -1 && e.getType() == DocumentEvent.EventType.REMOVE &&
+            pos >= getEndOffset()) {
+            // Event beyond our offsets. We may have represented this, that is
+            // the remove may have removed one of our child Elements that
+            // represented this, so, we should forward to last element.
+            firstUpdateIndex = getViewCount() - 1;
+        }
+        lastUpdateIndex = firstUpdateIndex;
+        View v = (firstUpdateIndex >= 0) ? getView(firstUpdateIndex) : null;
+        if (v != null) {
+            if ((v.getStartOffset() == pos) && (pos > 0)) {
+                // If v is at a boundary, forward the event to the previous
+                // view too.
+                firstUpdateIndex = Math.max(firstUpdateIndex - 1, 0);
+            }
+        }
+        if (e.getType() != DocumentEvent.EventType.REMOVE) {
+            lastUpdateIndex = getViewIndex(pos + e.getLength(), Position.Bias.Forward);
+            if (lastUpdateIndex < 0) {
+                lastUpdateIndex = getViewCount() - 1;
+            }
+        }
+        firstUpdateIndex = Math.max(firstUpdateIndex, 0);
+    }
+
+    /**
      * Forwards the <code>DocumentEvent</code> to the give child view.  This
      * simply messages the view with a call to <code>insertUpdate</code>,
      * <code>removeUpdate</code>, or <code>changedUpdate</code> depending
@@ -1345,4 +1353,14 @@
     private View parent;
     private Element elem;
 
+    /**
+     * The index of the first child view to be notified.
+     */
+    int firstUpdateIndex;
+
+    /**
+     * The index of the last child view to be notified.
+     */
+    int lastUpdateIndex;
+
 };
--- a/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -93,11 +93,11 @@
      * <code>drawSelectedText</code> so that the way selected and
      * unselected text are rendered can be customized.
      *
-     * @param p0 the starting document location to use >= 0
-     * @param p1 the ending document location to use >= p1
+     * @param p0 the starting document location to use &gt;= 0
+     * @param p1 the ending document location to use &gt;= p1
      * @param g the graphics context
-     * @param x the starting X position >= 0
-     * @param y the starting Y position >= 0
+     * @param x the starting X position &gt;= 0
+     * @param y the starting Y position &gt;= 0
      * @see #drawUnselectedText
      * @see #drawSelectedText
      */
@@ -165,11 +165,11 @@
      * text.
      *
      * @param g the graphics context
-     * @param x the starting X coordinate >= 0
-     * @param y the starting Y coordinate >= 0
-     * @param p0 the beginning position in the model >= 0
-     * @param p1 the ending position in the model >= p0
-     * @return the X location of the end of the range >= 0
+     * @param x the starting X coordinate &gt;= 0
+     * @param y the starting Y coordinate &gt;= 0
+     * @param p0 the beginning position in the model &gt;= 0
+     * @param p1 the ending position in the model &gt;= p0
+     * @return the X location of the end of the range &gt;= 0
      * @exception BadLocationException if the range is invalid
      */
     protected int drawUnselectedText(Graphics g, int x, int y,
@@ -190,10 +190,10 @@
      * the selected background.
      *
      * @param g the graphics context
-     * @param x the starting X coordinate >= 0
-     * @param y the starting Y coordinate >= 0
-     * @param p0 the beginning position in the model >= 0
-     * @param p1 the ending position in the model >= p0
+     * @param x the starting X coordinate &gt;= 0
+     * @param y the starting Y coordinate &gt;= 0
+     * @param p0 the beginning position in the model &gt;= 0
+     * @param p1 the ending position in the model &gt;= p0
      * @return the location of the end of the range.
      * @exception BadLocationException if the range is invalid
      */
@@ -326,10 +326,10 @@
      * This implementation does not support things like centering so it
      * ignores the tabOffset argument.
      *
-     * @param x the current position >= 0
+     * @param x the current position &gt;= 0
      * @param tabOffset the position within the text stream
-     *   that the tab occurred at >= 0.
-     * @return the tab stop, measured in points >= 0
+     *   that the tab occurred at &gt;= 0.
+     * @return the tab stop, measured in points &gt;= 0
      */
     public float nextTabStop(float x, int tabOffset) {
         if (tabSize == 0)
@@ -374,8 +374,8 @@
      * layout of the view along the given axis, if it
      * has any layout duties.
      *
-     * @param width the width >= 0
-     * @param height the height >= 0
+     * @param width the width &gt;= 0
+     * @param height the height &gt;= 0
      */
     public void setSize(float width, float height) {
         updateMetrics();
--- a/jdk/src/share/classes/javax/swing/text/ZoneView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/ZoneView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -130,7 +130,7 @@
      *
      * @param mzl the desired maximum number of zones
      *  to be actively loaded, must be greater than 0
-     * @exception IllegalArgumentException if <code>mzl</code> is < 1
+     * @exception IllegalArgumentException if <code>mzl</code> is &lt; 1
      */
     public void setMaxZonesLoaded(int mzl) {
         if (mzl < 1) {
@@ -198,11 +198,11 @@
      * implementation for a zone by changing this method.
      *
      * @param p0 the start of the desired zone.  This should
-     *  be >= getStartOffset() and < getEndOffset().  This
-     *  value should also be < p1.
+     *  be &gt;= getStartOffset() and &lt; getEndOffset().  This
+     *  value should also be &lt; p1.
      * @param p1 the end of the desired zone.  This should
-     *  be > getStartOffset() and <= getEndOffset().  This
-     *  value should also be > p0.
+     *  be &gt; getStartOffset() and &lt;= getEndOffset().  This
+     *  value should also be &gt; p0.
      */
     protected View createZone(int p0, int p1) {
         Document doc = getDocument();
@@ -242,7 +242,7 @@
      * Returns the child view index representing the given position in
      * the model.
      *
-     * @param pos the position >= 0
+     * @param pos the position &gt;= 0
      * @return  index of the view representing the given position, or
      *   -1 if no view represents that position
      */
--- a/jdk/src/share/classes/javax/swing/text/html/BlockView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/BlockView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -352,7 +352,7 @@
      *
      * @param axis may be either <code>View.X_AXIS</code>
      *           or <code>View.Y_AXIS</code>
-     * @return   the span the view would like to be rendered into >= 0;
+     * @return   the span the view would like to be rendered into &gt;= 0;
      *           typically the view is told to render into the span
      *           that is returned, although there is no guarantee;
      *           the parent may choose to resize or break the view
@@ -368,7 +368,7 @@
      *
      * @param axis may be either <code>View.X_AXIS</code>
      *           or <code>View.Y_AXIS</code>
-     * @return  the span the view would like to be rendered into >= 0;
+     * @return  the span the view would like to be rendered into &gt;= 0;
      *           typically the view is told to render into the span
      *           that is returned, although there is no guarantee;
      *           the parent may choose to resize or break the view
@@ -384,7 +384,7 @@
      *
      * @param axis may be either <code>View.X_AXIS</code>
      *           or <code>View.Y_AXIS</code>
-     * @return   the span the view would like to be rendered into >= 0;
+     * @return   the span the view would like to be rendered into &gt;= 0;
      *           typically the view is told to render into the span
      *           that is returned, although there is no guarantee;
      *           the parent may choose to resize or break the view
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java	Fri Oct 11 09:17:18 2013 -0400
@@ -117,7 +117,7 @@
  * </ul>
  * <p><b>Note: for the time being we do not fully support relative units,
  * unless noted, so that
- * p { margin-top: 10% } will be treated as if no margin-top was specified.
+ * p { margin-top: 10% } will be treated as if no margin-top was specified.</b>
  *
  * @author  Timothy Prinzing
  * @author  Scott Violet
--- a/jdk/src/share/classes/javax/swing/text/html/FormView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -380,7 +380,7 @@
      * axis of interest.
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
-     * @return   the span the view would like to be rendered into >= 0.
+     * @return   the span the view would like to be rendered into &gt;= 0.
      *           Typically the view is told to render into the span
      *           that is returned, although there is no guarantee.
      *           The parent may choose to resize or break the view.
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java	Fri Oct 11 09:17:18 2013 -0400
@@ -107,21 +107,21 @@
  * <p>With the following HTML content:</p>
  *
  * <pre>
- * &lt;html>
- *   &lt;head>
- *     &lt;title>An example HTMLDocument&lt;/title>
- *     &lt;style type="text/css">
+ * &lt;html&gt;
+ *   &lt;head&gt;
+ *     &lt;title&gt;An example HTMLDocument&lt;/title&gt;
+ *     &lt;style type="text/css"&gt;
  *       div { background-color: silver; }
  *       ul { color: red; }
- *     &lt;/style>
- *   &lt;/head>
- *   &lt;body>
- *     &lt;div id="BOX">
- *       &lt;p>Paragraph 1&lt;/p>
- *       &lt;p>Paragraph 2&lt;/p>
- *     &lt;/div>
- *   &lt;/body>
- * &lt;/html>
+ *     &lt;/style&gt;
+ *   &lt;/head&gt;
+ *   &lt;body&gt;
+ *     &lt;div id="BOX"&gt;
+ *       &lt;p&gt;Paragraph 1&lt;/p&gt;
+ *       &lt;p&gt;Paragraph 2&lt;/p&gt;
+ *     &lt;/div&gt;
+ *   &lt;/body&gt;
+ * &lt;/html&gt;
  * </pre>
  *
  * <p>All the methods for modifying an HTML document require an {@link
@@ -149,10 +149,10 @@
  * of any non-leaf element by using the methods
  * <code>insertAfterStart</code> and <code>insertBeforeEnd</code>.
  * For example, if <code>e</code> is the <code>DIV</code> element,
- * <code>d.insertAfterStart(e, "&lt;ul>&lt;li>List
- * Item&lt;/li>&lt;/ul>")</code> inserts the list before the first
- * paragraph, and <code>d.insertBeforeEnd(e, "&lt;ul>&lt;li>List
- * Item&lt;/li>&lt;/ul>")</code> inserts the list after the last
+ * <code>d.insertAfterStart(e, "&lt;ul&gt;&lt;li&gt;List
+ * Item&lt;/li&gt;&lt;/ul&gt;")</code> inserts the list before the first
+ * paragraph, and <code>d.insertBeforeEnd(e, "&lt;ul&gt;&lt;li&gt;List
+ * Item&lt;/li&gt;&lt;/ul&gt;")</code> inserts the list after the last
  * paragraph.  The <code>DIV</code> block becomes the parent of the
  * newly inserted elements.</p>
  *
@@ -160,9 +160,9 @@
  * using the methods <code>insertBeforeStart</code> and
  * <code>insertAfterEnd</code>.  For example, if <code>e</code> is the
  * <code>DIV</code> element, <code>d.insertBeforeStart(e,
- * "&lt;ul>&lt;li>List Item&lt;/li>&lt;/ul>")</code> inserts the list
+ * "&lt;ul&gt;&lt;li&gt;List Item&lt;/li&gt;&lt;/ul&gt;")</code> inserts the list
  * before the <code>DIV</code> element, and <code>d.insertAfterEnd(e,
- * "&lt;ul>&lt;li>List Item&lt;/li>&lt;/ul>")</code> inserts the list
+ * "&lt;ul&gt;&lt;li&gt;List Item&lt;/li&gt;&lt;/ul&gt;")</code> inserts the list
  * after the <code>DIV</code> element.  The newly inserted elements
  * become siblings of the <code>DIV</code> element.</p>
  *
@@ -171,10 +171,10 @@
  * <p>Elements and all their descendants can be replaced by using the
  * methods <code>setInnerHTML</code> and <code>setOuterHTML</code>.
  * For example, if <code>e</code> is the <code>DIV</code> element,
- * <code>d.setInnerHTML(e, "&lt;ul>&lt;li>List
- * Item&lt;/li>&lt;/ul>")</code> replaces all children paragraphs with
- * the list, and <code>d.setOuterHTML(e, "&lt;ul>&lt;li>List
- * Item&lt;/li>&lt;/ul>")</code> replaces the <code>DIV</code> element
+ * <code>d.setInnerHTML(e, "&lt;ul&gt;&lt;li&gt;List
+ * Item&lt;/li&gt;&lt;/ul&gt;")</code> replaces all children paragraphs with
+ * the list, and <code>d.setOuterHTML(e, "&lt;ul&gt;&lt;li&gt;List
+ * Item&lt;/li&gt;&lt;/ul&gt;")</code> replaces the <code>DIV</code> element
  * itself.  In latter case the parent of the list is the
  * <code>BODY</code> element.
  *
@@ -184,6 +184,7 @@
  * of various methods described above.</p>
  *
  * <table border=1 cellspacing=0>
+ *   <caption></caption>
  *   <tr>
  *     <th>Example</th>
  *     <th><code>insertAfterStart</code></th>
@@ -985,25 +986,25 @@
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
-     *     &lt;body>
+     *     &lt;body&gt;
      *       |
-     *     <b>&lt;div></b>
+     *     <b>&lt;div&gt;</b>
      *      /  \
-     *    &lt;p>   &lt;p>
+     *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>setInnerHTML(elem, "&lt;ul>&lt;li>")</code>
+     * <p>Invoking <code>setInnerHTML(elem, "&lt;ul&gt;&lt;li&gt;")</code>
      * results in the following structure (new elements are <font
      * color="red">in red</font>).</p>
      *
      * <pre>
-     *     &lt;body>
+     *     &lt;body&gt;
      *       |
-     *     <b>&lt;div></b>
+     *     <b>&lt;div&gt;</b>
      *         \
-     *         <font color="red">&lt;ul></font>
+     *         <font color="red">&lt;ul&gt;</font>
      *           \
-     *           <font color="red">&lt;li></font>
+     *           <font color="red">&lt;li&gt;</font>
      * </pre>
      *
      * <p>Parameter <code>elem</code> must not be a leaf element,
@@ -1066,23 +1067,23 @@
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
-     *     &lt;body>
+     *     &lt;body&gt;
      *       |
-     *     <b>&lt;div></b>
+     *     <b>&lt;div&gt;</b>
      *      /  \
-     *    &lt;p>   &lt;p>
+     *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>setOuterHTML(elem, "&lt;ul>&lt;li>")</code>
+     * <p>Invoking <code>setOuterHTML(elem, "&lt;ul&gt;&lt;li&gt;")</code>
      * results in the following structure (new elements are <font
      * color="red">in red</font>).</p>
      *
      * <pre>
-     *    &lt;body>
+     *    &lt;body&gt;
      *      |
-     *     <font color="red">&lt;ul></font>
+     *     <font color="red">&lt;ul&gt;</font>
      *       \
-     *       <font color="red">&lt;li></font>
+     *       <font color="red">&lt;li&gt;</font>
      * </pre>
      *
      * <p>If either <code>elem</code> or <code>htmlText</code>
@@ -1136,25 +1137,25 @@
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
-     *     &lt;body>
+     *     &lt;body&gt;
      *       |
-     *     <b>&lt;div></b>
+     *     <b>&lt;div&gt;</b>
      *      /  \
-     *    &lt;p>   &lt;p>
+     *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
      * <p>Invoking <code>insertAfterStart(elem,
-     * "&lt;ul>&lt;li>")</code> results in the following structure
+     * "&lt;ul&gt;&lt;li&gt;")</code> results in the following structure
      * (new elements are <font color="red">in red</font>).</p>
      *
      * <pre>
-     *        &lt;body>
+     *        &lt;body&gt;
      *          |
-     *        <b>&lt;div></b>
+     *        <b>&lt;div&gt;</b>
      *       /  |  \
-     *    <font color="red">&lt;ul></font> &lt;p> &lt;p>
+     *    <font color="red">&lt;ul&gt;</font> &lt;p&gt; &lt;p&gt;
      *     /
-     *  <font color="red">&lt;li></font>
+     *  <font color="red">&lt;li&gt;</font>
      * </pre>
      *
      * <p>Unlike the <code>insertBeforeStart</code> method, new
@@ -1206,25 +1207,25 @@
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
-     *     &lt;body>
+     *     &lt;body&gt;
      *       |
-     *     <b>&lt;div></b>
+     *     <b>&lt;div&gt;</b>
      *      /  \
-     *    &lt;p>   &lt;p>
+     *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>insertBeforeEnd(elem, "&lt;ul>&lt;li>")</code>
+     * <p>Invoking <code>insertBeforeEnd(elem, "&lt;ul&gt;&lt;li&gt;")</code>
      * results in the following structure (new elements are <font
      * color="red">in red</font>).</p>
      *
      * <pre>
-     *        &lt;body>
+     *        &lt;body&gt;
      *          |
-     *        <b>&lt;div></b>
+     *        <b>&lt;div&gt;</b>
      *       /  |  \
-     *     &lt;p> &lt;p> <font color="red">&lt;ul></font>
+     *     &lt;p&gt; &lt;p&gt; <font color="red">&lt;ul&gt;</font>
      *               \
-     *               <font color="red">&lt;li></font>
+     *               <font color="red">&lt;li&gt;</font>
      * </pre>
      *
      * <p>Unlike the <code>insertAfterEnd</code> method, new elements
@@ -1273,23 +1274,23 @@
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
-     *     &lt;body>
+     *     &lt;body&gt;
      *       |
-     *     <b>&lt;div></b>
+     *     <b>&lt;div&gt;</b>
      *      /  \
-     *    &lt;p>   &lt;p>
+     *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
      * <p>Invoking <code>insertBeforeStart(elem,
-     * "&lt;ul>&lt;li>")</code> results in the following structure
+     * "&lt;ul&gt;&lt;li&gt;")</code> results in the following structure
      * (new elements are <font color="red">in red</font>).</p>
      *
      * <pre>
-     *        &lt;body>
+     *        &lt;body&gt;
      *         /  \
-     *      <font color="red">&lt;ul></font> <b>&lt;div></b>
+     *      <font color="red">&lt;ul&gt;</font> <b>&lt;div&gt;</b>
      *       /    /  \
-     *     <font color="red">&lt;li></font> &lt;p>  &lt;p>
+     *     <font color="red">&lt;li&gt;</font> &lt;p&gt;  &lt;p&gt;
      * </pre>
      *
      * <p>Unlike the <code>insertAfterStart</code> method, new
@@ -1331,23 +1332,23 @@
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
-     *     &lt;body>
+     *     &lt;body&gt;
      *       |
-     *     <b>&lt;div></b>
+     *     <b>&lt;div&gt;</b>
      *      /  \
-     *    &lt;p>   &lt;p>
+     *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>insertAfterEnd(elem, "&lt;ul>&lt;li>")</code>
+     * <p>Invoking <code>insertAfterEnd(elem, "&lt;ul&gt;&lt;li&gt;")</code>
      * results in the following structure (new elements are <font
      * color="red">in red</font>).</p>
      *
      * <pre>
-     *        &lt;body>
+     *        &lt;body&gt;
      *         /  \
-     *      <b>&lt;div></b> <font color="red">&lt;ul></font>
+     *      <b>&lt;div&gt;</b> <font color="red">&lt;ul&gt;</font>
      *       / \    \
-     *     &lt;p> &lt;p>  <font color="red">&lt;li></font>
+     *     &lt;p&gt; &lt;p&gt;  <font color="red">&lt;li&gt;</font>
      * </pre>
      *
      * <p>Unlike the <code>insertBeforeEnd</code> method, new elements
@@ -2166,7 +2167,7 @@
      * <tr><td><code>HTML.Tag.VAR</code>       <td>CharacterAction
      * </table>
      * <p>
-     * Once &lt;/html> is encountered, the Actions are no longer notified.
+     * Once &lt;/html&gt; is encountered, the Actions are no longer notified.
      */
     public class HTMLReader extends HTMLEditorKit.ParserCallback {
 
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,7 +55,6 @@
  * an effect upon the way that HTML is modeled.  These
  * have influenced its design in a substantial way.
  * <dl>
- * <p>
  * <dt>
  * Support editing
  * <dd>
--- a/jdk/src/share/classes/javax/swing/text/html/ImageView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/ImageView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -554,8 +554,8 @@
      * Sets the size of the view.  This should cause
      * layout of the view if it has any layout duties.
      *
-     * @param width the width >= 0
-     * @param height the height >= 0
+     * @param width the width &gt;= 0
+     * @param height the height &gt;= 0
      */
     public void setSize(float width, float height) {
         sync();
--- a/jdk/src/share/classes/javax/swing/text/html/InlineView.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/InlineView.java	Fri Oct 11 09:17:18 2013 -0400
@@ -130,10 +130,10 @@
      *
      * @param axis may be either View.X_AXIS or View.Y_AXIS
      * @param pos the potential location of the start of the
-     *   broken view >= 0.  This may be useful for calculating tab
+     *   broken view &gt;= 0.  This may be useful for calculating tab
      *   positions.
      * @param len specifies the relative length from <em>pos</em>
-     *   where a potential break is desired >= 0.
+     *   where a potential break is desired &gt;= 0.
      * @return the weight, which should be a value between
      *   ForcedBreakWeight and BadBreakWeight.
      * @see LabelView
@@ -162,14 +162,14 @@
      * @param axis may be either <code>View.X_AXIS</code> or
      *          <code>View.Y_AXIS</code>
      * @param offset the location in the document model
-     *   that a broken fragment would occupy >= 0.  This
+     *   that a broken fragment would occupy &gt;= 0.  This
      *   would be the starting offset of the fragment
      *   returned
      * @param pos the position along the axis that the
-     *  broken view would occupy >= 0.  This may be useful for
+     *  broken view would occupy &gt;= 0.  This may be useful for
      *  things like tab calculations
      * @param len specifies the distance along the axis
-     *  where a potential break is desired >= 0
+     *  where a potential break is desired &gt;= 0
      * @return the fragment of the view that represents the
      *  given span.
      * @since 1.5
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Fri Oct 11 09:17:18 2013 -0400
@@ -74,7 +74,7 @@
  * is stored to translate the context of an element to a
  * rule quickly.  The following code fragment will display
  * the named styles, and therefore the CSS rules contained.
- * <code><pre>
+ * <pre><code>
  * &nbsp;
  * &nbsp; import java.util.*;
  * &nbsp; import javax.swing.text.*;
@@ -97,7 +97,7 @@
  * &nbsp;     }
  * &nbsp; }
  * &nbsp;
- * </pre></code>
+ * </code></pre>
  * <p>
  * The semantics for when a CSS style should overide visual attributes
  * defined by an element are not well defined. For example, the html
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,7 +42,7 @@
  */
 public final class ContentModel implements Serializable {
     /**
-     * Type. Either '*', '?', '+', ',', '|', '&'.
+     * Type. Either '*', '?', '+', ',', '|', '&amp;'.
      */
     public int type;
 
@@ -52,7 +52,7 @@
     public Object content;
 
     /**
-     * The next content model (in a ',', '|' or '&' expression).
+     * The next content model (in a ',', '|' or '&amp;' expression).
      */
     public ContentModel next;
 
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DocumentParser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DocumentParser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -48,8 +48,8 @@
  *     <li><i>handleStartTag(head, ...)</i></li>
  *     <li><i>handleEndTag(head)</i></li>
  *     <li><i>handleStartTag(body, ...)</i></li>
- *     <li>handleStartTag(p, ...)</i></li>
- *     <li>handleText(...)</li>
+ *     <li><i>handleStartTag(p, ...)</i></li>
+ *     <li><i>handleText(...)</i></li>
  *     <li><i>handleEndTag(p)</i></li>
  *     <li><i>handleEndTag(body)</i></li>
  *     <li><i>handleEndTag(html)</i></li>
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -58,12 +58,12 @@
  * space should be used here, but I am using &amp;nbsp to force the space to
  * be displayed):
  * <p>
- * '&lt;b>blah&nbsp;&lt;i>&nbsp;&lt;strike>&nbsp;foo' which can be treated as:
- * '&lt;b>blah&nbsp;&lt;i>&lt;strike>foo'
+ * '&lt;b&gt;blah&nbsp;&lt;i&gt;&nbsp;&lt;strike&gt;&nbsp;foo' which can be treated as:
+ * '&lt;b&gt;blah&nbsp;&lt;i&gt;&lt;strike&gt;foo'
  * <p>as well as:
- * '&lt;p>&lt;a href="xx">&nbsp;&lt;em>Using&lt;/em>&lt;/a>&lt;/p>'
+ * '&lt;p&gt;&lt;a href="xx"&gt;&nbsp;&lt;em&gt;Using&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;'
  * which appears to be treated as:
- * '&lt;p>&lt;a href="xx">&lt;em>Using&lt;/em>&lt;/a>&lt;/p>'
+ * '&lt;p&gt;&lt;a href="xx"&gt;&lt;em&gt;Using&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;'
  * <p>
  * If <code>strict</code> is false, when a tag that breaks flow,
  * (<code>TagElement.breaksFlows</code>) or trailing whitespace is
--- a/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java	Fri Oct 11 09:17:18 2013 -0400
@@ -60,7 +60,7 @@
     protected boolean            rootVisible;
 
     /**
-      * Height to use for each row.  If this is <= 0 the renderer will be
+      * Height to use for each row.  If this is &lt;= 0 the renderer will be
       * used to determine the height for each row.
       */
     protected int                rowHeight;
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -430,7 +430,7 @@
 
     /**
      * Returns true if <code>event</code> is <code>null</code>,
-     * or it is a <code>MouseEvent</code> with a click count > 2
+     * or it is a <code>MouseEvent</code> with a click count &gt; 2
      * and <code>inHitRegion</code> returns true.
      * @param event the event being studied
      */
@@ -448,7 +448,7 @@
     /**
      * Returns true if the passed in location is a valid mouse location
      * to start editing from. This is implemented to return false if
-     * <code>x</code> is <= the width of the icon and icon gap displayed
+     * <code>x</code> is &lt;= the width of the icon and icon gap displayed
      * by the renderer. In other words this returns true if the user
      * clicks over the text part displayed by the renderer, and false
      * otherwise.
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -60,8 +60,7 @@
  * that have a value of type {@code UIResource} are refreshed from the
  * defaults table. The following table lists the mapping between
  * {@code DefaultTreeCellRenderer} property and defaults table key:
- * <table border="1" cellpadding="1" cellspacing="0"
- *         valign="top" >
+ * <table border="1" cellpadding="1" cellspacing="0" summary="">
  *   <tr valign="top"  align="left">
  *     <th bgcolor="#CCCCFF" align="left">Property:
  *     <th bgcolor="#CCCCFF" align="left">Key:
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -164,8 +164,8 @@
      * Returns the child of <I>parent</I> at index <I>index</I> in the parent's
      * child array.  <I>parent</I> must be a node previously obtained from
      * this data source. This should not return null if <i>index</i>
-     * is a valid index for <i>parent</i> (that is <i>index</i> >= 0 &&
-     * <i>index</i> < getChildCount(<i>parent</i>)).
+     * is a valid index for <i>parent</i> (that is <i>index</i> &gt;= 0 &amp;&amp;
+     * <i>index</i> &lt; getChildCount(<i>parent</i>)).
      *
      * @param   parent  a node in the tree, obtained from this data source
      * @return  the child of <I>parent</I> at index <I>index</I>
--- a/jdk/src/share/classes/javax/swing/tree/TreeCellRenderer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/tree/TreeCellRenderer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -59,8 +59,8 @@
      * <pre>
      *     JTree.DropLocation dropLocation = tree.getDropLocation();
      *     if (dropLocation != null
-     *             && dropLocation.getChildIndex() == -1
-     *             && tree.getRowForPath(dropLocation.getPath()) == row) {
+     *             &amp;&amp; dropLocation.getChildIndex() == -1
+     *             &amp;&amp; tree.getRowForPath(dropLocation.getPath()) == row) {
      *
      *         // this row represents the current drop location
      *         // so render it specially, perhaps with a different color
--- a/jdk/src/share/classes/javax/swing/tree/TreeModel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/tree/TreeModel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -76,8 +76,8 @@
      * child array.  <code>parent</code> must be a node previously obtained
      * from this data source. This should not return <code>null</code>
      * if <code>index</code>
-     * is a valid index for <code>parent</code> (that is <code>index >= 0 &&
-     * index < getChildCount(parent</code>)).
+     * is a valid index for <code>parent</code> (that is <code>index &gt;= 0 &amp;&amp;
+     * index &lt; getChildCount(parent</code>)).
      *
      * @param   parent  a node in the tree, obtained from this data source
      * @return  the child of <code>parent</code> at index <code>index</code>
--- a/jdk/src/share/classes/javax/swing/undo/UndoManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/javax/swing/undo/UndoManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -57,9 +57,9 @@
  * and italicized are insignificant.
  * <p>
  * <a name="figure1"></a>
- * <table border=0>
+ * <table border=0 summary="">
  * <tr><td>
- *     <img src="doc-files/UndoManager-1.gif">
+ *     <img src="doc-files/UndoManager-1.gif" alt="">
  * <tr><td align=center>Figure 1
  * </table>
  * <p>
@@ -70,9 +70,9 @@
  * figure.
  * <p>
  * <a name="figure2"></a>
- * <table border=0>
+ * <table border=0 summary="">
  * <tr><td>
- *     <img src="doc-files/UndoManager-2.gif">
+ *     <img src="doc-files/UndoManager-2.gif" alt="">
  * <tr><td align=center>Figure 2
  * </table>
  * <p>
@@ -82,9 +82,9 @@
  * next edit to 0, as shown in the following figure.
  * <p>
  * <a name="figure3"></a>
- * <table border=0>
+ * <table border=0 summary="">
  * <tr><td>
- *     <img src="doc-files/UndoManager-3.gif">
+ *     <img src="doc-files/UndoManager-3.gif" alt="">
  * <tr><td align=center>Figure 3
  * </table>
  * <p>
@@ -108,9 +108,9 @@
  * figure.
  * <p>
  * <a name="figure4"></a>
- * <table border=0>
+ * <table border=0 summary="">
  * <tr><td>
- *     <img src="doc-files/UndoManager-4.gif">
+ *     <img src="doc-files/UndoManager-4.gif" alt="">
  * <tr><td align=center>Figure 4
  * </table>
  * <p>
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@
 import java.security.AccessControlContext;
 
 import java.io.File;
+import java.util.ResourceBundle;
 import java.util.Vector;
 
 /**
@@ -236,6 +237,11 @@
          */
         AccessControlContext getAccessControlContext(Component comp);
 
+        /**
+         * Revalidates the component synchronously.
+         */
+        void revalidateSynchronously(Component comp);
+
     }
 
     /*
@@ -246,6 +252,14 @@
          * Validates the container unconditionally.
          */
         void validateUnconditionally(Container cont);
+
+        /**
+         *
+         * Access to the private version of findComponentAt method which has
+         * a controllable behavior. Setting 'ignoreEnabled' to 'false'
+         * bypasses disabled Components during the search.
+         */
+        Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled);
     }
 
     /*
@@ -700,6 +714,13 @@
     }
 
     /*
+     * An accessor for the Toolkit class
+     */
+    public interface ToolkitAccessor {
+        void setPlatformResources(ResourceBundle bundle);
+    }
+
+    /*
      * Accessor instances are initialized in the static initializers of
      * corresponding AWT classes by using setters defined below.
      */
@@ -726,6 +747,7 @@
     private static TrayIconAccessor trayIconAccessor;
     private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
     private static SequencedEventAccessor sequencedEventAccessor;
+    private static ToolkitAccessor toolkitAccessor;
 
     /*
      * Set an accessor object for the java.awt.Component class.
@@ -1119,4 +1141,22 @@
         // (so not a single instance of the event has been created).
         return sequencedEventAccessor;
     }
+
+    /*
+     * Set an accessor object for the java.awt.Toolkit class.
+     */
+    public static void setToolkitAccessor(ToolkitAccessor ta) {
+        toolkitAccessor = ta;
+    }
+
+    /*
+     * Get the accessor object for the java.awt.Toolkit class.
+     */
+    public static ToolkitAccessor getToolkitAccessor() {
+        if (toolkitAccessor == null) {
+            unsafe.ensureClassInitialized(Toolkit.class);
+        }
+
+        return toolkitAccessor;
+    }
 }
--- a/jdk/src/share/classes/sun/awt/GlobalCursorManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/awt/GlobalCursorManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -134,7 +134,6 @@
      */
     protected abstract void getCursorPos(Point p);
 
-    protected abstract Component findComponentAt(Container con, int x, int y);
     protected abstract Point getLocationOnScreen(Component com);
 
     /**
@@ -190,9 +189,10 @@
             if (p != null) {
                 queryPos = new Point();
                 getCursorPos(queryPos);
-                Component c = findComponentAt((Container)comp,
-                                              queryPos.x - p.x,
-                                              queryPos.y - p.y);
+                Component c = AWTAccessor.getContainerAccessor().
+                        findComponentAt((Container) comp,
+                        queryPos.x - p.x, queryPos.y - p.y, false);
+
                 // If findComponentAt returns null, then something bad has
                 // happened. For example, the heavyweight Component may
                 // have been hidden or disabled by another thread. In that
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1765,7 +1765,14 @@
             Reader reader = new InputStreamReader(is, unicode);
 
             theObject = constructFlavoredObject(reader, flavor, Reader.class);
-
+            // Target data is a byte array
+        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+            if(isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
+                theObject = translateBytesToString(inputStreamToByteArray(str), format, localeTransferable)
+                        .getBytes(DataTransferer.getTextCharset(flavor));
+            } else {
+                theObject = inputStreamToByteArray(str);
+            }
             // Target data is an RMI object
         } else if (flavor.isRepresentationClassRemote()) {
 
--- a/jdk/src/share/classes/sun/instrument/InstrumentationImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/instrument/InstrumentationImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -170,11 +170,13 @@
         redefineClasses0(mNativeAgent, definitions);
     }
 
+    @SuppressWarnings("rawtypes")
     public Class[]
     getAllLoadedClasses() {
         return getAllLoadedClasses0(mNativeAgent);
     }
 
+    @SuppressWarnings("rawtypes")
     public Class[]
     getInitiatedClasses(ClassLoader loader) {
         return getInitiatedClasses0(mNativeAgent, loader);
@@ -255,9 +257,11 @@
     redefineClasses0(long nativeAgent, ClassDefinition[]  definitions)
         throws  ClassNotFoundException;
 
+    @SuppressWarnings("rawtypes")
     private native Class[]
     getAllLoadedClasses0(long nativeAgent);
 
+    @SuppressWarnings("rawtypes")
     private native Class[]
     getInitiatedClasses0(long nativeAgent, ClassLoader loader);
 
--- a/jdk/src/share/classes/sun/invoke/WrapperInstance.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/invoke/WrapperInstance.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,7 +30,7 @@
 /**
  * Private API used inside of java.lang.invoke.MethodHandles.
  * Interface implemented by every object which is produced by
- * {@link java.lang.invoke.MethodHandles#asInstance MethodHandles.asInstance}.
+ * {@link java.lang.invoke.MethodHandleProxies#asInterfaceInstance MethodHandleProxies.asInterfaceInstance}.
  * The methods of this interface allow a caller to recover the parameters
  * to {@code asInstance}.
  * This allows applications to repeatedly convert between method handles
--- a/jdk/src/share/classes/sun/invoke/util/ValueConversions.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/invoke/util/ValueConversions.java	Fri Oct 11 09:17:18 2013 -0400
@@ -502,51 +502,6 @@
         }
     }
 
-    static MethodHandle collectArguments(MethodHandle mh, int pos, MethodHandle collector) {
-        // FIXME: API needs public MHs.collectArguments.
-        // Should be:
-        //   return MethodHandles.collectArguments(mh, 0, collector);
-        // The rest of this code is a workaround for not having that API.
-        if (COLLECT_ARGUMENTS != null) {
-            try {
-                return (MethodHandle)
-                    COLLECT_ARGUMENTS.invokeExact(mh, pos, collector);
-            } catch (Throwable ex) {
-                if (ex instanceof RuntimeException)
-                    throw (RuntimeException) ex;
-                if (ex instanceof Error)
-                    throw (Error) ex;
-                throw new Error(ex.getMessage(), ex);
-            }
-        }
-        // Emulate MHs.collectArguments using fold + drop.
-        // This is slightly inefficient.
-        // More seriously, it can put a MH over the 255-argument limit.
-        mh = MethodHandles.dropArguments(mh, 1, collector.type().parameterList());
-        mh = MethodHandles.foldArguments(mh, collector);
-        return mh;
-    }
-    private static final MethodHandle COLLECT_ARGUMENTS;
-    static {
-        MethodHandle mh = null;
-        try {
-            final java.lang.reflect.Method m = MethodHandles.class
-                .getDeclaredMethod("collectArguments",
-                    MethodHandle.class, int.class, MethodHandle.class);
-            AccessController.doPrivileged(new PrivilegedAction<Void>() {
-                    @Override
-                    public Void run() {
-                        m.setAccessible(true);
-                        return null;
-                    }
-                });
-            mh = IMPL_LOOKUP.unreflect(m);
-        } catch (ReflectiveOperationException ex) {
-            throw newInternalError(ex);
-        }
-        COLLECT_ARGUMENTS = mh;
-    }
-
     private static final EnumMap<Wrapper, MethodHandle>[] WRAPPER_CASTS
             = newWrapperCaches(1);
 
@@ -1050,12 +1005,12 @@
             if (mh == ARRAY_IDENTITY)
                 mh = rightFiller;
             else
-                mh = collectArguments(mh, 0, rightFiller);
+                mh = MethodHandles.collectArguments(mh, 0, rightFiller);
         }
         if (mh == ARRAY_IDENTITY)
             mh = leftCollector;
         else
-            mh = collectArguments(mh, 0, leftCollector);
+            mh = MethodHandles.collectArguments(mh, 0, leftCollector);
         return mh;
     }
 
@@ -1101,7 +1056,7 @@
         if (midLen == LEFT_ARGS)
             return rightFill;
         else
-            return collectArguments(rightFill, 0, midFill);
+            return MethodHandles.collectArguments(rightFill, 0, midFill);
     }
 
     // Type-polymorphic version of varargs maker.
--- a/jdk/src/share/classes/sun/invoke/util/VerifyAccess.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/invoke/util/VerifyAccess.java	Fri Oct 11 09:17:18 2013 -0400
@@ -172,7 +172,7 @@
      * Decide if the given method type, attributed to a member or symbolic
      * reference of a given reference class, is really visible to that class.
      * @param type the supposed type of a member or symbolic reference of refc
-     * @param refc
+     * @param refc the class attempting to make the reference
      */
     public static boolean isTypeVisible(Class<?> type, Class<?> refc) {
         if (type == refc)  return true;  // easy check
@@ -197,7 +197,7 @@
      * Decide if the given method type, attributed to a member or symbolic
      * reference of a given reference class, is really visible to that class.
      * @param type the supposed type of a member or symbolic reference of refc
-     * @param refc
+     * @param refc the class attempting to make the reference
      */
     public static boolean isTypeVisible(java.lang.invoke.MethodType type, Class<?> refc) {
         for (int n = -1, max = type.parameterCount(); n < max; n++) {
@@ -210,8 +210,8 @@
 
     /**
      * Test if two classes have the same class loader and package qualifier.
-     * @param class1
-     * @param class2
+     * @param class1 a class
+     * @param class2 another class
      * @return whether they are in the same package
      */
     public static boolean isSamePackage(Class<?> class1, Class<?> class2) {
@@ -244,8 +244,8 @@
     /**
      * Test if two classes are defined as part of the same package member (top-level class).
      * If this is true, they can share private access with each other.
-     * @param class1
-     * @param class2
+     * @param class1 a class
+     * @param class2 another class
      * @return whether they are identical or nested together
      */
     public static boolean isSamePackageMember(Class<?> class1, Class<?> class2) {
@@ -287,8 +287,8 @@
     /**
      * Is the class loader of parentClass identical to, or an ancestor of,
      * the class loader of childClass?
-     * @param parentClass
-     * @param childClass
+     * @param parentClass a class
+     * @param childClass another class, which may be a descendent of the first class
      * @return whether parentClass precedes or equals childClass in class loader order
      */
     public static boolean classLoaderIsAncestor(Class<?> parentClass, Class<?> childClass) {
--- a/jdk/src/share/classes/sun/invoke/util/VerifyType.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/invoke/util/VerifyType.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,8 +41,8 @@
      * True if a value can be stacked as the source type and unstacked as the
      * destination type, without violating the JVM's type consistency.
      *
-     * @param call the type of a stacked value
-     * @param recv the type by which we'd like to treat it
+     * @param src the type of a stacked value
+     * @param dst the type by which we'd like to treat it
      * @return whether the retyping can be done without motion or reformatting
      */
     public static boolean isNullConversion(Class<?> src, Class<?> dst) {
@@ -67,9 +67,8 @@
 
     /**
      * Specialization of isNullConversion to reference types.
-
-     * @param call the type of a stacked value
-     * @param recv the reference type by which we'd like to treat it
+     * @param src the type of a stacked value
+     * @param dst the reference type by which we'd like to treat it
      * @return whether the retyping can be done without a cast
      */
     public static boolean isNullReferenceConversion(Class<?> src, Class<?> dst) {
--- a/jdk/src/share/classes/sun/net/www/content/image/gif.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/net/www/content/image/gif.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,6 +37,7 @@
         return new URLImageSource(urlc);
     }
 
+    @SuppressWarnings("rawtypes")
     public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
         Class<?>[] cls = classes;
         for (int i = 0; i < cls.length; i++) {
--- a/jdk/src/share/classes/sun/net/www/content/image/jpeg.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/net/www/content/image/jpeg.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,6 +36,7 @@
         return new URLImageSource(urlc);
     }
 
+    @SuppressWarnings("rawtypes")
     public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
         Class<?>[] cls = classes;
         for (int i = 0; i < cls.length; i++) {
--- a/jdk/src/share/classes/sun/net/www/content/image/png.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/net/www/content/image/png.java	Fri Oct 11 09:17:18 2013 -0400
@@ -36,6 +36,7 @@
         return new URLImageSource(urlc);
     }
 
+    @SuppressWarnings("rawtypes")
     public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
         Class<?>[] cls = classes;
         for (int i = 0; i < cls.length; i++) {
--- a/jdk/src/share/classes/sun/net/www/content/image/x_xbitmap.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/net/www/content/image/x_xbitmap.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
         return new URLImageSource(urlc);
     }
 
+    @SuppressWarnings("rawtypes")
     public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException {
         Class<?>[] cls = classes;
         for (int i = 0; i < cls.length; i++) {
--- a/jdk/src/share/classes/sun/net/www/content/image/x_xpixmap.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/net/www/content/image/x_xpixmap.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
         return new URLImageSource(urlc);
     }
 
+    @SuppressWarnings("rawtypes")
     public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException {
         Class<?>[] cls = classes;
         for (int i = 0; i < cls.length; i++) {
--- a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -434,6 +434,7 @@
         return delegate.getContent();
     }
 
+    @SuppressWarnings("rawtypes")
     public Object getContent(Class[] classes) throws IOException {
         return delegate.getContent(classes);
     }
--- a/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java	Fri Oct 11 09:17:18 2013 -0400
@@ -217,7 +217,7 @@
      */
     private static class Signature {
         private String methodName;
-        private Class[] argClasses;
+        private Class<?>[] argClasses;
 
         private volatile int hashCode = 0;
 
@@ -299,7 +299,7 @@
                 new PrivilegedExceptionAction<Method>() {
                     public Method run() throws Exception {
                         Class<?> t = getTrampolineClass();
-                        Class[] types = {
+                        Class<?>[] types = {
                             Method.class, Object.class, Object[].class
                         };
                         Method b = t.getDeclaredMethod("invoke", types);
--- a/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,20 +70,67 @@
     // for RSA, selected or default value of public exponent, always valid
     private BigInteger rsaPublicExponent = RSAKeyGenParameterSpec.F4;
 
+    // the supported keysize range of the native PKCS11 library
+    // if the value cannot be retrieved or unspecified, -1 is used.
+    private final int minKeySize;
+    private final int maxKeySize;
+
     // SecureRandom instance, if specified in init
     private SecureRandom random;
 
     P11KeyPairGenerator(Token token, String algorithm, long mechanism)
             throws PKCS11Exception {
         super();
+        int minKeyLen = -1;
+        int maxKeyLen = -1;
+        try {
+            CK_MECHANISM_INFO mechInfo = token.getMechanismInfo(mechanism);
+            if (mechInfo != null) {
+                minKeyLen = (int) mechInfo.ulMinKeySize;
+                maxKeyLen = (int) mechInfo.ulMaxKeySize;
+            }
+        } catch (PKCS11Exception p11e) {
+            // Should never happen
+            throw new ProviderException
+                        ("Unexpected error while getting mechanism info", p11e);
+        }
+        // set default key sizes and apply our own algorithm-specific limits
+        // override lower limit to disallow unsecure keys being generated
+        // override upper limit to deter DOS attack
+        if (algorithm.equals("EC")) {
+            keySize = 256;
+            if ((minKeyLen == -1) || (minKeyLen < 112)) {
+                minKeyLen = 112;
+            }
+            if ((maxKeyLen == -1) || (maxKeyLen > 2048)) {
+                maxKeyLen = 2048;
+            }
+        } else {
+            // RSA, DH, and DSA
+            keySize = 1024;
+            if ((minKeyLen == -1) || (minKeyLen < 512)) {
+                minKeyLen = 512;
+            }
+            if (algorithm.equals("RSA")) {
+                if ((maxKeyLen == -1) || (maxKeyLen > 64 * 1024)) {
+                    maxKeyLen = 64 * 1024;
+                }
+            }
+        }
+
+        // auto-adjust default keysize in case it's out-of-range
+        if ((minKeyLen != -1) && (keySize < minKeyLen)) {
+            keySize = minKeyLen;
+        }
+        if ((maxKeyLen != -1) && (keySize > maxKeyLen)) {
+            keySize = maxKeyLen;
+        }
         this.token = token;
         this.algorithm = algorithm;
         this.mechanism = mechanism;
-        if (algorithm.equals("EC")) {
-            initialize(256, null);
-        } else {
-            initialize(1024, null);
-        }
+        this.minKeySize = minKeyLen;
+        this.maxKeySize = maxKeyLen;
+        initialize(keySize, null);
     }
 
     // see JCA spec
@@ -94,9 +141,7 @@
         } catch (InvalidAlgorithmParameterException e) {
             throw new InvalidParameterException(e.getMessage());
         }
-        this.keySize = keySize;
         this.params = null;
-        this.random = random;
         if (algorithm.equals("EC")) {
             params = P11ECKeyFactory.getECParameterSpec(keySize);
             if (params == null) {
@@ -105,33 +150,35 @@
                     + keySize + " bits");
             }
         }
+        this.keySize = keySize;
+        this.random = random;
     }
 
     // see JCA spec
     public void initialize(AlgorithmParameterSpec params, SecureRandom random)
             throws InvalidAlgorithmParameterException {
         token.ensureValid();
+        int tmpKeySize;
         if (algorithm.equals("DH")) {
             if (params instanceof DHParameterSpec == false) {
                 throw new InvalidAlgorithmParameterException
                         ("DHParameterSpec required for Diffie-Hellman");
             }
-            DHParameterSpec dhParams = (DHParameterSpec)params;
-            int tmpKeySize = dhParams.getP().bitLength();
-            checkKeySize(tmpKeySize, dhParams);
-            this.keySize = tmpKeySize;
-            this.params = dhParams;
+            DHParameterSpec dhParams = (DHParameterSpec) params;
+            tmpKeySize = dhParams.getP().bitLength();
+            checkKeySize(tmpKeySize, null);
             // XXX sanity check params
         } else if (algorithm.equals("RSA")) {
             if (params instanceof RSAKeyGenParameterSpec == false) {
                 throw new InvalidAlgorithmParameterException
                         ("RSAKeyGenParameterSpec required for RSA");
             }
-            RSAKeyGenParameterSpec rsaParams = (RSAKeyGenParameterSpec)params;
-            int tmpKeySize = rsaParams.getKeysize();
+            RSAKeyGenParameterSpec rsaParams =
+                (RSAKeyGenParameterSpec) params;
+            tmpKeySize = rsaParams.getKeysize();
             checkKeySize(tmpKeySize, rsaParams);
-            this.keySize = tmpKeySize;
-            this.params = null;
+            // override the supplied params to null
+            params = null;
             this.rsaPublicExponent = rsaParams.getPublicExponent();
             // XXX sanity check params
         } else if (algorithm.equals("DSA")) {
@@ -139,11 +186,9 @@
                 throw new InvalidAlgorithmParameterException
                         ("DSAParameterSpec required for DSA");
             }
-            DSAParameterSpec dsaParams = (DSAParameterSpec)params;
-            int tmpKeySize = dsaParams.getP().bitLength();
-            checkKeySize(tmpKeySize, dsaParams);
-            this.keySize = tmpKeySize;
-            this.params = dsaParams;
+            DSAParameterSpec dsaParams = (DSAParameterSpec) params;
+            tmpKeySize = dsaParams.getP().bitLength();
+            checkKeySize(tmpKeySize, null);
             // XXX sanity check params
         } else if (algorithm.equals("EC")) {
             ECParameterSpec ecParams;
@@ -155,28 +200,42 @@
                         ("Unsupported curve: " + params);
                 }
             } else if (params instanceof ECGenParameterSpec) {
-                String name = ((ECGenParameterSpec)params).getName();
+                String name = ((ECGenParameterSpec) params).getName();
                 ecParams = P11ECKeyFactory.getECParameterSpec(name);
                 if (ecParams == null) {
                     throw new InvalidAlgorithmParameterException
                         ("Unknown curve name: " + name);
                 }
+                // override the supplied params with the derived one
+                params = ecParams;
             } else {
                 throw new InvalidAlgorithmParameterException
                     ("ECParameterSpec or ECGenParameterSpec required for EC");
             }
-            int tmpKeySize = ecParams.getCurve().getField().getFieldSize();
-            checkKeySize(tmpKeySize, ecParams);
-            this.keySize = tmpKeySize;
-            this.params = ecParams;
+            tmpKeySize = ecParams.getCurve().getField().getFieldSize();
+            checkKeySize(tmpKeySize, null);
         } else {
             throw new ProviderException("Unknown algorithm: " + algorithm);
         }
+        this.keySize = tmpKeySize;
+        this.params = params;
         this.random = random;
     }
 
-    private void checkKeySize(int keySize, AlgorithmParameterSpec params)
-            throws InvalidAlgorithmParameterException {
+    // NOTE: 'params' is only used for checking RSA keys currently.
+    private void checkKeySize(int keySize, RSAKeyGenParameterSpec params)
+        throws InvalidAlgorithmParameterException {
+        // check native range first
+        if ((minKeySize != -1) && (keySize < minKeySize)) {
+            throw new InvalidAlgorithmParameterException(algorithm +
+                " key must be at least " + minKeySize + " bits");
+        }
+        if ((maxKeySize != -1) && (keySize > maxKeySize)) {
+            throw new InvalidAlgorithmParameterException(algorithm +
+                " key must be at most " + maxKeySize + " bits");
+        }
+
+        // check our own algorithm-specific limits also
         if (algorithm.equals("EC")) {
             if (keySize < 112) {
                 throw new InvalidAlgorithmParameterException
@@ -187,41 +246,45 @@
                 throw new InvalidAlgorithmParameterException
                     ("Key size must be at most 2048 bit");
             }
-            return;
-        } else if (algorithm.equals("RSA")) {
-            BigInteger tmpExponent = rsaPublicExponent;
-            if (params != null) {
-                // Already tested for instanceof RSAKeyGenParameterSpec above
-                tmpExponent =
-                    ((RSAKeyGenParameterSpec)params).getPublicExponent();
-            }
-            try {
-                // This provider supports 64K or less.
-                RSAKeyFactory.checkKeyLengths(keySize, tmpExponent,
-                    512, 64 * 1024);
-            } catch (InvalidKeyException e) {
-                throw new InvalidAlgorithmParameterException(e.getMessage());
+        } else {
+            // RSA, DH, DSA
+            if (keySize < 512) {
+                throw new InvalidAlgorithmParameterException
+                    ("Key size must be at least 512 bit");
             }
-            return;
-        }
-
-        if (keySize < 512) {
-            throw new InvalidAlgorithmParameterException
-                ("Key size must be at least 512 bit");
-        }
-        if (algorithm.equals("DH") && (params != null)) {
-            // sanity check, nobody really wants keys this large
-            if (keySize > 64 * 1024) {
-                throw new InvalidAlgorithmParameterException
-                    ("Key size must be at most 65536 bit");
-            }
-        } else {
-            // this restriction is in the spec for DSA
-            // since we currently use DSA parameters for DH as well,
-            // it also applies to DH if no parameters are specified
-            if ((keySize > 1024) || ((keySize & 0x3f) != 0)) {
-                throw new InvalidAlgorithmParameterException
-                    ("Key size must be a multiple of 64 and at most 1024 bit");
+            if (algorithm.equals("RSA")) {
+                BigInteger tmpExponent = rsaPublicExponent;
+                if (params != null) {
+                    tmpExponent = params.getPublicExponent();
+                }
+                try {
+                    // Reuse the checking in SunRsaSign provider.
+                    // If maxKeySize is -1, then replace it with
+                    // Integer.MAX_VALUE to indicate no limit.
+                    RSAKeyFactory.checkKeyLengths(keySize, tmpExponent,
+                        minKeySize,
+                        (maxKeySize==-1? Integer.MAX_VALUE:maxKeySize));
+                } catch (InvalidKeyException e) {
+                    throw new InvalidAlgorithmParameterException(e.getMessage());
+                }
+            } else {
+                if (algorithm.equals("DH") && (params != null)) {
+                    // sanity check, nobody really wants keys this large
+                    if (keySize > 64 * 1024) {
+                        throw new InvalidAlgorithmParameterException
+                            ("Key size must be at most 65536 bit");
+                    }
+                } else {
+                    // this restriction is in the spec for DSA
+                    // since we currently use DSA parameters for DH as well,
+                    // it also applies to DH if no parameters are specified
+                    if ((keySize != 2048) &&
+                        ((keySize > 1024) || ((keySize & 0x3f) != 0))) {
+                        throw new InvalidAlgorithmParameterException(algorithm +
+                            " key must be multiples of 64 if less than 1024 bits" +
+                            ", or 2048 bits");
+                    }
+                }
             }
         }
     }
@@ -325,5 +388,4 @@
             token.releaseSession(session);
         }
     }
-
 }
--- a/jdk/src/share/classes/sun/security/provider/AuthPolicyFile.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/provider/AuthPolicyFile.java	Fri Oct 11 09:17:18 2013 -0400
@@ -91,7 +91,7 @@
     private boolean ignoreIdentityScope = true;
 
     // for use with the reflection API
-    private static final Class[] PARAMS = { String.class, String.class};
+    private static final Class<?>[] PARAMS = { String.class, String.class};
 
     /**
      * Initializes the Policy object and reads the default policy
--- a/jdk/src/share/classes/sun/security/provider/DomainKeyStore.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/provider/DomainKeyStore.java	Fri Oct 11 09:17:18 2013 -0400
@@ -41,7 +41,7 @@
  * This class provides the domain keystore type identified as "DKS".
  * DKS presents a collection of separate keystores as a single logical keystore.
  * The collection of keystores is specified in a domain configuration file which
- * is passed to DKS in a {@link KeyStore.DomainLoadStoreParameter}.
+ * is passed to DKS in a {@link DomainLoadStoreParameter}.
  * <p>
  * The following properties are supported:
  * <dl>
@@ -622,17 +622,16 @@
         }
 
         throw new UnsupportedOperationException(
-            "This keystore must be stored using a " +
-            "KeyStore.DomainLoadStoreParameter");
+            "This keystore must be stored using a DomainLoadStoreParameter");
     }
 
     @Override
     public void engineStore(KeyStore.LoadStoreParameter param)
         throws IOException, NoSuchAlgorithmException, CertificateException
     {
-        if (param instanceof KeyStore.DomainLoadStoreParameter) {
-            KeyStore.DomainLoadStoreParameter domainParameter =
-                (KeyStore.DomainLoadStoreParameter) param;
+        if (param instanceof DomainLoadStoreParameter) {
+            DomainLoadStoreParameter domainParameter =
+                (DomainLoadStoreParameter) param;
             List<KeyStoreBuilderComponents> builders = getBuilders(
                 domainParameter.getConfiguration(),
                     domainParameter.getProtectionParams());
@@ -645,7 +644,7 @@
                     if (!(pp instanceof KeyStore.PasswordProtection)) {
                         throw new KeyStoreException(
                             new IllegalArgumentException("ProtectionParameter" +
-                                " must be a KeyStore.PasswordPartection"));
+                                " must be a KeyStore.PasswordProtection"));
                     }
                     char[] password =
                         ((KeyStore.PasswordProtection) builder.protection)
@@ -663,7 +662,7 @@
         } else {
             throw new UnsupportedOperationException(
                 "This keystore must be stored using a " +
-                "KeyStore.DomainLoadStoreParameter");
+                "DomainLoadStoreParameter");
         }
     }
 
@@ -710,7 +709,7 @@
         } catch (Exception e) {
             throw new UnsupportedOperationException(
                 "This keystore must be loaded using a " +
-                "KeyStore.DomainLoadStoreParameter");
+                "DomainLoadStoreParameter");
         }
     }
 
@@ -718,9 +717,9 @@
     public void engineLoad(KeyStore.LoadStoreParameter param)
         throws IOException, NoSuchAlgorithmException, CertificateException
     {
-        if (param instanceof KeyStore.DomainLoadStoreParameter) {
-            KeyStore.DomainLoadStoreParameter domainParameter =
-                (KeyStore.DomainLoadStoreParameter) param;
+        if (param instanceof DomainLoadStoreParameter) {
+            DomainLoadStoreParameter domainParameter =
+                (DomainLoadStoreParameter) param;
             List<KeyStoreBuilderComponents> builders = getBuilders(
                 domainParameter.getConfiguration(),
                     domainParameter.getProtectionParams());
@@ -748,7 +747,7 @@
         } else {
             throw new UnsupportedOperationException(
                 "This keystore must be loaded using a " +
-                "KeyStore.DomainLoadStoreParameter");
+                "DomainLoadStoreParameter");
         }
     }
 
--- a/jdk/src/share/classes/sun/security/provider/SubjectCodeSource.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/provider/SubjectCodeSource.java	Fri Oct 11 09:17:18 2013 -0400
@@ -58,7 +58,7 @@
 
     private Subject subject;
     private LinkedList<PrincipalEntry> principals;
-    private static final Class[] PARAMS = { String.class };
+    private static final Class<?>[] PARAMS = { String.class };
     private static final sun.security.util.Debug debug =
         sun.security.util.Debug.getInstance("auth", "\t[Auth Access]");
     private ClassLoader sysClassLoader;
--- a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,8 @@
 
 import javax.security.auth.Subject;
 
+import sun.security.util.KeyUtil;
+import sun.security.action.GetPropertyAction;
 import sun.security.ssl.HandshakeMessage.*;
 import sun.security.ssl.CipherSuite.*;
 import sun.security.ssl.SignatureAndHashAlgorithm.*;
@@ -93,6 +95,50 @@
     // the preferable signature algorithm used by ServerKeyExchange message
     SignatureAndHashAlgorithm preferableSignatureAlgorithm;
 
+    // Flag to use smart ephemeral DH key which size matches the corresponding
+    // authentication key
+    private static final boolean useSmartEphemeralDHKeys;
+
+    // Flag to use legacy ephemeral DH key which size is 512 bits for
+    // exportable cipher suites, and 768 bits for others
+    private static final boolean useLegacyEphemeralDHKeys;
+
+    // The customized ephemeral DH key size for non-exportable cipher suites.
+    private static final int customizedDHKeySize;
+
+    static {
+        String property = AccessController.doPrivileged(
+                    new GetPropertyAction("jdk.tls.ephemeralDHKeySize"));
+        if (property == null || property.length() == 0) {
+            useLegacyEphemeralDHKeys = false;
+            useSmartEphemeralDHKeys = false;
+            customizedDHKeySize = -1;
+        } else if ("matched".equals(property)) {
+            useLegacyEphemeralDHKeys = false;
+            useSmartEphemeralDHKeys = true;
+            customizedDHKeySize = -1;
+        } else if ("legacy".equals(property)) {
+            useLegacyEphemeralDHKeys = true;
+            useSmartEphemeralDHKeys = false;
+            customizedDHKeySize = -1;
+        } else {
+            useLegacyEphemeralDHKeys = false;
+            useSmartEphemeralDHKeys = false;
+
+            try {
+                customizedDHKeySize = Integer.parseUnsignedInt(property);
+                if (customizedDHKeySize < 1024 || customizedDHKeySize > 2048) {
+                    throw new IllegalArgumentException(
+                        "Customized DH key size should be positive integer " +
+                        "between 1024 and 2048 bits, inclusive");
+                }
+            } catch (NumberFormatException nfe) {
+                throw new IllegalArgumentException(
+                        "Invalid system property jdk.tls.ephemeralDHKeySize");
+            }
+        }
+    }
+
     /*
      * Constructor ... use the keys found in the auth context.
      */
@@ -1107,7 +1153,7 @@
                 }
             }
 
-            setupEphemeralDHKeys(suite.exportable);
+            setupEphemeralDHKeys(suite.exportable, privateKey);
             break;
         case K_ECDHE_RSA:
             // need RSA certs for authentication
@@ -1144,7 +1190,8 @@
             if (setupPrivateKeyAndChain("DSA") == false) {
                 return false;
             }
-            setupEphemeralDHKeys(suite.exportable);
+
+            setupEphemeralDHKeys(suite.exportable, privateKey);
             break;
         case K_ECDHE_ECDSA:
             // get preferable peer signature algorithm for server key exchange
@@ -1188,7 +1235,7 @@
             break;
         case K_DH_ANON:
             // no certs needed for anonymous
-            setupEphemeralDHKeys(suite.exportable);
+            setupEphemeralDHKeys(suite.exportable, null);
             break;
         case K_ECDH_ANON:
             // no certs needed for anonymous
@@ -1237,15 +1284,70 @@
      * Acquire some "ephemeral" Diffie-Hellman  keys for this handshake.
      * We don't reuse these, for improved forward secrecy.
      */
-    private void setupEphemeralDHKeys(boolean export) {
+    private void setupEphemeralDHKeys(boolean export, Key key) {
         /*
-         * Diffie-Hellman keys ... we use 768 bit private keys due
-         * to the "use twice as many key bits as bits you want secret"
-         * rule of thumb, assuming we want the same size premaster
-         * secret with Diffie-Hellman and RSA key exchanges.  Except
-         * that exportable ciphers max out at 512 bits modulus values.
+         * 768 bits ephemeral DH private keys were used to be used in
+         * ServerKeyExchange except that exportable ciphers max out at 512
+         * bits modulus values. We still adhere to this behavior in legacy
+         * mode (system property "jdk.tls.ephemeralDHKeySize" is defined
+         * as "legacy").
+         *
+         * Old JDK (JDK 7 and previous) releases don't support DH keys bigger
+         * than 1024 bits. We have to consider the compatibility requirement.
+         * 1024 bits DH key is always used for non-exportable cipher suites
+         * in default mode (system property "jdk.tls.ephemeralDHKeySize"
+         * is not defined).
+         *
+         * However, if applications want more stronger strength, setting
+         * system property "jdk.tls.ephemeralDHKeySize" to "matched"
+         * is a workaround to use ephemeral DH key which size matches the
+         * corresponding authentication key. For example, if the public key
+         * size of an authentication certificate is 2048 bits, then the
+         * ephemeral DH key size should be 2048 bits accordingly unless
+         * the cipher suite is exportable.  This key sizing scheme keeps
+         * the cryptographic strength consistent between authentication
+         * keys and key-exchange keys.
+         *
+         * Applications may also want to customize the ephemeral DH key size
+         * to a fixed length for non-exportable cipher suites. This can be
+         * approached by setting system property "jdk.tls.ephemeralDHKeySize"
+         * to a valid positive integer between 1024 and 2048 bits, inclusive.
+         *
+         * Note that the minimum acceptable key size is 1024 bits except
+         * exportable cipher suites or legacy mode.
+         *
+         * Note that the maximum acceptable key size is 2048 bits because
+         * DH keys bigger than 2048 are not always supported by underlying
+         * JCE providers.
+         *
+         * Note that per RFC 2246, the key size limit of DH is 512 bits for
+         * exportable cipher suites.  Because of the weakness, exportable
+         * cipher suites are deprecated since TLS v1.1 and they are not
+         * enabled by default in Oracle provider. The legacy behavior is
+         * reserved and 512 bits DH key is always used for exportable
+         * cipher suites.
          */
-        dh = new DHCrypt((export ? 512 : 768), sslContext.getSecureRandom());
+        int keySize = export ? 512 : 1024;           // default mode
+        if (!export) {
+            if (useLegacyEphemeralDHKeys) {          // legacy mode
+                keySize = 768;
+            } else if (useSmartEphemeralDHKeys) {    // matched mode
+                if (key != null) {
+                    int ks = KeyUtil.getKeySize(key);
+                    // Note that SunJCE provider only supports 2048 bits DH
+                    // keys bigger than 1024.  Please DON'T use value other
+                    // than 1024 and 2048 at present.  We may improve the
+                    // underlying providers and key size here in the future.
+                    //
+                    // keySize = ks <= 1024 ? 1024 : (ks >= 2048 ? 2048 : ks);
+                    keySize = ks <= 1024 ? 1024 : 2048;
+                } // Otherwise, anonymous cipher suites, 1024-bit is used.
+            } else if (customizedDHKeySize > 0) {    // customized mode
+                keySize = customizedDHKeySize;
+            }
+        }
+
+        dh = new DHCrypt(keySize, sslContext.getSecureRandom());
     }
 
     // Setup the ephemeral ECDH parameters.
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java	Fri Oct 11 09:17:18 2013 -0400
@@ -93,7 +93,7 @@
     // prefix for new signature-related files in META-INF directory
     private static final String SIG_PREFIX = META_INF + "SIG-";
 
-    private static final Class[] PARAM_STRING = { String.class };
+    private static final Class<?>[] PARAM_STRING = { String.class };
 
     private static final String NONE = "NONE";
     private static final String P11KEYSTORE = "PKCS11";
--- a/jdk/src/share/classes/sun/security/tools/keytool/Main.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/tools/keytool/Main.java	Fri Oct 11 09:17:18 2013 -0400
@@ -72,6 +72,8 @@
 import sun.security.util.Password;
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
 
 import sun.security.pkcs.PKCS9Attribute;
 import sun.security.tools.KeyStoreUtil;
@@ -190,6 +192,10 @@
             KEYPASS, KEYSTORE, STOREPASS, STORETYPE,
             PROVIDERNAME, PROVIDERCLASS, PROVIDERARG,
             PROVIDERPATH, V),
+        IMPORTPASS("Imports.a.password",
+            ALIAS, KEYPASS, KEYALG, KEYSIZE, KEYSTORE,
+            STOREPASS, STORETYPE, PROVIDERNAME, PROVIDERCLASS,
+            PROVIDERARG, PROVIDERPATH, V, PROTECTED),
         IMPORTKEYSTORE("Imports.one.or.all.entries.from.another.keystore",
             SRCKEYSTORE, DESTKEYSTORE, SRCSTORETYPE,
             DESTSTORETYPE, SRCSTOREPASS, DESTSTOREPASS,
@@ -303,7 +309,7 @@
         }
     };
 
-    private static final Class[] PARAM_STRING = { String.class };
+    private static final Class<?>[] PARAM_STRING = { String.class };
 
     private static final String NONE = "NONE";
     private static final String P11KEYSTORE = "PKCS11";
@@ -409,6 +415,8 @@
                 command = GENKEYPAIR;
             } else if (collator.compare(flags, "-import") == 0) {
                 command = IMPORTCERT;
+            } else if (collator.compare(flags, "-importpassword") == 0) {
+                command = IMPORTPASS;
             }
             /*
              * Help
@@ -727,6 +735,7 @@
                         command != GENSECKEY &&
                         command != IDENTITYDB &&
                         command != IMPORTCERT &&
+                        command != IMPORTPASS &&
                         command != IMPORTKEYSTORE &&
                         command != PRINTCRL) {
                         throw new Exception(rb.getString
@@ -808,6 +817,7 @@
                         command == GENKEYPAIR ||
                         command == GENSECKEY ||
                         command == IMPORTCERT ||
+                        command == IMPORTPASS ||
                         command == IMPORTKEYSTORE ||
                         command == KEYCLONE ||
                         command == CHANGEALIAS ||
@@ -958,6 +968,13 @@
             }
             doGenSecretKey(alias, keyAlgName, keysize);
             kssave = true;
+        } else if (command == IMPORTPASS) {
+            if (keyAlgName == null) {
+                keyAlgName = "PBE";
+            }
+            // password is stored as a secret key
+            doGenSecretKey(alias, keyAlgName, keysize);
+            kssave = true;
         } else if (command == IDENTITYDB) {
             if (filename != null) {
                 try (InputStream inStream = new FileInputStream(filename)) {
@@ -1419,6 +1436,43 @@
         }
         return null;    // PKCS11, MSCAPI, or -protected
     }
+
+    /*
+     * Prompt the user for the password credential to be stored.
+     */
+    private char[] promptForCredential() throws Exception {
+        // Handle password supplied via stdin
+        if (System.console() == null) {
+            char[] importPass = Password.readPassword(System.in);
+            passwords.add(importPass);
+            return importPass;
+        }
+
+        int count;
+        for (count = 0; count < 3; count++) {
+            System.err.print(
+                rb.getString("Enter.the.password.to.be.stored."));
+            System.err.flush();
+            char[] entered = Password.readPassword(System.in);
+            passwords.add(entered);
+            System.err.print(rb.getString("Re.enter.password."));
+            char[] passAgain = Password.readPassword(System.in);
+            passwords.add(passAgain);
+            if (!Arrays.equals(entered, passAgain)) {
+                System.err.println(rb.getString("They.don.t.match.Try.again"));
+                continue;
+            }
+            return entered;
+        }
+
+        if (count == 3) {
+            throw new Exception(rb.getString
+                ("Too.many.failures.key.not.added.to.keystore"));
+        }
+
+        return null;
+    }
+
     /**
      * Creates a new secret key.
      */
@@ -1436,24 +1490,63 @@
             throw new Exception(form.format(source));
         }
 
+        // Use the keystore's default PBE algorithm for entry protection
+        boolean useDefaultPBEAlgorithm = true;
         SecretKey secKey = null;
-        KeyGenerator keygen = KeyGenerator.getInstance(keyAlgName);
-        if (keysize != -1) {
+
+        if (keyAlgName.toUpperCase().startsWith("PBE")) {
+            SecretKeyFactory factory = SecretKeyFactory.getInstance("PBE");
+
+            // User is prompted for PBE credential
+            secKey =
+                factory.generateSecret(new PBEKeySpec(promptForCredential()));
+
+            // Check whether a specific PBE algorithm was specified
+            if (!"PBE".equalsIgnoreCase(keyAlgName)) {
+                useDefaultPBEAlgorithm = false;
+            }
+
+            if (verbose) {
+                MessageFormat form = new MessageFormat(rb.getString(
+                    "Generated.keyAlgName.secret.key"));
+                Object[] source =
+                    {useDefaultPBEAlgorithm ? "PBE" : secKey.getAlgorithm()};
+                System.err.println(form.format(source));
+            }
+        } else {
+            KeyGenerator keygen = KeyGenerator.getInstance(keyAlgName);
+            if (keysize == -1) {
+                if ("DES".equalsIgnoreCase(keyAlgName)) {
+                    keysize = 56;
+                } else if ("DESede".equalsIgnoreCase(keyAlgName)) {
+                    keysize = 168;
+                } else {
+                    throw new Exception(rb.getString
+                        ("Please.provide.keysize.for.secret.key.generation"));
+                }
+            }
             keygen.init(keysize);
-        } else if ("DES".equalsIgnoreCase(keyAlgName)) {
-            keygen.init(56);
-        } else if ("DESede".equalsIgnoreCase(keyAlgName)) {
-            keygen.init(168);
-        } else {
-            throw new Exception(rb.getString
-                ("Please.provide.keysize.for.secret.key.generation"));
+            secKey = keygen.generateKey();
+
+            if (verbose) {
+                MessageFormat form = new MessageFormat(rb.getString
+                    ("Generated.keysize.bit.keyAlgName.secret.key"));
+                Object[] source = {new Integer(keysize),
+                                    secKey.getAlgorithm()};
+                System.err.println(form.format(source));
+            }
         }
 
-        secKey = keygen.generateKey();
         if (keyPass == null) {
             keyPass = promptForKeyPass(alias, null, storePass);
         }
-        keyStore.setKeyEntry(alias, secKey, keyPass, null);
+
+        if (useDefaultPBEAlgorithm) {
+            keyStore.setKeyEntry(alias, secKey, keyPass, null);
+        } else {
+            keyStore.setEntry(alias, new KeyStore.SecretKeyEntry(secKey),
+                new KeyStore.PasswordProtection(keyPass, keyAlgName, null));
+        }
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/tools/keytool/Resources.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/tools/keytool/Resources.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -65,10 +65,16 @@
         {"Generates.certificate.from.a.certificate.request",
                 "Generates certificate from a certificate request"}, //-gencert
         {"Generates.CRL", "Generates CRL"}, //-gencrl
+        {"Generated.keyAlgName.secret.key",
+                "Generated {0} secret key"}, //-genseckey
+        {"Generated.keysize.bit.keyAlgName.secret.key",
+                "Generated {0}-bit {1} secret key"}, //-genseckey
         {"Imports.entries.from.a.JDK.1.1.x.style.identity.database",
                 "Imports entries from a JDK 1.1.x-style identity database"}, //-identitydb
         {"Imports.a.certificate.or.a.certificate.chain",
                 "Imports a certificate or a certificate chain"}, //-importcert
+        {"Imports.a.password",
+                "Imports a password"}, //-importpass
         {"Imports.one.or.all.entries.from.another.keystore",
                 "Imports one or all entries from another keystore"}, //-importkeystore
         {"Clones.a.key.entry",
@@ -220,6 +226,8 @@
         {"Must.specify.alias", "Must specify alias"},
         {"Keystore.password.must.be.at.least.6.characters",
                 "Keystore password must be at least 6 characters"},
+        {"Enter.the.password.to.be.stored.",
+                "Enter the password to be stored:  "},
         {"Enter.keystore.password.", "Enter keystore password:  "},
         {"Enter.source.keystore.password.", "Enter source keystore password:  "},
         {"Enter.destination.keystore.password.", "Enter destination keystore password:  "},
@@ -328,6 +336,7 @@
         {"New.prompt.", "New {0}: "},
         {"Passwords.must.differ", "Passwords must differ"},
         {"Re.enter.new.prompt.", "Re-enter new {0}: "},
+        {"Re.enter.passpword.", "Re-enter password: "},
         {"Re.enter.new.password.", "Re-enter new password: "},
         {"They.don.t.match.Try.again", "They don't match. Try again"},
         {"Enter.prompt.alias.name.", "Enter {0} alias name:  "},
--- a/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Fri Oct 11 09:17:18 2013 -0400
@@ -77,9 +77,9 @@
     boolean modified = false;
 
     private static final boolean testing = false;
-    private static final Class[] TWOPARAMS = { String.class, String.class };
-    private static final Class[] ONEPARAMS = { String.class };
-    private static final Class[] NOPARAMS  = {};
+    private static final Class<?>[] TWOPARAMS = { String.class, String.class };
+    private static final Class<?>[] ONEPARAMS = { String.class };
+    private static final Class<?>[] NOPARAMS  = {};
     /*
      * All of the policy entries are read in from the
      * policy file and stored here.  Updates to the policy entries
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,104 @@
+/*
+ * 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 sun.swing;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/**
+ * Data model for a type-face selection combo-box.
+ */
+public abstract class AbstractFilterComboBoxModel
+        extends AbstractListModel<FileFilter>
+        implements ComboBoxModel<FileFilter>, PropertyChangeListener {
+
+    protected FileFilter[] filters;
+
+    protected AbstractFilterComboBoxModel() {
+        this.filters = getFileChooser().getChoosableFileFilters();
+    }
+
+    protected abstract JFileChooser getFileChooser();
+
+    @Override
+    public void propertyChange(PropertyChangeEvent event) {
+        String property = event.getPropertyName();
+        if (property == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+            this.filters = (FileFilter[]) event.getNewValue();
+            fireContentsChanged(this, -1, -1);
+        } else if (property == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+            fireContentsChanged(this, -1, -1);
+        }
+    }
+
+    @Override
+    public void setSelectedItem(Object filter) {
+        if (filter != null) {
+            getFileChooser().setFileFilter((FileFilter) filter);
+            fireContentsChanged(this, -1, -1);
+        }
+    }
+
+    @Override
+    public Object getSelectedItem() {
+        // Ensure that the current filter is in the list.
+        // NOTE: we should not have to do this, since JFileChooser adds
+        // the filter to the choosable filters list when the filter
+        // is set. Lets be paranoid just in case someone overrides
+        // setFileFilter in JFileChooser.
+        FileFilter currentFilter = getFileChooser().getFileFilter();
+        if (currentFilter != null) {
+            for (FileFilter filter : this.filters) {
+                if (filter == currentFilter) {
+                    return currentFilter;
+                }
+            }
+            getFileChooser().addChoosableFileFilter(currentFilter);
+        }
+        return currentFilter;
+    }
+
+    @Override
+    public int getSize() {
+        return (this.filters != null)
+                ? filters.length
+                : 0;
+    }
+
+    @Override
+    public FileFilter getElementAt(int index) {
+        if (index >= getSize()) {
+            // This shouldn't happen. Try to recover gracefully.
+            return getFileChooser().getFileFilter();
+        }
+        return (this.filters != null)
+                ? filters[index]
+                : null;
+    }
+}
--- a/jdk/src/share/classes/sun/swing/FilePane.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/swing/FilePane.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1980,18 +1980,18 @@
         }
 
         if (f instanceof ShellFolder) {
-            return ((ShellFolder) f).isFileSystem();
+            return f.canWrite();
         } else {
             if (usesShellFolder(getFileChooser())) {
                 try {
-                    return ShellFolder.getShellFolder(f).isFileSystem();
+                    return ShellFolder.getShellFolder(f).canWrite();
                 } catch (FileNotFoundException ex) {
                     // File doesn't exist
                     return false;
                 }
             } else {
                 // Ordinary file
-                return true;
+                return f.canWrite();
             }
         }
     }
--- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,8 +33,9 @@
 import java.awt.EventQueue;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
+import java.awt.MouseInfo;
+import java.awt.Point;
 import java.awt.Rectangle;
-import java.awt.event.ComponentListener;
 import java.awt.event.ContainerEvent;
 import java.awt.event.ContainerListener;
 import java.awt.image.BufferedImage;
@@ -48,6 +49,7 @@
 import javax.swing.JRootPane;
 import javax.swing.LayoutFocusTraversalPolicy;
 import javax.swing.RootPaneContainer;
+import javax.swing.SwingUtilities;
 
 import sun.awt.LightweightFrame;
 import sun.security.action.GetPropertyAction;
@@ -88,6 +90,15 @@
 
     private PropertyChangeListener layoutSizeListener;
 
+    static {
+        SwingAccessor.setJLightweightFrameAccessor(new SwingAccessor.JLightweightFrameAccessor() {
+            @Override
+            public void updateCursor(JLightweightFrame frame) {
+                frame.updateClientCursor();
+            }
+        });
+    }
+
     /**
      * Constructs a new, initially invisible {@code JLightweightFrame}
      * instance.
@@ -95,7 +106,7 @@
     public JLightweightFrame() {
         super();
         copyBufferEnabled = "true".equals(AccessController.
-            doPrivileged(new GetPropertyAction("jlf.copyBufferEnabled", "true")));
+            doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
 
         add(rootPane, BorderLayout.CENTER);
         setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
@@ -239,6 +250,11 @@
         };
         contentPane.setLayout(new BorderLayout());
         contentPane.add(component);
+        if ("true".equals(AccessController.
+            doPrivileged(new GetPropertyAction("swing.jlf.contentPaneTransparent", "false"))))
+        {
+            contentPane.setOpaque(false);
+        }
         setContentPane(contentPane);
 
         contentPane.addContainerListener(new ContainerListener() {
@@ -358,4 +374,21 @@
     public Component getGlassPane() {
         return getRootPane().getGlassPane();
     }
+
+
+    /*
+     * Notifies client toolkit that it should change a cursor.
+     *
+     * Called from the peer via SwingAccessor, because the
+     * Component.updateCursorImmediately method is final
+     * and could not be overridden.
+     */
+    private void updateClientCursor() {
+        Point p = MouseInfo.getPointerInfo().getLocation();
+        SwingUtilities.convertPointFromScreen(p, this);
+        Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
+        if (target != null) {
+            content.setCursor(target.getCursor());
+        }
+    }
 }
--- a/jdk/src/share/classes/sun/swing/LightweightContent.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/swing/LightweightContent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -26,6 +26,7 @@
 package sun.swing;
 
 import javax.swing.JComponent;
+import java.awt.Cursor;
 
 /**
  * The interface by means of which the {@link JLightweightFrame} class
@@ -179,4 +180,11 @@
      * application that the content minimum size has changed.
      */
     public void minimumSizeChanged(int width, int height);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that in needs to set a cursor
+     * @param cursor a cursor to set
+     */
+    default public void setCursor(Cursor cursor) { }
 }
--- a/jdk/src/share/classes/sun/swing/SwingAccessor.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/swing/SwingAccessor.java	Fri Oct 11 09:17:18 2013 -0400
@@ -72,6 +72,16 @@
     }
 
     /**
+     * An accessor for the JLightweightFrame class.
+     */
+    public interface JLightweightFrameAccessor {
+        /**
+         * Notifies the JLightweight frame that it needs to update a cursor
+         */
+        void updateCursor(JLightweightFrame frame);
+    }
+
+    /**
      * The javax.swing.text.JTextComponent class accessor object.
      */
     private static JTextComponentAccessor jtextComponentAccessor;
@@ -93,4 +103,23 @@
 
         return jtextComponentAccessor;
     }
+
+    /**
+     * The JLightweightFrame class accessor object
+     */
+    private static JLightweightFrameAccessor jLightweightFrameAccessor;
+
+    /**
+     * Set an accessor object for the JLightweightFrame class.
+     */
+    public static void setJLightweightFrameAccessor(JLightweightFrameAccessor accessor) {
+        jLightweightFrameAccessor = accessor;
+    }
+
+    /**
+     * Retrieve the accessor object for the JLightweightFrame class
+     */
+    public static JLightweightFrameAccessor getJLightweightFrameAccessor() {
+        return jLightweightFrameAccessor;
+    }
 }
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 import java.awt.font.*;
 import java.awt.geom.*;
 import java.awt.print.PrinterGraphics;
+import java.text.CharacterIterator;
 import java.text.AttributedCharacterIterator;
 import java.text.AttributedString;
 
@@ -504,22 +505,25 @@
                  * it to fit in the screen width. This distributes the spacing
                  * more evenly than directly laying out to the screen advances.
                  */
-                float screenWidth = (float)
-                   g2d.getFont().getStringBounds(text, DEFAULT_FRC).getWidth();
-                TextLayout layout = createTextLayout(c, text, g2d.getFont(),
-                                                   g2d.getFontRenderContext());
+                String trimmedText = trimTrailingSpaces(text);
+                if (!trimmedText.isEmpty()) {
+                    float screenWidth = (float) g2d.getFont().getStringBounds
+                            (trimmedText, DEFAULT_FRC).getWidth();
+                    TextLayout layout = createTextLayout(c, text, g2d.getFont(),
+                                                       g2d.getFontRenderContext());
 
-                layout = layout.getJustifiedLayout(screenWidth);
-                /* Use alternate print color if specified */
-                Color col = g2d.getColor();
-                if (col instanceof PrintColorUIResource) {
-                    g2d.setColor(((PrintColorUIResource)col).getPrintColor());
+                    layout = layout.getJustifiedLayout(screenWidth);
+                    /* Use alternate print color if specified */
+                    Color col = g2d.getColor();
+                    if (col instanceof PrintColorUIResource) {
+                        g2d.setColor(((PrintColorUIResource)col).getPrintColor());
+                    }
+
+                    layout.draw(g2d, x, y);
+
+                    g2d.setColor(col);
                 }
 
-                layout.draw(g2d, x, y);
-
-                g2d.setColor(col);
-
                 return;
             }
         }
@@ -789,25 +793,27 @@
                 if (frc != null &&
                     !isFontRenderContextPrintCompatible
                     (deviceFontRenderContext, frc)) {
-                    TextLayout layout =
-                        createTextLayout(c, new String(data, offset, length),
-                                       g2d.getFont(),
-                                       deviceFontRenderContext);
-                    float screenWidth = (float)g2d.getFont().
-                        getStringBounds(data, offset, offset + length, frc).
-                        getWidth();
-                    layout = layout.getJustifiedLayout(screenWidth);
+
+                    String text = new String(data, offset, length);
+                    TextLayout layout = new TextLayout(text, g2d.getFont(),
+                                    deviceFontRenderContext);
+                    String trimmedText = trimTrailingSpaces(text);
+                    if (!trimmedText.isEmpty()) {
+                        float screenWidth = (float)g2d.getFont().
+                            getStringBounds(trimmedText, frc).getWidth();
+                        layout = layout.getJustifiedLayout(screenWidth);
 
-                    /* Use alternate print color if specified */
-                    Color col = g2d.getColor();
-                    if (col instanceof PrintColorUIResource) {
-                        g2d.setColor(((PrintColorUIResource)col).getPrintColor());
+                        /* Use alternate print color if specified */
+                        Color col = g2d.getColor();
+                        if (col instanceof PrintColorUIResource) {
+                            g2d.setColor(((PrintColorUIResource)col).getPrintColor());
+                        }
+
+                        layout.draw(g2d,x,y);
+
+                        g2d.setColor(col);
                     }
 
-                    layout.draw(g2d,x,y);
-
-                    g2d.setColor(col);
-
                     return nextX;
                 }
             }
@@ -888,14 +894,23 @@
             } else {
                 frc = g2d.getFontRenderContext();
             }
-            TextLayout layout = new TextLayout(iterator, frc);
+            TextLayout layout;
             if (isPrinting) {
                 FontRenderContext deviceFRC = g2d.getFontRenderContext();
                 if (!isFontRenderContextPrintCompatible(frc, deviceFRC)) {
-                    float screenWidth = layout.getAdvance();
                     layout = new TextLayout(iterator, deviceFRC);
-                    layout = layout.getJustifiedLayout(screenWidth);
+                    AttributedCharacterIterator trimmedIt =
+                            getTrimmedTrailingSpacesIterator(iterator);
+                    if (trimmedIt != null) {
+                        float screenWidth = new TextLayout(trimmedIt, frc).
+                                getAdvance();
+                        layout = layout.getJustifiedLayout(screenWidth);
+                    }
+                } else {
+                    layout = new TextLayout(iterator, frc);
                 }
+            } else {
+                layout = new TextLayout(iterator, frc);
             }
             layout.draw(g2d, x, y);
             retVal = layout.getAdvance();
@@ -1047,6 +1062,39 @@
         return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
     }
 
+    private static String trimTrailingSpaces(String s) {
+        int i = s.length() - 1;
+        while(i >= 0 && Character.isWhitespace(s.charAt(i))) {
+            i--;
+        }
+        return s.substring(0, i + 1);
+    }
+
+    private static AttributedCharacterIterator getTrimmedTrailingSpacesIterator
+            (AttributedCharacterIterator iterator) {
+        int curIdx = iterator.getIndex();
+
+        char c = iterator.last();
+        while(c != CharacterIterator.DONE && Character.isWhitespace(c)) {
+            c = iterator.previous();
+        }
+
+        if (c != CharacterIterator.DONE) {
+            int endIdx = iterator.getIndex();
+
+            if (endIdx == iterator.getEndIndex() - 1) {
+                iterator.setIndex(curIdx);
+                return iterator;
+            } else {
+                AttributedString trimmedText = new AttributedString(iterator,
+                        iterator.getBeginIndex(), endIdx + 1);
+                return trimmedText.getIterator();
+            }
+        } else {
+            return null;
+        }
+    }
+
     /**
      * Determines whether the SelectedTextColor should be used for painting text
      * foreground for the specified highlight.
--- a/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -923,70 +923,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
-            PropertyChangeListener {
-        protected FileFilter[] filters;
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if(filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if(currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if(found == false) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if(filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public FileFilter getElementAt(int index) {
-            if(index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if(filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return SynthFileChooserUIImpl.this.getFileChooser();
         }
     }
 
--- a/jdk/src/share/classes/sun/tools/jstat/RowClosure.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/classes/sun/tools/jstat/RowClosure.java	Fri Oct 11 09:17:18 2013 -0400
@@ -62,6 +62,9 @@
             double d = ((Number)value).doubleValue();
             double scaledValue = c.getScale().scale(d);
             DecimalFormat df = new DecimalFormat(c.getFormat());
+            DecimalFormatSymbols syms = df.getDecimalFormatSymbols();
+            syms.setNaN("-");
+            df.setDecimalFormatSymbols(syms);
             s = df.format(scaledValue);
         }
 
--- a/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java	Fri Oct 11 09:17:18 2013 -0400
@@ -348,7 +348,7 @@
         InputStream is = null;
         try {
             Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
-            is = new URL(getDocumentBase(), mdname).openStream();
+            is = getClass().getResourceAsStream(mdname);
             XYZChemModel m = new XYZChemModel(is);
             Atom.setApplet(this);
             md = m;
--- a/jdk/src/share/demo/applets/MoleculeViewer/example1.html	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example1.html	Fri Oct 11 09:17:18 2013 -0400
@@ -2,10 +2,10 @@
   <head>
       <title>MoleculeViewer (example 1)</title>
   </head>
-  <body> 
+  <body>
       <h1>MoleculeViewer (example 1)</h1>
       <hr>
-      <applet code=XYZApp.class width=300 height=300>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=300 height=300>
 	<param name=model value="models/HyaluronicAcid.xyz">
 	alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -13,7 +13,7 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
 
 
 
--- a/jdk/src/share/demo/applets/MoleculeViewer/example2.html	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example2.html	Fri Oct 11 09:17:18 2013 -0400
@@ -2,10 +2,10 @@
   <head>
       <title>MoleculeViewer (example 2)</title>
   </head>
-  <body> 
+  <body>
       <h1>MoleculeViewer (example 2)</h1>
       <hr>
-      <applet code=XYZApp.class width=300 height=300>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=300 height=300>
 	<param name=model value="models/buckminsterfullerine.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -13,4 +13,4 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
--- a/jdk/src/share/demo/applets/MoleculeViewer/example3.html	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example3.html	Fri Oct 11 09:17:18 2013 -0400
@@ -5,25 +5,25 @@
   <body>
       <h1>MoleculeViewer (example 3)</h1>
       <hr>
-      <applet code=XYZApp.class width=100 height=100>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	<param name=model value="models/water.xyz">
 	alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	Your browser is completely ignoring the &lt;APPLET&gt; tag!
       </applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
           <param name=model value="models/benzene.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
 	</applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	  <param name=model value="models/ethane.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
 	</applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	  <param name=model value="models/cyclohexane.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -31,5 +31,5 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
 
--- a/jdk/src/share/demo/applets/WireFrame/ThreeD.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/WireFrame/ThreeD.java	Fri Oct 11 09:17:18 2013 -0400
@@ -416,7 +416,7 @@
         InputStream is = null;
         try {
             Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
-            is = new URL(getDocumentBase(), mdname).openStream();
+            is = getClass().getResourceAsStream(mdname);
             Model3D m = new Model3D(is);
             md = m;
             m.findBB();
--- a/jdk/src/share/demo/applets/WireFrame/example1.html	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/WireFrame/example1.html	Fri Oct 11 09:17:18 2013 -0400
@@ -5,7 +5,7 @@
   <body>
     <h1>3D Model: Cube</h1>
       <hr>
-      <applet code=ThreeD.class width=100 height=100>
+      <applet code=ThreeD.class archive=WireFrame.jar width=100 height=100>
 	<param name=model value="models/cube.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example2.html	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/WireFrame/example2.html	Fri Oct 11 09:17:18 2013 -0400
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: Dinosaur</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/dinasaur.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example3.html	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/WireFrame/example3.html	Fri Oct 11 09:17:18 2013 -0400
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: Hughes</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/hughes_500.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example4.html	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/share/demo/applets/WireFrame/example4.html	Fri Oct 11 09:17:18 2013 -0400
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: knoxS</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/knoxS.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/solaris/bin/java_md_solinux.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/bin/java_md_solinux.c	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -59,7 +59,6 @@
  */
 
 #ifdef __solaris__
-#  define DUAL_MODE
 #  ifndef LIBARCH32NAME
 #    error "The macro LIBARCH32NAME was not defined on the compile line"
 #  endif
--- a/jdk/src/solaris/classes/com/sun/management/OSMBeanFactory.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/classes/com/sun/management/OSMBeanFactory.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,6 +35,7 @@
  * public API and its API may change in incompatable ways between dot dot
  * releases and even patch releases. You should not rely on this class.
  */
+@jdk.Exported(false)
 public class OSMBeanFactory {
     /* static factory class */
     private OSMBeanFactory() {};
--- a/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,13 +145,8 @@
     }
 
     /*
-     * two native methods to call corresponding methods in Container and
-     * Component
+     * native method to call corresponding methods in Component
      */
-    protected  Component findComponentAt(Container con, int x, int y) {
-        return con.findComponentAt(x,y);
-    }
-
     protected  Point getLocationOnScreen(Component c) {
         return c.getLocationOnScreen();
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -28,6 +28,8 @@
 import java.awt.Graphics;
 
 import sun.awt.LightweightFrame;
+import sun.swing.JLightweightFrame;
+import sun.swing.SwingAccessor;
 
 public class XLightweightFramePeer extends XFramePeer {
 
@@ -62,4 +64,9 @@
             getLwTarget().ungrabFocus();
         }
     }
+
+    @Override
+    public void updateCursorImmediately() {
+        SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
+    }
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -2249,6 +2249,8 @@
                                                      XConstants.XkbModifierMapMask |
                                                      XConstants.XkbVirtualModsMask,
                                                      XConstants.XkbUseCoreKbd);
+
+                        XlibWrapper.XkbSetDetectableAutoRepeat(getDisplay(), true);
                     }
                 }
             }
--- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -459,7 +459,7 @@
             // other class tries to cast source field to Component).
             // We already filter DRAG events out (CR 6565779).
             e.setSource(xtiPeer.target);
-            Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
+            XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), e);
         }
         public void mouseClicked(MouseEvent e) {
             if ((e.getClickCount() > 1 || xtiPeer.balloon.isVisible()) &&
--- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Fri Oct 11 09:17:18 2013 -0400
@@ -592,7 +592,7 @@
     }
 
     static boolean isMutter() {
-        return isNetWMName("Mutter");
+        return isNetWMName("Mutter") || isNetWMName("GNOME Shell");
     }
 
     static boolean isNonReparentingWM() {
--- a/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	Fri Oct 11 09:17:18 2013 -0400
@@ -509,6 +509,7 @@
     static native long XkbGetUpdatedMap(long display, long which, long xkb);
     static native void XkbFreeKeyboard(long xkb, long which, boolean free_all);
     static native boolean XkbTranslateKeyCode(long xkb, int keycode, long mods, long mods_rtrn, long keysym_rtrn);
+    static native void XkbSetDetectableAutoRepeat(long display, boolean detectable);
 
 
     static native void XConvertCase(long keysym,
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRMaskImage.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRMaskImage.java	Fri Oct 11 09:17:18 2013 -0400
@@ -45,6 +45,7 @@
     int blitMaskPicture;
     int lastMaskWidth = 0;
     int lastMaskHeight = 0;
+    int lastEA = -1;
     AffineTransform lastMaskTransform;
 
     XRCompositeManager xrMgr;
@@ -82,13 +83,15 @@
                 lastMaskTransform = maskTX;
         }
 
-        if (lastMaskWidth != maskWidth || lastMaskHeight != maskHeight)  {
+        int currentEA = xrMgr.getAlphaColor().getAlpha();
+        if (lastMaskWidth != maskWidth || lastMaskHeight != maskHeight || lastEA != currentEA)  {
             //Only clear mask, if previous mask area is larger than new one, otherwise simple overpaint it
             if (lastMaskWidth > maskWidth || lastMaskHeight > maskHeight)  {
                 con.renderRectangle(blitMaskPicture, XRUtils.PictOpClear, XRColor.NO_ALPHA, 0, 0, lastMaskWidth, lastMaskHeight);
             }
 
             con.renderRectangle(blitMaskPicture, XRUtils.PictOpSrc, xrMgr.getAlphaColor(), 0, 0, maskWidth, maskHeight);
+            lastEA = currentEA;
         }
 
         lastMaskWidth = maskWidth;
--- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -51,6 +51,24 @@
 #define HAS_GLIBC_GETHOSTBY_R   1
 #endif
 
+static jclass ni_iacls;
+static jclass ni_ia4cls;
+static jmethodID ni_ia4ctrID;
+
+static void initializeInetClasses(JNIEnv *env)
+{
+    static int initialized = 0;
+    if (!initialized) {
+        ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
+        ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
+        ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+        ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+        ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+        initialized = 1;
+    }
+}
+
+
 #if defined(_ALLBSD_SOURCE) && !defined(HAS_GLIBC_GETHOSTBY_R)
 /* Use getaddrinfo(3), which is thread safe */
 /************************************************************************
@@ -99,14 +117,6 @@
     return (*env)->NewStringUTF(env, hostname);
 }
 
-static jclass ni_iacls;
-static jclass ni_ia4cls;
-static jmethodID ni_ia4ctrID;
-static jfieldID ni_iaaddressID;
-static jfieldID ni_iahostID;
-static jfieldID ni_iafamilyID;
-static int initialized = 0;
-
 /*
  * Find an internet address for a given hostname.  Note that this
  * code only works for addresses of type INET. The translation
@@ -129,14 +139,7 @@
     int error=0;
     struct addrinfo hints, *res, *resNew = NULL;
 
-    if (!initialized) {
-      ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
-      ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
-      ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
-      ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
-      ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
-      initialized = 1;
-    }
+    initializeInetClasses(env);
 
     if (IS_NULL(host)) {
         JNU_ThrowNullPointerException(env, "host is null");
@@ -160,6 +163,17 @@
         return NULL;
     }
 
+#ifdef MACOSX
+    /* If we're looking up the local machine, bypass DNS lookups and get
+     * address from getifaddrs.
+     */
+    ret = lookupIfLocalhost(env, hostname, JNI_FALSE);
+    if (ret != NULL || (*env)->ExceptionCheck(env)) {
+        JNU_ReleaseStringPlatformChars(env, host, hostname);
+        return ret;
+    }
+#endif
+
     error = getaddrinfo(hostname, NULL, &hints, &res);
 
     if (error) {
@@ -365,10 +379,7 @@
     return (*env)->NewStringUTF(env, hostname);
 }
 
-static jclass ni_iacls;
-static jclass ni_ia4cls;
-static jmethodID ni_ia4ctrID;
-static int initialized = 0;
+extern jobjectArray lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6);
 
 /*
  * Find an internet address for a given hostname.  Note that this
@@ -390,14 +401,7 @@
     int error = 0;
     struct addrinfo hints, *res, *resNew = NULL;
 
-    if (!initialized) {
-      ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
-      ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
-      ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
-      ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
-      ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
-      initialized = 1;
-    }
+    initializeInetClasses(env);
 
     if (IS_NULL(host)) {
         JNU_ThrowNullPointerException(env, "host is null");
--- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -33,7 +33,9 @@
 #include <strings.h>
 #include <stdlib.h>
 #include <ctype.h>
-#ifdef _ALLBSD_SOURCE
+#ifdef MACOSX
+#include <ifaddrs.h>
+#include <net/if.h>
 #include <unistd.h> /* gethostname */
 #endif
 
@@ -121,7 +123,145 @@
 static jmethodID ni_ia4ctrID;
 static jmethodID ni_ia6ctrID;
 static jfieldID ni_ia6ipaddressID;
-static int initialized = 0;
+
+static void initializeInetClasses(JNIEnv *env)
+{
+    static int initialized = 0;
+    if (!initialized) {
+        ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
+        ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
+        ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+        ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+        ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
+        ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
+        ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+        ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
+        ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
+        initialized = 1;
+    }
+}
+
+#ifdef MACOSX
+/* also called from Inet4AddressImpl.c */
+__private_extern__ jobjectArray
+lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6)
+{
+    jobjectArray result = NULL;
+    jboolean preferIPv6Address;
+    char myhostname[NI_MAXHOST+1];
+    struct ifaddrs *ifa = NULL;
+    int familyOrder = 0;
+    int count = 0, i, j;
+    int addrs4 = 0, addrs6 = 0, numV4Loopbacks = 0, numV6Loopbacks = 0;
+    jboolean includeLoopback = JNI_FALSE;
+    jobject name;
+
+    // Make sure static variables we need are set.
+    initializeInetClasses(env);
+
+    /* get the address preference */
+    preferIPv6Address = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
+
+    /* If the requested name matches this host's hostname, return IP addresses
+     * from all attached interfaces. (#2844683 et al) This prevents undesired
+     * PPP dialup, but may return addresses that don't actually correspond to
+     * the name (if the name actually matches something in DNS etc.
+     */
+    myhostname[0] = '\0';
+    if (JVM_GetHostName(myhostname, NI_MAXHOST)) {
+        /* Something went wrong, maybe networking is not setup? */
+        return NULL;
+    }
+    myhostname[NI_MAXHOST] = '\0';
+
+    if (strcmp(myhostname, hostname) != 0) {
+        // Non-self lookup
+        return NULL;
+    }
+
+    if (getifaddrs(&ifa) != 0) {
+        NET_ThrowNew(env, errno, "Can't get local interface addresses");
+        return NULL;
+    }
+
+    name = (*env)->NewStringUTF(env, hostname);
+
+    /* Iterate over the interfaces, and total up the number of IPv4 and IPv6
+     * addresses we have. Also keep a count of loopback addresses. We need to
+     * exclude them in the normal case, but return them if we don't get an IP
+     * address.
+     */
+    struct ifaddrs *iter = ifa;
+    while (iter) {
+        int family = iter->ifa_addr->sa_family;
+        if (iter->ifa_name[0] != '\0'  &&  iter->ifa_addr)
+        {
+            jboolean isLoopback = iter->ifa_flags & IFF_LOOPBACK;
+            if (family == AF_INET) {
+                addrs4++;
+                if (isLoopback) numV4Loopbacks++;
+            } else if (family == AF_INET6 && includeV6) {
+                addrs6++;
+                if (isLoopback) numV6Loopbacks++;
+            } else {
+                /* We don't care e.g. AF_LINK */
+            }
+        }
+        iter = iter->ifa_next;
+    }
+
+    if (addrs4 == numV4Loopbacks && addrs6 == numV6Loopbacks) {
+        // We don't have a real IP address, just loopback. We need to include
+        // loopback in our results.
+        includeLoopback = JNI_TRUE;
+    }
+
+    /* Create and fill the Java array. */
+    int arraySize = addrs4 + addrs6 -
+        (includeLoopback ? 0 : (numV4Loopbacks + numV6Loopbacks));
+    result = (*env)->NewObjectArray(env, arraySize, ni_iacls, NULL);
+    if (!result) goto done;
+
+    if (preferIPv6Address) {
+        i = includeLoopback ? addrs6 : (addrs6 - numV6Loopbacks);
+        j = 0;
+    } else {
+        i = 0;
+        j = includeLoopback ? addrs4 : (addrs4 - numV4Loopbacks);
+    }
+
+    // Now loop around the ifaddrs
+    iter = ifa;
+    while (iter != NULL) {
+        jboolean isLoopback = iter->ifa_flags & IFF_LOOPBACK;
+        int family = iter->ifa_addr->sa_family;
+
+        if (iter->ifa_name[0] != '\0'  &&  iter->ifa_addr
+            && (family == AF_INET || (family == AF_INET6 && includeV6))
+            && (!isLoopback || includeLoopback))
+        {
+            int port;
+            int index = (family == AF_INET) ? i++ : j++;
+            jobject o = NET_SockaddrToInetAddress(env, iter->ifa_addr, &port);
+            if (!o) {
+                freeifaddrs(ifa);
+                if (!(*env)->ExceptionCheck(env))
+                    JNU_ThrowOutOfMemoryError(env, "Object allocation failed");
+                return NULL;
+            }
+            setInetAddress_hostName(env, o, name);
+            (*env)->SetObjectArrayElement(env, result, index, o);
+            (*env)->DeleteLocalRef(env, o);
+        }
+        iter = iter->ifa_next;
+    }
+
+  done:
+    freeifaddrs(ifa);
+
+    return result;
+}
+#endif
 
 /*
  * Find an internet address for a given hostname.  Note that this
@@ -147,18 +287,7 @@
     struct addrinfo hints, *res, *resNew = NULL;
 #endif /* AF_INET6 */
 
-    if (!initialized) {
-      ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
-      ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
-      ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
-      ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
-      ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
-      ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
-      ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
-      ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
-      ni_ia6ipaddressID = (*env)->GetFieldID(env, ni_ia6cls, "ipaddress", "[B");
-      initialized = 1;
-    }
+    initializeInetClasses(env);
 
     if (IS_NULL(host)) {
         JNU_ThrowNullPointerException(env, "host is null");
@@ -167,6 +296,21 @@
     hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
     CHECK_NULL_RETURN(hostname, NULL);
 
+#ifdef MACOSX
+    /*
+     * If getaddrinfo has failed and we're looking up the local machine, we
+     * attempt to get the address from getifaddrs. This ensures we get an
+     * IPv6 address for the local machine.
+     */
+    if (error) {
+        ret = lookupIfLocalhost(env, hostname, JNI_TRUE);
+        if (ret != NULL || (*env)->ExceptionCheck(env)) {
+            JNU_ReleaseStringPlatformChars(env, host, hostname);
+            return ret;
+        }
+    }
+#endif
+
 #ifdef AF_INET6
     static jfieldID ia_preferIPv6AddressID;
     if (ia_preferIPv6AddressID == NULL) {
--- a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c	Fri Oct 11 09:17:18 2013 -0400
@@ -523,8 +523,12 @@
     //printf("native, output:  keysym:0x%0X; mods:0x%0X\n", *(unsigned int *)jlong_to_ptr(keysym_rtrn), *(unsigned int *)jlong_to_ptr(mods_rtrn));
     return b;
 }
-
-
+JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat
+(JNIEnv *env, jclass clazz, jlong display, jboolean detectable)
+{
+    AWT_CHECK_HAVE_LOCK();
+    XkbSetDetectableAutoRepeat((Display *) jlong_to_ptr(display), detectable, NULL);
+}
 /*
  * Class:     sun_awt_X11_XlibWrapper
  * Method:    XNextEvent
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -656,7 +656,7 @@
         _setFont(f);
     }
     public synchronized native void _setFont(Font f);
-    public final void updateCursorImmediately() {
+    public void updateCursorImmediately() {
         WGlobalCursorManager.getCursorManager().updateCursorImmediately();
     }
 
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -211,9 +211,9 @@
                         DataFlavor.allHtmlFlavor,
                         format);
             } else {
-                // handel other html flavor types, including custom and
+                // handle other html flavor types, including custom and
                 // fragment ones
-                bytes = HTMLCodec.convertToHTMLFormat(bytes);
+                bytes = HTMLCodec.convertToHTMLFormat(super.translateTransferable(contents, flavor, format));
             }
         } else {
             // we handle non-html types basing on  their
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -182,6 +182,7 @@
 
         AWTAccessor.getFileDialogAccessor().setFile(fileDialog, null);
         AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null);
+        AWTAccessor.getFileDialogAccessor().setDirectory(fileDialog, null);
 
         WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
              public void run() {
--- a/jdk/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2000, 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
@@ -48,7 +48,6 @@
 
     protected native void setCursor(Component comp, Cursor cursor, boolean u);
     protected native void getCursorPos(Point p);
-    protected native Component findComponentAt(Container con, int x, int y);
     /*
      * two native methods to call corresponding methods in Container and
      * Component
--- a/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,6 +31,8 @@
 import java.awt.event.MouseEvent;
 
 import sun.awt.LightweightFrame;
+import sun.swing.JLightweightFrame;
+import sun.swing.SwingAccessor;
 
 public class WLightweightFramePeer extends WFramePeer {
 
@@ -83,4 +85,9 @@
     public void ungrab() {
         getLwTarget().ungrabFocus();
     }
+
+    @Override
+    public void updateCursorImmediately() {
+        SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
+    }
 }
--- a/jdk/src/windows/native/sun/windows/awt_Container.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_Container.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, 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
@@ -31,7 +31,6 @@
  */
 
 jfieldID AwtContainer::layoutMgrID;
-jmethodID AwtContainer::findComponentAtMID;
 
 /************************************************************************
  * AwtContainer native methods
@@ -46,11 +45,7 @@
     AwtContainer::layoutMgrID =
         env->GetFieldID(cls, "layoutMgr", "Ljava/awt/LayoutManager;");
 
-    AwtContainer::findComponentAtMID =
-        env->GetMethodID(cls, "findComponentAt", "(IIZ)Ljava/awt/Component;");
-
     DASSERT(AwtContainer::layoutMgrID != NULL);
-    DASSERT(AwtContainer::findComponentAtMID);
 
     CATCH_BAD_ALLOC;
 }
--- a/jdk/src/windows/native/sun/windows/awt_Container.h	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_Container.h	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, 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
@@ -38,7 +38,6 @@
 
     /* java.awt.Container field ids */
     static jfieldID layoutMgrID;
-    static jmethodID findComponentAtMID;
 
 };
 
--- a/jdk/src/windows/native/sun/windows/awt_Cursor.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_Cursor.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -554,32 +554,6 @@
 
 /*
  * Class:     sun_awt_windows_WGlobalCursorManager
- * Method:    findComponentAt
- * Signature: (L/java/awt/Container;II)L/java/awt/Component
- */
-JNIEXPORT jobject JNICALL
-Java_sun_awt_windows_WGlobalCursorManager_findComponentAt(
-    JNIEnv *env, jobject, jobject container, jint x, jint y)
-{
-    TRY;
-
-    /*
-     * Call private version of Container.findComponentAt with the following
-     * flag set -- ignoreEnabled = false (i.e., don't return or recur into
-     * disabled Components);
-     * NOTE: it may return a JRootPane's glass pane as the target Component
-     */
-    JNI_CHECK_NULL_RETURN_NULL(container, "null container");
-    jobject comp =
-        env->CallObjectMethod(container, AwtContainer::findComponentAtMID,
-                              x, y, JNI_FALSE);
-    return comp;
-
-    CATCH_BAD_ALLOC_RET(NULL);
-}
-
-/*
- * Class:     sun_awt_windows_WGlobalCursorManager
  * Method:    getLocationOnScreen
  * Signature: (L/java/awt/Component;)L/java/awt/Point
  */
--- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@
     int length = env->GetStringLength(filterDescription);
     DASSERT(length + 1 < MAX_FILTER_STRING);
     LPCTSTR tmp = JNU_GetStringPlatformChars(env, filterDescription, NULL);
-    _tcscpy(s_fileFilterString, tmp);
+    _tcscpy_s(s_fileFilterString, MAX_FILTER_STRING, tmp);
     JNU_ReleaseStringPlatformChars(env, filterDescription, tmp);
 
     //AdditionalString should be terminated by two NULL characters (Windows
@@ -353,7 +353,7 @@
         if (!result) {
             dlgerr = ::CommDlgExtendedError();
             if (dlgerr == FNERR_INVALIDFILENAME) {
-                _tcscpy(fileBuffer, TEXT(""));
+                _tcscpy_s(fileBuffer, bufferLimit, TEXT(""));
                 if (mode == java_awt_FileDialog_LOAD) {
                     result = AwtFileDialog::GetOpenFileName(&ofn);
                 } else {
@@ -372,7 +372,9 @@
 
         // Report result to peer.
         if (result) {
-            jint length = (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile);
+            jint length = multipleMode
+                    ? (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile)
+                    : (jint)_tcslen(ofn.lpstrFile);
             jcharArray jnames = env->NewCharArray(length);
             env->SetCharArrayRegion(jnames, 0, length, (jchar*)ofn.lpstrFile);
 
--- a/jdk/src/windows/native/sun/windows/awt_Font.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_Font.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -366,17 +366,6 @@
     return awtFont;
 }
 
-int CALLBACK FindFamilyName (ENUMLOGFONTEX *lpelfe,
-          NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam)
-{
-    if(_tcsstr((LPTSTR)lParam, lpelfe->elfLogFont.lfFaceName)) {
-        _tcscpy((LPTSTR)lParam, lpelfe->elfLogFont.lfFaceName);
-        return 0;
-    } else {
-        return 1;
-    }
-}
-
 static void strip_tail(wchar_t* text, wchar_t* tail) { // strips tail and any possible whitespace before it from the end of text
     if (wcslen(text)<=wcslen(tail)) {
         return;
--- a/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, 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
@@ -428,17 +428,17 @@
         devnames->wOutputOffset =
             static_cast<WORD>(sizeof(DEVNAMES)/sizeof(TCHAR) + lenDriverName + lenPrinterName);
         if (info2->pDriverName != NULL) {
-            _tcscpy(lpcDevnames + devnames->wDriverOffset, info2->pDriverName);
+            _tcscpy_s(lpcDevnames + devnames->wDriverOffset, devnameSize - devnames->wDriverOffset, info2->pDriverName);
         } else {
             *(lpcDevnames + devnames->wDriverOffset) = _T('\0');
         }
         if (pPrinterName != NULL) {
-            _tcscpy(lpcDevnames + devnames->wDeviceOffset, pPrinterName);
+            _tcscpy_s(lpcDevnames + devnames->wDeviceOffset, devnameSize - devnames->wDeviceOffset, pPrinterName);
         } else {
             *(lpcDevnames + devnames->wDeviceOffset) = _T('\0');
         }
         if (info2->pPortName != NULL) {
-            _tcscpy(lpcDevnames + devnames->wOutputOffset, info2->pPortName);
+            _tcscpy_s(lpcDevnames + devnames->wOutputOffset, devnameSize - devnames->wOutputOffset, info2->pPortName);
         } else {
             *(lpcDevnames + devnames->wOutputOffset) = _T('\0');
         }
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -228,7 +228,7 @@
         // create input locale string, e.g., "00000409", from hkl.
         TCHAR inputLocale[9];
         TCHAR buf[9];
-        _tcscpy(inputLocale, TEXT("00000000"));
+        _tcscpy_s(inputLocale, 9, TEXT("00000000"));
 
     // 64-bit: ::LoadKeyboardLayout() is such a weird API - a string of
     // the hex value you want?!  Here we're converting our HKL value to
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -711,7 +711,7 @@
         _tcsncpy(m_nid.szTip, tooltip, TRAY_ICON_TOOLTIP_MAX_SIZE);
         m_nid.szTip[TRAY_ICON_TOOLTIP_MAX_SIZE - 1] = '\0';
     } else {
-        _tcscpy(m_nid.szTip, tooltip);
+        _tcscpy_s(m_nid.szTip, TRAY_ICON_TOOLTIP_MAX_SIZE, tooltip);
     }
 
     SendTrayMessage(NIM_MODIFY);
@@ -817,7 +817,7 @@
         m_nid.szInfoTitle[TRAY_ICON_BALLOON_TITLE_MAX_SIZE - 1] = '\0';
 
     } else {
-        _tcscpy(m_nid.szInfoTitle, caption);
+        _tcscpy_s(m_nid.szInfoTitle, TRAY_ICON_BALLOON_TITLE_MAX_SIZE, caption);
     }
 
     if (text[0] == '\0') {
@@ -830,7 +830,7 @@
         m_nid.szInfo[TRAY_ICON_BALLOON_INFO_MAX_SIZE - 1] = '\0';
 
     } else {
-        _tcscpy(m_nid.szInfo, text);
+        _tcscpy_s(m_nid.szInfo, TRAY_ICON_BALLOON_INFO_MAX_SIZE, text);
     }
 
     SendTrayMessage(NIM_MODIFY);
--- a/jdk/src/windows/native/sun/windows/awt_ole.cpp	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/src/windows/native/sun/windows/awt_ole.cpp	Fri Oct 11 09:17:18 2013 -0400
@@ -70,7 +70,7 @@
             bErrorReport?_T("Error:"):_T(""),
             szBuffer) < 0)
         {
-            _tcscpy(szBuffer1 + DTRACE_BUF_LEN - 5, _T("...")); //reserver for \n
+            _tcscpy_s(szBuffer1 + DTRACE_BUF_LEN - 5, 5, _T("...")); //reserver for \n
         }
         memcpy(szBuffer1, szTime, iTimeLen*sizeof(TCHAR));
         _tcscat(szBuffer1, _T("\n"));
--- a/jdk/test/ProblemList.txt	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/ProblemList.txt	Fri Oct 11 09:17:18 2013 -0400
@@ -134,6 +134,9 @@
 # 8021230
 java/lang/ThreadLocal/ThreadLocalSupplierTest.java              generic-all
 
+# 8023201
+java/lang/instrument/RetransformBigClass.sh                     generic-all
+java/lang/instrument/RedefineBigClass.sh                        generic-all
 
 ############################################################################
 
@@ -163,9 +166,6 @@
 # 7027502
 demo/jvmti/hprof/MonitorTest.java                               generic-all
 
-# 8021186
-jdk/lambda/vm/DefaultMethodsTest.java                           generic-all 
-
 # 8024423 - JVMTI: GetLoadedClasses doesn't enumerate anonymous classes 
 demo/jvmti/hprof/HeapAllTest.java                               generic-all
 demo/jvmti/hprof/HeapBinaryFormatTest.java                      generic-all
@@ -322,18 +322,6 @@
 # 8007410
 tools/launcher/FXLauncherTest.java                              linux-all
 
-# 8025427
-sun/tools/jstat/jstatLineCounts1.sh                                 generic-all
-sun/tools/jstat/jstatLineCounts2.sh                                 generic-all
-sun/tools/jstat/jstatLineCounts3.sh                                 generic-all
-sun/tools/jstat/jstatTimeStamp1.sh                                  generic-all
-sun/tools/jstat/jstatGcCauseOutput1.sh                              generic-all
-sun/tools/jstat/jstatLineCounts4.sh                                 generic-all
-sun/tools/jstatd/jstatdDefaults.sh                                  generic-all
-sun/tools/jstatd/jstatdExternalRegistry.sh                          generic-all
-sun/tools/jstatd/jstatdPort.sh                                      generic-all
-sun/tools/jstatd/jstatdServerName.sh                                generic-all
-
 ############################################################################
 
 # jdk_jdi
--- a/jdk/test/com/oracle/security/ucrypto/TestAES.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/*
- * 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     7088989
- * @summary Ensure the AES ciphers of OracleUcrypto provider works correctly
- */
-import java.io.*;
-import java.security.*;
-import java.security.spec.*;
-import java.util.*;
-import javax.crypto.*;
-import javax.crypto.spec.*;
-
-public class TestAES extends UcryptoTest {
-
-    private static final String[] PADDEDCIPHER_ALGOS = {
-        "AES/ECB/PKCS5Padding",
-        "AES/CBC/PKCS5Padding",
-        "AES/CFB128/PKCS5Padding"
-    };
-
-    private static final String[] CIPHER_ALGOS = {
-        "AES/ECB/NoPadding",
-        "AES/CBC/NoPadding",
-        "AES/CFB128/NoPadding",
-        "AES/CTR/NoPadding",
-    };
-
-    private static final SecretKey CIPHER_KEY =
-        new SecretKeySpec(new byte[16], "AES");
-
-    public static void main(String[] args) throws Exception {
-        main(new TestAES(), null);
-    }
-
-    public void doTest(Provider prov) throws Exception {
-        // Provider for testing Interoperability
-        Provider sunJCEProv = Security.getProvider("SunJCE");
-
-        testCipherInterop(CIPHER_ALGOS, CIPHER_KEY, prov, sunJCEProv);
-        testCipherInterop(PADDEDCIPHER_ALGOS, CIPHER_KEY, prov, sunJCEProv);
-
-        testCipherOffset(CIPHER_ALGOS, CIPHER_KEY, prov);
-        testCipherOffset(PADDEDCIPHER_ALGOS, CIPHER_KEY, prov);
-
-        testCipherKeyWrapping(PADDEDCIPHER_ALGOS, CIPHER_KEY, prov, sunJCEProv);
-        testCipherGCM(CIPHER_KEY, prov);
-    }
-
-    private static void testCipherInterop(String[] algos, SecretKey key,
-                                          Provider p,
-                                          Provider interopP) {
-        boolean testPassed = true;
-        byte[] in = new byte[32];
-        (new SecureRandom()).nextBytes(in);
-
-        for (String algo : algos) {
-            try {
-                // check ENC
-                Cipher c;
-                try {
-                    c = Cipher.getInstance(algo, p);
-                } catch (NoSuchAlgorithmException nsae) {
-                    System.out.println("Skipping Unsupported CIP algo: " + algo);
-                    continue;
-                }
-                c.init(Cipher.ENCRYPT_MODE, key, (AlgorithmParameters)null, null);
-                byte[] eout = c.doFinal(in, 0, in.length);
-
-                AlgorithmParameters params = c.getParameters();
-                Cipher c2 = Cipher.getInstance(algo, interopP);
-                c2.init(Cipher.ENCRYPT_MODE, key, params, null);
-                byte[] eout2 = c2.doFinal(in, 0, in.length);
-
-                if (!Arrays.equals(eout, eout2)) {
-                    System.out.println(algo + ": DIFF FAILED");
-                    testPassed = false;
-                } else {
-                    System.out.println(algo + ": ENC Passed");
-                }
-
-                // check DEC
-                c.init(Cipher.DECRYPT_MODE, key, params, null);
-                byte[] dout = c.doFinal(eout);
-                c2.init(Cipher.DECRYPT_MODE, key, params, null);
-                byte[] dout2 = c2.doFinal(eout2);
-
-                if (!Arrays.equals(dout, dout2)) {
-                    System.out.println(algo + ": DIFF FAILED");
-                    testPassed = false;
-                } else {
-                    System.out.println(algo + ": DEC Passed");
-                }
-            } catch(Exception ex) {
-                System.out.println("Unexpected Exception: " + algo);
-                ex.printStackTrace();
-                testPassed = false;
-            }
-        }
-
-        if (!testPassed) {
-            throw new RuntimeException("One or more CIPHER test failed!");
-        } else {
-            System.out.println("CIPHER Interop Tests Passed");
-        }
-    }
-
-    private static void testCipherOffset(String[] algos, SecretKey key,
-                                         Provider p) {
-        boolean testPassed = true;
-        byte[] in = new byte[16];
-        (new SecureRandom()).nextBytes(in);
-        int blockSize = 16;
-
-        for (int j = 1; j < (in.length - 1); j++) {
-            System.out.println("Input offset size: " + j);
-            for (int i = 0; i < algos.length; i++) {
-                try {
-                    // check ENC
-                    Cipher c;
-                    try {
-                        c = Cipher.getInstance(algos[i], p);
-                    } catch (NoSuchAlgorithmException nsae) {
-                        System.out.println("Skip Unsupported CIP algo: " + algos[i]);
-                        continue;
-                    }
-                    c.init(Cipher.ENCRYPT_MODE, key, (AlgorithmParameters)null, null);
-                    byte[] eout = new byte[c.getOutputSize(in.length)];
-                    int firstPartLen = in.length - j - 1;
-                    //System.out.print("1st UPDATE: " + firstPartLen);
-                    int k = c.update(in, 0, firstPartLen, eout, 0);
-                    k += c.update(in, firstPartLen, 1, eout, k);
-                    k += c.doFinal(in, firstPartLen+1, j, eout, k);
-
-                    AlgorithmParameters params = c.getParameters();
-
-                    Cipher c2 = Cipher.getInstance(algos[i], p);
-                    c2.init(Cipher.ENCRYPT_MODE, key, params, null);
-                    byte[] eout2 = new byte[c2.getOutputSize(in.length)];
-                    int k2 = c2.update(in, 0, j, eout2, 0);
-                    k2 += c2.update(in, j, 1, eout2, k2);
-                    k2 += c2.doFinal(in, j+1, firstPartLen, eout2, k2);
-
-                    if (!checkArrays(eout, k, eout2, k2)) testPassed = false;
-
-                    // check DEC
-                    c.init(Cipher.DECRYPT_MODE, key, params, null);
-                    byte[] dout = new byte[c.getOutputSize(eout.length)];
-                    k = c.update(eout, 0, firstPartLen, dout, 0);
-                    k += c.update(eout, firstPartLen, 1, dout, k);
-                    k += c.doFinal(eout, firstPartLen+1, eout.length - firstPartLen - 1, dout, k);
-                    if (!checkArrays(in, in.length, dout, k)) testPassed = false;
-                } catch(Exception ex) {
-                    System.out.println("Unexpected Exception: " + algos[i]);
-                    ex.printStackTrace();
-                    testPassed = false;
-                }
-            }
-        }
-        if (!testPassed) {
-            throw new RuntimeException("One or more CIPHER test failed!");
-        } else {
-            System.out.println("CIPHER Offset Tests Passed");
-        }
-    }
-
-    private static void testCipherKeyWrapping(String[] algos, SecretKey key,
-                                              Provider p, Provider interopP)
-        throws NoSuchAlgorithmException {
-        boolean testPassed = true;
-
-        // Test SecretKey, PrivateKey and PublicKey
-        Key[] tbwKeys = new Key[3];
-        int[] tbwKeyTypes = { Cipher.SECRET_KEY, Cipher.PRIVATE_KEY, Cipher.PUBLIC_KEY };
-        tbwKeys[0] = new SecretKeySpec(new byte[20], "Blowfish");
-        KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
-        kpg.initialize(1024);
-        KeyPair kp = kpg.generateKeyPair();
-        tbwKeys[1] = kp.getPrivate();
-        tbwKeys[2] = kp.getPublic();
-
-        for (int i = 0; i < algos.length; i++) {
-            try {
-                System.out.println(algos[i] + " - Native WRAP/Java UNWRAP");
-
-                Cipher c1;
-                try {
-                    c1 = Cipher.getInstance(algos[i], p);
-                } catch (NoSuchAlgorithmException nsae) {
-                    System.out.println("Skipping Unsupported CIP algo: " + algos[i]);
-                    continue;
-                }
-                c1.init(Cipher.WRAP_MODE, key, (AlgorithmParameters)null, null);
-                AlgorithmParameters params = c1.getParameters();
-                Cipher c2 = Cipher.getInstance(algos[i], interopP);
-                c2.init(Cipher.UNWRAP_MODE, key, params, null);
-
-                for (int j = 0; j < tbwKeys.length ; j++) {
-                    byte[] wrappedKey = c1.wrap(tbwKeys[j]);
-                    Key recovered = c2.unwrap(wrappedKey,
-                                              tbwKeys[j].getAlgorithm(), tbwKeyTypes[j]);
-                    if (!checkKeys(tbwKeys[j], recovered)) testPassed = false;
-                }
-
-                System.out.println(algos[i] + " - Java WRAP/Native UNWRAP");
-                c1 = Cipher.getInstance(algos[i], interopP);
-                c1.init(Cipher.WRAP_MODE, key, (AlgorithmParameters)null, null);
-                params = c1.getParameters();
-                c2 = Cipher.getInstance(algos[i], p);
-                c2.init(Cipher.UNWRAP_MODE, key, params, null);
-
-                for (int j = 0; j < tbwKeys.length ; j++) {
-                    byte[] wrappedKey = c1.wrap(tbwKeys[j]);
-                    Key recovered = c2.unwrap(wrappedKey,
-                                              tbwKeys[j].getAlgorithm(), tbwKeyTypes[j]);
-                    if (!checkKeys(tbwKeys[j], recovered)) testPassed = false;
-                }
-
-            } catch(Exception ex) {
-                System.out.println("Unexpected Exception: " + algos[i]);
-                ex.printStackTrace();
-                testPassed = false;
-            }
-        }
-        if (!testPassed) {
-            throw new RuntimeException("One or more CIPHER test failed!");
-        } else {
-            System.out.println("CIPHER KeyWrapping Tests Passed");
-        }
-    }
-
-
-    private static void testCipherGCM(SecretKey key,
-                                      Provider p) {
-        boolean testPassed = true;
-        byte[] in = new byte[16];
-        (new SecureRandom()).nextBytes(in);
-
-        byte[] iv = new byte[16];
-        (new SecureRandom()).nextBytes(iv);
-
-
-        String algo = "AES/GCM/NoPadding";
-        int tagLen[] = { 128, 120, 112, 104, 96, 64, 32 };
-
-        try {
-            Cipher c;
-            try {
-                c = Cipher.getInstance(algo, p);
-            } catch (NoSuchAlgorithmException nsae) {
-                System.out.println("Skipping Unsupported CIP algo: " + algo);
-                return;
-            }
-            for (int i = 0; i < tagLen.length; i++) {
-                AlgorithmParameterSpec paramSpec = new GCMParameterSpec(tagLen[i], iv);
-                // check ENC
-                c.init(Cipher.ENCRYPT_MODE, key, paramSpec, null);
-                c.updateAAD(iv);
-                byte[] eout = c.doFinal(in, 0, in.length);
-
-                AlgorithmParameters param = c.getParameters();
-                // check DEC
-                c.init(Cipher.DECRYPT_MODE, key, param, null);
-                c.updateAAD(iv);
-                byte[] dout = c.doFinal(eout, 0, eout.length);
-
-                if (!Arrays.equals(dout, in)) {
-                    System.out.println(algo + ": PT and RT DIFF FAILED");
-                    testPassed = false;
-                } else {
-                    System.out.println(algo + ": tagLen " + tagLen[i] + " done");
-                }
-            }
-        } catch(Exception ex) {
-            System.out.println("Unexpected Exception: " + algo);
-            ex.printStackTrace();
-            testPassed = false;
-        }
-        if (!testPassed) {
-            throw new RuntimeException("One or more CIPHER test failed!");
-        } else {
-            System.out.println("CIPHER GCM Tests Passed");
-        }
-    }
-
-    private static boolean checkArrays(byte[] a1, int a1Len, byte[] a2, int a2Len) {
-        boolean equal = true;
-        if (a1Len != a2Len) {
-            System.out.println("DIFFERENT OUT LENGTH");
-            equal = false;
-        } else {
-            for (int p = 0; p < a1Len; p++) {
-                if (a1[p] != a2[p]) {
-                    System.out.println("DIFF FAILED");
-                    equal = false;
-                    break;
-                }
-            }
-        }
-        return equal;
-    }
-
-    private static boolean checkKeys(Key k1, Key k2) {
-        boolean equal = true;
-        if (!k1.getAlgorithm().equalsIgnoreCase(k2.getAlgorithm())) {
-            System.out.println("DIFFERENT Key Algorithm");
-            equal = false;
-        } else if (!k1.getFormat().equalsIgnoreCase(k2.getFormat())) {
-            System.out.println("DIFFERENT Key Format");
-            equal = false;
-        } else if (!Arrays.equals(k1.getEncoded(), k2.getEncoded())) {
-            System.out.println("DIFFERENT Key Encoding");
-            equal = false;
-        }
-        return equal;
-    }
-}
--- a/jdk/test/com/oracle/security/ucrypto/TestDigest.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * 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     7088989
- * @summary Ensure the various message digests works correctly
- */
-import java.io.*;
-import java.security.*;
-import java.security.spec.*;
-import java.util.*;
-import javax.crypto.*;
-import javax.crypto.spec.*;
-
-public class TestDigest extends UcryptoTest {
-
-    private static final String[] MD_ALGOS = {
-        "MD5",
-        "SHA",
-        "SHA-256",
-        "SHA-384",
-        "SHA-512"
-    };
-
-    public static void main(String[] args) throws Exception {
-        main(new TestDigest(), null);
-    }
-
-    public void doTest(Provider p) {
-        boolean testPassed = true;
-        byte[] msg = new byte[200];
-        (new SecureRandom()).nextBytes(msg);
-        String interopProvName = "SUN";
-
-        for (String a : MD_ALGOS) {
-            try {
-                MessageDigest md, md2;
-                try {
-                    md = MessageDigest.getInstance(a, p);
-                } catch (NoSuchAlgorithmException nsae) {
-                    System.out.println("Skipping Unsupported MD algo: " + a);
-                    continue;
-                }
-                md2 = MessageDigest.getInstance(a, interopProvName);
-                // Test Interoperability for update+digest calls
-                for (int i = 0; i < 3; i++) {
-                    md.update(msg);
-                    byte[] digest = md.digest();
-                    md2.update(msg);
-                    byte[] digest2 = md2.digest();
-                    if (!Arrays.equals(digest, digest2)) {
-                        System.out.println("DIFF1 FAILED for: " + a + " at iter " + i);
-                        testPassed = false;
-                    }
-                }
-
-                // Test Interoperability for digest calls
-                md = MessageDigest.getInstance(a, p);
-                md2 = MessageDigest.getInstance(a, interopProvName);
-
-                for (int i = 0; i < 3; i++) {
-                    byte[] digest = md.digest();
-                    byte[] digest2 = md2.digest();
-                    if (!Arrays.equals(digest, digest2)) {
-                        System.out.println("DIFF2 FAILED for: " + a + " at iter " + i);
-                        testPassed = false;
-                    }
-                }
-
-                // Test Cloning functionality
-                md = MessageDigest.getInstance(a, p);
-                md2 = (MessageDigest) md.clone(); // clone right after construction
-                byte[] digest = md.digest();
-                byte[] digest2 = md2.digest();
-                if (!Arrays.equals(digest, digest2)) {
-                    System.out.println("DIFF-3.1 FAILED for: " + a);
-                    testPassed = false;
-                }
-                md.update(msg);
-                md2 = (MessageDigest) md.clone(); // clone again after update call
-                digest = md.digest();
-                digest2 = md2.digest();
-                if (!Arrays.equals(digest, digest2)) {
-                    System.out.println("DIFF-3.2 FAILED for: " + a);
-                    testPassed = false;
-                }
-                md2 = (MessageDigest) md.clone(); // clone after digest
-                digest = md.digest();
-                digest2 = md2.digest();
-                if (!Arrays.equals(digest, digest2)) {
-                    System.out.println("DIFF-3.3 FAILED for: " + a);
-                    testPassed = false;
-                }
-            } catch(Exception ex) {
-                System.out.println("Unexpected Exception: " + a);
-                ex.printStackTrace();
-                testPassed = false;
-            }
-        }
-        if (!testPassed) {
-            throw new RuntimeException("One or more MD test failed!");
-        } else {
-            System.out.println("MD Tests Passed");
-        }
-    }
-}
--- a/jdk/test/com/oracle/security/ucrypto/TestRSA.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,421 +0,0 @@
-/*
- * 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     7088989
- * @summary Ensure the RSA ciphers and signatures works correctly
- */
-import java.io.*;
-import java.security.*;
-import java.security.spec.*;
-import java.util.*;
-import java.math.*;
-import javax.crypto.*;
-
-public class TestRSA extends UcryptoTest {
-
-    // KAT
-    private static final byte PLAINTEXT[] = Arrays.copyOf
-        (new String("Known plaintext message utilized" +
-                    "for RSA Encryption &  Decryption" +
-                    "block, SHA1, SHA256, SHA384  and" +
-                    "SHA512 RSA Signature KAT tests.").getBytes(), 128);
-
-    private static final byte MOD[] = {
-        (byte)0xd5, (byte)0x84, (byte)0x95, (byte)0x07, (byte)0xf4, (byte)0xd0,
-        (byte)0x1f, (byte)0x82, (byte)0xf3, (byte)0x79, (byte)0xf4, (byte)0x99,
-        (byte)0x48, (byte)0x10, (byte)0xe1, (byte)0x71, (byte)0xa5, (byte)0x62,
-        (byte)0x22, (byte)0xa3, (byte)0x4b, (byte)0x00, (byte)0xe3, (byte)0x5b,
-        (byte)0x3a, (byte)0xcc, (byte)0x10, (byte)0x83, (byte)0xe0, (byte)0xaf,
-        (byte)0x61, (byte)0x13, (byte)0x54, (byte)0x6a, (byte)0xa2, (byte)0x6a,
-        (byte)0x2c, (byte)0x5e, (byte)0xb3, (byte)0xcc, (byte)0xa3, (byte)0x71,
-        (byte)0x9a, (byte)0xb2, (byte)0x3e, (byte)0x78, (byte)0xec, (byte)0xb5,
-        (byte)0x0e, (byte)0x6e, (byte)0x31, (byte)0x3b, (byte)0x77, (byte)0x1f,
-        (byte)0x6e, (byte)0x94, (byte)0x41, (byte)0x60, (byte)0xd5, (byte)0x6e,
-        (byte)0xd9, (byte)0xc6, (byte)0xf9, (byte)0x29, (byte)0xc3, (byte)0x40,
-        (byte)0x36, (byte)0x25, (byte)0xdb, (byte)0xea, (byte)0x0b, (byte)0x07,
-        (byte)0xae, (byte)0x76, (byte)0xfd, (byte)0x99, (byte)0x29, (byte)0xf4,
-        (byte)0x22, (byte)0xc1, (byte)0x1a, (byte)0x8f, (byte)0x05, (byte)0xfe,
-        (byte)0x98, (byte)0x09, (byte)0x07, (byte)0x05, (byte)0xc2, (byte)0x0f,
-        (byte)0x0b, (byte)0x11, (byte)0x83, (byte)0x39, (byte)0xca, (byte)0xc7,
-        (byte)0x43, (byte)0x63, (byte)0xff, (byte)0x33, (byte)0x80, (byte)0xe7,
-        (byte)0xc3, (byte)0x78, (byte)0xae, (byte)0xf1, (byte)0x73, (byte)0x52,
-        (byte)0x98, (byte)0x1d, (byte)0xde, (byte)0x5c, (byte)0x53, (byte)0x6e,
-        (byte)0x01, (byte)0x73, (byte)0x0d, (byte)0x12, (byte)0x7e, (byte)0x77,
-        (byte)0x03, (byte)0xf1, (byte)0xef, (byte)0x1b, (byte)0xc8, (byte)0xa8,
-        (byte)0x0f, (byte)0x97
-    };
-
-    private static final byte PUB_EXP[] = {(byte)0x01, (byte)0x00, (byte)0x01};
-
-    private static final byte PRIV_EXP[] = {
-        (byte)0x85, (byte)0x27, (byte)0x47, (byte)0x61, (byte)0x4c, (byte)0xd4,
-        (byte)0xb5, (byte)0xb2, (byte)0x0e, (byte)0x70, (byte)0x91, (byte)0x8f,
-        (byte)0x3d, (byte)0x97, (byte)0xf9, (byte)0x5f, (byte)0xcc, (byte)0x09,
-        (byte)0x65, (byte)0x1c, (byte)0x7c, (byte)0x5b, (byte)0xb3, (byte)0x6d,
-        (byte)0x63, (byte)0x3f, (byte)0x7b, (byte)0x55, (byte)0x22, (byte)0xbb,
-        (byte)0x7c, (byte)0x48, (byte)0x77, (byte)0xae, (byte)0x80, (byte)0x56,
-        (byte)0xc2, (byte)0x10, (byte)0xd5, (byte)0x03, (byte)0xdb, (byte)0x31,
-        (byte)0xaf, (byte)0x8d, (byte)0x54, (byte)0xd4, (byte)0x48, (byte)0x99,
-        (byte)0xa8, (byte)0xc4, (byte)0x23, (byte)0x43, (byte)0xb8, (byte)0x48,
-        (byte)0x0b, (byte)0xc7, (byte)0xbc, (byte)0xf5, (byte)0xcc, (byte)0x64,
-        (byte)0x72, (byte)0xbf, (byte)0x59, (byte)0x06, (byte)0x04, (byte)0x1c,
-        (byte)0x32, (byte)0xf5, (byte)0x14, (byte)0x2e, (byte)0x6e, (byte)0xe2,
-        (byte)0x0f, (byte)0x5c, (byte)0xde, (byte)0x36, (byte)0x3c, (byte)0x6e,
-        (byte)0x7c, (byte)0x4d, (byte)0xcc, (byte)0xd3, (byte)0x00, (byte)0x6e,
-        (byte)0xe5, (byte)0x45, (byte)0x46, (byte)0xef, (byte)0x4d, (byte)0x25,
-        (byte)0x46, (byte)0x6d, (byte)0x7f, (byte)0xed, (byte)0xbb, (byte)0x4f,
-        (byte)0x4d, (byte)0x9f, (byte)0xda, (byte)0x87, (byte)0x47, (byte)0x8f,
-        (byte)0x74, (byte)0x44, (byte)0xb7, (byte)0xbe, (byte)0x9d, (byte)0xf5,
-        (byte)0xdd, (byte)0xd2, (byte)0x4c, (byte)0xa5, (byte)0xab, (byte)0x74,
-        (byte)0xe5, (byte)0x29, (byte)0xa1, (byte)0xd2, (byte)0x45, (byte)0x3b,
-        (byte)0x33, (byte)0xde, (byte)0xd5, (byte)0xae, (byte)0xf7, (byte)0x03,
-        (byte)0x10, (byte)0x21
-    };
-
-    private static final byte PRIME_P[] = {
-        (byte)0xf9, (byte)0x74, (byte)0x8f, (byte)0x16, (byte)0x02, (byte)0x6b,
-        (byte)0xa0, (byte)0xee, (byte)0x7f, (byte)0x28, (byte)0x97, (byte)0x91,
-        (byte)0xdc, (byte)0xec, (byte)0xc0, (byte)0x7c, (byte)0x49, (byte)0xc2,
-        (byte)0x85, (byte)0x76, (byte)0xee, (byte)0x66, (byte)0x74, (byte)0x2d,
-        (byte)0x1a, (byte)0xb8, (byte)0xf7, (byte)0x2f, (byte)0x11, (byte)0x5b,
-        (byte)0x36, (byte)0xd8, (byte)0x46, (byte)0x33, (byte)0x3b, (byte)0xd8,
-        (byte)0xf3, (byte)0x2d, (byte)0xa1, (byte)0x03, (byte)0x83, (byte)0x2b,
-        (byte)0xec, (byte)0x35, (byte)0x43, (byte)0x32, (byte)0xff, (byte)0xdd,
-        (byte)0x81, (byte)0x7c, (byte)0xfd, (byte)0x65, (byte)0x13, (byte)0x04,
-        (byte)0x7c, (byte)0xfc, (byte)0x03, (byte)0x97, (byte)0xf0, (byte)0xd5,
-        (byte)0x62, (byte)0xdc, (byte)0x0d, (byte)0xbf
-    };
-
-    private static final byte PRIME_Q[] = {
-        (byte)0xdb, (byte)0x1e, (byte)0xa7, (byte)0x3d, (byte)0xe7, (byte)0xfa,
-        (byte)0x8b, (byte)0x04, (byte)0x83, (byte)0x48, (byte)0xf3, (byte)0xa5,
-        (byte)0x31, (byte)0x9d, (byte)0x35, (byte)0x5e, (byte)0x4d, (byte)0x54,
-        (byte)0x77, (byte)0xcc, (byte)0x84, (byte)0x09, (byte)0xf3, (byte)0x11,
-        (byte)0x0d, (byte)0x54, (byte)0xed, (byte)0x85, (byte)0x39, (byte)0xa9,
-        (byte)0xca, (byte)0xa8, (byte)0xea, (byte)0xae, (byte)0x19, (byte)0x9c,
-        (byte)0x75, (byte)0xdb, (byte)0x88, (byte)0xb8, (byte)0x04, (byte)0x8d,
-        (byte)0x54, (byte)0xc6, (byte)0xa4, (byte)0x80, (byte)0xf8, (byte)0x93,
-        (byte)0xf0, (byte)0xdb, (byte)0x19, (byte)0xef, (byte)0xd7, (byte)0x87,
-        (byte)0x8a, (byte)0x8f, (byte)0x5a, (byte)0x09, (byte)0x2e, (byte)0x54,
-        (byte)0xf3, (byte)0x45, (byte)0x24, (byte)0x29
-    };
-
-    private static final byte EXP_P[] = {
-        (byte)0x6a, (byte)0xd1, (byte)0x25, (byte)0x80, (byte)0x18, (byte)0x33,
-        (byte)0x3c, (byte)0x2b, (byte)0x44, (byte)0x19, (byte)0xfe, (byte)0xa5,
-        (byte)0x40, (byte)0x03, (byte)0xc4, (byte)0xfc, (byte)0xb3, (byte)0x9c,
-        (byte)0xef, (byte)0x07, (byte)0x99, (byte)0x58, (byte)0x17, (byte)0xc1,
-        (byte)0x44, (byte)0xa3, (byte)0x15, (byte)0x7d, (byte)0x7b, (byte)0x22,
-        (byte)0x22, (byte)0xdf, (byte)0x03, (byte)0x58, (byte)0x66, (byte)0xf5,
-        (byte)0x24, (byte)0x54, (byte)0x52, (byte)0x91, (byte)0x2d, (byte)0x76,
-        (byte)0xfe, (byte)0x63, (byte)0x64, (byte)0x4e, (byte)0x0f, (byte)0x50,
-        (byte)0x2b, (byte)0x65, (byte)0x79, (byte)0x1f, (byte)0xf1, (byte)0xbf,
-        (byte)0xc7, (byte)0x41, (byte)0x26, (byte)0xcc, (byte)0xc6, (byte)0x1c,
-        (byte)0xa9, (byte)0x83, (byte)0x6f, (byte)0x03
-    };
-
-    private static final byte EXP_Q[] = {
-        (byte)0x12, (byte)0x84, (byte)0x1a, (byte)0x99, (byte)0xce, (byte)0x9a,
-        (byte)0x8b, (byte)0x58, (byte)0xcc, (byte)0x47, (byte)0x43, (byte)0xdf,
-        (byte)0x77, (byte)0xbb, (byte)0xd3, (byte)0x20, (byte)0xae, (byte)0xe4,
-        (byte)0x2e, (byte)0x63, (byte)0x67, (byte)0xdc, (byte)0xf7, (byte)0x5f,
-        (byte)0x3f, (byte)0x83, (byte)0x27, (byte)0xb7, (byte)0x14, (byte)0x52,
-        (byte)0x56, (byte)0xbf, (byte)0xc3, (byte)0x65, (byte)0x06, (byte)0xe1,
-        (byte)0x03, (byte)0xcc, (byte)0x93, (byte)0x57, (byte)0x09, (byte)0x7b,
-        (byte)0x6f, (byte)0xe8, (byte)0x81, (byte)0x4a, (byte)0x2c, (byte)0xb7,
-        (byte)0x43, (byte)0xa9, (byte)0x20, (byte)0x1d, (byte)0xf6, (byte)0x56,
-        (byte)0x8b, (byte)0xcc, (byte)0xe5, (byte)0x4c, (byte)0xd5, (byte)0x4f,
-        (byte)0x74, (byte)0x67, (byte)0x29, (byte)0x51
-    };
-
-    private static final byte CRT_COEFF[] = {
-        (byte)0x23, (byte)0xab, (byte)0xf4, (byte)0x03, (byte)0x2f, (byte)0x29,
-        (byte)0x95, (byte)0x74, (byte)0xac, (byte)0x1a, (byte)0x33, (byte)0x96,
-        (byte)0x62, (byte)0xed, (byte)0xf7, (byte)0xf6, (byte)0xae, (byte)0x07,
-        (byte)0x2a, (byte)0x2e, (byte)0xe8, (byte)0xab, (byte)0xfb, (byte)0x1e,
-        (byte)0xb9, (byte)0xb2, (byte)0x88, (byte)0x1e, (byte)0x85, (byte)0x05,
-        (byte)0x42, (byte)0x64, (byte)0x03, (byte)0xb2, (byte)0x8b, (byte)0xc1,
-        (byte)0x81, (byte)0x75, (byte)0xd7, (byte)0xba, (byte)0xaa, (byte)0xd4,
-        (byte)0x31, (byte)0x3c, (byte)0x8a, (byte)0x96, (byte)0x23, (byte)0x9d,
-        (byte)0x3f, (byte)0x06, (byte)0x3e, (byte)0x44, (byte)0xa9, (byte)0x62,
-        (byte)0x2f, (byte)0x61, (byte)0x5a, (byte)0x51, (byte)0x82, (byte)0x2c,
-        (byte)0x04, (byte)0x85, (byte)0x73, (byte)0xd1
-    };
-
-    private static KeyPair genRSAKey(int keyLength) throws Exception {
-        KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
-        kpg.initialize(keyLength);
-        return kpg.generateKeyPair();
-    }
-
-    private static KeyPair genPredefinedRSAKeyPair() throws Exception {
-        KeyFactory kf = KeyFactory.getInstance("RSA");
-        BigInteger mod = new BigInteger(MOD);
-        BigInteger pub = new BigInteger(PUB_EXP);
-
-        PrivateKey privKey = kf.generatePrivate
-            (new RSAPrivateCrtKeySpec
-             (mod, pub, new BigInteger(PRIV_EXP),
-              new BigInteger(PRIME_P), new BigInteger(PRIME_Q),
-              new BigInteger(EXP_P), new BigInteger(EXP_Q),
-              new BigInteger(CRT_COEFF)));
-        PublicKey pubKey = kf.generatePublic(new RSAPublicKeySpec(mod, pub));
-        return new KeyPair(pubKey, privKey);
-    }
-
-    private static final String CIP_ALGOS[] = {
-        "RSA/ECB/NoPadding",
-        "RSA/ECB/PKCS1Padding"
-    };
-    private static final int INPUT_SIZE_REDUCTION[] = {
-        0,
-        11,
-    };
-    private static final String SIG_ALGOS[] = {
-        "MD5WithRSA",
-        "SHA1WithRSA",
-        "SHA256WithRSA",
-        "SHA384WithRSA",
-        "SHA512WithRSA"
-    };
-
-    private static KeyPair kp[] = null;
-
-    public static void main(String argv[]) throws Exception {
-        main(new TestRSA(), null);
-    }
-
-    public void doTest(Provider prov) throws Exception {
-        // first test w/ predefine KeyPair
-        KeyPair pkp = genPredefinedRSAKeyPair();
-        System.out.println("Test against Predefined RSA Key Pair");
-        testCipher(pkp, 128, true, prov);
-        testSignature(pkp, true, prov);
-
-        for (int i = 0; i < 10; i++) {
-            // then test w/ various key lengths
-            int keyLens[] = { 1024, 2048 };
-            kp = new KeyPair[keyLens.length];
-
-            testCipher(keyLens, false, prov);
-            testSignature(keyLens, false, prov);
-        }
-    }
-
-
-    private static void testCipher(KeyPair kp, int inputSizeInBytes,
-                                   boolean checkInterop, Provider prov)
-        throws Exception {
-        Cipher c1, c2;
-        for (int i = 0; i < CIP_ALGOS.length; i++) {
-            String algo = CIP_ALGOS[i];
-            try {
-                c1 = Cipher.getInstance(algo, prov);
-            } catch (NoSuchAlgorithmException nsae) {
-                System.out.println("Skip unsupported Cipher algo: " + algo);
-                continue;
-            }
-
-            if (checkInterop) {
-                c2 = Cipher.getInstance(algo, "SunJCE");
-            } else {
-                c2 = Cipher.getInstance(algo, prov);
-            }
-            byte[] data = Arrays.copyOf
-                 (PLAINTEXT, inputSizeInBytes - INPUT_SIZE_REDUCTION[i]);
-
-            testEncryption(c1, c2, kp, data);
-        }
-    }
-
-    private static void testCipher(int keyLens[], boolean checkInterop,
-                                   Provider prov)
-        throws Exception {
-        // RSA CipherText will always differ due to the random nonce in padding
-        // so we check whether both
-        // 1) Java Encrypt/C Decrypt
-        // 2) C Encrypt/Java Decrypt
-        // works
-        Cipher c1, c2;
-        for (int i = 0; i < CIP_ALGOS.length; i++) {
-            String algo = CIP_ALGOS[i];
-            try {
-                c1 = Cipher.getInstance(algo, prov);
-            } catch (NoSuchAlgorithmException nsae) {
-                System.out.println("Skip unsupported Cipher algo: " + algo);
-                continue;
-            }
-
-            if (checkInterop) {
-                c2 = Cipher.getInstance(algo, "SunJCE");
-            } else {
-                c2 = Cipher.getInstance(algo, prov);
-            }
-
-            for (int h = 0; h < keyLens.length; h++) {
-                // Defer key pair generation until now when it'll soon be used.
-                if (kp[h] == null) {
-                    kp[h] = genRSAKey(keyLens[h]);
-                }
-                System.out.println("\tTesting Cipher " + algo + " w/ KeySize " + keyLens[h]);
-                byte[] data = Arrays.copyOf
-                    (PLAINTEXT, keyLens[h]/8 - INPUT_SIZE_REDUCTION[i]);
-                testEncryption(c1, c2, kp[h], data);
-            }
-        }
-    }
-
-    private static void testEncryption(Cipher c1, Cipher c2, KeyPair kp, byte[] data)
-        throws Exception {
-        // C1 Encrypt + C2 Decrypt
-        byte[] out1 = null;
-        byte[] recoveredText = null;
-        try {
-            c1.init(Cipher.ENCRYPT_MODE, kp.getPublic());
-            out1 = c1.doFinal(data);
-            c2.init(Cipher.DECRYPT_MODE, kp.getPrivate());
-            recoveredText = c2.doFinal(out1);
-        } catch (Exception ex) {
-            System.out.println("\tDEC ERROR: unexpected exception");
-            ex.printStackTrace();
-            throw ex;
-        }
-        if(!Arrays.equals(recoveredText, data)) {
-            throw new RuntimeException("\tDEC ERROR: different PT bytes!");
-        }
-        // C2 Encrypt + C1 Decrypt
-        byte[] cipherText = null;
-        try {
-            c2.init(Cipher.ENCRYPT_MODE, kp.getPublic());
-            cipherText = c2.doFinal(data);
-            c1.init(Cipher.DECRYPT_MODE, kp.getPrivate());
-            try {
-                out1 = c1.doFinal(cipherText);
-            } catch (Exception ex) {
-                System.out.println("\tENC ERROR: invalid encrypted output");
-                ex.printStackTrace();
-                throw ex;
-            }
-        } catch (Exception ex) {
-            System.out.println("\tENC ERROR: unexpected exception");
-            ex.printStackTrace();
-            throw ex;
-        }
-        if (!Arrays.equals(out1, data)) {
-            throw new RuntimeException("\tENC ERROR: Decrypted result DIFF!");
-        }
-        System.out.println("\t=> PASS");
-    }
-
-    private static void testSignature(KeyPair kp, boolean checkInterop,
-                                      Provider prov) throws Exception {
-        byte[] data = PLAINTEXT;
-        Signature sig1, sig2;
-        for (int i = 0; i < SIG_ALGOS.length; i++) {
-            String algo = SIG_ALGOS[i];
-            try {
-                sig1 = Signature.getInstance(algo, prov);
-            } catch (NoSuchAlgorithmException nsae) {
-                System.out.println("Skip unsupported Signature algo: " + algo);
-                continue;
-            }
-
-            if (checkInterop) {
-                sig2 = Signature.getInstance(algo, "SunRsaSign");
-            } else {
-                sig2 = Signature.getInstance(algo, prov);
-            }
-            testSigning(sig1, sig2, kp, data);
-        }
-    }
-
-    private static void testSignature(int keyLens[], boolean checkInterop,
-                                      Provider prov) throws Exception {
-        byte[] data = PLAINTEXT;
-        Signature sig1, sig2;
-        for (int i = 0; i < SIG_ALGOS.length; i++) {
-            String algo = SIG_ALGOS[i];
-            try {
-                sig1 = Signature.getInstance(algo, prov);
-            } catch (NoSuchAlgorithmException nsae) {
-                System.out.println("Skip unsupported Signature algo: " + algo);
-                continue;
-            }
-
-            if (checkInterop) {
-                sig2 = Signature.getInstance(algo, "SunRsaSign");
-            } else {
-                sig2 = Signature.getInstance(algo, prov);
-            }
-
-            for (int h = 0; h < keyLens.length; h++) {
-                // Defer key pair generation until now when it'll soon be used.
-                if (kp[h] == null) {
-                    kp[h] = genRSAKey(keyLens[h]);
-                }
-                System.out.println("\tTesting Signature " + algo + " w/ KeySize " + keyLens[h]);
-
-                testSigning(sig1, sig2, kp[h], data);
-            }
-        }
-    }
-
-    private static void testSigning(Signature sig1, Signature sig2, KeyPair kp, byte[] data)
-            throws Exception {
-        boolean sameSig = false;
-        byte[] out = null;
-        try {
-            sig1.initSign(kp.getPrivate());
-            sig1.update(data);
-            out = sig1.sign();
-        } catch (Exception ex) {
-            System.out.println("\tSIGN ERROR: unexpected exception!");
-            ex.printStackTrace();
-        }
-
-        sig2.initSign(kp.getPrivate());
-        sig2.update(data);
-        byte[] out2 = sig2.sign();
-        if (!Arrays.equals(out2, out)) {
-            throw new RuntimeException("\tSIGN ERROR: Signature DIFF!");
-        }
-
-        boolean verify = false;
-        try {
-            System.out.println("\tVERIFY1 using native out");
-            sig1.initVerify(kp.getPublic());
-            sig1.update(data);
-            verify = sig1.verify(out);
-            if (!verify) {
-                throw new RuntimeException("VERIFY1 FAIL!");
-            }
-        } catch (Exception ex) {
-            System.out.println("\tVERIFY1 ERROR: unexpected exception!");
-            ex.printStackTrace();
-            throw ex;
-        }
-        System.out.println("\t=> PASS");
-    }
-}
--- a/jdk/test/com/oracle/security/ucrypto/UcryptoTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-
-
-// common infrastructure for OracleUcrypto provider tests
-
-import java.io.*;
-import java.util.*;
-import java.lang.reflect.*;
-
-import java.security.*;
-
-public abstract class UcryptoTest {
-
-    protected static final boolean hasUcrypto;
-    static {
-        hasUcrypto = (Security.getProvider("OracleUcrypto") != null);
-    }
-
-    private static Provider getCustomizedUcrypto(String config) throws Exception {
-        Class clazz = Class.forName("com.oracle.security.ucrypto.OracleUcrypto");
-        Constructor cons = clazz.getConstructor(new Class[] {String.class});
-        Object obj = cons.newInstance(new Object[] {config});
-        return (Provider)obj;
-    }
-
-    public abstract void doTest(Provider p) throws Exception;
-
-    public static void main(UcryptoTest test, String config) throws Exception {
-        Provider prov = null;
-        if (hasUcrypto) {
-            if (config != null) {
-                prov = getCustomizedUcrypto(config);
-            } else {
-                prov = Security.getProvider("OracleUcrypto");
-            }
-        }
-        if (prov == null) {
-            // un-available, skip testing...
-            System.out.println("No OracleUcrypto provider found, skipping test");
-            return;
-        }
-        test.doTest(prov);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,105 @@
+/*
+ * 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
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8012900
+ * @library ../UTIL
+ * @build TestUtil
+ * @run main TestCICOWithGCMAndAAD
+ * @summary Test CipherInputStream/OutputStream with AES GCM mode with AAD.
+ * @author Valerie Peng
+ */
+import java.io.*;
+import java.security.*;
+import java.util.*;
+import javax.crypto.*;
+
+public class TestCICOWithGCMAndAAD {
+    public static void main(String[] args) throws Exception {
+        //init Secret Key
+        KeyGenerator kg = KeyGenerator.getInstance("AES", "SunJCE");
+        kg.init(128);
+        SecretKey key = kg.generateKey();
+
+        //Do initialization of the plainText
+        byte[] plainText = new byte[700];
+        Random rdm = new Random();
+        rdm.nextBytes(plainText);
+
+        byte[] aad = new byte[128];
+        rdm.nextBytes(aad);
+        byte[] aad2 = aad.clone();
+        aad2[50]++;
+
+        Cipher encCipher = Cipher.getInstance("AES/GCM/NoPadding", "SunJCE");
+        encCipher.init(Cipher.ENCRYPT_MODE, key);
+        encCipher.updateAAD(aad);
+        Cipher decCipher = Cipher.getInstance("AES/GCM/NoPadding", "SunJCE");
+        decCipher.init(Cipher.DECRYPT_MODE, key, encCipher.getParameters());
+        decCipher.updateAAD(aad);
+
+        byte[] recovered = test(encCipher, decCipher, plainText);
+        if (!Arrays.equals(plainText, recovered)) {
+            throw new Exception("sameAAD: diff check failed!");
+        } else System.out.println("sameAAD: passed");
+
+        encCipher.init(Cipher.ENCRYPT_MODE, key);
+        encCipher.updateAAD(aad2);
+        recovered = test(encCipher, decCipher, plainText);
+        if (recovered != null && recovered.length != 0) {
+            throw new Exception("diffAAD: no data should be returned!");
+        } else System.out.println("diffAAD: passed");
+   }
+
+   private static byte[] test(Cipher encCipher, Cipher decCipher, byte[] plainText)
+            throws Exception {
+        //init cipher streams
+        ByteArrayInputStream baInput = new ByteArrayInputStream(plainText);
+        CipherInputStream ciInput = new CipherInputStream(baInput, encCipher);
+        ByteArrayOutputStream baOutput = new ByteArrayOutputStream();
+        CipherOutputStream ciOutput = new CipherOutputStream(baOutput, decCipher);
+
+        //do test
+        byte[] buffer = new byte[200];
+        int len = ciInput.read(buffer);
+        System.out.println("read " + len + " bytes from input buffer");
+
+        while (len != -1) {
+            ciOutput.write(buffer, 0, len);
+            System.out.println("wite " + len + " bytes to output buffer");
+            len = ciInput.read(buffer);
+            if (len != -1) {
+                System.out.println("read " + len + " bytes from input buffer");
+            } else {
+                System.out.println("finished reading");
+            }
+        }
+
+        ciOutput.flush();
+        ciInput.close();
+        ciOutput.close();
+
+        return baOutput.toByteArray();
+    }
+}
--- a/jdk/test/com/sun/jdi/BadHandshakeTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/com/sun/jdi/BadHandshakeTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -108,16 +108,7 @@
      */
     private static Process launch(String address, String class_name) throws IOException {
         String exe =   System.getProperty("java.home")
-                     + File.separator + "bin" + File.separator;
-        String arch = System.getProperty("os.arch");
-        String osname = System.getProperty("os.name");
-        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
-            exe += "sparcv9/java";
-        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
-            exe += "amd64/java";
-        } else {
-            exe += "java";
-        }
+                     + File.separator + "bin" + File.separator + "java";
         String cmd = exe + " " + VMConnection.getDebuggeeVMOptions() +
             " -agentlib:jdwp=transport=dt_socket" +
             ",server=y" + ",suspend=y" + ",address=" + address +
--- a/jdk/test/com/sun/jdi/DoubleAgentTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/com/sun/jdi/DoubleAgentTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -90,16 +90,7 @@
      */
     private static Process launch(String address, String class_name) throws IOException {
         String exe =   System.getProperty("java.home")
-                     + File.separator + "bin" + File.separator;
-        String arch = System.getProperty("os.arch");
-        String osname = System.getProperty("os.name");
-        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
-            exe += "sparcv9/java";
-        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
-            exe += "amd64/java";
-        } else {
-            exe += "java";
-        }
+                     + File.separator + "bin" + File.separator + "java";
         String jdwpOption = "-agentlib:jdwp=transport=dt_socket"
                          + ",server=y" + ",suspend=y" + ",address=" + address;
         String cmd = exe + " " + VMConnection.getDebuggeeVMOptions()
--- a/jdk/test/com/sun/jdi/ExclusiveBind.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/com/sun/jdi/ExclusiveBind.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, 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
@@ -97,16 +97,7 @@
      */
     private static Process launch(String address, boolean suspend, String class_name) throws IOException {
         String exe = System.getProperty("java.home") + File.separator + "bin" +
-            File.separator;
-        String arch = System.getProperty("os.arch");
-        String osname = System.getProperty("os.name");
-        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
-            exe += "sparcv9/java";
-        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
-            exe += "amd64/java";
-        } else {
-            exe += "java";
-        }
+            File.separator + "java";
         String cmd = exe + " " + VMConnection.getDebuggeeVMOptions() +
             " -agentlib:jdwp=transport=dt_socket,server=y,suspend=";
         if (suspend) {
--- a/jdk/test/com/sun/jdi/NoLaunchOptionTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/com/sun/jdi/NoLaunchOptionTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -142,7 +142,7 @@
         NoLaunchOptionTest myTest = new NoLaunchOptionTest();
         String results [] = myTest.run(VMConnection.insertDebuggeeVMOptions(cmds));
         if ((results[RETSTAT].equals("1")) &&
-            (results[STDERR].startsWith("ERROR:"))) {
+            (results[STDERR].contains("ERROR:"))) {
             System.out.println("Test passed: status = 1 with warning messages " +
                                "is expected and normal for this test");
         } else {
--- a/jdk/test/com/sun/jdi/PrivateTransportTest.sh	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/com/sun/jdi/PrivateTransportTest.sh	Fri Oct 11 09:17:18 2013 -0400
@@ -1,7 +1,7 @@
 #!/bin/ksh -p
 
 #
-# 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
@@ -102,28 +102,7 @@
 is_windows=false
 is_cygwin=false
 case `uname -s` in 
-  SunOS)
-    libarch=`uname -p`
-    d64=`echo "${DEBUGGEEFLAGS}" | fgrep -- -d64`
-    case `uname -p` in
-      sparc)
-	if [ "${d64}" != "" ] ; then
-	    libarch=sparcv9
-	fi
-        ;;
-      i386)
-        if [ "${d64}" != "" ] ; then
-	    libarch=amd64
-	fi
-        ;;
-      *)
-        echo "FAILURE:  Unknown uname -p: " `uname -p`
-        exit 1
-        ;;
-    esac
-    libloc=${jreloc}/lib/${libarch}
-    ;;
-  Linux)
+  SunOS|Linux)
     xx=`find ${jreloc}/lib -name libdt_socket.so`
     libloc=`dirname ${xx}`
     ;;
--- a/jdk/test/com/sun/jdi/RunToExit.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/com/sun/jdi/RunToExit.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,16 +113,7 @@
      */
     private static Process launch(String address, String class_name) throws IOException {
         String exe =   System.getProperty("java.home")
-                     + File.separator + "bin" + File.separator;
-        String arch = System.getProperty("os.arch");
-        String osname = System.getProperty("os.name");
-        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
-            exe += "sparcv9/java";
-        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
-            exe += "amd64/java";
-        } else {
-            exe += "java";
-        }
+                     + File.separator + "bin" + File.separator + "java";
         String cmd = exe + " " + VMConnection.getDebuggeeVMOptions() +
             " -agentlib:jdwp=transport=dt_socket" +
             ",server=y" + ",suspend=y" + ",address=" + address +
--- a/jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-#!/bin/ksh -p
-
-#
-# Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-#   @test       Solaris32AndSolaris64Test.sh
-#   @bug        4478312 4780570 4913748 6730273
-#   @summary    Test debugging with mixed 32/64bit VMs.
-#   @author     Tim Bell
-#   Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
-#
-#   @run build TestScaffold VMConnection TargetListener TargetAdapter
-#   @run compile -g FetchLocals.java
-#   @run compile -g DataModelTest.java
-#   @run shell/timeout=240 Solaris32AndSolaris64Test.sh DataModelTest
-#   @run shell/timeout=240 Solaris32AndSolaris64Test.sh FetchLocals
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail()
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass()
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-if [ $# = 0 ] ; then
-    echo "Error: no testname specified on cmd line"
-    exit 1
-fi
-testName=$1
-shift
-
-#Set appropriate jdk
-
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-          TESTJAVA=$1
-      else
-          echo "no JDK specified on command line so using JAVA_HOME=$JAVA_HOME"
-          TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   STANDALONE=1;
-fi
-echo "JDK under test is: $TESTJAVA"
-
-
-# The beginning of the script proper
-
-# Checking for proper OS and processor type.
-#
-# This test is only interested in SunOS SPARC sparcv9 and SunOS AMD64
-# (supporting both 32 and 64 bit Solaris binaries).
-#
-# All other platforms will instantly complete with passing
-# status.
-#
-OS=`uname -s`
-case "$OS" in
-   SunOS )
-      PATHSEP=":"
-      PTYPE=`uname -p`
-      if [ -x /usr/bin/isainfo ]; then
-          # Instruction set being used by the OS
-          ISET=`isainfo -k`
-      else
-          #SunOS 5.6 didn't have "isainfo"
-          pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
-      fi
-      ;;
-
-   Linux | Darwin )
-      pass "This test always passes on $OS"
-      ;;
-
-   Windows* | CYGWIN*)
-      pass "This test always passes on $OS"
-      ;;
-
-   # catch all other OSs
-   * )
-      echo "Unrecognized system!  $OS"
-      fail "Unrecognized system!  $OS"
-      ;;
-esac
-
-# Is the OS running in sparcv9 or amd64 mode?
-case "${ISET}" in
-  sparc )
-      pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
-      ;;
-  i386 )
-      pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
-      ;;
-  amd64 )
-      echo "OS is running in ${ISET} mode"
-      ;;
-  sparcv9 )
-      echo "OS is running in ${ISET} mode"
-      ;;
-  # catch all others
-  * )
-      echo "Unrecognized instruction set!  $OS/$PTYPE/${ISET}"
-      fail "Unrecognized instruction set!  $OS/$PTYPE/${ISET}"
-      ;;
-esac
-
-# SunOS 32 and 64 bit binaries must be available
-#     to test in the remainder of the script below.
-$TESTJAVA/bin/java -d64 -version > /dev/null 2<&1
-if [ $? = 1 ]; then
-   # The 64 bit version is not installed.  Make the test pass.
-   pass "This test always passes on $OS/$PTYPE if 64 bit jdk is not installed"
-fi
-
-# Want this test to run standalone as well as in the harness, so do the
-#  following to copy the test's directory into the harness's scratch directory
-#  and set all appropriate variables:
-
-#Deal with .class files:
-if [ -n "${STANDALONE}" ] ; then
-   #if running standalone, compile the support files
-   ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" \
-            TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
-   ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \
-            FetchLocals.java DataModelTest.java
-fi
-
-# Get DEBUGGEE flags
-DEBUGGEEFLAGS=
-filename=$TESTCLASSES/@debuggeeVMOptions
-if [ ! -r ${filename} ] ; then
-    filename=$TESTCLASSES/../@debuggeeVMOptions
-fi
-# Remove -d32, -d64 if present, and remove -XX:[+-]UseCompressedOops
-# if present since it is illegal in 32 bit mode.
-if [ -r ${filename} ] ; then
-    DEBUGGEEFLAGS=`cat ${filename} | sed \
-                        -e 's/-d32//g' \
-                        -e 's/-d64//g' \
-                        -e 's/-XX:.UseCompressedOops//g' \
-                        `
-fi
-
-#
-CLASSPATH="$TESTJAVA/lib/tools.jar${PATHSEP}${TESTCLASSES}"
-export CLASSPATH
-CP="-classpath \"${CLASSPATH}\""
-
-for DEBUGGERMODEL in \
-    32 \
-    64 \
-; do
-
-    for TARGETMODEL in \
-        32 \
-        64 \
-    ; do
-        DEBUGGERFLAGS="-d${DEBUGGERMODEL} -showversion -DEXPECTED=${TARGETMODEL}"
-        CONNECTSTRING="-connect 'com.sun.jdi.CommandLineLaunch:options=-d${TARGETMODEL} $DEBUGGEEFLAGS -showversion'"
-
-        for TARGETCLASS in $testName ; do
-            echo "--------------------------------------------"
-            echo "debugger=${DEBUGGERMODEL} debugee=${TARGETMODEL} class=${TARGETCLASS}"
-            echo "--------------------------------------------"
-            echo ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
-            eval ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
-            status=$?
-            if [ $status -ne "0" ];
-               then fail "$DEBUGGERMODEL to $TARGETMODEL test failed for class=$TARGETCLASS!"
-            fi
-        done
-    done
-done
-#
-# pass or fail the test based on status of the command
-if [ $status -eq "0" ];
-   then pass ""
-
-   else fail "unspecified test failure"
-fi
--- a/jdk/test/com/sun/jdi/connect/spi/SimpleLaunchingConnector.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/com/sun/jdi/connect/spi/SimpleLaunchingConnector.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,16 +143,7 @@
         TransportService.ListenKey key = ts.startListening();
 
         String exe = System.getProperty("java.home") + File.separator + "bin" +
-            File.separator;
-        String arch = System.getProperty("os.arch");
-        String osname = System.getProperty("os.name");
-        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
-            exe += "sparcv9/java";
-        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
-            exe += "amd64/java";
-        } else {
-            exe += "java";
-        }
+            File.separator + "java";
         String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
             key.address() +
             " -classpath " + System.getProperty("test.classes") +
--- a/jdk/test/demo/jvmti/DemoRun.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/demo/jvmti/DemoRun.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,28 +125,22 @@
         String libprefix = os_name.contains("Windows")?"":"lib";
         String libsuffix = os_name.contains("Windows")?".dll":
                                 os_name.contains("OS X")?".dylib":".so";
-        boolean d64      =    ( os_name.contains("Solaris") ||
-                                os_name.contains("SunOS") )
-                           && ( os_arch.equals("sparcv9") ||
-                                os_arch.equals("amd64"));
         boolean hprof    = demo_name.equals("hprof");
-        String isa_dir   = d64?(File.separator+os_arch):"";
         String java      = jre_home
-                             + File.separator + "bin" + isa_dir
+                             + File.separator + "bin"
                              + File.separator + "java";
         /* Array of strings to be passed in for exec:
          *   1. java
          *   2. -Dtest.classes=.
-         *   3. -d64                 (optional)
-         *   4. -Xcheck:jni          (Just because it finds bugs)
-         *   5. -Xverify:all         (Make sure verification is on full blast)
-         *   6. -agent
+         *   3. -Xcheck:jni          (Just because it finds bugs)
+         *   4. -Xverify:all         (Make sure verification is on full blast)
+         *   5. -agent
          *       vm_options
-         *   7+i. classname
+         *   6+i. classname
          */
         int nvm_options = 0;
         if ( vm_options != null ) nvm_options = vm_options.length;
-        String cmd[]     = new String[1 + (d64?1:0) + 7 + nvm_options];
+        String cmd[]     = new String[1 + 7 + nvm_options];
         String cmdLine;
         int exitStatus;
         int i,j;
@@ -160,10 +154,6 @@
         cmdLine += (cmd[i++] = cdir);
         cmdLine += " ";
         cmdLine += (cmd[i++] = "-Dtest.classes=" + cdir);
-        if ( d64 ) {
-            cmdLine += " ";
-            cmdLine += (cmd[i++] = "-d64");
-        }
         cmdLine += " ";
         cmdLine += (cmd[i++] = "-Xcheck:jni");
         cmdLine += " ";
@@ -178,7 +168,7 @@
                          + File.separator + "demo"
                          + File.separator + "jvmti"
                          + File.separator + demo_name
-                         + File.separator + "lib" + isa_dir
+                         + File.separator + "lib"
                          + File.separator + libprefix + demo_name + libsuffix;
             cmdLine += " ";
             cmdLine += (cmd[i++] = "-agentpath:" + libname
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.html	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+-->
+
+<html>
+    <head>
+        <title>CursorOverlappedPanelsTest, bug ID 8007155</title>
+    </head>
+    <body>
+    <applet CODE="CursorOverlappedPanelsTest.class" WIDTH=300 HEIGHT=100></applet>
+    <p> See the dialog box (usually in upper left corner) for instructions</p>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Cursor/CursorOverlappedPanelsTest/CursorOverlappedPanelsTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+//import java.applet.Applet;
+import javax.swing.BorderFactory;
+import javax.swing.JApplet;
+import javax.swing.JFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+
+/**
+ * @test
+ * @bug 8007155
+ * @summary [macosx] Disabled panel takes mouse input in JLayeredPane
+ * @author Alexander Scherbatiy: area=java.awt.Cursor
+ * @run applet/manual=yesno CursorOverlappedPanelsTest.html
+ */
+public class CursorOverlappedPanelsTest extends JApplet {
+    //Declare things used in the test, like buttons and labels here
+
+    public void init() {
+        //Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout(new BorderLayout());
+
+        String[] instructions = {
+            "Verify that the Crosshair cursor from enabled panel"
+            + " is displayed on the panels intersection",
+            "1) Move the mosue cursor on the Enabled and Disabled panels"
+            + " intersection",
+            "2) Check that the Crosshair cursor is displayed ",
+            "If so, press PASS, else press FAIL."
+        };
+        Sysout.createDialogWithInstructions(instructions);
+
+    }//End  init()
+
+    public void start() {
+        //Get things going.  Request focus, set size, et cetera
+        setSize(200, 200);
+        setVisible(true);
+        validate();
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    createAndShowGUI();
+                }
+            });
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }// start()
+
+    //The rest of this class is the actions which perform the test...
+    //Use Sysout.println to communicate with the user NOT System.out!!
+    //Sysout.println ("Something Happened!");
+    private static JPanel createPanel(Point location, boolean enabled) {
+        final JPanel panel = new JPanel();
+        panel.setOpaque(false);
+        panel.setEnabled(enabled);
+        panel.setSize(new Dimension(200, 200));
+        panel.setLocation(location);
+        panel.setBorder(BorderFactory.createTitledBorder(
+                enabled ? "Enabled" : "Disabled"));
+        panel.setCursor(Cursor.getPredefinedCursor(
+                enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
+        System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR));
+        return panel;
+    }
+
+    private static void createAndShowGUI() {
+        final JFrame frame = new JFrame("Test");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JLayeredPane layeredPane = new JLayeredPane();
+        layeredPane.setPreferredSize(new Dimension(400, 400));
+        JPanel enabledPanel = createPanel(new Point(10, 10), true);
+        JPanel disabledPanel = createPanel(new Point(100, 100), false);
+        layeredPane.add(disabledPanel, JLayeredPane.PALETTE_LAYER);
+        layeredPane.add(enabledPanel, JLayeredPane.DEFAULT_LAYER);
+
+        frame.getContentPane().add(layeredPane);
+        frame.pack();
+        frame.setVisible(true);
+    }
+}// class BlockedWindowTest
+
+/* Place other classes related to the test after this line */
+/**
+ * **************************************************
+ * Standard Test Machinery DO NOT modify anything below -- it's a standard chunk
+ * of code whose purpose is to make user interaction uniform, and thereby make
+ * it simpler to read and understand someone else's test.
+ * **************************************************
+ */
+/**
+ * This is part of the standard test machinery. It creates a dialog (with the
+ * instructions), and is the interface for sending text messages to the user. To
+ * print the instructions, send an array of strings to Sysout.createDialog
+ * WithInstructions method. Put one line of instructions per array entry. To
+ * display a message for the tester to see, simply call Sysout.println with the
+ * string to be displayed. This mimics System.out.println but works within the
+ * test harness as well as standalone.
+ */
+class Sysout {
+
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+    public static void println(String messageIn) {
+        dialog.displayMessage(messageIn);
+    }
+}// Sysout  class
+
+/**
+ * This is part of the standard test machinery. It provides a place for the test
+ * instructions to be displayed, and a place for interactive messages to the
+ * user to be displayed. To have the test instructions displayed, see Sysout. To
+ * have a message to the user be displayed, see Sysout. Do not call anything in
+ * this dialog directly.
+ */
+class TestDialog extends Dialog {
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                            lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) {
+                        posOfSpace = maxStringLength - 1;
+                    }
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                } //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+        System.out.println(messageIn);
+    }
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,144 @@
+/*
+ * 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 4476629
+  @library ../../../../javax/swing/regtesthelpers
+  @build Util
+  @summary KeyEvents dispatched to old focus owner that is no longer showing
+  @author son@sparc.spb.su: area=awt.focus
+  @run main KeyEventForBadFocusOwnerTest
+*/
+
+/**
+ * KeyEventForBadFocusOwnerTest.java
+ *
+ * summary: KeyEvents dispatched to old focus owner that is no longer showing
+ */
+
+
+import java.awt.Robot;
+import java.awt.Toolkit;
+
+import java.awt.event.*;
+
+import javax.swing.*;
+import javax.swing.event.*;
+import sun.awt.SunToolkit;
+
+public class KeyEventForBadFocusOwnerTest {
+    final static String ITEM_ONE_TEXT = "one";
+    final static String ITEM_TWO_TEXT = "two";
+
+    volatile static boolean itemOneSelected = false;
+    volatile static boolean itemTwoSelected = false;
+    volatile static boolean unexpectedItemSelected = false;
+
+    static Robot robot;
+    static SunToolkit toolkit;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JFrame frame = new JFrame("TEST");
+                JMenuBar mb = new JMenuBar();
+                JMenu one = new JMenu(ITEM_ONE_TEXT);
+                JMenu two = new JMenu(ITEM_TWO_TEXT);
+
+                mb.add(one);
+                mb.add(two);
+
+                ActionListener al = new ActionListener() {
+                    public void actionPerformed(ActionEvent ae) {
+                        String itemText = ((JMenuItem)ae.getSource()).getText();
+                        System.out.println("--> " + itemText);
+                        unexpectedItemSelected = true;
+                    }
+                };
+                one.setMnemonic(KeyEvent.VK_O);
+                JMenuItem item = new JMenuItem("one 1");
+                item.setMnemonic(KeyEvent.VK_O);
+                item.addActionListener(al);
+                one.add(item);
+                one.add("two");
+                one.add("three");
+
+                two.setMnemonic(KeyEvent.VK_T);
+                item = new JMenuItem("two 2");
+                item.setMnemonic(KeyEvent.VK_T);
+                item.addActionListener(al);
+                two.add(item);
+                two.add("three");
+                two.add("four");
+
+                PopupMenuListener popupMenuListener = new PopupMenuListener() {
+                    public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+                        System.out.print(e);
+                        System.out.print(e.getSource());
+                        String itemText = ((JPopupMenu)e.getSource()).getName();
+                        System.out.println("Menu " + itemText + "is opened.");
+                        switch(itemText) {
+                            case ITEM_ONE_TEXT:
+                                itemOneSelected = true;
+                                break;
+                            case ITEM_TWO_TEXT:
+                                itemTwoSelected = true;
+                                break;
+                        }
+                    }
+
+                    public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
+                    public void popupMenuCanceled(PopupMenuEvent e) {}
+                };
+                one.getPopupMenu().setName(ITEM_ONE_TEXT);
+                two.getPopupMenu().setName(ITEM_TWO_TEXT);
+                one.getPopupMenu().addPopupMenuListener(popupMenuListener);
+                two.getPopupMenu().addPopupMenuListener(popupMenuListener);
+                frame.setJMenuBar(mb);
+                frame.setSize(100,100);
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+
+        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        robot = new Robot();
+        robot.setAutoDelay(100);
+
+        Util.hitMnemonics(robot, KeyEvent.VK_O);
+        Util.hitMnemonics(robot, KeyEvent.VK_T);
+
+        toolkit.realSync();
+        Thread.sleep(1000); // workaround for MacOS
+
+        if (unexpectedItemSelected) {
+            throw new Exception("Test failed. KeyEvent dispatched to old focus owner. ");
+        }
+        if (!itemOneSelected || !itemTwoSelected) {
+            throw new Exception("Not all expected events were received");
+        }
+    }
+}
--- a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java	Fri Oct 11 09:17:18 2013 -0400
@@ -42,6 +42,7 @@
         GraphicsDevice gd = ge.getDefaultScreenDevice();
 
         Frame f = new Frame("Test frame");
+        f.setUndecorated(true);
         f.setBounds(100, 100, 320, 240);
 
         // First, check it can be made fullscreen window without any effects applied
--- a/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Fri Oct 11 09:17:18 2013 -0400
@@ -65,6 +65,12 @@
     }
 
     public static void main(final String[] args) throws Exception {
+
+        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) {
+            System.err.println("This test is not for OS X. Menu.setFont() is not supported on OS X.");
+            return;
+        }
+
         //Components initialization.
         frame.setMenuBar(mb);
         mb.setFont(new Font("Helvetica", Font.ITALIC, 5));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.awt.Color;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import sun.awt.SunToolkit;
+/*
+ * @test
+ * @bug 8008728
+ * @summary [macosx] Swing. JDialog. Modal dialog goes to background
+ * @author Alexandr Scherbatiy
+ * @run main ModalDialogOrderingTest
+ */
+
+public class ModalDialogOrderingTest {
+
+    private static final Color DIALOG_COLOR = Color.GREEN;
+    private static final Color FRAME_COLOR = Color.BLUE;
+
+    public static void main(String[] args) {
+
+        final Frame frame = new Frame("Test");
+        frame.setSize(100, 100);
+        frame.setBackground(FRAME_COLOR);
+        frame.setVisible(true);
+
+        final Dialog modalDialog = new Dialog((Frame) null, true);
+        modalDialog.setTitle("Modal Dialog");
+        modalDialog.setSize(50, 50);
+        modalDialog.setBackground(DIALOG_COLOR);
+        modalDialog.setModal(true);
+
+        new Thread(new Runnable() {
+
+            @Override
+            public void run() {
+                runTest(modalDialog, frame);
+            }
+        }).start();
+
+        modalDialog.setVisible(true);
+    }
+
+    private static void runTest(Dialog dialog, Frame frame) {
+        try {
+            SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+            Robot robot = new Robot();
+            robot.setAutoDelay(15);
+            robot.mouseMove(300, 300);
+
+            while (!dialog.isVisible()) {
+                toolkit.realSync();
+            }
+
+            Rectangle dialogBounds = dialog.getBounds();
+            Rectangle frameBounds = frame.getBounds();
+
+            double x0 = dialogBounds.getX();
+            double y0 = dialogBounds.getY();
+            double x1 = dialogBounds.getX() + dialogBounds.getWidth();
+            double y1 = dialogBounds.getY() + dialogBounds.getHeight();
+            double x2 = frameBounds.getX() + frameBounds.getWidth();
+            double y2 = frameBounds.getY() + frameBounds.getHeight();
+
+            int clickX = (int) ((x2 + x1) / 2);
+            int clickY = (int) ((y2 + y1) / 2);
+
+            robot.mouseMove(clickX, clickY);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            toolkit.realSync();
+
+            int colorX = (int) ((x0 + x1) / 2);
+            int colorY = (int) ((y0 + y1) / 2);
+
+            Color color = robot.getPixelColor(colorX, colorY);
+
+            dialog.setVisible(false);
+            frame.setVisible(false);
+
+            if (!DIALOG_COLOR.equals(color)) {
+                throw new RuntimeException("The frame is on top"
+                        + " of the modal dialog!");
+            }
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,108 @@
+/*
+ * 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 test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * @test
+ * @bug 8012026
+ * @summary Component.getMousePosition() does not work in an applet on MacOS
+ * @author Petr Pchelko
+ * @library ../../regtesthelpers
+ * @build Util
+ * @compile GetMousePositionWithOverlay.java
+ * @run main/othervm GetMousePositionWithOverlay
+ */
+
+public class GetMousePositionWithOverlay {
+
+    static Frame backFrame;
+    static Frame frontFrame;
+
+    public static void main(String[] args) throws Throwable {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    constructTestUI();
+                }
+            });
+            Util.waitForIdle(null);
+
+            Robot r = new Robot();
+            Util.pointOnComp(frontFrame, r);
+            Util.waitForIdle(null);
+
+            Point pos = getMousePosition(backFrame);
+            if (pos != null) {
+                throw new RuntimeException("Test failed. Mouse position should be null but was" + pos);
+            }
+
+            pos = getMousePosition(frontFrame);
+            if (pos == null) {
+                throw new RuntimeException("Test failed. Mouse position should not be null");
+            }
+
+            r.mouseMove(189, 189);
+            Util.waitForIdle(null);
+
+            pos = getMousePosition(backFrame);
+            if (pos == null) {
+                throw new RuntimeException("Test failed. Mouse position should not be null");
+            }
+        } finally {
+            SwingUtilities.invokeLater(new Runnable() {
+                @Override
+                public void run() {
+                    backFrame.dispose();
+                    frontFrame.dispose();
+                }
+            });
+        }
+    }
+
+    private static Point getMousePosition(final Component component) throws Exception {
+        final AtomicReference<Point> pos = new AtomicReference<Point>();
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                pos.set(component.getMousePosition());
+            }
+        });
+        return pos.get();
+    }
+
+    private static void constructTestUI() {
+        backFrame = new Frame();
+        backFrame.setBounds(100, 100, 100, 100);
+        backFrame.setVisible(true);
+
+        frontFrame = new Frame();
+        frontFrame.setBounds(120, 120, 60, 60);
+        frontFrame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,111 @@
+/*
+ * 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 test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
+
+/**
+ * @test
+ * @bug 8012026
+ * @summary Component.getMousePosition() does not work in an applet on MacOS
+ * @author Petr Pchelko
+ * @library ../../regtesthelpers
+ * @build Util
+ * @compile GetMousePositionWithPopup.java
+ * @run main/othervm GetMousePositionWithPopup
+ */
+
+public class GetMousePositionWithPopup {
+
+    private static Frame frame1;
+    private static Frame frame2;
+
+    public static void main(String[] args) throws Exception {
+        try {
+        Robot r = Util.createRobot();
+        r.mouseMove(0, 0);
+        Util.waitForIdle(null);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                constructTestUI();
+            }
+        });
+
+        Util.waitForIdle(null);
+        r.mouseMove(149, 149);
+        Util.waitForIdle(null);
+        r.mouseMove(150, 150);
+        Util.waitForIdle(null);
+
+        } finally {
+            SwingUtilities.invokeLater(new Runnable() {
+                @Override
+                public void run() {
+                    frame1.dispose();
+                    frame2.dispose();
+                }
+            });
+        }
+    }
+
+    private static void constructTestUI() {
+        frame1 = new Frame();
+        frame1.setBounds(100, 100, 100, 100);
+        frame1.addMouseMotionListener(new MouseMotionAdapter() {
+
+            private boolean shown = false;
+
+            @Override
+            public void mouseMoved(MouseEvent e) {
+                if (shown) {
+                    return;
+                }
+
+                shown = true;
+
+                frame2 = new Frame();
+                frame2.setBounds(120, 120, 120, 120);
+                frame2.setVisible(true);
+
+                Point positionInFrame2 = frame2.getMousePosition();
+                if (positionInFrame2.x != 30 || positionInFrame2.y != 30) {
+                    throw new RuntimeException("Wrong position reported. Should be [30, 30] but was [" +
+                            positionInFrame2.x + ", " + positionInFrame2.y + "]");
+                }
+
+                Point positionInFrame1 = frame1.getMousePosition();
+                if (positionInFrame1 != null) {
+                    throw new RuntimeException("Wrong position reported. Should be null");
+                }
+
+            }
+        });
+        frame1.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,314 @@
+/*
+ * 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.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.InvalidDnDOperationException;
+import java.awt.dnd.peer.DragSourceContextPeer;
+import java.awt.font.TextAttribute;
+import java.awt.im.InputMethodHighlight;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.peer.*;
+import java.net.URL;
+import java.util.Map;
+import java.util.Properties;
+
+
+/**
+ * @test
+ * @bug 7172833
+ * @summary java.awt.Toolkit methods is/setDynamicLayout() should be consistent.
+ * @author Sergey Bylokhov
+ */
+public final class bug7172833 {
+
+    public static void main(final String[] args) throws Exception {
+        final StubbedToolkit t = new StubbedToolkit();
+
+        t.setDynamicLayout(true);
+        if(!t.isDynamicLayoutSet()){
+            throw new RuntimeException("'true' expected but 'false' returned");
+        }
+
+        t.setDynamicLayout(false);
+        if(t.isDynamicLayoutSet()){
+            throw new RuntimeException("'false' expected but 'true' returned");
+        }
+    }
+
+    static final class StubbedToolkit extends Toolkit {
+
+        @Override
+        protected boolean isDynamicLayoutSet() throws HeadlessException {
+            return super.isDynamicLayoutSet();
+        }
+
+        @Override
+        protected DesktopPeer createDesktopPeer(final Desktop target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected ButtonPeer createButton(final Button target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected TextFieldPeer createTextField(final TextField target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected LabelPeer createLabel(final Label target) throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected ListPeer createList(final List target) throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected CheckboxPeer createCheckbox(final Checkbox target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected ScrollbarPeer createScrollbar(final Scrollbar target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected ScrollPanePeer createScrollPane(final ScrollPane target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected TextAreaPeer createTextArea(final TextArea target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected ChoicePeer createChoice(final Choice target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected FramePeer createFrame(final Frame target) throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected CanvasPeer createCanvas(final Canvas target) {
+            return null;
+        }
+
+        @Override
+        protected PanelPeer createPanel(final Panel target) {
+            return null;
+        }
+
+        @Override
+        protected WindowPeer createWindow(final Window target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected DialogPeer createDialog(final Dialog target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected MenuBarPeer createMenuBar(final MenuBar target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected MenuPeer createMenu(final Menu target) throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected PopupMenuPeer createPopupMenu(final PopupMenu target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected MenuItemPeer createMenuItem(final MenuItem target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected FileDialogPeer createFileDialog(final FileDialog target)
+                throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected CheckboxMenuItemPeer createCheckboxMenuItem(
+                final CheckboxMenuItem target) throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected FontPeer getFontPeer(final String name, final int style) {
+            return null;
+        }
+
+        @Override
+        public Dimension getScreenSize() throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        public int getScreenResolution() throws HeadlessException {
+            return 0;
+        }
+
+        @Override
+        public ColorModel getColorModel() throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        public String[] getFontList() {
+            return new String[0];
+        }
+
+        @Override
+        public FontMetrics getFontMetrics(final Font font) {
+            return null;
+        }
+
+        @Override
+        public void sync() {
+
+        }
+
+        @Override
+        public Image getImage(final String filename) {
+            return null;
+        }
+
+        @Override
+        public Image getImage(final URL url) {
+            return null;
+        }
+
+        @Override
+        public Image createImage(final String filename) {
+            return null;
+        }
+
+        @Override
+        public Image createImage(final URL url) {
+            return null;
+        }
+
+        @Override
+        public boolean prepareImage(
+                final Image image, final int width, final int height,
+                                    final ImageObserver observer) {
+            return false;
+        }
+
+        @Override
+        public int checkImage(final Image image, final int width, final int height,
+                              final ImageObserver observer) {
+            return 0;
+        }
+
+        @Override
+        public Image createImage(final ImageProducer producer) {
+            return null;
+        }
+
+        @Override
+        public Image createImage(final byte[] imagedata, final int imageoffset,
+                                 final int imagelength) {
+            return null;
+        }
+
+        @Override
+        public PrintJob getPrintJob(final Frame frame, final String jobtitle,
+                                    final Properties props) {
+            return null;
+        }
+
+        @Override
+        public void beep() {
+
+        }
+
+        @Override
+        public Clipboard getSystemClipboard() throws HeadlessException {
+            return null;
+        }
+
+        @Override
+        protected EventQueue getSystemEventQueueImpl() {
+            return null;
+        }
+
+        @Override
+        public DragSourceContextPeer createDragSourceContextPeer(
+                final DragGestureEvent dge) throws InvalidDnDOperationException {
+            return null;
+        }
+
+        @Override
+        public boolean isModalityTypeSupported(
+                final Dialog.ModalityType modalityType) {
+            return false;
+        }
+
+        @Override
+        public boolean isModalExclusionTypeSupported(
+                final Dialog.ModalExclusionType modalExclusionType) {
+            return false;
+        }
+
+        @Override
+        public Map<TextAttribute, ?> mapInputMethodHighlight(
+                final InputMethodHighlight highlight) throws HeadlessException {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 7129133
+ * @summary [macosx] Accelerators are displayed as Meta instead of the Command symbol
+ * @author leonid.romanov@oracle.com
+ * @run main bug7129133
+ */
+
+import java.awt.*;
+
+public class bug7129133 {
+    public static void main(String[] args) throws Exception {
+        if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
+            System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
+            return;
+        }
+
+        Toolkit.getDefaultToolkit();
+
+        String cmdSymbol = "\u2318";
+        String val = Toolkit.getProperty("AWT.meta", "Meta");
+
+        if (!val.equals(cmdSymbol)) {
+           throw new Exception("Wrong property value for AWT.meta. Expected: " + cmdSymbol + ", actual: " + val);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.html	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,43 @@
+<html>
+<!--
+ 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 6384984 8004032
+  @summary TrayIcon try to dispay a tooltip when is not visible
+  @author Dmitry.Cherepanov@sun.com area=awt.tray
+  @run applet/manual=yesno ShowAfterDisposeTest.html
+  -->
+<head>
+<title> ShowAfterDisposeTest </title>
+</head>
+<body>
+
+<h1>ShowAfterDisposeTest<br>Bug ID: 6384984</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="ShowAfterDisposeTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,246 @@
+/*
+ * 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 6384984 8004032
+  @summary TrayIcon try to dispay a tooltip when is not visible
+  @author Dmitry.Cherepanov@sun.com area=awt.tray
+  @run applet/manual=yesno ShowAfterDisposeTest.html
+*/
+
+import java.applet.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+
+public class ShowAfterDisposeTest extends Applet
+{
+    boolean traySupported;
+
+    public void init()
+    {
+        this.setLayout (new BorderLayout ());
+
+        String[] instructions;
+        traySupported = SystemTray.isSupported();
+        if (traySupported)
+        {
+            String[] s =
+            {
+                "1) When the test starts an icon is added to the SystemTray area.",
+                "2a) If you use Apple OS X,",
+                "    right click on this icon (it's important to click before the tooltip is shown).",
+                "    The icon should disappear.",
+                "2b) If you use other os (Windows, Linux, Solaris),",
+                "    double click on this icon (it's important to click before the tooltip is shown).",
+                "    The icon should disappear.",
+                "3) If the bug is reproducible then the test will fail without assistance.",
+                "4) Just press the 'pass' button."
+            };
+            instructions = s;
+        }
+        else
+        {
+            String[] s =
+            {
+              "The test cannot be run because SystemTray is not supported.",
+              "Simply press PASS button."
+            };
+            instructions = s;
+        }
+        Sysout.createDialogWithInstructions(instructions);
+    }
+
+    public void start ()
+    {
+        setSize (200,200);
+        setVisible(true);
+        validate();
+
+        if (!traySupported)
+        {
+            return;
+        }
+
+        BufferedImage img = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);
+        Graphics g = img.createGraphics();
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, 32, 32);
+        g.setColor(Color.RED);
+        g.fillRect(6, 6, 20, 20);
+        g.dispose();
+
+        final SystemTray tray = SystemTray.getSystemTray();
+        final TrayIcon icon = new TrayIcon(img);
+        icon.setImageAutoSize(true);
+        icon.addActionListener(new ActionListener()
+            {
+                public void actionPerformed(ActionEvent ev)
+                {
+                    tray.remove(icon);
+                }
+            }
+        );
+
+        try {
+            tray.add(icon);
+        } catch (AWTException e) {
+            Sysout.println(e.toString());
+            Sysout.println("!!! The test coudn't be performed !!!");
+            return;
+        }
+        icon.setToolTip("tooltip");
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+}
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+            }
+        }
+    }
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+}
--- a/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,6 +23,7 @@
 
 /**
  * @test @summary JVM crash if the frame maximized from offscreen
+ * @bug 8020210
  * @author Petr Pchelko
  * @library ../../regtesthelpers
  * @build Util
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.awt.Frame;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyAdapter;
+import sun.awt.ExtendedKeyCodes;
+import sun.awt.SunToolkit;
+
+/*
+ * @test
+ * @bug 8007156
+ * @summary Extended key code is not set for a key event
+ * @author Alexandr Scherbatiy
+ * @run main ExtendedKeyCodeTest
+ */
+public class ExtendedKeyCodeTest {
+
+    private static volatile boolean setExtendedKeyCode = true;
+    private static volatile int eventsCount = 0;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+
+        Frame frame = new Frame();
+        frame.setSize(300, 300);
+
+        frame.addKeyListener(new KeyAdapter() {
+
+            @Override
+            public void keyPressed(KeyEvent e) {
+                eventsCount++;
+                setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
+                    == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+            }
+
+            @Override
+            public void keyReleased(KeyEvent e) {
+                eventsCount++;
+                setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
+                    == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+            }
+        });
+
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_D);
+        robot.keyRelease(KeyEvent.VK_D);
+        toolkit.realSync();
+
+        frame.dispose();
+
+        if (eventsCount != 2 || !setExtendedKeyCode) {
+            throw new RuntimeException("Wrong extended key code");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,81 @@
+/*
+ * 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.awt.AWTEvent;
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.AWTEventListener;
+import java.awt.event.KeyEvent;
+import java.util.Locale;
+import sun.awt.SunToolkit;
+
+/*
+ * @test
+ * @bug 8022401
+ * @summary Wrong key char
+ * @author Alexandr Scherbatiy
+ * @run main KeyCharTest
+ */
+public class KeyCharTest {
+
+    private static volatile int eventsCount = 0;
+
+    static {
+        Locale.setDefault(Locale.ENGLISH);
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+
+            @Override
+            public void eventDispatched(AWTEvent event) {
+                eventsCount++;
+                char delete = ((KeyEvent) event).getKeyChar();
+                if (delete != '\u007f') {
+                    throw new RuntimeException("Key char is not delete: '" + delete + "'");
+                }
+            }
+        }, AWTEvent.KEY_EVENT_MASK);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        Frame frame = new Frame();
+        frame.setSize(300, 300);
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        Robot robot = new Robot();
+
+        robot.keyPress(KeyEvent.VK_DELETE);
+        robot.keyRelease(KeyEvent.VK_DELETE);
+        toolkit.realSync();
+
+        frame.dispose();
+
+        if (eventsCount != 3) {
+            throw new RuntimeException("Wrong number of key events: " + eventsCount);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/TransformAttribute/TransformEqualityTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
+ * @summary test equals method
+ * @bug 7092764
+ */
+
+import java.awt.font.TransformAttribute;
+import java.awt.geom.AffineTransform;
+
+public class TransformEqualityTest {
+
+    public static void main(String[] args) {
+        AffineTransform tx1 = new AffineTransform(1, 0, 1, 1, 0, 0);
+        AffineTransform tx2 = new AffineTransform(1, 0, 1, 1, 0, 0);
+        AffineTransform tx3 = new AffineTransform(2, 0, 1, 1, 0, 0);
+        TransformAttribute ta1a = new TransformAttribute(tx1);
+        TransformAttribute ta1b = new TransformAttribute(tx1);
+        TransformAttribute ta2 = new TransformAttribute(tx2);
+        TransformAttribute ta3 = new TransformAttribute(tx3);
+        if (ta1a.equals(null)) {
+            throw new RuntimeException("should not be equal to null.");
+        }
+        if (!ta1a.equals(ta1a)) {
+            throw new RuntimeException("(1) should be equal.");
+        }
+        if (!ta1a.equals(ta1b)) {
+            throw new RuntimeException("(2) should be equal.");
+        }
+        if (!ta1a.equals(ta2)) {
+            throw new RuntimeException("(3) should be equal.");
+        }
+        if (ta2.equals(ta3)) {
+            throw new RuntimeException("should be different.");
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/DrawImage/EABlitTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+import java.util.*;
+import javax.swing.*;
+
+/**
+ * @test
+ * @bug 8024895
+ * @summary tests if changing extra alpha values are honored for transformed blits
+ * @author ceisserer
+ */
+public class EABlitTest extends Frame {
+    protected void test() {
+        BufferedImage srcImg = createSrcImage();
+        Image dstImg = getGraphicsConfiguration().createCompatibleVolatileImage(20, 50);
+
+        //be over-cautious and render twice to avoid BI caching issues
+        renderToVI(srcImg, dstImg);
+        renderToVI(srcImg, dstImg);
+
+        BufferedImage validationImg = new BufferedImage(20, 50, BufferedImage.TYPE_INT_RGB);
+        Graphics2D valG = (Graphics2D) validationImg.getGraphics();
+        valG.drawImage(dstImg, 0, 0, null);
+
+        //Loop over all pixel, and count the different pixel values encountered.
+        TreeSet<Integer> colorCntSet = new TreeSet<>();
+        for (int x=0; x < validationImg.getWidth(); x++) {
+            for (int y=0; y < validationImg.getHeight(); y++) {
+                int rgb = validationImg.getRGB(x, y);
+                colorCntSet.add(rgb);
+            }
+        }
+
+        //Check if we encountered 3 different color values in total
+        if (colorCntSet.size() == 3) {
+            System.out.println("Passed!");
+        } else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+
+    protected void renderToVI(BufferedImage src, Image dst) {
+        Graphics2D g = (Graphics2D) dst.getGraphics();
+
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, 50, 50);
+        g.rotate(0.5f);
+        g.setRenderingHint(RenderingHints.KEY_RENDERING,
+                           RenderingHints.VALUE_RENDER_QUALITY);
+
+        g.setComposite(AlphaComposite.SrcOver.derive(1f));
+        g.drawImage(src, 10, 10, null);
+
+        g.setComposite(AlphaComposite.SrcOver.derive(0.5f));
+        g.drawImage(src, 20, 20, null);
+    }
+
+    protected BufferedImage createSrcImage() {
+        BufferedImage bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g = (Graphics2D) bi.getGraphics();
+        g.setColor(Color.YELLOW);
+        g.fillRect(0, 0, 10, 10);
+        return bi;
+    }
+
+    public static void main(String[] args) {
+         new EABlitTest().test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/bug8023392/bug8023392.html	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,20 @@
+<html>
+<!--
+  @test
+  @bug 8023392
+  @summary Swing text components printed with spaces between chars
+  @author Anton Nashatyrev
+  @run applet/manual=yesno bug8023392.html
+  -->
+<head>
+    <title> Bug 8023392 </title>
+</head>
+<body>
+
+<h1>Bug ID: 8023392</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="bug8023392.class" WIDTH=400 HEIGHT=400></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/bug8023392/bug8023392.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,286 @@
+/*
+ * 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 8023392
+  @summary Swing text components printed with spaces between chars
+  @author Anton Nashatyrev
+  @run applet/manual=yesno bug8023392.html
+*/
+
+import javax.swing.*;
+import javax.swing.border.LineBorder;
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.font.TextAttribute;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+
+
+public class bug8023392 extends Applet {
+    static final String[] instructions = {
+        "A Frame containing several pairs of labels ((a) and (b)) is displayed.",
+        "Labels of each pair look the same and are left-aligned (with spaces ",
+        "between chars).",
+        "1. Hit the print button.",
+        "2. Select any available printer (printing to file is also fine).",
+        "3. Look at the printing result (paper, PDF, PS, etc.):",
+        "   The (a) and (b) labels should look almost the same and the (a) labels",
+        "   shouldn't appear as if they are stretched along X axis."};
+
+    public void init() {
+        this.setLayout(new BorderLayout());
+        add(new SimplePrint2(), BorderLayout.CENTER);
+
+        Sysout.createDialogWithInstructions(instructions);
+
+    }
+
+    public static class SimplePrint2 extends JPanel
+            implements ActionListener, Printable {
+        JLabel label1;
+        JLabel label2;
+        JButton printButton;
+
+
+        public SimplePrint2() {
+            setLayout(new BorderLayout());
+            label1 = new JLabel("2a) a b c d e" +
+                    "                         ");
+            label2 = new JLabel("2b) a b c d e");
+
+            Box p1 = new Box(BoxLayout.Y_AXIS);
+            p1.add(label1);
+            p1.add(label2);
+            p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") {
+                String s = "3a) a b c d e                                     ";
+                @Override
+                protected void paintComponent(Graphics g) {
+                    sun.swing.SwingUtilities2.drawChars(this, g, s.toCharArray(),
+                            0, s.length(), 0, 15);
+                }
+            });
+            p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") {
+                String s = "3b) a b c d e";
+                @Override
+                protected void paintComponent(Graphics g) {
+                    sun.swing.SwingUtilities2.drawChars(this, g, s.toCharArray(),
+                            0, s.length(), 0, 15);
+                }
+            });
+            p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") {
+                String s = "4a) a b c d e                                     ";
+                AttributedCharacterIterator it;
+                {
+                    AttributedString as = new AttributedString(s);
+                    as.addAttribute(TextAttribute.FONT, getFont());
+                    as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 3, 8);
+                    it = as.getIterator();
+                }
+                @Override
+                protected void paintComponent(Graphics g) {
+                    sun.swing.SwingUtilities2.drawString(this, g, it, 0, 15);
+                }
+            });
+
+            p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") {
+                String s = "4b) a b c d e";
+                AttributedCharacterIterator it;
+                {
+                    AttributedString as = new AttributedString(s);
+                    as.addAttribute(TextAttribute.FONT, getFont());
+                    as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 3, 8);
+                    it = as.getIterator();
+                }
+                @Override
+                protected void paintComponent(Graphics g) {
+                    sun.swing.SwingUtilities2.drawString(this, g, it, 0, 15);
+                }
+            });
+
+            JPanel p2 = new JPanel();
+            printButton = new JButton("Print");
+            printButton.addActionListener(this);
+            p2.add(printButton);
+
+            Container c = this;
+            c.add(p1, BorderLayout.CENTER);
+            c.add(p2, BorderLayout.SOUTH);
+
+            String[] data = {
+                    "1a) \u30aa\u30f3\u30e9\u30a4\u30f3\u6d88\u8fbc" +
+                    "                                              ",
+                    "1b) \u30aa\u30f3\u30e9\u30a4\u30f3\u6d88\u8fbc"
+            };
+            JList l0 = new JList(data);
+            l0.setVisibleRowCount(l0.getModel().getSize());
+            JScrollPane jsp = new JScrollPane(l0);
+            l0.setBorder(new LineBorder(Color.GRAY));
+            c.add(jsp, BorderLayout.NORTH);
+
+            for (Component comp : new Component[]{label1, label2, printButton}) {
+                comp.setFont(new Font("Monospaced", 0, 16));
+            }
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            PrinterJob job = PrinterJob.getPrinterJob();
+            job.setPrintable(this);
+            if (job.printDialog()) {
+                try {
+                    job.print();
+                } catch (PrinterException ex) {
+                    ex.printStackTrace();
+                }
+            }
+        }
+
+        public int print(Graphics graphics,
+                         PageFormat pageFormat,
+                         int pageIndex)
+                throws PrinterException {
+            if (pageIndex >= 1) {
+                return Printable.NO_SUCH_PAGE;
+            }
+
+            this.paint(graphics);
+            return Printable.PAGE_EXISTS;
+        }
+    }
+}
+
+
+/**
+ * *************************************************
+ * Standard Test Machinery
+ * DO NOT modify anything below -- it's a standard
+ * chunk of code whose purpose is to make user
+ * interaction uniform, and thereby make it simpler
+ * to read and understand someone else's test.
+ * **************************************************
+ */
+class Sysout {
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        dialog.show();
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        dialog.show();
+        println("Any messages for the tester will display here.");
+    }
+
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+
+    public static void println(String messageIn) {
+        dialog.displayMessage(messageIn);
+    }
+
+}// Sysout  class
+
+
+class TestDialog extends Dialog {
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("South", messageText);
+
+        pack();
+
+        show();
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                            lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                }
+                //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+    }
+
+}// TestDialog  class
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/Test7172865.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,162 @@
+/*
+ * 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.beans.IndexedPropertyDescriptor;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+
+/*
+ * @test
+ * @bug 7172854 7172865
+ * @summary Tests that cached methods are not lost
+ * @author Sergey Malenkov
+ */
+
+public class Test7172865 {
+    public static void main(String[] args) throws Exception {
+        int errors = 0;
+
+        MethodDescriptor md = new MethodDescriptor(Test7172865.class.getMethod("getGood"));
+
+        errors += test(PropertyDescriptor.class, "good", true);
+        PropertyDescriptor pdGoodString = new PropertyDescriptor("good", Test7172865.class, "getGood", "setGood");
+        PropertyDescriptor pdGoodMethod = new PropertyDescriptor("good",
+                Test7172865.class.getMethod("getGood"),
+                Test7172865.class.getMethod("setGood", args.getClass()));
+
+        errors += test(PropertyDescriptor.class, "bad", false);
+        PropertyDescriptor pdBadString = new PropertyDescriptor("bad", Test7172865.class, "getBad", null);
+        PropertyDescriptor pdBadMethod = new PropertyDescriptor("bad",
+                Test7172865.class.getMethod("getBad"),
+                Test7172865.class.getMethod("setBad", args.getClass()));
+
+        errors += test(IndexedPropertyDescriptor.class, "good", true);
+        IndexedPropertyDescriptor ipdGoodString = new IndexedPropertyDescriptor("good", Test7172865.class, "getGood", "setGood", "getGood", "setGood");
+        IndexedPropertyDescriptor ipdGoodMethod = new IndexedPropertyDescriptor("good",
+                Test7172865.class.getMethod("getGood"),
+                Test7172865.class.getMethod("setGood", args.getClass()),
+                Test7172865.class.getMethod("getGood", Integer.TYPE),
+                Test7172865.class.getMethod("setGood", Integer.TYPE, String.class));
+
+        errors += test(IndexedPropertyDescriptor.class, "bad", false);
+        IndexedPropertyDescriptor ipdBadString = new IndexedPropertyDescriptor("bad", Test7172865.class, "getBad", null, "getBad", null);
+        IndexedPropertyDescriptor ipdBadMethod = new IndexedPropertyDescriptor("bad",
+                Test7172865.class.getMethod("getBad"),
+                Test7172865.class.getMethod("setBad", args.getClass()),
+                Test7172865.class.getMethod("getBad", Integer.TYPE),
+                Test7172865.class.getMethod("setBad", Integer.TYPE, String.class));
+
+        for (int i = 1; i <= 2; i++) {
+            System.out.println("STEP: " + i);
+            errors += test("md", null != md.getMethod());
+
+            errors += test("pdGoodString", pdGoodString, true, true);
+            errors += test("pdGoodMethod", pdGoodMethod, true, true);
+
+            errors += test("pdBadString", pdBadString, true, false);
+            errors += test("pdBadMethod", pdBadMethod, true, true);
+
+            errors += test("ipdGoodString", ipdGoodString, true, true, true, true);
+            errors += test("ipdGoodMethod", ipdGoodMethod, true, true, true, true);
+
+            errors += test("ipdBadString", ipdBadString, true, false, true, false);
+            errors += test("ipdBadMethod", ipdBadMethod, true, true, true, true);
+
+            try {
+                int[] array = new int[1024];
+                while (true) {
+                    array = new int[array.length << 1];
+                }
+            }
+            catch (OutOfMemoryError error) {
+                System.gc();
+            }
+        }
+        if (errors > 0) {
+            throw new Error("found " + errors + " errors");
+        }
+    }
+
+    private static int test(Class<?> type, String property, boolean value) {
+        String message = type.getSimpleName() + "(" + property + ") ";
+        try {
+            type.getConstructor(String.class, Class.class).newInstance(property, Test7172865.class);
+            message += "passed";
+        }
+        catch (Exception exception) {
+            message += "failed";
+            value = !value;
+        }
+        if (value) {
+            message += " as expected";
+        }
+        System.out.println(message);
+        return value ? 0 : 1;
+    }
+
+    private static int test(String message, boolean value) {
+        System.out.println(message + ": " + (value ? "passed" : "failed"));
+        return value ? 0 : 1;
+    }
+
+    private static int test(String message, PropertyDescriptor pd, boolean rm, boolean wm) {
+        return test(message + ".Read", rm == (null != pd.getReadMethod()))
+             + test(message + ".Write", wm == (null != pd.getWriteMethod()));
+    }
+
+    private static int test(String message, IndexedPropertyDescriptor ipd, boolean rm, boolean wm, boolean irm, boolean iwm) {
+        return test(message, ipd, rm, wm)
+             + test(message + ".IndexedRead", irm == (null != ipd.getIndexedReadMethod()))
+             + test(message + ".IndexedWrite", iwm == (null != ipd.getIndexedWriteMethod()));
+    }
+
+    public String[] getGood() {
+        return null;
+    }
+
+    public String getGood(int index) {
+        return null;
+    }
+
+    public void setGood(String[] good) {
+    }
+
+    public void setGood(int index, String value) {
+    }
+
+    public String[] getBad() {
+        return null;
+    }
+
+    public String getBad(int index) {
+        return null;
+    }
+
+    public Test7172865 setBad(String[] bad) {
+        return null;
+    }
+
+    public Test7172865 setBad(int index, String value) {
+        return null;
+    }
+}
--- a/jdk/test/java/beans/Performance/Test7122740.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/beans/Performance/Test7122740.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7122740
+ * @bug 7187618 7122740
  * @summary Tests just a benchmark of PropertyDescriptor(String, Class) performance
  * @author Sergey Malenkov
  * @run main/manual Test7122740
--- a/jdk/test/java/beans/Performance/Test7184799.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/beans/Performance/Test7184799.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7184799
+ * @bug 7187618 7184799
  * @summary Tests just a benchmark of Introspector.getBeanInfo(Class) performance
  * @author Sergey Malenkov
  * @run main/manual Test7184799
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Class/forName/arrayClass/Class1.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+public class Class1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Class/forName/arrayClass/Class2.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+public class Class2 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Class/forName/arrayClass/Class3.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+public class Class3 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Class/forName/arrayClass/Class4.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+public class Class4 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Class/forName/arrayClass/ExceedMaxDim.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,129 @@
+/*
+ * 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 7044282
+ * @build Class1 Class2 Class3 Class4
+ * @run main ExceedMaxDim
+ * @summary Make sure you can't get an array class of dimension > 255.
+ */
+
+// Class1, Class2, Class3 and Class4 should not have been loaded prior to the
+// calls to forName
+
+public class ExceedMaxDim {
+                             //0123456789012345678901234567890123456789
+    private String brackets = "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" +
+                              "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" +
+                              "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" +
+                              "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" +
+                              "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" +
+                              "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" +
+                              "[[[[[[[[[[[[[[";
+    private String name254 = brackets + "Ljava.lang.String;";
+    private String name255 = "[" + name254;
+    private String name256 = "[" + name255;
+    private String name1 = "[Ljava.lang.String;";
+    private String bigName;
+    private int error = 0;
+
+    private static final ClassLoader IMPLICIT_LOADER = null;
+
+    public ExceedMaxDim() {
+        super();
+
+        StringBuilder sb = new StringBuilder(Short.MAX_VALUE + 50);
+        for (int i = 0; i < Short.MAX_VALUE + 20; i++)
+            sb.append('[');
+        sb.append("Ljava.lang.String;");
+        bigName = sb.toString();
+
+        if (name256.lastIndexOf('[') != 255) // 256:th [
+            throw new RuntimeException("Test broken");
+    }
+
+    public static void main(String[] args) throws Exception {
+        ExceedMaxDim test = new ExceedMaxDim();
+        test.testImplicitLoader();
+        test.testOtherLoader();
+
+        if (test.error != 0)
+            throw new RuntimeException("Test failed, was able to create array with dim > 255." +
+                    " See log for details.");
+    }
+
+    private void testImplicitLoader() throws Exception {
+        // These four should succeed
+        assertSucceedForName(name1, IMPLICIT_LOADER);
+        assertSucceedForName(name254, IMPLICIT_LOADER);
+        assertSucceedForName(name255, IMPLICIT_LOADER);
+        assertSucceedForName(brackets + "[LClass1;", IMPLICIT_LOADER);
+
+        // The following three should fail
+        assertFailForName(name256, IMPLICIT_LOADER);
+        assertFailForName(bigName, IMPLICIT_LOADER);
+        assertFailForName(brackets + "[[LClass2;", IMPLICIT_LOADER);
+    }
+
+    private void testOtherLoader() throws Exception {
+        ClassLoader cl = ExceedMaxDim.class.getClassLoader();
+
+        // These four should succeed
+        assertSucceedForName(name1, cl);
+        assertSucceedForName(name254,cl);
+        assertSucceedForName(name255, cl);
+        assertSucceedForName(brackets + "[LClass3;", cl);
+
+        // The following three should fail
+        assertFailForName(name256, cl);
+        assertFailForName(bigName, cl);
+        assertFailForName(brackets + "[[Class4;", cl);
+    }
+
+    private void assertFailForName(String name, ClassLoader cl) {
+        Class<?> c;
+        try {
+            if (cl == null)
+                c = Class.forName(name);
+            else
+                c = Class.forName(name, true, cl);
+            error++;
+            System.err.println("ERROR: could create " + c);
+        } catch (ClassNotFoundException e) {
+            ;// ok
+        }
+    }
+
+    private void assertSucceedForName(String name, ClassLoader cl) {
+        Class<?> c;
+        try {
+            if (cl == null)
+                c = Class.forName(name);
+            else
+                c = Class.forName(name, true, cl);
+        } catch (ClassNotFoundException e) {
+            error++;
+            System.err.println("ERROR: could not create " + name);
+        }
+    }
+}
--- a/jdk/test/java/lang/invoke/AccessControlTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/lang/invoke/AccessControlTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -133,7 +133,7 @@
         }
 
         /** Simulate all assertions from the spec. for Lookup.in:
-         * <hr/>
+         * <hr>
          * Creates a lookup on the specified new lookup class.
          * [A1] The resulting object will report the specified
          * class as its own {@link #lookupClass lookupClass}.
@@ -155,7 +155,7 @@
          * </ul>
          * Other than the above cases, the new lookup will have the same
          * access capabilities as the original. [A8]
-         * <hr/>
+         * <hr>
          */
         public LookupCase in(Class<?> c2) {
             Class<?> c1 = lookupClass();
--- a/jdk/test/java/lang/invoke/BigArityTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/lang/invoke/BigArityTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -93,6 +93,65 @@
     }
 
     @Test
+    public void asCollectorIAE01() throws ReflectiveOperationException {
+        final int [] INVALID_ARRAY_LENGTHS = {
+            Integer.MIN_VALUE, Integer.MIN_VALUE + 1, -2, -1, 255, 256, Integer.MAX_VALUE - 1, Integer.MAX_VALUE
+        };
+        MethodHandle target = MethodHandles.publicLookup().findStatic(Arrays.class,
+                "deepToString", MethodType.methodType(String.class, Object[].class));
+        int minbig = Integer.MAX_VALUE;
+        for (int invalidLength : INVALID_ARRAY_LENGTHS) {
+            if (minbig > invalidLength && invalidLength > 100)  minbig = invalidLength;
+            try {
+                target.asCollector(Object[].class, invalidLength);
+                assert(false) : invalidLength;
+            } catch (IllegalArgumentException ex) {
+                System.out.println("OK: "+ex);
+            }
+        }
+        // Sizes not in the above array are good:
+        target.asCollector(Object[].class, minbig-1);
+        for (int i = 2; i <= 10; i++)
+            target.asCollector(Object[].class, minbig-i);
+    }
+
+    @Test
+    public void invoker02() {
+        for (int i = 0; i < 255; i++) {
+            MethodType mt = MethodType.genericMethodType(i);
+            MethodType expMT = mt.insertParameterTypes(0, MethodHandle.class);
+            if (i < 254) {
+                assertEquals(expMT, MethodHandles.invoker(mt).type());
+            } else {
+                try {
+                    MethodHandles.invoker(mt);
+                    assert(false) : i;
+                } catch (IllegalArgumentException ex) {
+                    System.out.println("OK: "+ex);
+                }
+            }
+        }
+    }
+
+    @Test
+    public void exactInvoker02() {
+        for (int i = 0; i < 255; i++) {
+            MethodType mt = MethodType.genericMethodType(i);
+            MethodType expMT = mt.insertParameterTypes(0, MethodHandle.class);
+            if (i < 254) {
+                assertEquals(expMT, MethodHandles.exactInvoker(mt).type());
+            } else {
+                try {
+                    MethodHandles.exactInvoker(mt);
+                    assert(false) : i;
+                } catch (IllegalArgumentException ex) {
+                    System.out.println("OK: "+ex);
+                }
+            }
+        }
+    }
+
+    @Test
     public void testBoundaryValues() throws Throwable {
         for (int badArity : new int[]{ -1, MAX_JVM_ARITY+1, MAX_JVM_ARITY }) {
             try {
@@ -102,6 +161,37 @@
                 System.out.println("OK: "+ex);
             }
         }
+        final int MAX_MH_ARITY      = MAX_JVM_ARITY - 1;  // mh.invoke(arg*[N])
+        final int MAX_INVOKER_ARITY = MAX_MH_ARITY - 1;   // inv.invoke(mh, arg*[N])
+        for (int arity : new int[]{ 0, 1, MAX_MH_ARITY-2, MAX_MH_ARITY-1, MAX_MH_ARITY }) {
+            MethodHandle mh = MH_hashArguments(arity);
+            if (arity < MAX_INVOKER_ARITY) {
+                MethodHandle ximh = MethodHandles.exactInvoker(mh.type());
+                MethodHandle gimh = MethodHandles.invoker(mh.type());
+                MethodHandle simh = MethodHandles.spreadInvoker(mh.type(), 0);
+                if (arity != 0) {
+                    simh = MethodHandles.spreadInvoker(mh.type(), 1);
+                } else {
+                    try {
+                        simh = MethodHandles.spreadInvoker(mh.type(), 1);
+                        assert(false) : arity;
+                    } catch (IllegalArgumentException ex) {
+                        System.out.println("OK: "+ex);
+                    }
+                }
+                if (arity != 0) {
+                    simh = MethodHandles.spreadInvoker(mh.type(), arity-1);
+                } else {
+                    try {
+                        simh = MethodHandles.spreadInvoker(mh.type(), arity-1);
+                        assert(false) : arity;
+                    } catch (IllegalArgumentException ex) {
+                        System.out.println("OK: "+ex);
+                    }
+                }
+                simh = MethodHandles.spreadInvoker(mh.type(), arity);
+            }
+        }
     }
 
     // Make sure the basic argument spreading and varargs mechanisms are working.
@@ -133,7 +223,7 @@
             if (cls == Object[].class)
                 r = smh.invokeExact(tail);
             else if (cls == Integer[].class)
-                r = smh.invokeExact((Integer[]) tail);
+                r = smh.invokeExact((Integer[]) tail); //warning OK, see 8019340
             else
                 r = smh.invoke(tail);
             assertEquals(r0, r);
@@ -235,21 +325,41 @@
             MethodHandle mh_VA = mh.asSpreader(cls, arity);
             assert(mh_VA.type().parameterType(0) == cls);
             testArities(cls, arity, iterations, verbose, mh, mh_VA);
+            // mh_CA will collect arguments of a particular type and pass them to mh_VA
+            MethodHandle mh_CA = mh_VA.asCollector(cls, arity);
+            MethodHandle mh_VA2 = mh_CA.asSpreader(cls, arity);
+            assert(mh_CA.type().equals(mh.type()));
+            assert(mh_VA2.type().equals(mh_VA.type()));
             if (cls != Object[].class) {
-                // mh_CA will collect arguments of a particular type and pass them to mh_VA
-                MethodHandle mh_CA = mh_VA.asCollector(cls, arity);
-                MethodHandle mh_VA2 = mh_CA.asSpreader(cls, arity);
                 try {
                     mh_VA2.invokeWithArguments(new Object[arity]);
                     throw new AssertionError("should not reach");
                 } catch (ClassCastException | WrongMethodTypeException ex) {
                 }
-                assert(mh_CA.type().equals(mh.type()));
-                assert(mh_VA2.type().equals(mh_VA.type()));
-                testArities(cls, arity, iterations, false, mh_CA, mh_VA2);
             }
+            int iterations_VA = iterations / 100;
+            testArities(cls, arity, iterations_VA, false, mh_CA, mh_VA2);
         }
     }
+
+   /**
+     * Tests calls to {@link BigArityTest#hashArguments hashArguments} as related to a single given arity N.
+     * Applies the given {@code mh} to a set of N integer arguments, checking the answer.
+     * Also applies the varargs variation {@code mh_VA} to an array of type C[] (given by {@code cls}).
+     * Test steps:
+     * <ul>
+     * <li>mh_VA.invokeExact(new C[]{ arg, ... })</li>
+     * <li>mh.invokeWithArguments((Object[]) new C[]{ arg, ... })</li>
+     * <li>exactInvoker(mh.type()).invokeWithArguments(new Object[]{ mh, arg, ... })</li>
+     * <li>invoker(mh.type()).invokeWithArguments(new Object[]{ mh, arg, ... })</li>
+     * </ul>
+     * @param cls     array type for varargs call (one of Object[], Number[], Integer[], Comparable[])
+     * @param arity   N, the number of arguments to {@code mh} and length of its varargs array, in [0..255]
+     * @param iterations  number of times to repeat each test step (at least 4)
+     * @param verbose are we printing extra output?
+     * @param mh      a fixed-arity version of {@code hashArguments}
+     * @param mh_VA   a variable-arity version of {@code hashArguments}, accepting the given array type {@code cls}
+     */
     private void testArities(Class<? extends Object[]> cls,
                              int arity,
                              int iterations,
@@ -292,7 +402,7 @@
             if (cls == Object[].class)
                 r = mh_VA.invokeExact(args);
             else if (cls == Integer[].class)
-                r = mh_VA.invokeExact((Integer[])args);
+                r = mh_VA.invokeExact((Integer[])args); //warning OK, see 8019340
             else
                 r = mh_VA.invoke(args);
             assertEquals(r0, r);
@@ -392,10 +502,16 @@
     a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF],
     a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7],
     // </editor-fold>
-    a[0xF8], a[0xF9], a[0xFA], a[0xFB]);
+    a[0xF8], a[0xF9], a[0xFA], a[0xFB]); // hashArguments_252
         assertEquals(r0, r);
         MethodType mt = MethodType.genericMethodType(ARITY);
         MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt);
+        test252(mh, a, r0);
+        MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY);
+        test252(mh_CA, a, r0);
+    }
+    public void test252(MethodHandle mh, Object[] a, Object r0) throws Throwable {
+        Object r;
         r = mh.invokeExact(
     // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ...">
     a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F],
@@ -599,10 +715,16 @@
     a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF],
     a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7],
     // </editor-fold>
-    a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC]);
+    a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC]); // hashArguments_253
         assertEquals(r0, r);
         MethodType mt = MethodType.genericMethodType(ARITY);
         MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt);
+        test253(mh, a, r0);
+        MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY);
+        test253(mh_CA, a, r0);
+    }
+    public void test253(MethodHandle mh, Object[] a, Object r0) throws Throwable {
+        Object r;
         r = mh.invokeExact(
     // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ...">
     a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F],
@@ -648,7 +770,6 @@
     // </editor-fold>
     a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC]);
         assertEquals(r0, r);
-        // FIXME: This next one fails, because it uses an internal invoker of arity 255.
         r = ximh.invokeWithArguments(cat(mh,a));
         assertEquals(r0, r);
         MethodHandle gimh = MethodHandles.invoker(mh.type());
@@ -674,7 +795,6 @@
     // </editor-fold>
     a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC]);
         assertEquals(r0, r);
-        // FIXME: This next one fails, because it uses an internal invoker of arity 255.
         r = gimh.invokeWithArguments(cat(mh,a));
         assertEquals(r0, r);
         mh = mh.asType(mh.type().changeParameterType(0x10, Integer.class));
@@ -808,10 +928,16 @@
     a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF],
     a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7],
     // </editor-fold>
-    a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC], a[0xFD]);
+    a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC], a[0xFD]); // hashArguments_254
         assertEquals(r0, r);
         MethodType mt = MethodType.genericMethodType(ARITY);
         MethodHandle mh = MethodHandles.lookup().findStatic(BigArityTest.class, "hashArguments_"+ARITY, mt);
+        test254(mh, a, r0);
+        MethodHandle mh_CA = MH_hashArguments_VA.asFixedArity().asCollector(Object[].class, ARITY);
+        test254(mh_CA, a, r0);
+    }
+    public void test254(MethodHandle mh, Object[] a, Object r0) throws Throwable {
+        Object r;
         r = mh.invokeExact(
     // <editor-fold defaultstate="collapsed" desc="a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], ...">
     a[0x00], a[0x01], a[0x02], a[0x03], a[0x04], a[0x05], a[0x06], a[0x07], a[0x08], a[0x09], a[0x0A], a[0x0B], a[0x0C], a[0x0D], a[0x0E], a[0x0F],
@@ -833,7 +959,6 @@
     // </editor-fold>
     a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC], a[0xFD]);
         assertEquals(r0, r);
-        // FIXME: This next one fails, because it uses an internal invoker of arity 255.
         r = mh.invokeWithArguments(a);
         assertEquals(r0, r);
         try {
@@ -998,7 +1123,7 @@
     a[0xE0], a[0xE1], a[0xE2], a[0xE3], a[0xE4], a[0xE5], a[0xE6], a[0xE7], a[0xE8], a[0xE9], a[0xEA], a[0xEB], a[0xEC], a[0xED], a[0xEE], a[0xEF],
     a[0xF0], a[0xF1], a[0xF2], a[0xF3], a[0xF4], a[0xF5], a[0xF6], a[0xF7],
     // </editor-fold>
-    a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC], a[0xFD], a[0xFE]);
+    a[0xF8], a[0xF9], a[0xFA], a[0xFB], a[0xFC], a[0xFD], a[0xFE]); // hashArguments_255
         assertEquals(r0, r);
         MethodType mt = MethodType.genericMethodType(ARITY);
         MethodHandle mh;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/CallStaticInitOrder.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @summary static initializer invocation order
+ *
+ * @build indify.Indify
+ * @compile CallStaticInitOrder.java
+ * @run main/othervm
+ *      indify.Indify
+ *      --expand-properties --classpath ${test.classes}
+ *      --java test.java.lang.invoke.CallStaticInitOrder
+ */
+
+package test.java.lang.invoke;
+
+import java.io.*;
+
+import java.lang.invoke.*;
+import static java.lang.invoke.MethodHandles.*;
+import static java.lang.invoke.MethodType.*;
+
+public class CallStaticInitOrder {
+    private static int TICK;
+    private static synchronized int tick(String event) {
+        int n = ++TICK;
+        System.out.println("event #"+n+" = "+event);
+        return n;
+    }
+
+    static int Init1Tick;
+    private static class Init1 {
+        static { Init1Tick = tick("foo -> Init1.<clinit>"); }
+        static int foo() { return Init1Tick; }
+    }
+
+    static int Init2Tick;
+    private static class Init2 {
+        static { Init2Tick = tick("bar -> Init2.<clinit>"); }
+        static int bar() { return Init2Tick; }
+    }
+
+    static int Init3Tick;
+    private static class Init3 {
+        static { Init3Tick = tick("baz -> Init3.<clinit>"); }
+        static int baz() { return Init3Tick; }
+    }
+
+    static int Init4Tick;
+    private static class Init4 {
+        static { Init4Tick = tick("bat -> Init4.<clinit>"); }
+        static int bat() { return Init4Tick; }
+    }
+
+    static int Init5Tick;
+    private static class Init5 {
+        static { Init5Tick = tick("read bang -> Init5.<clinit>"); }
+        static int bang = Init5Tick;
+    }
+
+    static int Init6Tick;
+    private static class Init6 {
+        static { Init6Tick = tick("write pong -> Init6.<clinit>"); }
+        static int pong;
+    }
+
+    private static final MutableCallSite CONSTANT_CS_baz;
+    private static MethodHandle MH_foo() throws ReflectiveOperationException {
+        return lookup().findStatic(Init1.class, "foo", methodType(int.class));
+    }
+    private static final MethodHandle CONSTANT_MH_bar;
+    private static MethodHandle MH_baz() throws ReflectiveOperationException {
+        return lookup().findStatic(Init3.class, "baz", methodType(int.class));
+    }
+    private static final MethodHandle CONSTANT_MH_bat;
+    private static final MethodHandle CONSTANT_MH_bangGetter;
+    private static final MethodHandle CONSTANT_MH_pongSetter;
+    static {
+        try {
+            int t1 = tick("CallStaticInitOrder.<clinit>");
+            {
+                CONSTANT_CS_baz = new MutableCallSite(methodType(int.class));
+                // MH_foo() := lookup().findStatic(Init1.class, "foo", methodType(int.class));
+                CONSTANT_MH_bar = lookup().findStatic(Init2.class, "bar", methodType(int.class));
+                // MH_baz() := lookup().findStatic(Init3.class, "baz", methodType(int.class));
+                CONSTANT_MH_bat = lookup().unreflect(Init4.class.getDeclaredMethod("bat"));
+                CONSTANT_MH_bangGetter = lookup().findStaticGetter(Init5.class, "bang", int.class);
+                MethodHandle pongSetter = lookup().findStaticSetter(Init6.class, "pong", int.class);
+                MethodHandle tickGetter = lookup().findStaticGetter(CallStaticInitOrder.class, "Init6Tick", int.class);
+                CONSTANT_MH_pongSetter = filterReturnValue(insertArguments(pongSetter, 0, -99), tickGetter);
+            }
+            int t2 = tick("CallStaticInitOrder.<clinit> done");
+            assertEquals(t1+1, t2);  // no ticks in between
+        } catch (Exception ex) {
+            throw new InternalError(ex.toString());
+        }
+    }
+
+    public static void main(String... av) throws Throwable {
+        testInit();
+        if (LAST_LOSER != null)  throw LAST_LOSER;
+    }
+
+    private static Throwable LAST_LOSER;
+
+    private static void assertEquals(int expected, int actual) {
+        if (expected != actual) {
+            Throwable loser = new AssertionError("expected: " + expected + ", actual: " + actual);
+            if (LAST_LOSER != null)
+                LAST_LOSER.printStackTrace(System.out);
+            LAST_LOSER = loser;
+        }
+    }
+
+    private static void testInit() throws Throwable {
+        System.out.println("runFoo = "+runFoo());
+        System.out.println("runBar = "+runBar());
+        try {
+            runBaz();
+        } catch (IllegalStateException ex) {
+            tick("runBaz throw/catch");
+        }
+        CONSTANT_CS_baz.setTarget(MH_baz());
+        System.out.println("runBaz = "+runBaz());
+        System.out.println("runBat = "+runBat());
+        System.out.println("runBang = "+runBang());
+        System.out.println("runPong = "+runPong());
+    }
+
+    private static int runFoo() throws Throwable {
+        assertEquals(Init1Tick, 0);  // Init1 not initialized yet
+        int t1 = tick("runFoo");
+        int t2 = (int) INDY_foo().invokeExact();
+        int t3 = tick("runFoo done");
+        assertEquals(Init1Tick, t2);  // when Init1 was initialized
+        assertEquals(t1+2, t3);  // exactly two ticks in between
+        assertEquals(t1+1, t2);  // init happened inside
+        return t2;
+    }
+    private static MethodHandle INDY_foo() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm().invoke(lookup(), "foo", methodType(int.class))).dynamicInvoker();
+    }
+
+    private static int runBar() throws Throwable {
+        assertEquals(Init2Tick, 0);  // Init2 not initialized yet
+        int t1 = tick("runBar");
+        int t2 = (int) INDY_bar().invokeExact();
+        int t3 = tick("runBar done");
+        assertEquals(Init2Tick, t2);  // when Init2 was initialized
+        assertEquals(t1+2, t3);  // exactly two ticks in between
+        assertEquals(t1+1, t2);  // init happened inside
+        return t2;
+    }
+    private static MethodHandle INDY_bar() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm().invoke(lookup(), "bar", methodType(int.class))).dynamicInvoker();
+    }
+
+    private static int runBaz() throws Throwable {
+        assertEquals(Init3Tick, 0);  // Init3 not initialized yet
+        int t1 = tick("runBaz");
+        int t2 = (int) INDY_baz().invokeExact();
+        int t3 = tick("runBaz done");
+        assertEquals(Init3Tick, t2);  // when Init3 was initialized
+        assertEquals(t1+2, t3);  // exactly two ticks in between
+        assertEquals(t1+1, t2);  // init happened inside
+        return t2;
+    }
+    private static MethodHandle INDY_baz() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm().invoke(lookup(), "baz", methodType(int.class))).dynamicInvoker();
+    }
+
+    private static int runBat() throws Throwable {
+        assertEquals(Init4Tick, 0);  // Init4 not initialized yet
+        int t1 = tick("runBat");
+        int t2 = (int) INDY_bat().invokeExact();
+        int t3 = tick("runBat done");
+        assertEquals(Init4Tick, t2);  // when Init4 was initialized
+        assertEquals(t1+2, t3);  // exactly two ticks in between
+        assertEquals(t1+1, t2);  // init happened inside
+        return t2;
+    }
+    private static MethodHandle INDY_bat() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm().invoke(lookup(), "bat", methodType(int.class))).dynamicInvoker();
+    }
+
+    private static int runBang() throws Throwable {
+        assertEquals(Init5Tick, 0);  // Init5 not initialized yet
+        int t1 = tick("runBang");
+        int t2 = (int) INDY_bang().invokeExact();
+        int t3 = tick("runBang done");
+        assertEquals(Init5Tick, t2);  // when Init5 was initialized
+        assertEquals(t1+2, t3);  // exactly two ticks in between
+        assertEquals(t1+1, t2);  // init happened inside
+        return t2;
+    }
+    private static MethodHandle INDY_bang() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm().invoke(lookup(), "bang", methodType(int.class))).dynamicInvoker();
+    }
+
+    private static int runPong() throws Throwable {
+        assertEquals(Init6Tick, 0);  // Init6 not initialized yet
+        int t1 = tick("runPong");
+        int t2 = (int) INDY_pong().invokeExact();
+        int t3 = tick("runPong done");
+        assertEquals(Init6Tick, t2);  // when Init6 was initialized
+        assertEquals(t1+2, t3);  // exactly two ticks in between
+        assertEquals(t1+1, t2);  // init happened inside
+        return t2;
+    }
+    private static MethodHandle INDY_pong() throws Throwable {
+        shouldNotCallThis();
+        return ((CallSite) MH_bsm().invoke(lookup(), "pong", methodType(int.class))).dynamicInvoker();
+    }
+
+    private static CallSite bsm(Lookup caller, String name, MethodType type) throws ReflectiveOperationException {
+        System.out.println("bsm "+name+type);
+        CallSite res;
+        switch (name) {
+        case "foo":
+            res = new ConstantCallSite(MH_foo()); break;
+        case "bar":
+            res = new ConstantCallSite(CONSTANT_MH_bar); break;
+        case "baz":
+            res = CONSTANT_CS_baz; break;
+        case "bat":
+            res = new ConstantCallSite(CONSTANT_MH_bat); break;
+        case "bang":
+            res = new ConstantCallSite(CONSTANT_MH_bangGetter); break;
+        case "pong":
+            res = new ConstantCallSite(CONSTANT_MH_pongSetter); break;
+        default:
+            res = null;
+        }
+        if (res == null || !res.type().equals(type)) {
+            throw new AssertionError(String.valueOf(res));
+        }
+        return res;
+    }
+    private static MethodHandle MH_bsm() throws ReflectiveOperationException {
+        shouldNotCallThis();
+        return lookup().findStatic(lookup().lookupClass(), "bsm",
+                                   methodType(CallSite.class, Lookup.class, String.class, MethodType.class));
+    }
+    private static void shouldNotCallThis() {
+        // if this gets called, the transformation has not taken place
+        throw new AssertionError("this code should be statically transformed away by Indify");
+    }
+}
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -53,7 +53,11 @@
     }
 
     public void run() throws Throwable {
+        testMisc();
+        testFindStatic();
+        testFindConstructor();
         testFindVirtual();
+        testFindSpecial();
         testPermuteArguments();
         testDropArguments();
         testFilterArguments();
@@ -99,7 +103,8 @@
 
 {}
 
-    @Test public void testFindVirtual() throws Throwable {
+    @Test public void testMisc() throws Throwable {
+// Extra tests, not from javadoc:
 {}
 MethodHandle CONCAT_3 = LOOKUP.findVirtual(String.class,
   "concat", methodType(String.class, String.class));
@@ -114,6 +119,92 @@
 {}
     }
 
+    @Test public void testFindStatic() throws Throwable {
+{}
+MethodHandle MH_asList = publicLookup().findStatic(Arrays.class,
+  "asList", methodType(List.class, Object[].class));
+assertEquals("[x, y]", MH_asList.invoke("x", "y").toString());
+{}
+    }
+
+    @Test public void testFindVirtual() throws Throwable {
+{}
+MethodHandle MH_concat = publicLookup().findVirtual(String.class,
+  "concat", methodType(String.class, String.class));
+MethodHandle MH_hashCode = publicLookup().findVirtual(Object.class,
+  "hashCode", methodType(int.class));
+MethodHandle MH_hashCode_String = publicLookup().findVirtual(String.class,
+  "hashCode", methodType(int.class));
+assertEquals("xy", (String) MH_concat.invokeExact("x", "y"));
+assertEquals("xy".hashCode(), (int) MH_hashCode.invokeExact((Object)"xy"));
+assertEquals("xy".hashCode(), (int) MH_hashCode_String.invokeExact("xy"));
+// interface method:
+MethodHandle MH_subSequence = publicLookup().findVirtual(CharSequence.class,
+  "subSequence", methodType(CharSequence.class, int.class, int.class));
+assertEquals("def", MH_subSequence.invoke("abcdefghi", 3, 6).toString());
+// constructor "internal method" must be accessed differently:
+MethodType MT_newString = methodType(void.class); //()V for new String()
+try { assertEquals("impossible", lookup()
+        .findVirtual(String.class, "<init>", MT_newString));
+ } catch (NoSuchMethodException ex) { } // OK
+MethodHandle MH_newString = publicLookup()
+  .findConstructor(String.class, MT_newString);
+assertEquals("", (String) MH_newString.invokeExact());
+{}
+    }
+
+    @Test public void testFindConstructor() throws Throwable {
+{}
+MethodHandle MH_newArrayList = publicLookup().findConstructor(
+  ArrayList.class, methodType(void.class, Collection.class));
+Collection orig = Arrays.asList("x", "y");
+Collection copy = (ArrayList) MH_newArrayList.invokeExact(orig);
+assert(orig != copy);
+assertEquals(orig, copy);
+// a variable-arity constructor:
+MethodHandle MH_newProcessBuilder = publicLookup().findConstructor(
+  ProcessBuilder.class, methodType(void.class, String[].class));
+ProcessBuilder pb = (ProcessBuilder)
+  MH_newProcessBuilder.invoke("x", "y", "z");
+assertEquals("[x, y, z]", pb.command().toString());
+{}
+    }
+
+// for testFindSpecial
+{}
+static class Listie extends ArrayList {
+  public String toString() { return "[wee Listie]"; }
+  static Lookup lookup() { return MethodHandles.lookup(); }
+}
+{}
+
+    @Test public void testFindSpecial() throws Throwable {
+{}
+// no access to constructor via invokeSpecial:
+MethodHandle MH_newListie = Listie.lookup()
+  .findConstructor(Listie.class, methodType(void.class));
+Listie l = (Listie) MH_newListie.invokeExact();
+try { assertEquals("impossible", Listie.lookup().findSpecial(
+        Listie.class, "<init>", methodType(void.class), Listie.class));
+ } catch (NoSuchMethodException ex) { } // OK
+// access to super and self methods via invokeSpecial:
+MethodHandle MH_super = Listie.lookup().findSpecial(
+  ArrayList.class, "toString" , methodType(String.class), Listie.class);
+MethodHandle MH_this = Listie.lookup().findSpecial(
+  Listie.class, "toString" , methodType(String.class), Listie.class);
+MethodHandle MH_duper = Listie.lookup().findSpecial(
+  Object.class, "toString" , methodType(String.class), Listie.class);
+assertEquals("[]", (String) MH_super.invokeExact(l));
+assertEquals(""+l, (String) MH_this.invokeExact(l));
+assertEquals("[]", (String) MH_duper.invokeExact(l)); // ArrayList method
+try { assertEquals("inaccessible", Listie.lookup().findSpecial(
+        String.class, "toString", methodType(String.class), Listie.class));
+ } catch (IllegalAccessException ex) { } // OK
+Listie subl = new Listie() { public String toString() { return "[subclass]"; } };
+assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method
+{}
+    }
+
     @Test public void testPermuteArguments() throws Throwable {
         {{
 {} /// JAVADOC
@@ -190,6 +281,28 @@
             }}
     }
 
+    @Test public void testCollectArguments() throws Throwable {
+        {{
+{} /// JAVADOC
+MethodHandle deepToString = publicLookup()
+  .findStatic(Arrays.class, "deepToString", methodType(String.class, Object[].class));
+MethodHandle ts1 = deepToString.asCollector(String[].class, 1);
+assertEquals("[strange]", (String) ts1.invokeExact("strange"));
+MethodHandle ts2 = deepToString.asCollector(String[].class, 2);
+assertEquals("[up, down]", (String) ts2.invokeExact("up", "down"));
+MethodHandle ts3 = deepToString.asCollector(String[].class, 3);
+MethodHandle ts3_ts2 = collectArguments(ts3, 1, ts2);
+assertEquals("[top, [up, down], strange]",
+             (String) ts3_ts2.invokeExact("top", "up", "down", "strange"));
+MethodHandle ts3_ts2_ts1 = collectArguments(ts3_ts2, 3, ts1);
+assertEquals("[top, [up, down], [strange]]",
+             (String) ts3_ts2_ts1.invokeExact("top", "up", "down", "strange"));
+MethodHandle ts3_ts2_ts3 = collectArguments(ts3_ts2, 1, ts3);
+assertEquals("[top, [[up, down, strange], charm], bottom]",
+             (String) ts3_ts2_ts3.invokeExact("top", "up", "down", "strange", "charm", "bottom"));
+            }}
+    }
+
     @Test public void testFoldArguments() throws Throwable {
         {{
 {} /// JAVADOC
@@ -264,6 +377,12 @@
 MethodHandle eq2 = equals.asSpreader(Object[].class, 2);
 assert( (boolean) eq2.invokeExact(new Object[]{ "me", "me" }));
 assert(!(boolean) eq2.invokeExact(new Object[]{ "me", "thee" }));
+// try to spread from anything but a 2-array:
+for (int n = 0; n <= 10; n++) {
+  Object[] badArityArgs = (n == 2 ? null : new Object[n]);
+  try { assert((boolean) eq2.invokeExact(badArityArgs) && false); }
+  catch (IllegalArgumentException ex) { } // OK
+}
 // spread both arguments from a String array:
 MethodHandle eq2s = equals.asSpreader(String[].class, 2);
 assert( (boolean) eq2s.invokeExact(new String[]{ "me", "me" }));
--- a/jdk/test/java/lang/invoke/MethodHandlesTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -140,7 +140,7 @@
         Object actual   = calledLog.get(calledLog.size() - 1);
         if (expected.equals(actual) && verbosity < 9)  return;
         System.out.println("assertCalled "+name+":");
-        System.out.println("expected:   "+expected);
+        System.out.println("expected:   "+deepToString(expected));
         System.out.println("actual:     "+actual);
         System.out.println("ex. types:  "+getClasses(expected));
         System.out.println("act. types: "+getClasses(actual));
@@ -148,7 +148,25 @@
     }
     static void printCalled(MethodHandle target, String name, Object... args) {
         if (verbosity >= 3)
-            System.out.println("calling MH="+target+" to "+name+Arrays.toString(args));
+            System.out.println("calling MH="+target+" to "+name+deepToString(args));
+    }
+    static String deepToString(Object x) {
+        if (x == null)  return "null";
+        if (x instanceof Collection)
+            x = ((Collection)x).toArray();
+        if (x instanceof Object[]) {
+            Object[] ax = (Object[]) x;
+            ax = Arrays.copyOf(ax, ax.length, Object[].class);
+            for (int i = 0; i < ax.length; i++)
+                ax[i] = deepToString(ax[i]);
+            x = Arrays.deepToString(ax);
+        }
+        if (x.getClass().isArray())
+            try {
+                x = Arrays.class.getMethod("toString", x.getClass()).invoke(null, x);
+            } catch (ReflectiveOperationException ex) { throw new Error(ex); }
+        assert(!(x instanceof Object[]));
+        return x.toString();
     }
 
     static Object castToWrapper(Object value, Class<?> dst) {
@@ -230,6 +248,12 @@
                     { param = c; break; }
             }
         }
+        if (param.isArray()) {
+            Class<?> ctype = param.getComponentType();
+            Object arg = Array.newInstance(ctype, 2);
+            Array.set(arg, 0, randomArg(ctype));
+            return arg;
+        }
         if (param.isInterface() && param.isAssignableFrom(List.class))
             return Arrays.asList("#"+nextArg());
         if (param.isInterface() || param.isAssignableFrom(String.class))
@@ -253,6 +277,9 @@
             args[i] = randomArg(param);
         return args;
     }
+    static Object[] randomArgs(List<Class<?>> params) {
+        return randomArgs(params.toArray(new Class<?>[params.size()]));
+    }
 
     @SafeVarargs @SuppressWarnings("varargs")
     static <T, E extends T> T[] array(Class<T[]> atype, E... a) {
@@ -323,6 +350,11 @@
         }
         return list.asType(listType);
     }
+    /** Variation of varargsList, but with the given ptypes and rtype. */
+    static MethodHandle varargsList(List<Class<?>> ptypes, Class<?> rtype) {
+        MethodHandle list = varargsList(ptypes.size(), rtype);
+        return list.asType(MethodType.methodType(rtype, ptypes));
+    }
     private static MethodHandle LIST_TO_STRING, LIST_TO_INT;
     private static String listToString(List<?> x) { return x.toString(); }
     private static int listToInt(List<?> x) { return x.toString().hashCode(); }
@@ -363,6 +395,7 @@
         protected Example(String name) { this.name = name; }
         @SuppressWarnings("LeakingThisInConstructor")
         protected Example(int x) { this(); called("protected <init>", this, x); }
+        //Example(Void x) { does not exist; lookup elicts NoSuchMethodException }
         @Override public String toString() { return name; }
 
         public void            v0()     { called("v0", this); }
@@ -463,6 +496,9 @@
         return lookup.in(defc);
     }
 
+    /** Is findVirtual (etc.) of "&lt;init&lt;" supposed to elicit a NoSuchMethodException? */
+    final static boolean INIT_REF_CAUSES_NSME = true;
+
     @Test
     public void testFindStatic() throws Throwable {
         if (CAN_SKIP_WORKING)  return;
@@ -483,6 +519,8 @@
         testFindStatic(Example.class, Object.class, "s7", float.class, double.class);
 
         testFindStatic(false, PRIVATE, Example.class, void.class, "bogus");
+        testFindStatic(false, PRIVATE, Example.class, void.class, "<init>", int.class);
+        testFindStatic(false, PRIVATE, Example.class, void.class, "<init>", Void.class);
         testFindStatic(false, PRIVATE, Example.class, void.class, "v0");
     }
 
@@ -505,11 +543,12 @@
             target = maybeMoveIn(lookup, defc).findStatic(defc, methodName, type);
         } catch (ReflectiveOperationException ex) {
             noAccess = ex;
+            assertExceptionClass(
+                (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>"))
+                ?   NoSuchMethodException.class
+                :   IllegalAccessException.class,
+                noAccess);
             if (verbosity >= 5)  ex.printStackTrace(System.out);
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
         }
         if (verbosity >= 3)
             System.out.println("findStatic "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target
@@ -527,6 +566,13 @@
             System.out.print(':');
     }
 
+    static void assertExceptionClass(Class<? extends Throwable> expected,
+                                     Throwable actual) {
+        if (expected.isInstance(actual))  return;
+        actual.printStackTrace();
+        assertEquals(expected, actual.getClass());
+    }
+
     static final boolean DEBUG_METHOD_HANDLE_NAMES = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
 
     // rough check of name string
@@ -556,6 +602,8 @@
         testFindVirtual(PubExample.class, void.class, "Pub/pro_v0");
 
         testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "bogus");
+        testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "<init>", int.class);
+        testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "<init>", Void.class);
         testFindVirtual(false, PRIVATE, Example.class, Example.class, void.class, "s0");
 
         // test dispatch
@@ -568,6 +616,16 @@
         testFindVirtual(IntExample.Impl.class, IntExample.class, void.class, "Int/v0");
     }
 
+    @Test
+    public void testFindVirtualClone() throws Throwable {
+        // test some ad hoc system methods
+        testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone");
+        testFindVirtual(true, PUBLIC, Object[].class, Object.class, "clone");
+        testFindVirtual(true, PUBLIC, int[].class, Object.class, "clone");
+        for (Class<?> cls : new Class<?>[]{ boolean[].class, long[].class, float[].class, char[].class })
+            testFindVirtual(true, PUBLIC, cls, Object.class, "clone");
+    }
+
     void testFindVirtual(Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
         Class<?> rcvc = defc;
         testFindVirtual(rcvc, defc, ret, name, params);
@@ -580,6 +638,9 @@
     void testFindVirtual(Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
         testFindVirtual(true, lookup, rcvc, defc, ret, name, params);
     }
+    void testFindVirtual(boolean positive, Lookup lookup, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
+        testFindVirtual(positive, lookup, defc, defc, ret, name, params);
+    }
     void testFindVirtual(boolean positive, Lookup lookup, Class<?> rcvc, Class<?> defc, Class<?> ret, String name, Class<?>... params) throws Throwable {
         countTest(positive);
         String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
@@ -591,11 +652,12 @@
             target = maybeMoveIn(lookup, defc).findVirtual(defc, methodName, type);
         } catch (ReflectiveOperationException ex) {
             noAccess = ex;
+            assertExceptionClass(
+                (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>"))
+                ?   NoSuchMethodException.class
+                :   IllegalAccessException.class,
+                noAccess);
             if (verbosity >= 5)  ex.printStackTrace(System.out);
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
         }
         if (verbosity >= 3)
             System.out.println("findVirtual "+lookup+": "+defc.getName()+"."+name+"/"+type+" => "+target
@@ -618,8 +680,21 @@
         Object[] argsWithSelf = randomArgs(paramsWithSelf);
         if (selfc.isAssignableFrom(rcvc) && rcvc != selfc)  argsWithSelf[0] = randomArg(rcvc);
         printCalled(target, name, argsWithSelf);
-        target.invokeWithArguments(argsWithSelf);
-        assertCalled(name, argsWithSelf);
+        Object res = target.invokeWithArguments(argsWithSelf);
+        if (Example.class.isAssignableFrom(defc) || IntExample.class.isAssignableFrom(defc)) {
+            assertCalled(name, argsWithSelf);
+        } else if (name.equals("clone")) {
+            // Ad hoc method call outside Example.  For Object[].clone.
+            printCalled(target, name, argsWithSelf);
+            assertEquals(MethodType.methodType(Object.class, rcvc), target.type());
+            Object orig = argsWithSelf[0];
+            assertEquals(orig.getClass(), res.getClass());
+            if (res instanceof Object[])
+                assertArrayEquals((Object[])res, (Object[])argsWithSelf[0]);
+            assert(Arrays.deepEquals(new Object[]{res}, new Object[]{argsWithSelf[0]}));
+        } else {
+            assert(false) : Arrays.asList(positive, lookup, rcvc, defc, ret, name, deepToString(params));
+        }
         if (verbosity >= 1)
             System.out.print(':');
     }
@@ -632,11 +707,11 @@
         testFindSpecial(SubExample.class, Example.class, void.class, "pkg_v0");
         testFindSpecial(RemoteExample.class, PubExample.class, void.class, "Pub/pro_v0");
         // Do some negative testing:
-        testFindSpecial(false, EXAMPLE, SubExample.class, Example.class, void.class, "bogus");
-        testFindSpecial(false, PRIVATE, SubExample.class, Example.class, void.class, "bogus");
         for (Lookup lookup : new Lookup[]{ PRIVATE, EXAMPLE, PACKAGE, PUBLIC }) {
             testFindSpecial(false, lookup, Object.class, Example.class, void.class, "v0");
+            testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "bogus");
             testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", int.class);
+            testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "<init>", Void.class);
             testFindSpecial(false, lookup, SubExample.class, Example.class, void.class, "s0");
         }
     }
@@ -662,19 +737,25 @@
         countTest(positive);
         String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
         MethodType type = MethodType.methodType(ret, params);
+        Lookup specialLookup = maybeMoveIn(lookup, specialCaller);
+        boolean specialAccessOK = (specialLookup.lookupClass() == specialCaller &&
+                                   (specialLookup.lookupModes() & Lookup.PRIVATE) != 0);
         MethodHandle target = null;
         Exception noAccess = null;
         try {
             if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
-            if (verbosity >= 5)  System.out.println("  lookup => "+maybeMoveIn(lookup, specialCaller));
-            target = maybeMoveIn(lookup, specialCaller).findSpecial(defc, methodName, type, specialCaller);
+            if (verbosity >= 5)  System.out.println("  lookup => "+specialLookup);
+            target = specialLookup.findSpecial(defc, methodName, type, specialCaller);
         } catch (ReflectiveOperationException ex) {
             noAccess = ex;
+            assertExceptionClass(
+                (!specialAccessOK)  // this check should happen first
+                ?   IllegalAccessException.class
+                : (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>"))
+                ?   NoSuchMethodException.class
+                : IllegalAccessException.class,
+                noAccess);
             if (verbosity >= 5)  ex.printStackTrace(System.out);
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
         }
         if (verbosity >= 3)
             System.out.println("findSpecial from "+specialCaller.getName()+" to "+defc.getName()+"."+name+"/"+type+" => "+target
@@ -719,7 +800,7 @@
             target = lookup.findConstructor(defc, type);
         } catch (ReflectiveOperationException ex) {
             noAccess = ex;
-            assertTrue(noAccess instanceof IllegalAccessException);
+            assertTrue(noAccess.getClass().getName(), noAccess instanceof IllegalAccessException);
         }
         if (verbosity >= 3)
             System.out.println("findConstructor "+defc.getName()+".<init>/"+type+" => "+target
@@ -750,6 +831,8 @@
         testBind(Example.class, Object.class, "v2", int.class, Object.class);
         testBind(Example.class, Object.class, "v2", int.class, int.class);
         testBind(false, PRIVATE, Example.class, void.class, "bogus");
+        testBind(false, PRIVATE, Example.class, void.class, "<init>", int.class);
+        testBind(false, PRIVATE, Example.class, void.class, "<init>", Void.class);
         testBind(SubExample.class, void.class, "Sub/v0");
         testBind(SubExample.class, void.class, "Sub/pkg_v0");
         testBind(IntExample.Impl.class, void.class, "Int/v0");
@@ -773,11 +856,12 @@
             target = maybeMoveIn(lookup, defc).bind(receiver, methodName, type);
         } catch (ReflectiveOperationException ex) {
             noAccess = ex;
+            assertExceptionClass(
+                (name.contains("bogus") || INIT_REF_CAUSES_NSME && name.contains("<init>"))
+                ?   NoSuchMethodException.class
+                :   IllegalAccessException.class,
+                noAccess);
             if (verbosity >= 5)  ex.printStackTrace(System.out);
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
         }
         if (verbosity >= 3)
             System.out.println("bind "+receiver+"."+name+"/"+type+" => "+target
@@ -840,6 +924,10 @@
         countTest(positive);
         String methodName = name.substring(1 + name.indexOf('/'));  // foo/bar => foo
         MethodType type = MethodType.methodType(ret, params);
+        Lookup specialLookup = (specialCaller != null ? maybeMoveIn(lookup, specialCaller) : null);
+        boolean specialAccessOK = (specialCaller != null &&
+                                   specialLookup.lookupClass() == specialCaller &&
+                                   (specialLookup.lookupModes() & Lookup.PRIVATE) != 0);
         Method rmethod = defc.getDeclaredMethod(methodName, params);
         MethodHandle target = null;
         Exception noAccess = null;
@@ -848,16 +936,15 @@
         try {
             if (verbosity >= 4)  System.out.println("lookup via "+lookup+" of "+defc+" "+name+type);
             if (isSpecial)
-                target = maybeMoveIn(lookup, specialCaller).unreflectSpecial(rmethod, specialCaller);
+                target = specialLookup.unreflectSpecial(rmethod, specialCaller);
             else
                 target = maybeMoveIn(lookup, defc).unreflect(rmethod);
         } catch (ReflectiveOperationException ex) {
             noAccess = ex;
+            assertExceptionClass(
+                IllegalAccessException.class,  // NSME is impossible, since it was already reflected
+                noAccess);
             if (verbosity >= 5)  ex.printStackTrace(System.out);
-            if (name.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchMethodException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
         }
         if (verbosity >= 3)
             System.out.println("unreflect"+(isSpecial?"Special":"")+" "+defc.getName()+"."+name+"/"+type
@@ -1091,11 +1178,12 @@
         } catch (ReflectiveOperationException ex) {
             mh = null;
             noAccess = ex;
+            assertExceptionClass(
+                (fname.contains("bogus"))
+                ?   NoSuchFieldException.class
+                :   IllegalAccessException.class,
+                noAccess);
             if (verbosity >= 5)  ex.printStackTrace(System.out);
-            if (fname.contains("bogus"))
-                assertTrue(noAccess instanceof NoSuchFieldException);
-            else
-                assertTrue(noAccess instanceof IllegalAccessException);
         }
         if (verbosity >= 3)
             System.out.println("find"+(isStatic?"Static":"")+(isGetter?"Getter":"Setter")+" "+fclass.getName()+"."+fname+"/"+ftype
@@ -1753,24 +1841,24 @@
     }
 
     @Test  // SLOW
-    public void testCollectArguments() throws Throwable {
+    public void testAsCollector() throws Throwable {
         if (CAN_SKIP_WORKING)  return;
-        startTest("collectArguments");
+        startTest("asCollector");
         for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) {
             if (verbosity >= 3)
-                System.out.println("collectArguments "+argType);
+                System.out.println("asCollector "+argType);
             for (int nargs = 0; nargs < 50; nargs++) {
                 if (CAN_TEST_LIGHTLY && nargs > 11)  break;
                 for (int pos = 0; pos <= nargs; pos++) {
                     if (CAN_TEST_LIGHTLY && pos > 2 && pos < nargs-2)  continue;
                     if (nargs > 10 && pos > 4 && pos < nargs-4 && pos % 10 != 3)
                         continue;
-                    testCollectArguments(argType, pos, nargs);
+                    testAsCollector(argType, pos, nargs);
                 }
             }
         }
     }
-    public void testCollectArguments(Class<?> argType, int pos, int nargs) throws Throwable {
+    public void testAsCollector(Class<?> argType, int pos, int nargs) throws Throwable {
         countTest();
         // fake up a MH with the same type as the desired adapter:
         MethodHandle fake = varargsArray(nargs);
@@ -1917,37 +2005,108 @@
     }
 
     @Test
+    public void testCollectArguments() throws Throwable {
+        if (CAN_SKIP_WORKING)  return;
+        startTest("collectArguments");
+        testFoldOrCollectArguments(true);
+    }
+
+    @Test
     public void testFoldArguments() throws Throwable {
         if (CAN_SKIP_WORKING)  return;
         startTest("foldArguments");
-        for (int nargs = 0; nargs <= 4; nargs++) {
-            for (int fold = 0; fold <= nargs; fold++) {
-                for (int pos = 0; pos <= nargs; pos++) {
-                    testFoldArguments(nargs, pos, fold);
+        testFoldOrCollectArguments(false);
+    }
+
+    void testFoldOrCollectArguments(boolean isCollect) throws Throwable {
+        for (Class<?> lastType : new Class<?>[]{ Object.class, String.class, int.class }) {
+            for (Class<?> collectType : new Class<?>[]{ Object.class, String.class, int.class, void.class }) {
+                int maxArity = 10;
+                if (collectType != String.class)  maxArity = 5;
+                if (lastType != Object.class)  maxArity = 4;
+                for (int nargs = 0; nargs <= maxArity; nargs++) {
+                    ArrayList<Class<?>> argTypes = new ArrayList<>(Collections.nCopies(nargs, Object.class));
+                    int maxMix = 20;
+                    if (collectType != Object.class)  maxMix = 0;
+                    Map<Object,Integer> argTypesSeen = new HashMap<>();
+                    for (int mix = 0; mix <= maxMix; mix++) {
+                        if (!mixArgs(argTypes, mix, argTypesSeen))  continue;
+                        for (int collect = 0; collect <= nargs; collect++) {
+                            for (int pos = 0; pos <= nargs - collect; pos++) {
+                                testFoldOrCollectArguments(argTypes, pos, collect, collectType, lastType, isCollect);
+                            }
+                        }
+                    }
                 }
             }
         }
     }
 
-    void testFoldArguments(int nargs, int pos, int fold) throws Throwable {
-        if (pos != 0)  return;  // can fold only at pos=0 for now
+    boolean mixArgs(List<Class<?>> argTypes, int mix, Map<Object,Integer> argTypesSeen) {
+        assert(mix >= 0);
+        if (mix == 0)  return true;  // no change
+        if ((mix >>> argTypes.size()) != 0)  return false;
+        for (int i = 0; i < argTypes.size(); i++) {
+            if (i >= 31)  break;
+            boolean bit = (mix & (1 << i)) != 0;
+            if (bit) {
+                Class<?> type = argTypes.get(i);
+                if (type == Object.class)
+                    type = String.class;
+                else if (type == String.class)
+                    type = int.class;
+                else
+                    type = Object.class;
+                argTypes.set(i, type);
+            }
+        }
+        Integer prev = argTypesSeen.put(new ArrayList<>(argTypes), mix);
+        if (prev != null) {
+            if (verbosity >= 4)  System.out.println("mix "+prev+" repeated "+mix+": "+argTypes);
+            return false;
+        }
+        if (verbosity >= 3)  System.out.println("mix "+mix+" = "+argTypes);
+        return true;
+    }
+
+    void testFoldOrCollectArguments(List<Class<?>> argTypes,  // argument types minus the inserted combineType
+                                    int pos, int fold, // position and length of the folded arguments
+                                    Class<?> combineType, // type returned from the combiner
+                                    Class<?> lastType,  // type returned from the target
+                                    boolean isCollect) throws Throwable {
+        int nargs = argTypes.size();
+        if (pos != 0 && !isCollect)  return;  // can fold only at pos=0 for now
         countTest();
-        MethodHandle target = varargsList(1 + nargs);
-        MethodHandle combine = varargsList(fold).asType(MethodType.genericMethodType(fold));
-        List<Object> argsToPass = Arrays.asList(randomArgs(nargs, Object.class));
+        List<Class<?>> combineArgTypes = argTypes.subList(pos, pos + fold);
+        List<Class<?>> targetArgTypes = new ArrayList<>(argTypes);
+        if (isCollect)  // does targret see arg[pos..pos+cc-1]?
+            targetArgTypes.subList(pos, pos + fold).clear();
+        if (combineType != void.class)
+            targetArgTypes.add(pos, combineType);
+        MethodHandle target = varargsList(targetArgTypes, lastType);
+        MethodHandle combine = varargsList(combineArgTypes, combineType);
+        List<Object> argsToPass = Arrays.asList(randomArgs(argTypes));
         if (verbosity >= 3)
-            System.out.println("fold "+target+" with "+combine);
-        MethodHandle target2 = MethodHandles.foldArguments(target, combine);
+            System.out.println((isCollect ? "collect" : "fold")+" "+target+" with "+combine);
+        MethodHandle target2;
+        if (isCollect)
+            target2 = MethodHandles.collectArguments(target, pos, combine);
+        else
+            target2 = MethodHandles.foldArguments(target, combine);
         // Simulate expected effect of combiner on arglist:
-        List<Object> expected = new ArrayList<>(argsToPass);
-        List<Object> argsToFold = expected.subList(pos, pos + fold);
+        List<Object> expectedList = new ArrayList<>(argsToPass);
+        List<Object> argsToFold = expectedList.subList(pos, pos + fold);
         if (verbosity >= 3)
-            System.out.println("fold: "+argsToFold+" into "+target2);
+            System.out.println((isCollect ? "collect" : "fold")+": "+argsToFold+" into "+target2);
         Object foldedArgs = combine.invokeWithArguments(argsToFold);
-        argsToFold.add(0, foldedArgs);
+        if (isCollect)
+            argsToFold.clear();
+        if (combineType != void.class)
+            argsToFold.add(0, foldedArgs);
         Object result = target2.invokeWithArguments(argsToPass);
         if (verbosity >= 3)
             System.out.println("result: "+result);
+        Object expected = target.invokeWithArguments(expectedList);
         if (!expected.equals(result))
             System.out.println("*** fail at n/p/f = "+nargs+"/"+pos+"/"+fold+": "+argsToPass+" => "+result+" != "+expected);
         assertEquals(expected, result);
--- a/jdk/test/java/lang/invoke/RevealDirectTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/lang/invoke/RevealDirectTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -104,6 +104,9 @@
         private static Lookup localLookup() { return lookup(); }
         private static List<Member> members() { return getMembers(lookup().lookupClass()); };
     }
+    static class Nestmate {
+        private static Lookup localLookup() { return lookup(); }
+    }
 
     static boolean VERBOSE = false;
 
@@ -152,7 +155,10 @@
                                   getMembers(Method.class, "invoke"));
         mems = callerSensitive(true, publicOnly(mems));
         // CS methods cannot be looked up with publicLookup
-        testOnMembersNoLookup("testCallerSensitiveNegative", mems, publicLookup());
+        testOnMembersNoLookup("testCallerSensitiveNegative/1", mems, publicLookup());
+        // CS methods have to be revealed with a matching lookupClass
+        testOnMembersNoReveal("testCallerSensitiveNegative/2", mems, Simple.localLookup(), publicLookup());
+        testOnMembersNoReveal("testCallerSensitiveNegative/3", mems, Simple.localLookup(), Nestmate.localLookup());
     }
     @Test public void testMethodHandleNatives() throws Throwable {
         if (VERBOSE)  System.out.println("@Test testMethodHandleNatives");
@@ -703,7 +709,7 @@
             try {
                 info = revLookup.revealDirect(mh);
                 if (expectEx2)  throw new AssertionError("unexpected revelation for negative test");
-            } catch (Throwable ex2) {
+            } catch (IllegalArgumentException|SecurityException ex2) {
                 if (VERBOSE)  System.out.println("  "+variation+": "+res+" => "+mh.getClass().getName()+" => (EX2)"+ex2);
                 if (expectEx2)
                     continue;  // this is OK; we expected the reflect to fail
--- a/jdk/test/java/lang/invoke/TestPrivateMember.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/lang/invoke/TestPrivateMember.java	Fri Oct 11 09:17:18 2013 -0400
@@ -47,7 +47,10 @@
         MethodHandles.Lookup lookup = MethodHandles.lookup();
         MethodType mt = MethodType.methodType(void.class);
         try {
-            MethodHandle mh = lookup.findStatic(Class.class, "checkInitted", mt);
+            Class<?> checkInittedHolder = TestPrivateMemberPackageSibling.class;
+            // Original model:  checkInittedHolder = Class.class;
+            // Not using Class.checkInitted because it could change without notice.
+            MethodHandle mh = lookup.findStatic(checkInittedHolder, "checkInitted", mt);
             throw new RuntimeException("IllegalAccessException not thrown");
         } catch (IllegalAccessException e) {
             // okay
@@ -55,3 +58,7 @@
         }
     }
 }
+
+class TestPrivateMemberPackageSibling {
+    private static void checkInitted() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8023524
+ * @summary tests logging generated classes for lambda
+ * @library /java/nio/file
+ * @run testng LogGeneratedClassesTest
+ */
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFileAttributeView;
+import java.util.stream.Stream;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.testng.SkipException;
+
+import static java.nio.file.attribute.PosixFilePermissions.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+public class LogGeneratedClassesTest extends LUtils {
+    String longFQCN;
+
+    @BeforeClass
+    public void setup() throws IOException {
+        final List<String> scratch = new ArrayList<>();
+        scratch.clear();
+        scratch.add("package com.example;");
+        scratch.add("public class TestLambda {");
+        scratch.add("    interface I {");
+        scratch.add("        int foo();");
+        scratch.add("    }");
+        scratch.add("    public static void main(String[] args) {");
+        scratch.add("        I lam = () -> 10;");
+        scratch.add("        Runnable r = () -> {");
+        scratch.add("            System.out.println(\"Runnable\");");
+        scratch.add("        };");
+        scratch.add("        r.run();");
+        scratch.add("        System.out.println(\"Finish\");");
+        scratch.add("    }");
+        scratch.add("}");
+
+        File test = new File("TestLambda.java");
+        createFile(test, scratch);
+        compile("-d", ".", test.getName());
+
+        scratch.remove(0);
+        scratch.remove(0);
+        scratch.add(0, "public class LongPackageName {");
+        StringBuilder sb = new StringBuilder("com.example.");
+        // longer than 255 which exceed max length of most filesystems
+        for (int i = 0; i < 30; i++) {
+            sb.append("nonsense.");
+        }
+        sb.append("enough");
+        longFQCN = sb.toString() + ".LongPackageName";
+        sb.append(";");
+        sb.insert(0, "package ");
+        scratch.add(0, sb.toString());
+        test = new File("LongPackageName.java");
+        createFile(test, scratch);
+        compile("-d", ".", test.getName());
+
+        // create target
+        Files.createDirectory(Paths.get("dump"));
+        Files.createDirectories(Paths.get("dumpLong/com/example/nonsense"));
+        Files.createFile(Paths.get("dumpLong/com/example/nonsense/nonsense"));
+        Files.createFile(Paths.get("file"));
+    }
+
+    @AfterClass
+    public void cleanup() throws IOException {
+        Files.delete(Paths.get("TestLambda.java"));
+        Files.delete(Paths.get("LongPackageName.java"));
+        Files.delete(Paths.get("file"));
+        TestUtil.removeAll(Paths.get("com"));
+        TestUtil.removeAll(Paths.get("dump"));
+        TestUtil.removeAll(Paths.get("dumpLong"));
+    }
+
+    @Test
+    public void testNotLogging() {
+        TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
+                               "-cp", ".",
+                               "-Djava.security.manager",
+                               "com.example.TestLambda");
+        tr.assertZero("Should still return 0");
+    }
+
+    @Test
+    public void testLogging() throws IOException {
+        assertTrue(Files.exists(Paths.get("dump")));
+        TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
+                               "-cp", ".",
+                               "-Djdk.internal.lambda.dumpProxyClasses=dump",
+                               "-Djava.security.manager",
+                               "com.example.TestLambda");
+        // dump/com/example + 2 class files
+        assertEquals(Files.walk(Paths.get("dump")).count(), 5, "Two lambda captured");
+        tr.assertZero("Should still return 0");
+    }
+
+    @Test
+    public void testDumpDirNotExist() throws IOException {
+        assertFalse(Files.exists(Paths.get("notExist")));
+        TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
+                               "-cp", ".",
+                               "-Djdk.internal.lambda.dumpProxyClasses=notExist",
+                               "-Djava.security.manager",
+                               "com.example.TestLambda");
+        assertEquals(tr.testOutput.stream()
+                                  .filter(s -> s.startsWith("WARNING"))
+                                  .peek(s -> assertTrue(s.contains("does not exist")))
+                                  .count(),
+                     1, "only show error once");
+        tr.assertZero("Should still return 0");
+    }
+
+    @Test
+    public void testDumpDirIsFile() throws IOException {
+        assertTrue(Files.isRegularFile(Paths.get("file")));
+        TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
+                               "-cp", ".",
+                               "-Djdk.internal.lambda.dumpProxyClasses=file",
+                               "-Djava.security.manager",
+                               "com.example.TestLambda");
+        assertEquals(tr.testOutput.stream()
+                                  .filter(s -> s.startsWith("WARNING"))
+                                  .peek(s -> assertTrue(s.contains("not a directory")))
+                                  .count(),
+                     1, "only show error once");
+        tr.assertZero("Should still return 0");
+    }
+
+    @Test
+    public void testDumpDirNotWritable() throws IOException {
+        if (! Files.getFileStore(Paths.get("."))
+                   .supportsFileAttributeView(PosixFileAttributeView.class)) {
+            // No easy way to setup readonly directory
+            throw new SkipException("Posix not supported");
+        }
+
+        Files.createDirectory(Paths.get("readOnly"),
+                              asFileAttribute(fromString("r-xr-xr-x")));
+
+        TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
+                               "-cp", ".",
+                               "-Djdk.internal.lambda.dumpProxyClasses=readOnly",
+                               "-Djava.security.manager",
+                               "com.example.TestLambda");
+        assertEquals(tr.testOutput.stream()
+                                  .filter(s -> s.startsWith("WARNING"))
+                                  .peek(s -> assertTrue(s.contains("not writable")))
+                                  .count(),
+                     1, "only show error once");
+        tr.assertZero("Should still return 0");
+
+        TestUtil.removeAll(Paths.get("readOnly"));
+    }
+
+    @Test
+    public void testLoggingException() throws IOException {
+        assertTrue(Files.exists(Paths.get("dumpLong")));
+        TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
+                               "-cp", ".",
+                               "-Djdk.internal.lambda.dumpProxyClasses=dumpLong",
+                               "-Djava.security.manager",
+                               longFQCN);
+        assertEquals(tr.testOutput.stream()
+                                  .filter(s -> s.startsWith("WARNING: Exception"))
+                                  .count(),
+                     2, "show error each capture");
+        // dumpLong/com/example/nosense/nosense
+        assertEquals(Files.walk(Paths.get("dumpLong")).count(), 5, "Two lambda captured failed to log");
+        tr.assertZero("Should still return 0");
+    }
+}
--- a/jdk/test/java/lang/reflect/Array/ExceedMaxDim.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/lang/reflect/Array/ExceedMaxDim.java	Fri Oct 11 09:17:18 2013 -0400
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4100814
+ * @bug 4100814 7044282
  * @summary Make sure you can't create an array of dimension > 256.
  */
 
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Makefile	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Makefile	Fri Oct 11 09:17:18 2013 -0400
@@ -21,33 +21,14 @@
 ifeq ($(uname), SunOS)
   PLATFORM = solaris
   ISAINFO = isainfo
-  ifndef ARCH_DATA_MODEL
-    ARCH_DATA_MODEL=32
-  endif
-  ifeq ($(ARCH_DATA_MODEL), 32)
-    archExpr = case "`$(UNAME) -p`" in  \
-		i386) \
-		    $(ECHO) i586 \
-		    ;; \
-		sparc*)	 \
-		    $(ECHO) sparc \
-		    ;; \
-		*) \
-		    $(UNAME) -p	 \
-		    ;; \
-	     esac
-    ARCH		:= $(shell $(archExpr) )
-  else
-    ARCH := $(shell $(ISAINFO) -n)
-  endif
+  ARCH_DATA_MODEL=64
+  ARCH := $(shell $(ISAINFO) -n)
   CC = cc
   LD = ld
   CFLAGS = -D_REENTRANT -D__solaris__
   LDFLAGS_COMMON = -G
   EXTRA_LIBS = -lc
-  ifeq ($(ARCH_DATA_MODEL), 64)
-      CC += -xarch=v9
-  endif
+  CC += -m64 -Kpic
 endif
 
 ifeq ($(uname), Linux)
Binary file jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/lib/solaris-amd64/libLauncher.so has changed
Binary file jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/lib/solaris-i586/libLauncher.so has changed
Binary file jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/lib/solaris-sparc/libLauncher.so has changed
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh	Fri Oct 11 09:17:18 2013 -0400
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
 # questions.
 #
 
-
 # @test
 # @bug 4673940
 # @bug 4930794
@@ -39,7 +38,6 @@
     exit 0
 fi
 
-
 # if TESTJAVA isn't set then we assume an interactive run. So that it's
 # clear which version of 'java' is running we do a 'which java' and
 # a 'java -version'.
@@ -64,24 +62,17 @@
 
 
 # Check that we have libLauncher.so for the right platform.
-# On Solaris we assume 64-bit if java -d64 works.
+# On Solaris we assume 64-bit
 
 DFLAG=
 if [ "$os" = "SunOS" ]; then
     PLATFORM=solaris
     case "`uname -p`" in
 	i[3-9]86) 
-	    ARCH=i586
+	    ARCH=amd64
 	    ;;
 	sparc)
-	    ARCH=sparc
-	    ${JAVA} -d64 -version > /dev/null 2<&1 
-	    if [ $? = 1 ]; then
-	        ARCH=sparc
-	    else
-		ARCH=sparcv9
-		DFLAG=-d64
-	    fi
+	    ARCH=sparcv9
 	    ;;
     esac 
 fi
--- a/jdk/test/java/nio/file/Files/BytesAndLines.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/nio/file/Files/BytesAndLines.java	Fri Oct 11 09:17:18 2013 -0400
@@ -22,7 +22,9 @@
  */
 
 /* @test
- * @bug 7006126 8020669
+ * @bug 7006126 8020669 8024788
+ * @build BytesAndLines PassThroughFileSystem
+ * @run main BytesAndLines
  * @summary Unit test for methods for Files readAllBytes, readAllLines and
  *     and write methods.
  */
@@ -92,6 +94,16 @@
             byte[] data = Files.readAllBytes(pathStat);
             assertTrue(data.length > 0, "Files.readAllBytes('" + statFile + "') failed to read");
         }
+
+        // test readAllBytes on custom file system
+        Path myfile = PassThroughFileSystem.create().getPath(file.toString());
+        for (int size=0; size<=1024; size+=512) {
+            byte[] b1 = new byte[size];
+            rand.nextBytes(b1);
+            Files.write(myfile, b1);
+            byte[] b2 = Files.readAllBytes(myfile);
+            assertTrue(Arrays.equals(b1, b2), "bytes not equal");
+        }
     }
 
 
--- a/jdk/test/java/time/tck/java/time/AbstractTCKTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/AbstractTCKTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -68,6 +68,8 @@
 import java.io.ObjectStreamConstants;
 import java.io.Serializable;
 import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Formatter;
 
 /**
  * Base test class.
@@ -131,10 +133,10 @@
             assertEquals(dis.readByte(), ObjectStreamConstants.TC_NULL);  // no superclasses
             if (expectedBytes.length < 256) {
                 assertEquals(dis.readByte(), ObjectStreamConstants.TC_BLOCKDATA);
-                assertEquals(dis.readUnsignedByte(), expectedBytes.length);
+                assertEquals(dis.readUnsignedByte(), expectedBytes.length, "blockdata length incorrect");
             } else {
                 assertEquals(dis.readByte(), ObjectStreamConstants.TC_BLOCKDATALONG);
-                assertEquals(dis.readInt(), expectedBytes.length);
+                assertEquals(dis.readInt(), expectedBytes.length, "blockdatalong length incorrect");
             }
             byte[] input = new byte[expectedBytes.length];
             dis.readFully(input);
@@ -162,4 +164,33 @@
         }
     }
 
+
+    /**
+     * Utility method to dump a byte array in a java syntax.
+     * @param bytes and array of bytes
+     * @return a string containing the bytes formatted in java syntax
+     */
+    protected static String dumpSerialStream(byte[] bytes) {
+        StringBuilder sb = new StringBuilder(bytes.length * 5);
+        Formatter fmt = new Formatter(sb);
+        fmt.format("    byte[] bytes = {" );
+        final int linelen = 10;
+        for (int i = 0; i < bytes.length; i++) {
+            if (i % linelen == 0) {
+                fmt.format("%n        ");
+            }
+            fmt.format(" %3d,", bytes[i] & 0xff);
+            if ((i % linelen) == (linelen-1) || i == bytes.length - 1) {
+                fmt.format("  /*");
+                int s = i / linelen * linelen;
+                int k = i % linelen;
+                for (int j = 0; j <= k && s + j < bytes.length; j++) {
+                    fmt.format(" %c", bytes[s + j] & 0xff);
+                }
+                fmt.format(" */");
+            }
+        }
+        fmt.format("%n    };%n");
+        return sb.toString();
+    }
 }
--- a/jdk/test/java/time/tck/java/time/TCKClock_Fixed.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKClock_Fixed.java	Fri Oct 11 09:17:18 2013 -0400
@@ -80,12 +80,6 @@
     private static final ZoneId PARIS = ZoneId.of("Europe/Paris");
     private static final Instant INSTANT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneOffset.ofHours(2)).toInstant();
 
-    //-----------------------------------------------------------------------
-    public void test_isSerializable() throws IOException, ClassNotFoundException {
-        assertSerializable(Clock.fixed(INSTANT, ZoneOffset.UTC));
-        assertSerializable(Clock.fixed(INSTANT, PARIS));
-    }
-
     //-------------------------------------------------------------------------
     public void test_fixed_InstantZoneId() {
         Clock test = Clock.fixed(INSTANT, PARIS);
--- a/jdk/test/java/time/tck/java/time/TCKClock_Offset.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKClock_Offset.java	Fri Oct 11 09:17:18 2013 -0400
@@ -62,7 +62,6 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertSame;
 
-import java.io.IOException;
 import java.time.Clock;
 import java.time.Duration;
 import java.time.Instant;
@@ -84,11 +83,6 @@
     private static final Duration OFFSET = Duration.ofSeconds(2);
 
     //-----------------------------------------------------------------------
-    public void test_isSerializable() throws IOException, ClassNotFoundException {
-        assertSerializable(Clock.offset(Clock.system(PARIS), OFFSET));
-    }
-
-    //-----------------------------------------------------------------------
     public void test_offset_ClockDuration() {
         Clock test = Clock.offset(Clock.fixed(INSTANT, PARIS), OFFSET);
         //System.out.println(test.instant());
--- a/jdk/test/java/time/tck/java/time/TCKClock_System.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKClock_System.java	Fri Oct 11 09:17:18 2013 -0400
@@ -62,7 +62,6 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 
-import java.io.IOException;
 import java.time.Clock;
 import java.time.Instant;
 import java.time.ZoneId;
@@ -80,13 +79,6 @@
     private static final ZoneId PARIS = ZoneId.of("Europe/Paris");
 
     //-----------------------------------------------------------------------
-    public void test_isSerializable() throws IOException, ClassNotFoundException {
-        assertSerializable(Clock.systemUTC());
-        assertSerializable(Clock.systemDefaultZone());
-        assertSerializable(Clock.system(PARIS));
-    }
-
-    //-----------------------------------------------------------------------
     public void test_instant() {
         Clock system = Clock.systemUTC();
         assertEquals(system.getZone(), ZoneOffset.UTC);
--- a/jdk/test/java/time/tck/java/time/TCKClock_Tick.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKClock_Tick.java	Fri Oct 11 09:17:18 2013 -0400
@@ -62,7 +62,6 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertSame;
 
-import java.io.IOException;
 import java.time.Clock;
 import java.time.Duration;
 import java.time.Instant;
@@ -81,16 +80,7 @@
 
     private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow");
     private static final ZoneId PARIS = ZoneId.of("Europe/Paris");
-    private static final Duration AMOUNT = Duration.ofSeconds(2);
     private static final ZonedDateTime ZDT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneOffset.ofHours(2));
-    private static final Instant INSTANT = ZDT.toInstant();
-
-    //-----------------------------------------------------------------------
-    public void test_isSerializable() throws IOException, ClassNotFoundException {
-        assertSerializable(Clock.tickSeconds(PARIS));
-        assertSerializable(Clock.tickMinutes(MOSCOW));
-        assertSerializable(Clock.tick(Clock.fixed(INSTANT, PARIS), AMOUNT));
-    }
 
     //-----------------------------------------------------------------------
     public void test_tick_ClockDuration_250millis() {
--- a/jdk/test/java/time/tck/java/time/TCKDuration.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKDuration.java	Fri Oct 11 09:17:18 2013 -0400
@@ -77,6 +77,7 @@
 import java.time.DateTimeException;
 import java.time.Duration;
 import java.time.Instant;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.Period;
@@ -104,26 +105,6 @@
     private static final long CYCLE_SECS = 146097L * 86400L;
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(Duration.ofHours(5));
-        assertSerializable(Duration.ofHours(0));
-        assertSerializable(Duration.ofHours(-5));
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(1);
-            dos.writeLong(654321);
-            dos.writeInt(123456789);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(Duration.ofSeconds(654321, 123456789), bytes);
-    }
-
-    //-----------------------------------------------------------------------
     // constants
     //-----------------------------------------------------------------------
     @Test
@@ -863,10 +844,17 @@
         assertEquals(Duration.between(end, start), Duration.between(start, end).negated());
     }
 
-    @Test(expectedExceptions=DateTimeException.class)
+    @Test
     public void factory_between_TemporalTemporal_mixedTypes() {
         Instant start = Instant.ofEpochSecond(1);
         ZonedDateTime end = Instant.ofEpochSecond(4).atZone(ZoneOffset.UTC);
+        assertEquals(Duration.between(start, end), Duration.ofSeconds(3));
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void factory_between_TemporalTemporal_invalidMixedTypes() {
+        Instant start = Instant.ofEpochSecond(1);
+        LocalDate end = LocalDate.of(2010, 6, 20);
         Duration.between(start, end);
     }
 
--- a/jdk/test/java/time/tck/java/time/TCKInstant.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKInstant.java	Fri Oct 11 09:17:18 2013 -0400
@@ -84,6 +84,7 @@
 import java.time.Duration;
 import java.time.Instant;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.OffsetDateTime;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
@@ -155,24 +156,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(Instant.ofEpochMilli(134l));
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(2);
-            dos.writeLong(654321);
-            dos.writeInt(123456789);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(Instant.ofEpochSecond(654321, 123456789), bytes);
-    }
-
-    //-----------------------------------------------------------------------
     private void check(Instant instant, long epochSecs, int nos) {
         assertEquals(instant.getEpochSecond(), epochSecs);
         assertEquals(instant.getNano(), nos);
@@ -1818,7 +1801,7 @@
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) {
         Instant i1 = Instant.ofEpochSecond(seconds1, nanos1);
         Instant i2 = Instant.ofEpochSecond(seconds2, nanos2);
         long amount = i1.until(i2, unit);
@@ -1826,25 +1809,46 @@
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit_negated(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit_negated(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) {
         Instant i1 = Instant.ofEpochSecond(seconds1, nanos1);
         Instant i2 = Instant.ofEpochSecond(seconds2, nanos2);
         long amount = i2.until(i1, unit);
         assertEquals(amount, -expected);
     }
 
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_between(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) {
+        Instant i1 = Instant.ofEpochSecond(seconds1, nanos1);
+        Instant i2 = Instant.ofEpochSecond(seconds2, nanos2);
+        long amount = unit.between(i1, i2);
+        assertEquals(amount, expected);
+    }
+
+    @Test
+    public void test_until_convertedType() {
+        Instant start = Instant.ofEpochSecond(12, 3000);
+        OffsetDateTime end = start.plusSeconds(2).atOffset(ZoneOffset.ofHours(2));
+        assertEquals(start.until(end, SECONDS), 2);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidType() {
+        Instant start = Instant.ofEpochSecond(12, 3000);
+        start.until(LocalTime.of(11, 30), SECONDS);
+    }
+
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
-    public void test_periodUntil_TemporalUnit_unsupportedUnit() {
+    public void test_until_TemporalUnit_unsupportedUnit() {
         TEST_12345_123456789.until(TEST_12345_123456789, MONTHS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullEnd() {
+    public void test_until_TemporalUnit_nullEnd() {
         TEST_12345_123456789.until(null, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullUnit() {
+    public void test_until_TemporalUnit_nullUnit() {
         TEST_12345_123456789.until(TEST_12345_123456789, null);
     }
 
--- a/jdk/test/java/time/tck/java/time/TCKLocalDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKLocalDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -196,28 +196,6 @@
         return list;
     }
 
-
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(TEST_2007_07_15);
-        assertSerializable(LocalDate.MIN);
-        assertSerializable(LocalDate.MAX);
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(3);
-            dos.writeInt(2012);
-            dos.writeByte(9);
-            dos.writeByte(16);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(LocalDate.of(2012, 9, 16), bytes);
-    }
-
     //-----------------------------------------------------------------------
     private void check(LocalDate test, int y, int m, int d) {
         assertEquals(test.getYear(), y);
@@ -1745,29 +1723,48 @@
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) {
         long amount = date1.until(date2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit_negated(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit_negated(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) {
         long amount = date2.until(date1, unit);
         assertEquals(amount, -expected);
     }
 
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_between(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) {
+        long amount = unit.between(date1, date2);
+        assertEquals(amount, expected);
+    }
+
+    @Test
+    public void test_until_convertedType() {
+        LocalDate start = LocalDate.of(2010, 6, 30);
+        OffsetDateTime end = start.plusDays(2).atStartOfDay().atOffset(OFFSET_PONE);
+        assertEquals(start.until(end, DAYS), 2);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidType() {
+        LocalDate start = LocalDate.of(2010, 6, 30);
+        start.until(LocalTime.of(11, 30), DAYS);
+    }
+
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
-    public void test_periodUntil_TemporalUnit_unsupportedUnit() {
+    public void test_until_TemporalUnit_unsupportedUnit() {
         TEST_2007_07_15.until(TEST_2007_07_15, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullEnd() {
+    public void test_until_TemporalUnit_nullEnd() {
         TEST_2007_07_15.until(null, DAYS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullUnit() {
+    public void test_until_TemporalUnit_nullUnit() {
         TEST_2007_07_15.until(TEST_2007_07_15, null);
     }
 
--- a/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -242,31 +242,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(TEST_2007_07_15_12_30_40_987654321);
-        assertSerializable(LocalDateTime.MIN);
-        assertSerializable(LocalDateTime.MAX);
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(5);
-            dos.writeInt(2012);
-            dos.writeByte(9);
-            dos.writeByte(16);
-            dos.writeByte(22);
-            dos.writeByte(17);
-            dos.writeByte(59);
-            dos.writeInt(459_000_000);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(LocalDateTime.of(2012, 9, 16, 22, 17, 59, 459_000_000), bytes);
-    }
-
-    //-----------------------------------------------------------------------
     // constants
     //-----------------------------------------------------------------------
     @Test
@@ -2920,24 +2895,43 @@
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) {
         long amount = dt1.until(dt2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit_negated(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit_negated(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) {
         long amount = dt2.until(dt1, unit);
         assertEquals(amount, -expected);
     }
 
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_between(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) {
+        long amount = unit.between(dt1, dt2);
+        assertEquals(amount, expected);
+    }
+
+    @Test
+    public void test_until_convertedType() {
+        LocalDateTime start = LocalDateTime.of(2010, 6, 30, 2, 30);
+        OffsetDateTime end = start.plusDays(2).atOffset(OFFSET_PONE);
+        assertEquals(start.until(end, DAYS), 2);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidType() {
+        LocalDateTime start = LocalDateTime.of(2010, 6, 30, 2, 30);
+        start.until(LocalTime.of(11, 30), DAYS);
+    }
+
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullEnd() {
+    public void test_until_TemporalUnit_nullEnd() {
         TEST_2007_07_15_12_30_40_987654321.until(null, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullUnit() {
+    public void test_until_TemporalUnit_nullUnit() {
         TEST_2007_07_15_12_30_40_987654321.until(TEST_2007_07_15_12_30_40_987654321, null);
     }
 
--- a/jdk/test/java/time/tck/java/time/TCKLocalTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKLocalTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -191,64 +191,7 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(TEST_12_30_40_987654321);
-        assertSerializable(LocalTime.MIN);
-        assertSerializable(LocalTime.MAX);
-    }
 
-    @Test
-    public void test_serialization_format_h() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(4);
-            dos.writeByte(-1 - 22);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(LocalTime.of(22, 0), bytes);
-    }
-
-    @Test
-    public void test_serialization_format_hm() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(4);
-            dos.writeByte(22);
-            dos.writeByte(-1 - 17);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(LocalTime.of(22, 17), bytes);
-    }
-
-    @Test
-    public void test_serialization_format_hms() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(4);
-            dos.writeByte(22);
-            dos.writeByte(17);
-            dos.writeByte(-1 - 59);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(LocalTime.of(22, 17, 59), bytes);
-    }
-
-    @Test
-    public void test_serialization_format_hmsn() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(4);
-            dos.writeByte(22);
-            dos.writeByte(17);
-            dos.writeByte(59);
-            dos.writeInt(459_000_000);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(LocalTime.of(22, 17, 59, 459_000_000), bytes);
-    }
-
-    //-----------------------------------------------------------------------
     private void check(LocalTime test, int h, int m, int s, int n) {
         assertEquals(test.getHour(), h);
         assertEquals(test.getMinute(), m);
@@ -2028,29 +1971,48 @@
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) {
         long amount = time1.until(time2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit_negated(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit_negated(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) {
         long amount = time2.until(time1, unit);
         assertEquals(amount, -expected);
     }
 
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_between(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) {
+        long amount = unit.between(time1, time2);
+        assertEquals(amount, expected);
+    }
+
+    @Test
+    public void test_until_convertedType() {
+        LocalTime start = LocalTime.of(11, 30);
+        LocalDateTime end = start.plusSeconds(2).atDate(LocalDate.of(2010, 6, 30));
+        assertEquals(start.until(end, SECONDS), 2);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidType() {
+        LocalTime start = LocalTime.of(11, 30);
+        start.until(LocalDate.of(2010, 6, 30), SECONDS);
+    }
+
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
-    public void test_periodUntil_TemporalUnit_unsupportedUnit() {
+    public void test_until_TemporalUnit_unsupportedUnit() {
         TEST_12_30_40_987654321.until(TEST_12_30_40_987654321, DAYS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullEnd() {
+    public void test_until_TemporalUnit_nullEnd() {
         TEST_12_30_40_987654321.until(null, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullUnit() {
+    public void test_until_TemporalUnit_nullUnit() {
         TEST_12_30_40_987654321.until(TEST_12_30_40_987654321, null);
     }
 
--- a/jdk/test/java/time/tck/java/time/TCKMonthDay.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKMonthDay.java	Fri Oct 11 09:17:18 2013 -0400
@@ -137,24 +137,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws ClassNotFoundException, IOException {
-        assertSerializable(TEST_07_15);
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(13);       // java.time.temporal.Ser.MONTH_DAY_TYPE
-            dos.writeByte(9);
-            dos.writeByte(16);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(MonthDay.of(9, 16), bytes);
-    }
-
-    //-----------------------------------------------------------------------
     void check(MonthDay test, int m, int d) {
         assertEquals(test.getMonth().getValue(), m);
         assertEquals(test.getDayOfMonth(), d);
--- a/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -91,6 +91,13 @@
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
 import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.FOREVER;
+import static java.time.temporal.ChronoUnit.HALF_DAYS;
+import static java.time.temporal.ChronoUnit.HOURS;
+import static java.time.temporal.ChronoUnit.MICROS;
+import static java.time.temporal.ChronoUnit.MILLIS;
+import static java.time.temporal.ChronoUnit.MINUTES;
+import static java.time.temporal.ChronoUnit.MONTHS;
 import static java.time.temporal.ChronoUnit.NANOS;
 import static java.time.temporal.ChronoUnit.SECONDS;
 import static org.testng.Assert.assertEquals;
@@ -210,43 +217,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(TEST_2008_6_30_11_30_59_000000500);
-        assertSerializable(OffsetDateTime.MIN);
-        assertSerializable(OffsetDateTime.MAX);
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(10);       // java.time.Ser.OFFSET_DATE_TIME_TYPE
-        }
-        byte[] bytes = baos.toByteArray();
-        ByteArrayOutputStream baosDateTime = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baosDateTime) ) {
-            dos.writeByte(5);
-            dos.writeInt(2012);
-            dos.writeByte(9);
-            dos.writeByte(16);
-            dos.writeByte(22);
-            dos.writeByte(17);
-            dos.writeByte(59);
-            dos.writeInt(464_000_000);
-        }
-        byte[] bytesDateTime = baosDateTime.toByteArray();
-        ByteArrayOutputStream baosOffset = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baosOffset) ) {
-            dos.writeByte(8);
-            dos.writeByte(4);  // quarter hours stored: 3600 / 900
-        }
-        byte[] bytesOffset = baosOffset.toByteArray();
-        LocalDateTime ldt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 464_000_000);
-        assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes, bytesDateTime, bytesOffset);
-    }
-
-    //-----------------------------------------------------------------------
     // constants
     //-----------------------------------------------------------------------
     @Test
@@ -1166,6 +1136,74 @@
     }
 
     //-----------------------------------------------------------------------
+    // until(Temporal, TemporalUnit)
+    //-----------------------------------------------------------------------
+    @DataProvider(name="periodUntilUnit")
+    Object[][] data_untilUnit() {
+        return new Object[][] {
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 13, 1, 1, 0, OFFSET_PONE), HALF_DAYS, 1},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), HOURS, 1},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), MINUTES, 60},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), SECONDS, 3600},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), MILLIS, 3600*1000},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), MICROS, 3600*1000*1000L},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE), NANOS, 3600*1000*1000L*1000},
+
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 14, 1, 1, 0, OFFSET_PTWO), HALF_DAYS, 1},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), HOURS, 1},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), MINUTES, 60},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), SECONDS, 3600},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), MILLIS, 3600*1000},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), MICROS, 3600*1000*1000L},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 6, 30, 3, 1, 1, 0, OFFSET_PTWO), NANOS, 3600*1000*1000L*1000},
+
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 7, 1, 1, 1, 0, 999999999, OFFSET_PONE), DAYS, 0},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 7, 1, 1, 1, 1, 0, OFFSET_PONE), DAYS, 1},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 8, 29, 1, 1, 1, 0, OFFSET_PONE), MONTHS, 1},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 8, 30, 1, 1, 1, 0, OFFSET_PONE), MONTHS, 2},
+                {OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE), OffsetDateTime.of(2010, 8, 31, 1, 1, 1, 0, OFFSET_PONE), MONTHS, 2},
+        };
+    }
+
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit(OffsetDateTime odt1, OffsetDateTime odt2, TemporalUnit unit, long expected) {
+        long amount = odt1.until(odt2, unit);
+        assertEquals(amount, expected);
+    }
+
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_negated(OffsetDateTime odt1, OffsetDateTime odt2, TemporalUnit unit, long expected) {
+        long amount = odt2.until(odt1, unit);
+        assertEquals(amount, -expected);
+    }
+
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_between(OffsetDateTime odt1, OffsetDateTime odt2, TemporalUnit unit, long expected) {
+        long amount = unit.between(odt1, odt2);
+        assertEquals(amount, expected);
+    }
+
+    @Test
+    public void test_until_convertedType() {
+        OffsetDateTime odt = OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE);
+        ZonedDateTime zdt = odt.plusSeconds(3).toZonedDateTime();
+        assertEquals(odt.until(zdt, SECONDS), 3);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidType() {
+        OffsetDateTime odt = OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE);
+        odt.until(Instant.ofEpochSecond(12), SECONDS);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidTemporalUnit() {
+        OffsetDateTime odt1 = OffsetDateTime.of(2010, 6, 30, 1, 1, 1, 0, OFFSET_PONE);
+        OffsetDateTime odt2 = OffsetDateTime.of(2010, 6, 30, 2, 1, 1, 0, OFFSET_PONE);
+        odt1.until(odt2, FOREVER);
+    }
+
+    //-----------------------------------------------------------------------
     // format(DateTimeFormatter)
     //-----------------------------------------------------------------------
     @Test
--- a/jdk/test/java/time/tck/java/time/TCKOffsetTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKOffsetTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -184,40 +184,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(TEST_11_30_59_500_PONE);
-        assertSerializable(OffsetTime.MIN);
-        assertSerializable(OffsetTime.MAX);
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(9);       // java.time.Ser.OFFSET_TIME_TYPE
-        }
-        byte[] bytes = baos.toByteArray();
-        ByteArrayOutputStream baosTime = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baosTime) ) {
-            dos.writeByte(4);
-            dos.writeByte(22);
-            dos.writeByte(17);
-            dos.writeByte(59);
-            dos.writeInt(464_000_000);
-        }
-        byte[] bytesTime = baosTime.toByteArray();
-        ByteArrayOutputStream baosOffset = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baosOffset) ) {
-            dos.writeByte(8);
-            dos.writeByte(4);  // quarter hours stored: 3600 / 900
-        }
-        byte[] bytesOffset = baosOffset.toByteArray();
-        assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes,
-                bytesTime, bytesOffset);
-    }
-
-    //-----------------------------------------------------------------------
     // constants
     //-----------------------------------------------------------------------
     @Test
@@ -1103,49 +1069,61 @@
     // until(Temporal, TemporalUnit)
     //-----------------------------------------------------------------------
     @DataProvider(name="periodUntilUnit")
-    Object[][] data_periodUntilUnit() {
+    Object[][] data_untilUnit() {
         return new Object[][] {
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(13, 1, 1), ZoneOffset.ofHours(1)), HALF_DAYS, 1},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), HOURS, 1},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), MINUTES, 60},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), SECONDS, 3600},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), MILLIS, 3600*1000},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), MICROS, 3600*1000*1000L},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1)), NANOS, 3600*1000*1000L*1000},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(13, 1, 1, 0, OFFSET_PONE), HALF_DAYS, 1},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), HOURS, 1},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), MINUTES, 60},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), SECONDS, 3600},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), MILLIS, 3600*1000},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), MICROS, 3600*1000*1000L},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(2, 1, 1, 0, OFFSET_PONE), NANOS, 3600*1000*1000L*1000},
 
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(14, 1, 1), ZoneOffset.ofHours(2)), HALF_DAYS, 1},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), HOURS, 1},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), MINUTES, 60},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), SECONDS, 3600},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), MILLIS, 3600*1000},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), MICROS, 3600*1000*1000L},
-            {OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1)), OffsetTime.of(LocalTime.of(3, 1, 1), ZoneOffset.ofHours(2)), NANOS, 3600*1000*1000L*1000},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(14, 1, 1, 0, OFFSET_PTWO), HALF_DAYS, 1},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), HOURS, 1},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), MINUTES, 60},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), SECONDS, 3600},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), MILLIS, 3600*1000},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), MICROS, 3600*1000*1000L},
+                {OffsetTime.of(1, 1, 1, 0, OFFSET_PONE), OffsetTime.of(3, 1, 1, 0, OFFSET_PTWO), NANOS, 3600*1000*1000L*1000},
         };
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) {
         long amount = offsetTime1.until(offsetTime2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit_negated(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit_negated(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) {
         long amount = offsetTime2.until(offsetTime1, unit);
         assertEquals(amount, -expected);
     }
 
-    @Test(expectedExceptions=DateTimeException.class)
-    public void test_periodUntil_InvalidType() {
-        OffsetTime offsetTime = OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1));
-        OffsetDateTime offsetDateTime = offsetTime.atDate(LocalDate.of(1980, 2, 10));
-        offsetTime.until(offsetDateTime, SECONDS);
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_between(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) {
+        long amount = unit.between(offsetTime1, offsetTime2);
+        assertEquals(amount, expected);
+    }
+
+    @Test
+    public void test_until_convertedType() {
+        OffsetTime offsetTime = OffsetTime.of(1, 1, 1, 0, OFFSET_PONE);
+        OffsetDateTime offsetDateTime = offsetTime.plusSeconds(3).atDate(LocalDate.of(1980, 2, 10));
+        assertEquals(offsetTime.until(offsetDateTime, SECONDS), 3);
     }
 
     @Test(expectedExceptions=DateTimeException.class)
-    public void test_periodUntil_InvalidTemporalUnit() {
-        OffsetTime offsetTime1 = OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1));
-        OffsetTime offsetTime2 = OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1));
+    public void test_until_invalidType() {
+        OffsetTime offsetTime = OffsetTime.of(1, 1, 1, 0, OFFSET_PONE);
+        offsetTime.until(LocalDate.of(1980, 2, 10), SECONDS);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidTemporalUnit() {
+        OffsetTime offsetTime1 = OffsetTime.of(1, 1, 1, 0, OFFSET_PONE);
+        OffsetTime offsetTime2 = OffsetTime.of(2, 1, 1, 0, OFFSET_PONE);
         offsetTime1.until(offsetTime2, MONTHS);
     }
 
--- a/jdk/test/java/time/tck/java/time/TCKPeriod.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKPeriod.java	Fri Oct 11 09:17:18 2013 -0400
@@ -60,6 +60,7 @@
 package tck.java.time;
 
 import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.HOURS;
 import static java.time.temporal.ChronoUnit.YEARS;
 import static org.testng.Assert.assertEquals;
 
@@ -67,6 +68,7 @@
 import java.time.Duration;
 import java.time.LocalDate;
 import java.time.Period;
+import java.time.chrono.ThaiBuddhistChronology;
 import java.time.format.DateTimeParseException;
 import java.time.temporal.ChronoUnit;
 import java.time.temporal.Temporal;
@@ -87,14 +89,6 @@
 public class TCKPeriod extends AbstractTCKTest {
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(Period.ZERO);
-        assertSerializable(Period.ofDays(1));
-        assertSerializable(Period.of(1, 2, 3));
-    }
-
-    //-----------------------------------------------------------------------
     // ofYears(int)
     //-----------------------------------------------------------------------
     @Test
@@ -221,6 +215,41 @@
     }
 
     @Test(expectedExceptions = DateTimeException.class)
+    public void factory_from_TemporalAmount_DaysHours() {
+        TemporalAmount amount = new TemporalAmount() {
+            @Override
+            public long get(TemporalUnit unit) {
+                if (unit == DAYS) {
+                    return 1;
+                } else {
+                    return 2;
+                }
+            }
+            @Override
+            public List<TemporalUnit> getUnits() {
+                List<TemporalUnit> list = new ArrayList<>();
+                list.add(DAYS);
+                list.add(HOURS);
+                return list;
+            }
+            @Override
+            public Temporal addTo(Temporal temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public Temporal subtractFrom(Temporal temporal) {
+                throw new UnsupportedOperationException();
+            }
+        };
+        Period.from(amount);
+    }
+
+    @Test(expectedExceptions = DateTimeException.class)
+    public void factory_from_TemporalAmount_NonISO() {
+        Period.from(ThaiBuddhistChronology.INSTANCE.period(1, 1, 1));
+    }
+
+    @Test(expectedExceptions = DateTimeException.class)
     public void factory_from_TemporalAmount_Duration() {
         Period.from(Duration.ZERO);
     }
@@ -602,10 +631,45 @@
     }
 
     @Test(dataProvider="plus")
-    public void test_plus(Period base, Period add, Period expected) {
+    public void test_plus_TemporalAmount(Period base, Period add, Period expected) {
         assertEquals(base.plus(add), expected);
     }
 
+    @Test(expectedExceptions = DateTimeException.class)
+    public void test_plus_TemporalAmount_nonISO() {
+        pymd(4, 5, 6).plus(ThaiBuddhistChronology.INSTANCE.period(1, 0, 0));
+    }
+
+    @Test(expectedExceptions = DateTimeException.class)
+    public void test_plus_TemporalAmount_DaysHours() {
+        TemporalAmount amount = new TemporalAmount() {
+            @Override
+            public long get(TemporalUnit unit) {
+                if (unit == DAYS) {
+                    return 1;
+                } else {
+                    return 2;
+                }
+            }
+            @Override
+            public List<TemporalUnit> getUnits() {
+                List<TemporalUnit> list = new ArrayList<>();
+                list.add(DAYS);
+                list.add(HOURS);
+                return list;
+            }
+            @Override
+            public Temporal addTo(Temporal temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public Temporal subtractFrom(Temporal temporal) {
+                throw new UnsupportedOperationException();
+            }
+        };
+        pymd(4, 5, 6).plus(amount);
+    }
+
     //-----------------------------------------------------------------------
     // plusYears()
     //-----------------------------------------------------------------------
@@ -712,10 +776,45 @@
     }
 
     @Test(dataProvider="minus")
-    public void test_minus(Period base, Period subtract, Period expected) {
+    public void test_minus_TemporalAmount(Period base, Period subtract, Period expected) {
         assertEquals(base.minus(subtract), expected);
     }
 
+    @Test(expectedExceptions = DateTimeException.class)
+    public void test_minus_TemporalAmount_nonISO() {
+        pymd(4, 5, 6).minus(ThaiBuddhistChronology.INSTANCE.period(1, 0, 0));
+    }
+
+    @Test(expectedExceptions = DateTimeException.class)
+    public void test_minus_TemporalAmount_DaysHours() {
+        TemporalAmount amount = new TemporalAmount() {
+            @Override
+            public long get(TemporalUnit unit) {
+                if (unit == DAYS) {
+                    return 1;
+                } else {
+                    return 2;
+                }
+            }
+            @Override
+            public List<TemporalUnit> getUnits() {
+                List<TemporalUnit> list = new ArrayList<>();
+                list.add(DAYS);
+                list.add(HOURS);
+                return list;
+            }
+            @Override
+            public Temporal addTo(Temporal temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public Temporal subtractFrom(Temporal temporal) {
+                throw new UnsupportedOperationException();
+            }
+        };
+        pymd(4, 5, 6).minus(amount);
+    }
+
     //-----------------------------------------------------------------------
     // minusYears()
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKYear.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKYear.java	Fri Oct 11 09:17:18 2013 -0400
@@ -65,10 +65,8 @@
 import static java.time.temporal.ChronoUnit.CENTURIES;
 import static java.time.temporal.ChronoUnit.DAYS;
 import static java.time.temporal.ChronoUnit.DECADES;
-import static java.time.temporal.ChronoUnit.HOURS;
 import static java.time.temporal.ChronoUnit.MILLENNIA;
 import static java.time.temporal.ChronoUnit.MONTHS;
-import static java.time.temporal.ChronoUnit.WEEKS;
 import static java.time.temporal.ChronoUnit.YEARS;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
@@ -90,8 +88,8 @@
 import java.time.YearMonth;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
+import java.time.chrono.IsoChronology;
 import java.time.chrono.IsoEra;
-import java.time.chrono.IsoChronology;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeParseException;
 import java.time.temporal.ChronoField;
@@ -152,25 +150,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(Year.of(2));
-        assertSerializable(Year.of(0));
-        assertSerializable(Year.of(-2));
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(11);       // java.time.temporal.Ser.YEAR_TYPE
-            dos.writeInt(2012);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(Year.of(2012), bytes);
-    }
-
-    //-----------------------------------------------------------------------
     // now()
     //-----------------------------------------------------------------------
     @Test
@@ -248,17 +227,17 @@
 
     //-----------------------------------------------------------------------
     @Test
-    public void test_factory_CalendricalObject() {
+    public void test_from_TemporalAccessor() {
         assertEquals(Year.from(LocalDate.of(2007, 7, 15)), Year.of(2007));
     }
 
     @Test(expectedExceptions=DateTimeException.class)
-    public void test_factory_CalendricalObject_invalid_noDerive() {
+    public void test_from_TemporalAccessor_invalid_noDerive() {
         Year.from(LocalTime.of(12, 30));
     }
 
     @Test(expectedExceptions=NullPointerException.class)
-    public void test_factory_CalendricalObject_null() {
+    public void test_from_TemporalAccessor_null() {
         Year.from((TemporalAccessor) null);
     }
 
@@ -616,13 +595,13 @@
         };
     }
 
-    @Test(groups={"tck"}, dataProvider="plus_long_TemporalUnit")
+    @Test(dataProvider="plus_long_TemporalUnit")
     public void test_plus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class expectedEx) {
         if (expectedEx == null) {
             assertEquals(base.plus(amount, unit), expectedYear);
         } else {
             try {
-                Year result = base.plus(amount, unit);
+                base.plus(amount, unit);
                 fail();
             } catch (Exception ex) {
                 assertTrue(expectedEx.isInstance(ex));
@@ -748,7 +727,7 @@
         };
     }
 
-    @Test(groups={"tck"}, dataProvider="minus_long_TemporalUnit")
+    @Test(dataProvider="minus_long_TemporalUnit")
     public void test_minus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class expectedEx) {
         if (expectedEx == null) {
             assertEquals(base.minus(amount, unit), expectedYear);
@@ -807,7 +786,7 @@
     //-----------------------------------------------------------------------
     // with(TemporalField, long)
     //-----------------------------------------------------------------------
-    @Test(groups={"tck"})
+    @Test
     public void test_with() {
         Year base = Year.of(5);
         Year result = base.with(ChronoField.ERA, 0);
@@ -942,29 +921,48 @@
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit(Year year1, Year year2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit(Year year1, Year year2, TemporalUnit unit, long expected) {
         long amount = year1.until(year2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit_negated(Year year1, Year year2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit_negated(Year year1, Year year2, TemporalUnit unit, long expected) {
         long amount = year2.until(year1, unit);
         assertEquals(amount, -expected);
     }
 
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_between(Year year1, Year year2, TemporalUnit unit, long expected) {
+        long amount = unit.between(year1, year2);
+        assertEquals(amount, expected);
+    }
+
+    @Test
+    public void test_until_convertedType() {
+        Year start = Year.of(2010);
+        YearMonth end = start.plusYears(2).atMonth(Month.APRIL);
+        assertEquals(start.until(end, YEARS), 2);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidType() {
+        Year start = Year.of(2010);
+        start.until(LocalTime.of(11, 30), YEARS);
+    }
+
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
-    public void test_periodUntil_TemporalUnit_unsupportedUnit() {
+    public void test_until_TemporalUnit_unsupportedUnit() {
         TEST_2008.until(TEST_2008, MONTHS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullEnd() {
+    public void test_until_TemporalUnit_nullEnd() {
         TEST_2008.until(null, DAYS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullUnit() {
+    public void test_until_TemporalUnit_nullUnit() {
         TEST_2008.until(TEST_2008, null);
     }
 
--- a/jdk/test/java/time/tck/java/time/TCKYearMonth.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKYearMonth.java	Fri Oct 11 09:17:18 2013 -0400
@@ -70,7 +70,6 @@
 import static java.time.temporal.ChronoUnit.HOURS;
 import static java.time.temporal.ChronoUnit.MILLENNIA;
 import static java.time.temporal.ChronoUnit.MONTHS;
-import static java.time.temporal.ChronoUnit.WEEKS;
 import static java.time.temporal.ChronoUnit.YEARS;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
@@ -157,24 +156,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws IOException, ClassNotFoundException {
-        assertSerializable(TEST_2008_06);
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(12);       // java.time.temporal.Ser.YEAR_MONTH_TYPE
-            dos.writeInt(2012);
-            dos.writeByte(9);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(YearMonth.of(2012, 9), bytes);
-    }
-
-    //-----------------------------------------------------------------------
     void check(YearMonth test, int y, int m) {
         assertEquals(test.getYear(), y);
         assertEquals(test.getMonth().getValue(), m);
@@ -288,17 +269,17 @@
 
     //-----------------------------------------------------------------------
     @Test
-    public void test_factory_CalendricalObject() {
+    public void test_from_TemporalAccessor() {
         assertEquals(YearMonth.from(LocalDate.of(2007, 7, 15)), YearMonth.of(2007, 7));
     }
 
     @Test(expectedExceptions=DateTimeException.class)
-    public void test_factory_CalendricalObject_invalid_noDerive() {
+    public void test_from_TemporalAccessor_invalid_noDerive() {
         YearMonth.from(LocalTime.of(12, 30));
     }
 
     @Test(expectedExceptions=NullPointerException.class)
-    public void test_factory_CalendricalObject_null() {
+    public void test_from_TemporalAccessor_null() {
         YearMonth.from((TemporalAccessor) null);
     }
 
@@ -786,7 +767,7 @@
         };
     }
 
-    @Test(groups={"tck"}, dataProvider="plus_long_TemporalUnit")
+    @Test(dataProvider="plus_long_TemporalUnit")
     public void test_plus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class expectedEx) {
         if (expectedEx == null) {
             assertEquals(base.plus(amount, unit), expectedYearMonth);
@@ -838,7 +819,7 @@
         };
     }
 
-    @Test(groups={"tck"}, dataProvider="plus_TemporalAmount")
+    @Test(dataProvider="plus_TemporalAmount")
     public void test_plus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class expectedEx) {
         if (expectedEx == null) {
             assertEquals(base.plus(temporalAmount), expectedYearMonth);
@@ -1001,7 +982,7 @@
         };
     }
 
-    @Test(groups={"tck"}, dataProvider="minus_long_TemporalUnit")
+    @Test(dataProvider="minus_long_TemporalUnit")
     public void test_minus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class expectedEx) {
         if (expectedEx == null) {
             assertEquals(base.minus(amount, unit), expectedYearMonth);
@@ -1053,7 +1034,7 @@
         };
     }
 
-    @Test(groups={"tck"}, dataProvider="minus_TemporalAmount")
+    @Test(dataProvider="minus_TemporalAmount")
     public void test_minus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class expectedEx) {
         if (expectedEx == null) {
             assertEquals(base.minus(temporalAmount), expectedYearMonth);
@@ -1261,29 +1242,48 @@
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) {
         long amount = ym1.until(ym2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
-    public void test_periodUntil_TemporalUnit_negated(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) {
+    public void test_until_TemporalUnit_negated(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) {
         long amount = ym2.until(ym1, unit);
         assertEquals(amount, -expected);
     }
 
+    @Test(dataProvider="periodUntilUnit")
+    public void test_until_TemporalUnit_between(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) {
+        long amount = unit.between(ym1, ym2);
+        assertEquals(amount, expected);
+    }
+
+    @Test
+    public void test_until_convertedType() {
+        YearMonth start = YearMonth.of(2010, 6);
+        LocalDate end = start.plusMonths(2).atDay(12);
+        assertEquals(start.until(end, MONTHS), 2);
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_until_invalidType() {
+        YearMonth start = YearMonth.of(2010, 6);
+        start.until(LocalTime.of(11, 30), MONTHS);
+    }
+
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
-    public void test_periodUntil_TemporalUnit_unsupportedUnit() {
+    public void test_until_TemporalUnit_unsupportedUnit() {
         TEST_2008_06.until(TEST_2008_06, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullEnd() {
+    public void test_until_TemporalUnit_nullEnd() {
         TEST_2008_06.until(null, DAYS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
-    public void test_periodUntil_TemporalUnit_nullUnit() {
+    public void test_until_TemporalUnit_nullUnit() {
         TEST_2008_06.until(TEST_2008_06, null);
     }
 
--- a/jdk/test/java/time/tck/java/time/TCKZoneId.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKZoneId.java	Fri Oct 11 09:17:18 2013 -0400
@@ -93,110 +93,6 @@
 public class TCKZoneId extends AbstractTCKTest {
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(ZoneId.of("Europe/London"));
-        assertSerializable(ZoneId.of("America/Chicago"));
-    }
-
-    @Test
-    public void test_serialization_format() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(7);
-            dos.writeUTF("Europe/London");
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(ZoneId.of("Europe/London"), bytes);
-    }
-
-    @Test
-    public void test_deserialization_lenient_characters() throws Exception {
-        // an ID can be loaded without validation during deserialization
-        String id = "QWERTYUIOPASDFGHJKLZXCVBNM~/._+-";
-        ZoneId deser = deserialize(id);
-        // getId, equals, hashCode, toString and normalized are OK
-        assertEquals(deser.getId(), id);
-        assertEquals(deser.toString(), id);
-        assertEquals(deser, deser);
-        assertEquals(deser.hashCode(), deser.hashCode());
-        assertEquals(deser.normalized(), deser);
-        // getting the rules is not
-        try {
-            deser.getRules();
-            fail();
-        } catch (ZoneRulesException ex) {
-            // expected
-        }
-    }
-
-    @Test(expectedExceptions=DateTimeException.class)
-    public void test_deserialization_lenient_badCharacters() throws Exception {
-        // an ID can be loaded without validation during deserialization
-        // but there is a check to ensure the ID format is valid
-        deserialize("|!?");
-    }
-
-    @Test(dataProvider="offsetBasedValid")
-    public void test_deserialization_lenient_offsetNotAllowed_noPrefix(String input, String resolvedId) throws Exception {
-        ZoneId deserialized = deserialize(input);
-        assertEquals(deserialized, ZoneId.of(input));
-        assertEquals(deserialized, ZoneId.of(resolvedId));
-    }
-
-    @Test(dataProvider="offsetBasedValidPrefix")
-    public void test_deserialization_lenient_offsetNotAllowed_prefixUTC(String input, String resolvedId, String offsetId) throws Exception {
-        ZoneId deserialized = deserialize("UTC" + input);
-        assertEquals(deserialized, ZoneId.of("UTC" + input));
-        assertEquals(deserialized, ZoneId.of("UTC" + resolvedId));
-    }
-
-    @Test(dataProvider="offsetBasedValidPrefix")
-    public void test_deserialization_lenient_offsetNotAllowed_prefixGMT(String input, String resolvedId, String offsetId) throws Exception {
-        ZoneId deserialized = deserialize("GMT" + input);
-        assertEquals(deserialized, ZoneId.of("GMT" + input));
-        assertEquals(deserialized, ZoneId.of("GMT" + resolvedId));
-    }
-
-    @Test(dataProvider="offsetBasedValidPrefix")
-    public void test_deserialization_lenient_offsetNotAllowed_prefixUT(String input, String resolvedId, String offsetId) throws Exception {
-        ZoneId deserialized = deserialize("UT" + input);
-        assertEquals(deserialized, ZoneId.of("UT" + input));
-        assertEquals(deserialized, ZoneId.of("UT" + resolvedId));
-    }
-
-    private ZoneId deserialize(String id) throws Exception {
-        String serClass = ZoneId.class.getPackage().getName() + ".Ser";
-        Class<?> serCls = Class.forName(serClass);
-        Field field = serCls.getDeclaredField("serialVersionUID");
-        field.setAccessible(true);
-        long serVer = (Long) field.get(null);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos)) {
-            dos.writeShort(ObjectStreamConstants.STREAM_MAGIC);
-            dos.writeShort(ObjectStreamConstants.STREAM_VERSION);
-            dos.writeByte(ObjectStreamConstants.TC_OBJECT);
-            dos.writeByte(ObjectStreamConstants.TC_CLASSDESC);
-            dos.writeUTF(serClass);
-            dos.writeLong(serVer);
-            dos.writeByte(ObjectStreamConstants.SC_EXTERNALIZABLE | ObjectStreamConstants.SC_BLOCK_DATA);
-            dos.writeShort(0);  // number of fields
-            dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA);  // end of classdesc
-            dos.writeByte(ObjectStreamConstants.TC_NULL);  // no superclasses
-            dos.writeByte(ObjectStreamConstants.TC_BLOCKDATA);
-            dos.writeByte(1 + 2 + id.length());  // length of data (1 byte + 2 bytes UTF length + 32 bytes UTF)
-            dos.writeByte(7);  // ZoneId
-            dos.writeUTF(id);
-            dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA);  // end of blockdata
-        }
-        ZoneId deser = null;
-        try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
-            deser = (ZoneId) ois.readObject();
-        }
-        return deser;
-    }
-
-    //-----------------------------------------------------------------------
     // OLD_SHORT_IDS
     //-----------------------------------------------------------------------
     public void test_constant_OLD_IDS_PRE_2005() {
--- a/jdk/test/java/time/tck/java/time/TCKZoneOffset.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKZoneOffset.java	Fri Oct 11 09:17:18 2013 -0400
@@ -121,46 +121,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws Exception {
-        assertSerializable(ZoneOffset.of("+01:30"));
-    }
-
-    @Test
-    public void test_serialization_format_quarterPositive() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(8);
-            dos.writeByte(6);  // stored as quarter hours
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(ZoneOffset.ofHoursMinutes(1, 30), bytes);
-    }
-
-    @Test
-    public void test_serialization_format_quarterNegative() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(8);
-            dos.writeByte(-10);  // stored as quarter hours
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(ZoneOffset.ofHoursMinutes(-2, -30), bytes);
-    }
-
-    @Test
-    public void test_serialization_format_full() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(8);
-            dos.writeByte(127);
-            dos.writeInt(53265);
-        }
-        byte[] bytes = baos.toByteArray();
-        assertSerializedBySer(ZoneOffset.ofTotalSeconds(53265), bytes);
-    }
-
-    //-----------------------------------------------------------------------
     // constants
     //-----------------------------------------------------------------------
     @Test
--- a/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -223,54 +223,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization() throws ClassNotFoundException, IOException {
-        assertSerializable(TEST_DATE_TIME);
-    }
-
-    @Test
-    public void test_serialization_format_zoneId() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(6);
-            dos.writeInt(2012); // date
-            dos.writeByte(9);
-            dos.writeByte(16);
-            dos.writeByte(22);  // time
-            dos.writeByte(17);
-            dos.writeByte(59);
-            dos.writeInt(470_000_000);
-            dos.writeByte(4);  // offset
-            dos.writeByte(7);  // zoneId
-            dos.writeUTF("Europe/London");
-        }
-        byte[] bytes = baos.toByteArray();
-        ZonedDateTime zdt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 470_000_000).atZone(ZoneId.of("Europe/London"));
-        assertSerializedBySer(zdt, bytes);
-    }
-
-    @Test
-    public void test_serialization_format_zoneOffset() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baos) ) {
-            dos.writeByte(6);
-            dos.writeInt(2012); // date
-            dos.writeByte(9);
-            dos.writeByte(16);
-            dos.writeByte(22);  // time
-            dos.writeByte(17);
-            dos.writeByte(59);
-            dos.writeInt(470_000_000);
-            dos.writeByte(4);  // offset
-            dos.writeByte(8);  // zoneId
-            dos.writeByte(4);
-        }
-        byte[] bytes = baos.toByteArray();
-        ZonedDateTime zdt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 470_000_000).atZone(ZoneOffset.ofHours(1));
-        assertSerializedBySer(zdt, bytes);
-    }
-
-    //-----------------------------------------------------------------------
     // now()
     //-----------------------------------------------------------------------
     @Test
@@ -2049,7 +2001,7 @@
     // compare results to OffsetDateTime.until, especially wrt dates
 
     @Test(dataProvider="plusDays")
-    public void test_periodUntil_days(ZonedDateTime base, long expected, ZonedDateTime end) {
+    public void test_until_days(ZonedDateTime base, long expected, ZonedDateTime end) {
         if (base.toLocalTime().equals(end.toLocalTime()) == false) {
             return;  // avoid DST gap input values
         }
@@ -2057,27 +2009,27 @@
     }
 
     @Test(dataProvider="plusTime")
-    public void test_periodUntil_hours(ZonedDateTime base, long expected, ZonedDateTime end) {
+    public void test_until_hours(ZonedDateTime base, long expected, ZonedDateTime end) {
         assertEquals(base.until(end, HOURS), expected);
     }
 
     @Test(dataProvider="plusTime")
-    public void test_periodUntil_minutes(ZonedDateTime base, long expected, ZonedDateTime end) {
+    public void test_until_minutes(ZonedDateTime base, long expected, ZonedDateTime end) {
         assertEquals(base.until(end, MINUTES), expected * 60);
     }
 
     @Test(dataProvider="plusTime")
-    public void test_periodUntil_seconds(ZonedDateTime base, long expected, ZonedDateTime end) {
+    public void test_until_seconds(ZonedDateTime base, long expected, ZonedDateTime end) {
         assertEquals(base.until(end, SECONDS), expected * 3600);
     }
 
     @Test(dataProvider="plusTime")
-    public void test_periodUntil_nanos(ZonedDateTime base, long expected, ZonedDateTime end) {
+    public void test_until_nanos(ZonedDateTime base, long expected, ZonedDateTime end) {
         assertEquals(base.until(end, NANOS), expected * 3600_000_000_000L);
     }
 
     @Test
-    public void test_periodUntil_parisLondon() {
+    public void test_until_parisLondon() {
         ZonedDateTime midnightLondon = LocalDate.of(2012, 6, 28).atStartOfDay(ZONE_LONDON);
         ZonedDateTime midnightParis1 = LocalDate.of(2012, 6, 29).atStartOfDay(ZONE_PARIS);
         ZonedDateTime oneAm1 = LocalDateTime.of(2012, 6, 29, 1, 0).atZone(ZONE_PARIS);
@@ -2093,7 +2045,7 @@
     }
 
     @Test
-    public void test_periodUntil_gap() {
+    public void test_until_gap() {
         ZonedDateTime before = TEST_PARIS_GAP_2008_03_30_02_30.withHour(0).withMinute(0).atZone(ZONE_PARIS);
         ZonedDateTime after = TEST_PARIS_GAP_2008_03_30_02_30.withHour(0).withMinute(0).plusDays(1).atZone(ZONE_PARIS);
 
@@ -2102,7 +2054,7 @@
     }
 
     @Test
-    public void test_periodUntil_overlap() {
+    public void test_until_overlap() {
         ZonedDateTime before = TEST_PARIS_OVERLAP_2008_10_26_02_30.withHour(0).withMinute(0).atZone(ZONE_PARIS);
         ZonedDateTime after = TEST_PARIS_OVERLAP_2008_10_26_02_30.withHour(0).withMinute(0).plusDays(1).atZone(ZONE_PARIS);
 
@@ -2111,17 +2063,17 @@
     }
 
     @Test(expectedExceptions=DateTimeException.class)
-    public void test_periodUntil_differentType() {
+    public void test_until_differentType() {
         TEST_DATE_TIME_PARIS.until(TEST_LOCAL_2008_06_30_11_30_59_500, DAYS);
     }
 
     @Test(expectedExceptions=NullPointerException.class)
-    public void test_periodUntil_nullTemporal() {
+    public void test_until_nullTemporal() {
         TEST_DATE_TIME_PARIS.until(null, DAYS);
     }
 
     @Test(expectedExceptions=NullPointerException.class)
-    public void test_periodUntil_nullUnit() {
+    public void test_until_nullUnit() {
         TEST_DATE_TIME_PARIS.until(TEST_DATE_TIME_PARIS, null);
     }
 
--- a/jdk/test/java/time/tck/java/time/chrono/CopticDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/CopticDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -297,18 +297,12 @@
     }
 
     @Override
-    public long until(Temporal endDateTime, TemporalUnit unit) {
-        if (endDateTime instanceof ChronoLocalDate == false) {
-            throw new DateTimeException("Unable to calculate period between objects of two different types");
-        }
-        ChronoLocalDate end = (ChronoLocalDate) endDateTime;
-        if (getChronology().equals(end.getChronology()) == false) {
-            throw new DateTimeException("Unable to calculate period between two different chronologies");
-        }
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        CopticDate end = getChronology().date(endExclusive);
         if (unit instanceof ChronoUnit) {
             return LocalDate.from(this).until(end, unit);  // TODO: this is wrong
         }
-        return unit.between(this, endDateTime);
+        return unit.between(this, end);
     }
 
     @Override
@@ -354,4 +348,27 @@
                 .append(dom < 10 ? "-0" : "-").append(dom);
         return buf.toString();
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof CopticDate) {
+            CopticDate cd = (CopticDate)obj;
+            if (this.prolepticYear == cd.prolepticYear &&
+                    this.month == cd.month &&
+                    this.day == cd.day) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        long epDay = toEpochDay();
+        return getChronology().hashCode() ^ ((int) (epDay ^ (epDay >>> 32)));
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -306,23 +306,6 @@
         }
     }
 
-    //-----------------------------------------------------------------------
-    // Test Serialization of Calendars
-    //-----------------------------------------------------------------------
-    @Test( dataProvider="calendars")
-    public void test_ChronoSerialization(Chronology chrono) throws Exception {
-        LocalDate ref = LocalDate.of(2013, 1, 5);
-        ChronoLocalDate orginal = chrono.date(ref);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(orginal);
-        out.close();
-        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-        ObjectInputStream in = new ObjectInputStream(bais);
-        @SuppressWarnings("unchecked")
-        ChronoLocalDate ser = (ChronoLocalDate) in.readObject();
-        assertEquals(ser, orginal, "deserialized date is wrong");
-    }
 
     //-----------------------------------------------------------------------
     @Test(dataProvider="calendars")
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -318,23 +318,6 @@
     }
 
     //-----------------------------------------------------------------------
-    // Test Serialization of ISO via chrono API
-    //-----------------------------------------------------------------------
-    @Test( dataProvider="calendars")
-    public void test_ChronoLocalDateTimeSerialization(Chronology chrono) throws Exception {
-        LocalDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3);
-        ChronoLocalDateTime<?> orginal = chrono.date(ref).atTime(ref.toLocalTime());
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(orginal);
-        out.close();
-        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-        ObjectInputStream in = new ObjectInputStream(bais);
-        ChronoLocalDateTime<?> ser = (ChronoLocalDateTime<?>) in.readObject();
-        assertEquals(ser, orginal, "deserialized date is wrong");
-    }
-
-    //-----------------------------------------------------------------------
     @Test(dataProvider="calendars")
     public void test_from_TemporalAccessor(Chronology chrono) {
         LocalDateTime refDateTime = LocalDateTime.of(2013, 1, 1, 12, 30);
@@ -361,6 +344,13 @@
     }
 
     //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_getChronology(Chronology chrono) {
+        ChronoLocalDateTime test = chrono.localDateTime(LocalDateTime.of(2010, 6, 30, 11, 30));
+        assertEquals(test.getChronology(), chrono);
+    }
+
+    //-----------------------------------------------------------------------
     /**
      * FixedAdjusted returns a fixed Temporal in all adjustments.
      * Construct an adjuster with the Temporal that should be returned from adjust.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,279 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2013, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.chrono;
+
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.HOURS;
+import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.YEARS;
+import static org.testng.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.time.DateTimeException;
+import java.time.LocalDate;
+import java.time.Period;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoPeriod;
+import java.time.chrono.Chronology;
+import java.time.chrono.HijrahChronology;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.ThaiBuddhistChronology;
+import java.time.temporal.Temporal;
+import java.time.temporal.UnsupportedTemporalTypeException;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class TCKChronoPeriod {
+
+    //-----------------------------------------------------------------------
+    // regular data factory for names and descriptions of available calendars
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "calendars")
+    Chronology[][] data_of_calendars() {
+        return new Chronology[][]{
+                    {HijrahChronology.INSTANCE},
+                    {IsoChronology.INSTANCE},
+                    {JapaneseChronology.INSTANCE},
+                    {MinguoChronology.INSTANCE},
+                    {ThaiBuddhistChronology.INSTANCE}};
+    }
+
+    //-----------------------------------------------------------------------
+    // Test Serialization of Calendars
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_serialization(Chronology chrono) throws Exception {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream(baos);
+        out.writeObject(period);
+        out.close();
+        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+        ObjectInputStream in = new ObjectInputStream(bais);
+        ChronoPeriod ser = (ChronoPeriod) in.readObject();
+        assertEquals(ser, period, "deserialized ChronoPeriod is wrong");
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_get(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        assertEquals(period.get(YEARS), 1);
+        assertEquals(period.get(MONTHS), 2);
+        assertEquals(period.get(DAYS), 3);
+    }
+
+    @Test(dataProvider="calendars", expectedExceptions=UnsupportedTemporalTypeException.class)
+    public void test_get_unsupported(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        period.get(HOURS);
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_getUnits(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        assertEquals(period.getUnits().size(), 3);
+        assertEquals(period.getUnits().get(0), YEARS);
+        assertEquals(period.getUnits().get(1), MONTHS);
+        assertEquals(period.getUnits().get(2), DAYS);
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_getChronology(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        assertEquals(period.getChronology(), chrono);
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_isZero_isNegative(Chronology chrono) {
+        ChronoPeriod periodPositive = chrono.period(1, 2, 3);
+        assertEquals(periodPositive.isZero(), false);
+        assertEquals(periodPositive.isNegative(), false);
+
+        ChronoPeriod periodZero = chrono.period(0, 0, 0);
+        assertEquals(periodZero.isZero(), true);
+        assertEquals(periodZero.isNegative(), false);
+
+        ChronoPeriod periodNegative = chrono.period(-1, 0, 0);
+        assertEquals(periodNegative.isZero(), false);
+        assertEquals(periodNegative.isNegative(), true);
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_plus(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ChronoPeriod period2 = chrono.period(2, 3, 4);
+        ChronoPeriod result = period.plus(period2);
+        assertEquals(result, chrono.period(3, 5, 7));
+    }
+
+    @Test(dataProvider="calendars", expectedExceptions=DateTimeException.class)
+    public void test_plus_wrongChrono(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ChronoPeriod isoPeriod = Period.of(2, 3, 4);
+        ChronoPeriod thaiPeriod = ThaiBuddhistChronology.INSTANCE.period(2, 3, 4);
+        // one of these two will fail
+        period.plus(isoPeriod);
+        period.plus(thaiPeriod);
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_minus(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ChronoPeriod period2 = chrono.period(2, 3, 4);
+        ChronoPeriod result = period.minus(period2);
+        assertEquals(result, chrono.period(-1, -1, -1));
+    }
+
+    @Test(dataProvider="calendars", expectedExceptions=DateTimeException.class)
+    public void test_minus_wrongChrono(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ChronoPeriod isoPeriod = Period.of(2, 3, 4);
+        ChronoPeriod thaiPeriod = ThaiBuddhistChronology.INSTANCE.period(2, 3, 4);
+        // one of these two will fail
+        period.minus(isoPeriod);
+        period.minus(thaiPeriod);
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_addTo(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ChronoLocalDate date = chrono.dateNow();
+        Temporal result = period.addTo(date);
+        assertEquals(result, date.plus(14, MONTHS).plus(3, DAYS));
+    }
+
+    @Test(dataProvider="calendars", expectedExceptions=DateTimeException.class)
+    public void test_addTo_wrongChrono(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1);
+        ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1);
+        // one of these two will fail
+        period.addTo(isoDate);
+        period.addTo(thaiDate);
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_subtractFrom(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ChronoLocalDate date = chrono.dateNow();
+        Temporal result = period.subtractFrom(date);
+        assertEquals(result, date.minus(14, MONTHS).minus(3, DAYS));
+    }
+
+    @Test(dataProvider="calendars", expectedExceptions=DateTimeException.class)
+    public void test_subtractFrom_wrongChrono(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        ChronoLocalDate isoDate = LocalDate.of(2000, 1, 1);
+        ChronoLocalDate thaiDate = ThaiBuddhistChronology.INSTANCE.date(2000, 1, 1);
+        // one of these two will fail
+        period.subtractFrom(isoDate);
+        period.subtractFrom(thaiDate);
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_negated(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        assertEquals(period.negated(), chrono.period(-1, -2, -3));
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_multipliedBy(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        assertEquals(period.multipliedBy(3), chrono.period(3, 6, 9));
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_equals_equal(Chronology chrono) {
+        ChronoPeriod a1 = chrono.period(1, 2, 3);
+        ChronoPeriod a2 = chrono.period(1, 2, 3);
+        assertEquals(a1, a1);
+        assertEquals(a1, a2);
+        assertEquals(a2, a1);
+        assertEquals(a2, a2);
+        assertEquals(a1.hashCode(), a2.hashCode());
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_equals_notEqual(Chronology chrono) {
+        ChronoPeriod a = chrono.period(1, 2, 3);
+        ChronoPeriod b = chrono.period(2, 2, 3);
+        assertEquals(a.equals(b), false);
+        assertEquals(b.equals(a), false);
+        assertEquals(a.equals(""), false);
+        assertEquals(a.equals(null), false);
+    }
+
+    @Test(dataProvider="calendars")
+    public void test_toString(Chronology chrono) {
+        ChronoPeriod period = chrono.period(1, 2, 3);
+        if (period instanceof Period == false) {
+            assertEquals(period.toString(), chrono.getId() + " P1Y2M3D");
+        }
+    }
+
+}
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java	Fri Oct 11 09:17:18 2013 -0400
@@ -321,24 +321,6 @@
     }
 
     //-----------------------------------------------------------------------
-    // Test Serialization of ISO via chrono API
-    //-----------------------------------------------------------------------
-    @Test( dataProvider="calendars")
-    public void test_ChronoZonedDateTimeSerialization(Chronology chrono) throws Exception {
-        ZonedDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3).atZone(ZoneId.of("GMT+01:23"));
-        ChronoZonedDateTime<?> orginal = chrono.date(ref).atTime(ref.toLocalTime()).atZone(ref.getZone());
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(orginal);
-        out.close();
-        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-        ObjectInputStream in = new ObjectInputStream(bais);
-        @SuppressWarnings("unchecked")
-        ChronoZonedDateTime<?> ser = (ChronoZonedDateTime<?>) in.readObject();
-        assertEquals(ser, orginal, "deserialized date is wrong");
-    }
-
-    //-----------------------------------------------------------------------
     @Test(dataProvider="calendars")
     public void test_from_TemporalAccessor(Chronology chrono) {
         ZonedDateTime refDateTime = ZonedDateTime.of(2013, 1, 1, 12, 30, 0, 0, ZoneId.of("Europe/Paris"));
@@ -363,6 +345,13 @@
     }
 
     //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_getChronology(Chronology chrono) {
+        ChronoZonedDateTime test = chrono.zonedDateTime(ZonedDateTime.of(2010, 6, 30, 11, 30, 0, 0, ZoneOffset.UTC));
+        assertEquals(test.getChronology(), chrono);
+    }
+
+    //-----------------------------------------------------------------------
     /**
      * FixedAdjusted returns a fixed Temporal in all adjustments.
      * Construct an adjuster with the Temporal that should be returned from adjust.
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronology.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronology.java	Fri Oct 11 09:17:18 2013 -0400
@@ -64,7 +64,6 @@
 import static org.testng.Assert.assertSame;
 import static org.testng.Assert.assertTrue;
 
-import java.util.Locale;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
@@ -338,20 +337,4 @@
         Chronology chrono = Chronology.of("FooFoo");
     }
 
-    //-----------------------------------------------------------------------
-    // serialization; serialize and check each calendar system
-    //-----------------------------------------------------------------------
-    @Test(dataProvider = "calendarNameAndType")
-    public void test_chronoSerializationSingleton(String id, String _calendarType) throws Exception {
-        Chronology original = Chronology.of(id);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(original);
-        out.close();
-        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-        ObjectInputStream in = new ObjectInputStream(bais);
-        Chronology ser = (Chronology) in.readObject();
-        assertEquals(ser, original, "Deserialized Chronology is not correct");
-    }
-
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronologySerialization.java	Fri Oct 11 08:43:07 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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.
- */
-
-/*
- * Copyright (c) 2013, Stephen Colebourne & Michael Nascimento Santos
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *  * Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- *
- *  * Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- *  * Neither the name of JSR-310 nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package tck.java.time.chrono;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.PrintStream;
-import java.time.chrono.Chronology;
-import java.time.chrono.HijrahChronology;
-import java.time.chrono.IsoChronology;
-import java.time.chrono.JapaneseChronology;
-import java.time.chrono.MinguoChronology;
-import java.time.chrono.ThaiBuddhistChronology;
-
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-public class TCKChronologySerialization {
-
-    //-----------------------------------------------------------------------
-    // regular data factory for names and descriptions of available calendars
-    //-----------------------------------------------------------------------
-    @DataProvider(name = "calendars")
-    Chronology[][] data_of_calendars() {
-        return new Chronology[][]{
-                    {HijrahChronology.INSTANCE},
-                    {IsoChronology.INSTANCE},
-                    {JapaneseChronology.INSTANCE},
-                    {MinguoChronology.INSTANCE},
-                    {ThaiBuddhistChronology.INSTANCE}};
-    }
-
-    //-----------------------------------------------------------------------
-    // Test Serialization of Calendars
-    //-----------------------------------------------------------------------
-    @Test(dataProvider="calendars")
-    public void test_ChronoSerialization(Chronology chrono) throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(chrono);
-        out.close();
-
-        byte[] bytes = baos.toByteArray();
-        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-
-        ObjectInputStream in = new ObjectInputStream(bais);
-        @SuppressWarnings("unchecked")
-        Chronology ser = (Chronology) in.readObject();
-        assertEquals(ser, chrono, "deserialized Chronology is wrong");
-    }
-
-    /**
-     * Utility method to dump a byte array in a java syntax.
-     * @param bytes and array of bytes
-     * @param os the outputstream to receive the output.
-     */
-    static void dumpSerialStream(byte[] bytes, PrintStream os) {
-        os.printf("    byte[] bytes = {" );
-        final int linelen = 10;
-        for (int i = 0; i < bytes.length; i++) {
-            if (i % linelen == 0) {
-                os.printf("%n        ");
-            }
-            os.printf(" %3d,", bytes[i] & 0xff);
-            if ((i % linelen) == (linelen-1) || i == bytes.length - 1) {
-                os.printf("  /*");
-                int s = i / linelen * linelen;
-                int k = i % linelen;
-                for (int j = 0; j <= k && s + j < bytes.length; j++) {
-                    os.printf(" %c", bytes[s + j] & 0xff);
-                }
-                os.printf(" */");
-            }
-        }
-        os.printf("%n    };%n");
-    }
-
-}
--- a/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java	Fri Oct 11 09:17:18 2013 -0400
@@ -79,6 +79,7 @@
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoPeriod;
 import java.time.chrono.Chronology;
 import java.time.chrono.Era;
 import java.time.chrono.IsoChronology;
@@ -87,6 +88,7 @@
 import java.time.chrono.JapaneseEra;
 import java.time.chrono.MinguoChronology;
 import java.time.chrono.MinguoDate;
+import java.time.chrono.ThaiBuddhistChronology;
 import java.time.format.ResolverStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.ChronoUnit;
@@ -615,8 +617,8 @@
     public void test_periodUntilDate() {
         JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
         JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
-        Period period = mdate1.until(mdate2);
-        assertEquals(period, Period.of(1, 1, 1));
+        ChronoPeriod period = mdate1.until(mdate2);
+        assertEquals(period, JapaneseChronology.INSTANCE.period(1, 1, 1));
     }
 
     @Test
@@ -632,8 +634,8 @@
         JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
         JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
         MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
-        Period period = mdate1.until(ldate2);
-        assertEquals(period, Period.of(1, 1, 1));
+        ChronoPeriod period = mdate1.until(ldate2);
+        assertEquals(period, JapaneseChronology.INSTANCE.period(1, 1, 1));
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java	Fri Oct 11 09:17:18 2013 -0400
@@ -69,13 +69,13 @@
 import java.time.LocalTime;
 import java.time.Month;
 import java.time.OffsetDateTime;
-import java.time.Period;
 import java.time.Year;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.ChronoPeriod;
 import java.time.chrono.ChronoZonedDateTime;
 import java.time.chrono.Chronology;
 import java.time.chrono.Era;
@@ -84,8 +84,6 @@
 import java.time.chrono.MinguoChronology;
 import java.time.chrono.MinguoDate;
 import java.time.chrono.MinguoEra;
-import java.time.chrono.MinguoChronology;
-import java.time.chrono.MinguoDate;
 import java.time.chrono.ThaiBuddhistChronology;
 import java.time.chrono.ThaiBuddhistDate;
 import java.time.format.ResolverStyle;
@@ -499,8 +497,8 @@
     public void test_periodUntilDate() {
         MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
         MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
-        Period period = mdate1.until(mdate2);
-        assertEquals(period, Period.of(1, 1, 1));
+        ChronoPeriod period = mdate1.until(mdate2);
+        assertEquals(period, MinguoChronology.INSTANCE.period(1, 1, 1));
     }
 
     @Test
@@ -516,8 +514,8 @@
         MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
         MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
         ThaiBuddhistDate ldate2 = ThaiBuddhistChronology.INSTANCE.date(mdate2);
-        Period period = mdate1.until(ldate2);
-        assertEquals(period, Period.of(1, 1, 1));
+        ChronoPeriod period = mdate1.until(ldate2);
+        assertEquals(period, MinguoChronology.INSTANCE.period(1, 1, 1));
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/chrono/TCKTestServiceLoader.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKTestServiceLoader.java	Fri Oct 11 09:17:18 2013 -0400
@@ -60,10 +60,6 @@
 
 import static org.testng.Assert.assertEquals;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.time.LocalDate;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.Chronology;
@@ -78,29 +74,11 @@
 public class TCKTestServiceLoader {
 
      @Test
-     public void test_CopticServiceLoader() {
+     public void test_TestServiceLoader() {
         Chronology chrono = Chronology.of("Coptic");
         ChronoLocalDate copticDate = chrono.date(1729, 4, 27);
         LocalDate ld = LocalDate.from(copticDate);
         assertEquals(ld, LocalDate.of(2013, 1, 5), "CopticDate does not match LocalDate");
     }
 
-
-    //-----------------------------------------------------------------------
-    // Test Serialization of Loaded Coptic Calendar
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_ChronoSerialization() throws Exception {
-        Chronology chrono = Chronology.of("Coptic");
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(chrono);
-        out.close();
-        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
-        ObjectInputStream in = new ObjectInputStream(bais);
-        @SuppressWarnings("unchecked")
-        Chronology ser = (Chronology) in.readObject();
-        assertEquals(ser, chrono, "deserialized Chronology is wrong");
-    }
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java	Fri Oct 11 09:17:18 2013 -0400
@@ -72,11 +72,11 @@
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.Month;
-import java.time.Period;
 import java.time.Year;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoPeriod;
 import java.time.chrono.Chronology;
 import java.time.chrono.Era;
 import java.time.chrono.IsoChronology;
@@ -458,8 +458,8 @@
     public void test_periodUntilDate() {
         ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1);
         ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2);
-        Period period = mdate1.until(mdate2);
-        assertEquals(period, Period.of(1, 1, 1));
+        ChronoPeriod period = mdate1.until(mdate2);
+        assertEquals(period, ThaiBuddhistChronology.INSTANCE.period(1, 1, 1));
     }
 
     @Test
@@ -475,8 +475,8 @@
         ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1);
         ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2);
         MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
-        Period period = mdate1.until(ldate2);
-        assertEquals(period, Period.of(1, 1, 1));
+        ChronoPeriod period = mdate1.until(ldate2);
+        assertEquals(period, ThaiBuddhistChronology.INSTANCE.period(1, 1, 1));
     }
 
     //-----------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,164 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.chrono.serial;
+
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.ChronoField.YEAR;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.ObjectStreamConstants;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.HijrahChronology;
+import java.time.chrono.HijrahDate;
+import java.time.chrono.JapaneseDate;
+import java.time.chrono.JapaneseEra;
+import java.time.chrono.MinguoDate;
+import java.time.chrono.ThaiBuddhistDate;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test serialization of built-in chronologies.
+ */
+@Test
+public class TCKChronoLocalDateSerialization extends AbstractTCKTest {
+
+    static final int CHRONO_TYPE = 1;            // java.time.chrono.Ser.CHRONO_TYPE
+    static final int JAPANESE_DATE_TYPE = 4;     // java.time.chrono.Ser.JAPANESE_DATE_TYPE
+    static final int HIJRAH_DATE_TYPE = 6;       // java.time.chrono.Ser.HIJRAH_DATE_TYPE
+    static final int MINGUO_DATE_TYPE = 7;       // java.time.chrono.Ser.MINGUO_DATE_TYPE
+    static final int THAIBUDDHIST_DATE_TYPE = 8; // java.time.chrono.Ser.THAIBUDDHIST_DATE_TYPE
+
+    //-----------------------------------------------------------------------
+    // Regular data factory for names and descriptions of available calendars
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "calendars")
+    Object[][] data_of_calendars() {
+        return new Object[][]{
+            {JapaneseDate.of(JapaneseEra.HEISEI, 25, 01, 05), JAPANESE_DATE_TYPE},
+            {MinguoDate.of(102, 01, 05),                      MINGUO_DATE_TYPE},
+            {ThaiBuddhistDate.of(2556, 01, 05),               THAIBUDDHIST_DATE_TYPE},
+        };
+    }
+
+
+    //-----------------------------------------------------------------------
+    // Test Serialization of Calendars
+    //-----------------------------------------------------------------------
+    @Test( dataProvider="calendars")
+    public void test_ChronoSerialization(ChronoLocalDate date, int dateType) throws Exception {
+        assertSerializable(date);
+    }
+
+    //-----------------------------------------------------------------------
+    // Test that serialization produces exact sequence of bytes
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    private void test_serialization_format(ChronoLocalDate date, int dateType) throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(dateType);
+            dos.writeInt(date.get(YEAR));
+            dos.writeByte(date.get(MONTH_OF_YEAR));
+            dos.writeByte(date.get(DAY_OF_MONTH));
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(date, bytes);
+    }
+
+    //-----------------------------------------------------------------------
+    // Test HijrajDate serialization is a type, Chronology, year, month, day
+    //-----------------------------------------------------------------------
+    @Test()
+    public void test_hijrahSerialization_format() throws Exception {
+        HijrahChronology chrono = HijrahChronology.INSTANCE;
+        HijrahDate date = HijrahDate.of(1433, 10, 29);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+        // Expect the type of the HijrahDate in the stream
+        byte[] hijrahDateBytes = new byte[] {HIJRAH_DATE_TYPE};
+
+        // Literal reference to Hijrah-Umalqura Chronology
+        byte[] hijrahChronoBytes = new byte[] {
+            115, 113, 0, 126, 0, 0,                        /* p w \u0001 \u0006 s q \u0000 ~ \u0000 \u0000 */
+            119, 18, 1, 0, 15, 72, 105, 106, 114, 97,      /* w \u0012 \u0001 \u0000 \u000f H i j r a */
+            104, 45, 117, 109, 97, 108, 113, 117, 114, 97, /* h - u m a l q u r a */
+            120,                                           /*  \u001d x */
+        };
+
+        // Build the sequence that represents the data in the stream
+        baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(ObjectStreamConstants.TC_BLOCKDATA);
+            dos.writeByte(6);   // 6 bytes follow
+            dos.writeInt(date.get(YEAR));
+            dos.writeByte(date.get(MONTH_OF_YEAR));
+            dos.writeByte(date.get(DAY_OF_MONTH));
+            dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA);
+        }
+        byte[] dateBytes = baos.toByteArray();
+
+        assertSerializedBySer(date, hijrahDateBytes, hijrahChronoBytes, dateBytes);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.chrono.serial;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.Chronology;
+import java.time.chrono.HijrahChronology;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.ThaiBuddhistChronology;
+
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test serialization of ChronoLocalDateTime for all built-in chronologies.
+ */
+@Test
+public class TCKChronoLocalDateTimeSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    // regular data factory for available calendars
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "calendars")
+    Chronology[][] data_of_calendars() {
+        return new Chronology[][]{
+                    {HijrahChronology.INSTANCE},
+                    {IsoChronology.INSTANCE},
+                    {JapaneseChronology.INSTANCE},
+                    {MinguoChronology.INSTANCE},
+                    {ThaiBuddhistChronology.INSTANCE}};
+    }
+
+    //-----------------------------------------------------------------------
+    // Test Serialization of ChronoLocalDateTime
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_ChronoLocalDateTimeSerialization(Chronology chrono) throws Exception {
+        LocalDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3);
+        ChronoLocalDateTime<?> original = chrono.date(ref).atTime(ref.toLocalTime());
+        assertSerializable(original);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.chrono.serial;
+
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.chrono.ChronoZonedDateTime;
+import java.time.chrono.Chronology;
+import java.time.chrono.HijrahChronology;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.ThaiBuddhistChronology;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test assertions that must be true for all built-in chronologies.
+ */
+@Test
+public class TCKChronoZonedDateTimeSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    // regular data factory for names and descriptions of available calendars
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "calendars")
+    Chronology[][] data_of_calendars() {
+        return new Chronology[][]{
+                    {HijrahChronology.INSTANCE},
+                    {IsoChronology.INSTANCE},
+                    {JapaneseChronology.INSTANCE},
+                    {MinguoChronology.INSTANCE},
+                    {ThaiBuddhistChronology.INSTANCE},
+        };
+    }
+
+    //-----------------------------------------------------------------------
+    // Test Serialization of ISO via chrono API
+    //-----------------------------------------------------------------------
+    @Test( dataProvider="calendars")
+    public void test_ChronoZonedDateTimeSerialization(Chronology chrono) throws Exception {
+        ZonedDateTime ref = LocalDate.of(2013, 1, 5).atTime(12, 1, 2, 3).atZone(ZoneId.of("GMT+01:23"));
+        ChronoZonedDateTime<?> original = chrono.date(ref).atTime(ref.toLocalTime()).atZone(ref.getZone());
+        assertSerializable(original);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2013, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.chrono.serial;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+
+import java.time.chrono.Chronology;
+import java.time.chrono.HijrahChronology;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.ThaiBuddhistChronology;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import tck.java.time.AbstractTCKTest;
+
+@Test
+public class TCKChronologySerialization extends AbstractTCKTest {
+
+    static final int CHRONO_TYPE = 1;            // java.time.chrono.Ser.CHRONO_TYPE
+
+    //-----------------------------------------------------------------------
+    // Regular data factory for available calendars
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "calendars")
+    Chronology[][] data_of_calendars() {
+        return new Chronology[][]{
+                    {HijrahChronology.INSTANCE},
+                    {IsoChronology.INSTANCE},
+                    {JapaneseChronology.INSTANCE},
+                    {MinguoChronology.INSTANCE},
+                    {ThaiBuddhistChronology.INSTANCE}};
+    }
+
+    //-----------------------------------------------------------------------
+    // Test Serialization of Calendars
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    public void test_chronoSerialization(Chronology chrono) throws Exception {
+        assertSerializable(chrono);
+    }
+
+    //-----------------------------------------------------------------------
+    // Test that serialization produces exact sequence of bytes
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="calendars")
+    private void test_serializationBytes(Chronology chrono) throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(CHRONO_TYPE);
+            dos.writeUTF(chrono.getId());
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(chrono, bytes);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKCopticSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2011-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.chrono.serial;
+
+import java.io.IOException;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.Chronology;
+
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Tests the serialization of ChronoLocalDate using a CopticDate.
+ */
+@Test
+public class TCKCopticSerialization extends AbstractTCKTest {
+
+    @Test
+    public void test_eraSerialization() throws IOException, ClassNotFoundException {
+        Chronology chrono = Chronology.of("Coptic");
+        ChronoLocalDate copticDate = chrono.date(1729, 4, 27);
+        assertSerializable(copticDate);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/chrono/serial/TCKEraSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2011-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.chrono.serial;
+
+
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.ChronoField.YEAR;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.Era;
+import java.time.chrono.HijrahEra;
+import java.time.chrono.IsoEra;
+import java.time.chrono.JapaneseEra;
+import java.time.chrono.MinguoEra;
+import java.time.chrono.ThaiBuddhistEra;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Tests the built-in Eras are serializable.
+ * Note that the serialized form of IsoEra, MinguoEra, ThaiBuddhistEra,
+ * and HijrahEra are defined and provided by Enum.
+ * The serialized form of these types are not tested, only that they are
+ * serializable.
+ */
+@Test
+public class TCKEraSerialization extends AbstractTCKTest {
+
+    static final int JAPANESE_ERA_TYPE = 5;     // java.time.chrono.Ser.JAPANESE_ERA
+
+
+    //-----------------------------------------------------------------------
+    // Regular data factory for the available Eras
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "Eras")
+    Era[][] data_of_calendars() {
+        return new Era[][] {
+                    {HijrahEra.AH},
+                    {IsoEra.BCE},
+                    {IsoEra.CE},
+                    {MinguoEra.BEFORE_ROC},
+                    {MinguoEra.ROC},
+                    {ThaiBuddhistEra.BEFORE_BE},
+                    {ThaiBuddhistEra.BE},
+        };
+    }
+
+    @Test(dataProvider="Eras")
+    public void test_eraSerialization(Era era) throws IOException, ClassNotFoundException {
+        assertSerializableSame(era);
+    }
+
+    //-----------------------------------------------------------------------
+    // Test JapaneseEra serialization produces exact sequence of bytes
+    //-----------------------------------------------------------------------
+    @Test
+    private void test_JapaneseErasSerialization() throws Exception {
+        for (JapaneseEra era : JapaneseEra.values()) {
+            assertSerializableSame(era);
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            try (DataOutputStream dos = new DataOutputStream(baos) ) {
+                dos.writeByte(JAPANESE_ERA_TYPE);
+                dos.writeByte(era.getValue());
+            }
+            byte[] bytes = baos.toByteArray();
+            assertSerializedBySer(era, bytes);
+        }
+    }
+
+}
--- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java	Fri Oct 11 09:17:18 2013 -0400
@@ -190,8 +190,69 @@
 
     //-----------------------------------------------------------------------
     @Test(expectedExceptions=NullPointerException.class)
-    public void test_appendValueReduced_null() throws Exception {
-        builder.appendValueReduced(null, 2, 2000);
+    public void test_appendValueReduced_int_nullField() throws Exception {
+        builder.appendValueReduced(null, 2, 2, 2000);
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_int_minWidthTooSmall() throws Exception {
+        builder.appendValueReduced(YEAR, 0, 2, 2000);
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_int_minWidthTooBig() throws Exception {
+        builder.appendValueReduced(YEAR, 11, 2, 2000);
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_int_maxWidthTooSmall() throws Exception {
+        builder.appendValueReduced(YEAR, 2, 0, 2000);
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_int_maxWidthTooBig() throws Exception {
+        builder.appendValueReduced(YEAR, 2, 11, 2000);
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_int_maxWidthLessThanMin() throws Exception {
+        builder.appendValueReduced(YEAR, 2, 1, 2000);
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(expectedExceptions=NullPointerException.class)
+    public void test_appendValueReduced_date_nullField() throws Exception {
+        builder.appendValueReduced(null, 2, 2, LocalDate.of(2000, 1, 1));
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void test_appendValueReduced_date_nullDate() throws Exception {
+        builder.appendValueReduced(YEAR, 2, 2, null);
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_date_minWidthTooSmall() throws Exception {
+        builder.appendValueReduced(YEAR, 0, 2, LocalDate.of(2000, 1, 1));
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_date_minWidthTooBig() throws Exception {
+        builder.appendValueReduced(YEAR, 11, 2, LocalDate.of(2000, 1, 1));
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_date_maxWidthTooSmall() throws Exception {
+        builder.appendValueReduced(YEAR, 2, 0, LocalDate.of(2000, 1, 1));
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_date_maxWidthTooBig() throws Exception {
+        builder.appendValueReduced(YEAR, 2, 11, LocalDate.of(2000, 1, 1));
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void test_appendValueReduced_date_maxWidthLessThanMin() throws Exception {
+        builder.appendValueReduced(YEAR, 2, 1, LocalDate.of(2000, 1, 1));
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatters.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatters.java	Fri Oct 11 09:17:18 2013 -0400
@@ -126,9 +126,10 @@
     @Test
     public void test_pattern_String() {
         DateTimeFormatter test = DateTimeFormatter.ofPattern("d MMM yyyy");
+        Locale fmtLocale = Locale.getDefault(Locale.Category.FORMAT);
         assertEquals(test.format(LocalDate.of(2012, 6, 30)), "30 " +
-                Month.JUNE.getDisplayName(TextStyle.SHORT, Locale.getDefault()) + " 2012");
-        assertEquals(test.getLocale(), Locale.getDefault());
+                Month.JUNE.getDisplayName(TextStyle.SHORT, fmtLocale) + " 2012");
+        assertEquals(test.getLocale(), fmtLocale, "Locale.Category.FORMAT");
     }
 
     @Test(expectedExceptions=IllegalArgumentException.class)
--- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java	Fri Oct 11 09:17:18 2013 -0400
@@ -90,20 +90,33 @@
 import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.FOREVER;
+import static java.time.temporal.ChronoUnit.NANOS;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.Period;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.chrono.Chronology;
+import java.time.chrono.ThaiBuddhistChronology;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.DateTimeParseException;
 import java.time.format.ResolverStyle;
+import java.time.temporal.ChronoUnit;
 import java.time.temporal.IsoFields;
+import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalQuery;
+import java.time.temporal.TemporalUnit;
+import java.time.temporal.ValueRange;
+import java.util.Map;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -872,4 +885,210 @@
         }
     }
 
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_fieldResolvesToLocalTime() {
+        TemporalField field = new TemporalField() {
+            @Override
+            public TemporalUnit getBaseUnit() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public TemporalUnit getRangeUnit() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public ValueRange range() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isDateBased() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isTimeBased() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isSupportedBy(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public long getFrom(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public <R extends Temporal> R adjustInto(R temporal, long newValue) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public TemporalAccessor resolve(
+                    Map<TemporalField, Long> fieldValues, Chronology chronology,
+                    ZoneId zone, ResolverStyle resolverStyle) {
+                return LocalTime.MIDNIGHT.plusNanos(fieldValues.remove(this));
+            }
+        };
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter();
+        TemporalAccessor accessor = f.parse("1234567890");
+        assertEquals(accessor.query(TemporalQuery.localDate()), null);
+        assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.of(0, 0, 1, 234_567_890));
+    }
+
+    @Test
+    public void test_fieldResolvesToChronoLocalDateTime() {
+        TemporalField field = new TemporalField() {
+            @Override
+            public TemporalUnit getBaseUnit() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public TemporalUnit getRangeUnit() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public ValueRange range() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isDateBased() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isTimeBased() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isSupportedBy(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public long getFrom(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public <R extends Temporal> R adjustInto(R temporal, long newValue) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public TemporalAccessor resolve(
+                    Map<TemporalField, Long> fieldValues, Chronology chronology,
+                    ZoneId zone, ResolverStyle resolverStyle) {
+                fieldValues.remove(this);
+                return LocalDateTime.of(2010, 6, 30, 12, 30);
+            }
+        };
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter();
+        TemporalAccessor accessor = f.parse("1234567890");
+        assertEquals(accessor.query(TemporalQuery.localDate()), LocalDate.of(2010, 6, 30));
+        assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.of(12, 30));
+    }
+
+    @Test(expectedExceptions = DateTimeParseException.class)
+    public void test_fieldResolvesWrongChrono() {
+        TemporalField field = new TemporalField() {
+            @Override
+            public TemporalUnit getBaseUnit() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public TemporalUnit getRangeUnit() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public ValueRange range() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isDateBased() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isTimeBased() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isSupportedBy(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public long getFrom(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public <R extends Temporal> R adjustInto(R temporal, long newValue) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public TemporalAccessor resolve(
+                    Map<TemporalField, Long> fieldValues, Chronology chronology,
+                    ZoneId zone, ResolverStyle resolverStyle) {
+                return ThaiBuddhistChronology.INSTANCE.dateNow();
+            }
+        };
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter();
+        f.parse("1234567890");
+    }
+
+    @Test(expectedExceptions = DateTimeParseException.class)
+    public void test_fieldResolvesWrongZone() {
+        TemporalField field = new TemporalField() {
+            @Override
+            public TemporalUnit getBaseUnit() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public TemporalUnit getRangeUnit() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public ValueRange range() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isDateBased() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isTimeBased() {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public boolean isSupportedBy(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public long getFrom(TemporalAccessor temporal) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public <R extends Temporal> R adjustInto(R temporal, long newValue) {
+                throw new UnsupportedOperationException();
+            }
+            @Override
+            public TemporalAccessor resolve(
+                    Map<TemporalField, Long> fieldValues, Chronology chronology,
+                    ZoneId zone, ResolverStyle resolverStyle) {
+                return ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, ZoneId.of("Europe/Paris"));
+            }
+        };
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withZone(ZoneId.of("Europe/London"));
+        f.parse("1234567890");
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKClockSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012 Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+
+import java.io.IOException;
+import java.time.Clock;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+
+import org.testng.annotations.Test;
+
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test system and offset clocks serialization.
+ */
+@Test
+public class TCKClockSerialization extends AbstractTCKTest {
+
+    private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow");
+    private static final ZoneId PARIS = ZoneId.of("Europe/Paris");
+
+    private static final Duration AMOUNT = Duration.ofSeconds(2);
+    private static final ZonedDateTime ZDT = LocalDateTime.of(2008, 6, 30, 11, 30, 10, 500).atZone(ZoneOffset.ofHours(2));
+    private static final Instant INSTANT = ZDT.toInstant();
+
+    //-----------------------------------------------------------------------
+    public void test_systemClockSerializable() throws IOException, ClassNotFoundException {
+        assertSerializable(Clock.systemUTC());
+        assertSerializable(Clock.systemDefaultZone());
+        assertSerializable(Clock.system(PARIS));
+    }
+
+    //-----------------------------------------------------------------------
+    public void test_offsetClockSerializable() throws IOException, ClassNotFoundException {
+        assertSerializable(Clock.offset(Clock.system(PARIS), AMOUNT));
+    }
+
+    //-----------------------------------------------------------------------
+    public void test_tickClockSerializable() throws IOException, ClassNotFoundException {
+        assertSerializable(Clock.tickSeconds(PARIS));
+        assertSerializable(Clock.tickMinutes(MOSCOW));
+        assertSerializable(Clock.tick(Clock.fixed(INSTANT, PARIS), AMOUNT));
+    }
+
+    //-----------------------------------------------------------------------
+    public void test_fixedClockSerializable() throws IOException, ClassNotFoundException {
+        assertSerializable(Clock.fixed(INSTANT, ZoneOffset.UTC));
+        assertSerializable(Clock.fixed(INSTANT, PARIS));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKDurationSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.Serializable;
+import java.time.Duration;
+
+/**
+ * Test Duration serialization.
+ */
+@Test
+public class TCKDurationSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_interfaces() {
+        assertTrue(Serializable.class.isAssignableFrom(Duration.class));
+        assertTrue(Comparable.class.isAssignableFrom(Duration.class));
+    }
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(Duration.ofHours(5));
+        assertSerializable(Duration.ofHours(0));
+        assertSerializable(Duration.ofHours(-5));
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(1);
+            dos.writeLong(654321);
+            dos.writeInt(123456789);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(Duration.ofSeconds(654321, 123456789), bytes);
+    }
+
+    //-----------------------------------------------------------------------
+    // serialization
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_deserializationSingleton() throws Exception {
+        assertSerializableSame(Duration.ZERO);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKInstantSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.Instant;
+
+/**
+ * Test Instant serialization.
+ */
+@Test
+public class TCKInstantSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(Instant.ofEpochMilli(134l));
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(2);
+            dos.writeLong(654321);
+            dos.writeInt(123456789);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(Instant.ofEpochSecond(654321, 123456789), bytes);
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.LocalDate;
+
+/**
+ * Test LocalDate serialization.
+ */
+@Test
+public class TCKLocalDateSerialization extends AbstractTCKTest {
+
+    private LocalDate TEST_2007_07_15;
+
+    @BeforeMethod
+    public void setUp() {
+        TEST_2007_07_15 = LocalDate.of(2007, 7, 15);
+    }
+
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(TEST_2007_07_15);
+        assertSerializable(LocalDate.MIN);
+        assertSerializable(LocalDate.MAX);
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(3);
+            dos.writeInt(2012);
+            dos.writeByte(9);
+            dos.writeByte(16);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(LocalDate.of(2012, 9, 16), bytes);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.LocalDateTime;
+
+/**
+ * Test serialization of LocalDateTime.
+ */
+@Test
+public class TCKLocalDateTimeSerialization extends AbstractTCKTest {
+
+    private LocalDateTime TEST_2007_07_15_12_30_40_987654321 = LocalDateTime.of(2007, 7, 15, 12, 30, 40, 987654321);
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(TEST_2007_07_15_12_30_40_987654321);
+        assertSerializable(LocalDateTime.MIN);
+        assertSerializable(LocalDateTime.MAX);
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(5);
+            dos.writeInt(2012);
+            dos.writeByte(9);
+            dos.writeByte(16);
+            dos.writeByte(22);
+            dos.writeByte(17);
+            dos.writeByte(59);
+            dos.writeInt(459_000_000);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(LocalDateTime.of(2012, 9, 16, 22, 17, 59, 459_000_000), bytes);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.LocalTime;
+
+/**
+ * Test LocalTime serialization.
+ */
+@Test
+public class TCKLocalTimeSerialization extends AbstractTCKTest {
+
+
+    private LocalTime TEST_12_30_40_987654321;
+
+
+    @BeforeMethod
+    public void setUp() {
+        TEST_12_30_40_987654321 = LocalTime.of(12, 30, 40, 987654321);
+    }
+
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(TEST_12_30_40_987654321);
+        assertSerializable(LocalTime.MIN);
+        assertSerializable(LocalTime.MAX);
+    }
+
+    @Test
+    public void test_serialization_format_h() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(4);
+            dos.writeByte(-1 - 22);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(LocalTime.of(22, 0), bytes);
+    }
+
+    @Test
+    public void test_serialization_format_hm() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(4);
+            dos.writeByte(22);
+            dos.writeByte(-1 - 17);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(LocalTime.of(22, 17), bytes);
+    }
+
+    @Test
+    public void test_serialization_format_hms() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(4);
+            dos.writeByte(22);
+            dos.writeByte(17);
+            dos.writeByte(-1 - 59);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(LocalTime.of(22, 17, 59), bytes);
+    }
+
+    @Test
+    public void test_serialization_format_hmsn() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(4);
+            dos.writeByte(22);
+            dos.writeByte(17);
+            dos.writeByte(59);
+            dos.writeInt(459_000_000);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(LocalTime.of(22, 17, 59, 459_000_000), bytes);
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKMonthDaySerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.time.MonthDay;
+
+/**
+ * Test MonthDay serialization.
+ */
+@Test
+public class TCKMonthDaySerialization extends AbstractTCKTest {
+
+    private MonthDay TEST_07_15;
+
+    @BeforeMethod
+    public void setUp() {
+        TEST_07_15 = MonthDay.of(7, 15);
+    }
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws ClassNotFoundException, IOException {
+        assertSerializable(TEST_07_15);
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(13);       // java.time.temporal.Ser.MONTH_DAY_TYPE
+            dos.writeByte(9);
+            dos.writeByte(16);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(MonthDay.of(9, 16), bytes);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+
+/**
+ * Test OffsetDateTime serialization.
+ */
+@Test
+public class TCKOffsetDateTimeSerialization extends AbstractTCKTest {
+
+    private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
+    private OffsetDateTime TEST_2008_6_30_11_30_59_000000500;
+
+    @BeforeMethod
+    public void setUp() {
+        TEST_2008_6_30_11_30_59_000000500 = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 500, OFFSET_PONE);
+    }
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(TEST_2008_6_30_11_30_59_000000500);
+        assertSerializable(OffsetDateTime.MIN);
+        assertSerializable(OffsetDateTime.MAX);
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(10);       // java.time.Ser.OFFSET_DATE_TIME_TYPE
+        }
+        byte[] bytes = baos.toByteArray();
+        ByteArrayOutputStream baosDateTime = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baosDateTime) ) {
+            dos.writeByte(5);
+            dos.writeInt(2012);
+            dos.writeByte(9);
+            dos.writeByte(16);
+            dos.writeByte(22);
+            dos.writeByte(17);
+            dos.writeByte(59);
+            dos.writeInt(464_000_000);
+        }
+        byte[] bytesDateTime = baosDateTime.toByteArray();
+        ByteArrayOutputStream baosOffset = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baosOffset) ) {
+            dos.writeByte(8);
+            dos.writeByte(4);  // quarter hours stored: 3600 / 900
+        }
+        byte[] bytesOffset = baosOffset.toByteArray();
+        LocalDateTime ldt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 464_000_000);
+        assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes, bytesDateTime, bytesOffset);
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.OffsetTime;
+import java.time.ZoneOffset;
+
+/**
+ * Test OffsetTime serialization.
+ */
+@Test
+public class TCKOffsetTimeSerialization extends AbstractTCKTest {
+
+    private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
+    private OffsetTime TEST_11_30_59_500_PONE;
+
+    @BeforeMethod
+    public void setUp() {
+        TEST_11_30_59_500_PONE = OffsetTime.of(11, 30, 59, 500, OFFSET_PONE);
+    }
+
+
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(TEST_11_30_59_500_PONE);
+        assertSerializable(OffsetTime.MIN);
+        assertSerializable(OffsetTime.MAX);
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(9);       // java.time.Ser.OFFSET_TIME_TYPE
+        }
+        byte[] bytes = baos.toByteArray();
+        ByteArrayOutputStream baosTime = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baosTime) ) {
+            dos.writeByte(4);
+            dos.writeByte(22);
+            dos.writeByte(17);
+            dos.writeByte(59);
+            dos.writeInt(464_000_000);
+        }
+        byte[] bytesTime = baosTime.toByteArray();
+        ByteArrayOutputStream baosOffset = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baosOffset) ) {
+            dos.writeByte(8);
+            dos.writeByte(4);  // quarter hours stored: 3600 / 900
+        }
+        byte[] bytesOffset = baosOffset.toByteArray();
+        assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes,
+                bytesTime, bytesOffset);
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKPeriodSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.time.Period;
+
+/**
+ * Test serialization of Period.
+ */
+@Test
+public class TCKPeriodSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(Period.ZERO);
+        assertSerializable(Period.ofDays(1));
+        assertSerializable(Period.of(1, 2, 3));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKYearMonthSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.time.YearMonth;
+
+/**
+ * Test serialization of YearMonth.
+ */
+@Test
+public class TCKYearMonthSerialization extends AbstractTCKTest {
+
+    private YearMonth TEST_2008_06;
+
+    @BeforeMethod
+    public void setUp() {
+        TEST_2008_06 = YearMonth.of(2008, 6);
+    }
+
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws IOException, ClassNotFoundException {
+        assertSerializable(TEST_2008_06);
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(12);       // java.time.temporal.Ser.YEAR_MONTH_TYPE
+            dos.writeInt(2012);
+            dos.writeByte(9);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(YearMonth.of(2012, 9), bytes);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKYearSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.Year;
+
+/**
+ * Test Year serialization.
+ */
+@Test
+public class TCKYearSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(Year.of(2));
+        assertSerializable(Year.of(0));
+        assertSerializable(Year.of(-2));
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(11);       // java.time.temporal.Ser.YEAR_TYPE
+            dos.writeInt(2012);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(Year.of(2012), bytes);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.*;
+import java.lang.reflect.Field;
+import java.time.DateTimeException;
+import java.time.ZoneId;
+import java.time.zone.ZoneRulesException;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+/**
+ * Test serialization of ZoneId.
+ */
+@Test
+public class TCKZoneIdSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(ZoneId.of("Europe/London"));
+        assertSerializable(ZoneId.of("America/Chicago"));
+    }
+
+    @Test
+    public void test_serialization_format() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(7);
+            dos.writeUTF("Europe/London");
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(ZoneId.of("Europe/London"), bytes);
+    }
+
+    @Test
+    public void test_deserialization_lenient_characters() throws Exception {
+        // an ID can be loaded without validation during deserialization
+        String id = "QWERTYUIOPASDFGHJKLZXCVBNM~/._+-";
+        ZoneId deser = deserialize(id);
+        // getId, equals, hashCode, toString and normalized are OK
+        assertEquals(deser.getId(), id);
+        assertEquals(deser.toString(), id);
+        assertEquals(deser, deser);
+        assertEquals(deser.hashCode(), deser.hashCode());
+        assertEquals(deser.normalized(), deser);
+        // getting the rules is not
+        try {
+            deser.getRules();
+            fail();
+        } catch (ZoneRulesException ex) {
+            // expected
+        }
+    }
+
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_deserialization_lenient_badCharacters() throws Exception {
+        // an ID can be loaded without validation during deserialization
+        // but there is a check to ensure the ID format is valid
+        deserialize("|!?");
+    }
+
+    @Test(dataProvider="offsetBasedValid")
+    public void test_deserialization_lenient_offsetNotAllowed_noPrefix(String input, String resolvedId) throws Exception {
+        ZoneId deserialized = deserialize(input);
+        assertEquals(deserialized, ZoneId.of(input));
+        assertEquals(deserialized, ZoneId.of(resolvedId));
+    }
+
+    @Test(dataProvider="offsetBasedValidPrefix")
+    public void test_deserialization_lenient_offsetNotAllowed_prefixUTC(String input, String resolvedId, String offsetId) throws Exception {
+        ZoneId deserialized = deserialize("UTC" + input);
+        assertEquals(deserialized, ZoneId.of("UTC" + input));
+        assertEquals(deserialized, ZoneId.of("UTC" + resolvedId));
+    }
+
+    @Test(dataProvider="offsetBasedValidPrefix")
+    public void test_deserialization_lenient_offsetNotAllowed_prefixGMT(String input, String resolvedId, String offsetId) throws Exception {
+        ZoneId deserialized = deserialize("GMT" + input);
+        assertEquals(deserialized, ZoneId.of("GMT" + input));
+        assertEquals(deserialized, ZoneId.of("GMT" + resolvedId));
+    }
+
+    @Test(dataProvider="offsetBasedValidPrefix")
+    public void test_deserialization_lenient_offsetNotAllowed_prefixUT(String input, String resolvedId, String offsetId) throws Exception {
+        ZoneId deserialized = deserialize("UT" + input);
+        assertEquals(deserialized, ZoneId.of("UT" + input));
+        assertEquals(deserialized, ZoneId.of("UT" + resolvedId));
+    }
+
+    private ZoneId deserialize(String id) throws Exception {
+        String serClass = ZoneId.class.getPackage().getName() + ".Ser";
+        Class<?> serCls = Class.forName(serClass);
+        Field field = serCls.getDeclaredField("serialVersionUID");
+        field.setAccessible(true);
+        long serVer = (Long) field.get(null);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos)) {
+            dos.writeShort(ObjectStreamConstants.STREAM_MAGIC);
+            dos.writeShort(ObjectStreamConstants.STREAM_VERSION);
+            dos.writeByte(ObjectStreamConstants.TC_OBJECT);
+            dos.writeByte(ObjectStreamConstants.TC_CLASSDESC);
+            dos.writeUTF(serClass);
+            dos.writeLong(serVer);
+            dos.writeByte(ObjectStreamConstants.SC_EXTERNALIZABLE | ObjectStreamConstants.SC_BLOCK_DATA);
+            dos.writeShort(0);  // number of fields
+            dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA);  // end of classdesc
+            dos.writeByte(ObjectStreamConstants.TC_NULL);  // no superclasses
+            dos.writeByte(ObjectStreamConstants.TC_BLOCKDATA);
+            dos.writeByte(1 + 2 + id.length());  // length of data (1 byte + 2 bytes UTF length + 32 bytes UTF)
+            dos.writeByte(7);  // ZoneId
+            dos.writeUTF(id);
+            dos.writeByte(ObjectStreamConstants.TC_ENDBLOCKDATA);  // end of blockdata
+        }
+        ZoneId deser = null;
+        try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
+            deser = (ZoneId) ois.readObject();
+        }
+        return deser;
+    }
+
+    //-----------------------------------------------------------------------
+    // regular factory and .normalized()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="offsetBasedValid")
+    Object[][] data_offsetBasedValid() {
+        return new Object[][] {
+                {"Z", "Z"},
+                {"+0", "Z"},
+                {"-0", "Z"},
+                {"+00", "Z"},
+                {"+0000", "Z"},
+                {"+00:00", "Z"},
+                {"+000000", "Z"},
+                {"+00:00:00", "Z"},
+                {"-00", "Z"},
+                {"-0000", "Z"},
+                {"-00:00", "Z"},
+                {"-000000", "Z"},
+                {"-00:00:00", "Z"},
+                {"+5", "+05:00"},
+                {"+01", "+01:00"},
+                {"+0100", "+01:00"},
+                {"+01:00", "+01:00"},
+                {"+010000", "+01:00"},
+                {"+01:00:00", "+01:00"},
+                {"+12", "+12:00"},
+                {"+1234", "+12:34"},
+                {"+12:34", "+12:34"},
+                {"+123456", "+12:34:56"},
+                {"+12:34:56", "+12:34:56"},
+                {"-02", "-02:00"},
+                {"-5", "-05:00"},
+                {"-0200", "-02:00"},
+                {"-02:00", "-02:00"},
+                {"-020000", "-02:00"},
+                {"-02:00:00", "-02:00"},
+        };
+    }
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name="offsetBasedValidPrefix")
+    Object[][] data_offsetBasedValidPrefix() {
+        return new Object[][] {
+                {"", "", "Z"},
+                {"+0", "", "Z"},
+                {"-0", "", "Z"},
+                {"+00", "", "Z"},
+                {"+0000", "", "Z"},
+                {"+00:00", "", "Z"},
+                {"+000000", "", "Z"},
+                {"+00:00:00", "", "Z"},
+                {"-00", "", "Z"},
+                {"-0000", "", "Z"},
+                {"-00:00", "", "Z"},
+                {"-000000", "", "Z"},
+                {"-00:00:00", "", "Z"},
+                {"+5", "+05:00", "+05:00"},
+                {"+01", "+01:00", "+01:00"},
+                {"+0100", "+01:00", "+01:00"},
+                {"+01:00", "+01:00", "+01:00"},
+                {"+010000", "+01:00", "+01:00"},
+                {"+01:00:00", "+01:00", "+01:00"},
+                {"+12", "+12:00", "+12:00"},
+                {"+1234", "+12:34", "+12:34"},
+                {"+12:34", "+12:34", "+12:34"},
+                {"+123456", "+12:34:56", "+12:34:56"},
+                {"+12:34:56", "+12:34:56", "+12:34:56"},
+                {"-02", "-02:00", "-02:00"},
+                {"-5", "-05:00", "-05:00"},
+                {"-0200", "-02:00", "-02:00"},
+                {"-02:00", "-02:00", "-02:00"},
+                {"-020000", "-02:00", "-02:00"},
+                {"-02:00:00", "-02:00", "-02:00"},
+        };
+    }
+
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.time.ZoneOffset;
+
+/**
+ * Test serialization of ZoneOffset.
+ */
+@Test
+public class TCKZoneOffsetSerialization extends AbstractTCKTest {
+
+
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws Exception {
+        assertSerializable(ZoneOffset.of("+01:30"));
+    }
+
+    @Test
+    public void test_serialization_format_quarterPositive() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(8);
+            dos.writeByte(6);  // stored as quarter hours
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(ZoneOffset.ofHoursMinutes(1, 30), bytes);
+    }
+
+    @Test
+    public void test_serialization_format_quarterNegative() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(8);
+            dos.writeByte(-10);  // stored as quarter hours
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(ZoneOffset.ofHoursMinutes(-2, -30), bytes);
+    }
+
+    @Test
+    public void test_serialization_format_full() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(8);
+            dos.writeByte(127);
+            dos.writeInt(53265);
+        }
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(ZoneOffset.ofTotalSeconds(53265), bytes);
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.serial;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+
+/**
+ * Test serialization of ZonedDateTime.
+ */
+@Test
+public class TCKZonedDateTimeSerialization extends AbstractTCKTest {
+
+    private static final ZoneOffset OFFSET_0100 = ZoneOffset.ofHours(1);
+    private static final ZoneId ZONE_0100 = OFFSET_0100;
+    private static final ZoneId ZONE_PARIS = ZoneId.of("Europe/Paris");
+    private LocalDateTime TEST_LOCAL_2008_06_30_11_30_59_500;
+    private ZonedDateTime TEST_DATE_TIME;
+
+
+    @BeforeMethod
+    public void setUp() {
+        TEST_LOCAL_2008_06_30_11_30_59_500 = LocalDateTime.of(2008, 6, 30, 11, 30, 59, 500);
+        TEST_DATE_TIME = ZonedDateTime.of(TEST_LOCAL_2008_06_30_11_30_59_500, ZONE_0100);
+    }
+
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization() throws ClassNotFoundException, IOException {
+        assertSerializable(TEST_DATE_TIME);
+    }
+
+    @Test
+    public void test_serialization_format_zoneId() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(6);
+            dos.writeInt(2012); // date
+            dos.writeByte(9);
+            dos.writeByte(16);
+            dos.writeByte(22);  // time
+            dos.writeByte(17);
+            dos.writeByte(59);
+            dos.writeInt(470_000_000);
+            dos.writeByte(4);  // offset
+            dos.writeByte(7);  // zoneId
+            dos.writeUTF("Europe/London");
+        }
+        byte[] bytes = baos.toByteArray();
+        ZonedDateTime zdt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 470_000_000).atZone(ZoneId.of("Europe/London"));
+        assertSerializedBySer(zdt, bytes);
+    }
+
+    @Test
+    public void test_serialization_format_zoneOffset() throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (DataOutputStream dos = new DataOutputStream(baos) ) {
+            dos.writeByte(6);
+            dos.writeInt(2012); // date
+            dos.writeByte(9);
+            dos.writeByte(16);
+            dos.writeByte(22);  // time
+            dos.writeByte(17);
+            dos.writeByte(59);
+            dos.writeInt(470_000_000);
+            dos.writeByte(4);  // offset
+            dos.writeByte(8);  // zoneId
+            dos.writeByte(4);
+        }
+        byte[] bytes = baos.toByteArray();
+        ZonedDateTime zdt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 470_000_000).atZone(ZoneOffset.ofHours(1));
+        assertSerializedBySer(zdt, bytes);
+    }
+
+}
--- a/jdk/test/java/time/tck/java/time/temporal/TCKIsoFields.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/temporal/TCKIsoFields.java	Fri Oct 11 09:17:18 2013 -0400
@@ -70,11 +70,13 @@
 
 import java.time.DayOfWeek;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.DateTimeParseException;
 import java.time.format.ResolverStyle;
 import java.time.temporal.IsoFields;
+import java.time.temporal.Temporal;
 import java.time.temporal.ValueRange;
 
 import org.testng.annotations.DataProvider;
@@ -276,14 +278,21 @@
                 {LocalDate.of(2000, 1, 1), LocalDate.of(1998, 12, 31), -4},
                 {LocalDate.of(2000, 1, 1), LocalDate.of(1998, 10, 2), -4},
                 {LocalDate.of(2000, 1, 1), LocalDate.of(1998, 10, 1), -5},
+
+                {LocalDate.of(2000, 1, 1), LocalDateTime.of(2001, 4, 5, 0, 0), 5},
         };
     }
 
     @Test(dataProvider="quartersBetween")
-    public void test_quarters_between(LocalDate start, LocalDate end, long expected) {
+    public void test_quarters_between(LocalDate start, Temporal end, long expected) {
         assertEquals(IsoFields.QUARTER_YEARS.between(start, end), expected);
     }
 
+    @Test(dataProvider="quartersBetween")
+    public void test_quarters_between_until(LocalDate start, Temporal end, long expected) {
+        assertEquals(start.until(end, IsoFields.QUARTER_YEARS), expected);
+    }
+
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/temporal/TCKJulianFields.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/temporal/TCKJulianFields.java	Fri Oct 11 09:17:18 2013 -0400
@@ -76,7 +76,7 @@
 import tck.java.time.AbstractTCKTest;
 
 /**
- * Test.
+ * Test Julian Fields.
  */
 @Test
 public class TCKJulianFields extends AbstractTCKTest {
@@ -86,16 +86,6 @@
     private static final LocalDate NOV12_1945 = LocalDate.of(1945, 11, 12);
     private static final LocalDate JAN01_0001 = LocalDate.of(1, 1, 1);
 
-    //-----------------------------------------------------------------------
-    @DataProvider(name="julian_fields")
-    Object[][] julian_samples() {
-        return new Object[][] {
-            {JulianFields.JULIAN_DAY},
-            {JulianFields.MODIFIED_JULIAN_DAY},
-            {JulianFields.RATA_DIE},
-        };
-    }
-
     @DataProvider(name="samples")
     Object[][] data_samples() {
         return new Object[][] {
@@ -122,11 +112,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Test(dataProvider="julian_fields")
-    public void test_serializable(TemporalField field) throws IOException, ClassNotFoundException {
-        assertSerializable(field);
-    }
-
     public void test_basics() {
         assertEquals(JulianFields.JULIAN_DAY.isDateBased(), true);
         assertEquals(JulianFields.JULIAN_DAY.isTimeBased(), false);
--- a/jdk/test/java/time/tck/java/time/temporal/TCKWeekFields.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/temporal/TCKWeekFields.java	Fri Oct 11 09:17:18 2013 -0400
@@ -713,12 +713,6 @@
         }
     }
 
-    //-----------------------------------------------------------------------
-    @Test(dataProvider="weekFields")
-    public void test_serializable_singleton(DayOfWeek firstDayOfWeek, int minDays) throws IOException, ClassNotFoundException {
-        WeekFields weekDef = WeekFields.of(firstDayOfWeek, minDays);
-        assertSerializableSame(weekDef);  // spec state singleton
-    }
 
     //-----------------------------------------------------------------------
     @DataProvider(name="weekFields")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.temporal.serial;
+
+import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH;
+import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR;
+import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH;
+import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR;
+import static java.time.temporal.ChronoField.AMPM_OF_DAY;
+import static java.time.temporal.ChronoField.CLOCK_HOUR_OF_AMPM;
+import static java.time.temporal.ChronoField.CLOCK_HOUR_OF_DAY;
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static java.time.temporal.ChronoField.DAY_OF_YEAR;
+import static java.time.temporal.ChronoField.EPOCH_DAY;
+import static java.time.temporal.ChronoField.HOUR_OF_AMPM;
+import static java.time.temporal.ChronoField.HOUR_OF_DAY;
+import static java.time.temporal.ChronoField.MICRO_OF_DAY;
+import static java.time.temporal.ChronoField.MICRO_OF_SECOND;
+import static java.time.temporal.ChronoField.MILLI_OF_DAY;
+import static java.time.temporal.ChronoField.MILLI_OF_SECOND;
+import static java.time.temporal.ChronoField.MINUTE_OF_DAY;
+import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.ChronoField.NANO_OF_DAY;
+import static java.time.temporal.ChronoField.NANO_OF_SECOND;
+import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
+import static java.time.temporal.ChronoField.SECOND_OF_DAY;
+import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
+import static java.time.temporal.ChronoField.YEAR;
+import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoField.ERA;
+
+import java.io.IOException;
+import java.time.temporal.ChronoField;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test serialization of ChronoField.
+ */
+@Test
+public class TCKChronoFieldSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    // List of Fields
+    //-----------------------------------------------------------------------
+    @DataProvider(name="fieldBased")
+    Object[][] data_fieldBased() {
+        return new Object[][] {
+                {DAY_OF_WEEK},
+                {ALIGNED_DAY_OF_WEEK_IN_MONTH},
+                {ALIGNED_DAY_OF_WEEK_IN_YEAR},
+                {DAY_OF_MONTH},
+                {DAY_OF_YEAR},
+                {EPOCH_DAY},
+                {ALIGNED_WEEK_OF_MONTH},
+                {ALIGNED_WEEK_OF_YEAR},
+                {MONTH_OF_YEAR},
+                {PROLEPTIC_MONTH},
+                {YEAR_OF_ERA},
+                {YEAR},
+                {ERA},
+
+                {AMPM_OF_DAY},
+                {CLOCK_HOUR_OF_DAY},
+                {HOUR_OF_DAY},
+                {CLOCK_HOUR_OF_AMPM},
+                {HOUR_OF_AMPM},
+                {MINUTE_OF_DAY},
+                {MINUTE_OF_HOUR},
+                {SECOND_OF_DAY},
+                {SECOND_OF_MINUTE},
+                {MILLI_OF_DAY},
+                {MILLI_OF_SECOND},
+                {MICRO_OF_DAY},
+                {MICRO_OF_SECOND},
+                {NANO_OF_DAY},
+                {NANO_OF_SECOND},
+        };
+    }
+
+    @Test(dataProvider = "fieldBased")
+    public void test_fieldSerializable(ChronoField field) throws IOException, ClassNotFoundException {
+        assertSerializableSame(field);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,122 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.temporal.serial;
+
+import static java.time.temporal.ChronoUnit.CENTURIES;
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.DECADES;
+import static java.time.temporal.ChronoUnit.ERAS;
+import static java.time.temporal.ChronoUnit.FOREVER;
+import static java.time.temporal.ChronoUnit.HALF_DAYS;
+import static java.time.temporal.ChronoUnit.HOURS;
+import static java.time.temporal.ChronoUnit.MICROS;
+import static java.time.temporal.ChronoUnit.MILLENNIA;
+import static java.time.temporal.ChronoUnit.MILLIS;
+import static java.time.temporal.ChronoUnit.MINUTES;
+import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.NANOS;
+import static java.time.temporal.ChronoUnit.SECONDS;
+import static java.time.temporal.ChronoUnit.WEEKS;
+import static java.time.temporal.ChronoUnit.YEARS;
+
+import java.io.IOException;
+import java.time.temporal.ChronoUnit;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test.
+ */
+@Test
+public class TCKChronoUnitSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    // ChronoUnits
+    //-----------------------------------------------------------------------
+    @DataProvider(name="chronoUnit")
+    Object[][] data_chronoUnit() {
+        return new Object[][] {
+                {FOREVER},
+                {ERAS},
+                {MILLENNIA},
+                {CENTURIES},
+                {DECADES},
+                {YEARS},
+                {MONTHS},
+                {WEEKS},
+                {DAYS},
+
+                {HALF_DAYS},
+                {HOURS},
+                {MINUTES},
+                {SECONDS},
+                {MICROS},
+                {MILLIS},
+                {NANOS},
+
+        };
+    }
+
+    @Test(dataProvider = "chronoUnit")
+    public void test_unitType(ChronoUnit unit) throws IOException, ClassNotFoundException {
+        assertSerializableSame(unit);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKJulianFieldsSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.temporal.serial;
+
+import java.io.IOException;
+import java.time.temporal.JulianFields;
+import java.time.temporal.TemporalField;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test serialization of JulianFields
+ */
+@Test
+public class TCKJulianFieldsSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name="julian_fields")
+    Object[][] julian_samples() {
+        return new Object[][] {
+            {JulianFields.JULIAN_DAY},
+            {JulianFields.MODIFIED_JULIAN_DAY},
+            {JulianFields.RATA_DIE},
+        };
+    }
+
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="julian_fields")
+    public void test_serializable(TemporalField field) throws IOException, ClassNotFoundException {
+        assertSerializable(field);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.temporal.serial;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.time.temporal.ValueRange;
+
+import org.testng.annotations.Test;
+
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test serialization of ValueRange.
+ */
+@Test
+public class TCKValueRangeSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    // Serialization
+    //-----------------------------------------------------------------------
+    public void test_serialization() throws Exception {
+        ValueRange range = ValueRange.of(1, 2, 3, 4);
+        assertSerializable(range);
+    }
+
+
+    /**
+     * Verify Serialized bytes of a ValueRange.
+     * @throws IOException if thrown during serialization is an unexpected test tailure
+     */
+    public void test_valueRangeSerialized() throws IOException {
+        byte[] expected = {
+            (byte)172, (byte)237,   0,   5, 115, 114,   0,  29, 106,  97, /* \u00ac \u00ed \u0000 \u0005 s r \u0000 \u001d j a */
+            118,  97,  46, 116, 105, 109, 101,  46, 116, 101, /* v a . t i m e . t e */
+            109, 112, 111, 114,  97, 108,  46,  86,  97, 108, /* m p o r a l . V a l */
+            117, 101,  82,  97, 110, 103, 101, (byte)154, 113, (byte)169, /* u e R a n g e \u009a q \u00a9 */
+             86, (byte)242, (byte)205,  90, (byte)184,   2,   0,   4,  74,   0, /* V \u00f2 \u00cd Z \u00b8 \u0002 \u0000 \u0004 J \u0000 */
+             10, 109,  97, 120,  76,  97, 114, 103, 101, 115, /*  m a x L a r g e s */
+            116,  74,   0,  11, 109,  97, 120,  83, 109,  97, /* t J \u0000 \u000b m a x S m a */
+            108, 108, 101, 115, 116,  74,   0,  10, 109, 105,/* l l e s t J \u0000 m i */
+            110,  76,  97, 114, 103, 101, 115, 116,  74,   0, /* n L a r g e s t J \u0000 */
+             11, 109, 105, 110,  83, 109,  97, 108, 108, 101, /* \u000b m i n S m a l l e */
+            115, 116, 120, 112,   0,   0,   0,   0,   0,   0, /* s t x p \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 */
+              0,  40,   0,   0,   0,   0,   0,   0,   0,  30, /* \u0000 ( \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u001e */
+              0,   0,   0,   0,   0,   0,   0,  20,   0,   0, /* \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0000 \u0014 \u0000 \u0000 */
+              0,   0,   0,   0,   0,  10,                     /* \u0000 \u0000 \u0000 \u0000 \u0000 */
+        };
+
+        ValueRange range = ValueRange.of(10, 20, 30, 40);
+        try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(baos) ) {
+            oos.writeObject(range);
+
+            byte[] actual = baos.toByteArray();
+            assertEquals(actual, expected, "Serialized bytes incorrect");
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.temporal.serial;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.io.IOException;
+import java.time.DayOfWeek;
+import java.time.temporal.WeekFields;
+
+/**
+ * Test serialization of WeekFields.
+ */
+@Test
+public class TCKWeekFieldsSerialization extends AbstractTCKTest {
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="weekFields")
+    public void test_serializable_singleton(DayOfWeek firstDayOfWeek, int minDays) throws IOException, ClassNotFoundException {
+        WeekFields weekDef = WeekFields.of(firstDayOfWeek, minDays);
+        assertSerializableSame(weekDef);  // spec state singleton
+    }
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name="weekFields")
+    Object[][] data_weekFields() {
+        Object[][] objects = new Object[49][];
+        int i = 0;
+        for (DayOfWeek firstDayOfWeek : DayOfWeek.values()) {
+            for (int minDays = 1; minDays <= 7; minDays++) {
+                objects[i++] = new Object[] {firstDayOfWeek, minDays};
+            }
+        }
+        return objects;
+    }
+
+
+}
--- a/jdk/test/java/time/tck/java/time/zone/TCKFixedZoneRules.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/zone/TCKFixedZoneRules.java	Fri Oct 11 09:17:18 2013 -0400
@@ -107,25 +107,7 @@
     //-----------------------------------------------------------------------
     // Basics
     //-----------------------------------------------------------------------
-    @Test(dataProvider="rules")
-    public void test_serialization(ZoneRules test, ZoneOffset expectedOffset) throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(test);
-        baos.close();
-        byte[] bytes = baos.toByteArray();
 
-        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        ObjectInputStream in = new ObjectInputStream(bais);
-        ZoneRules result = (ZoneRules) in.readObject();
-
-        assertEquals(result, test);
-        assertEquals(result.getClass(), test.getClass());
-    }
-
-    //-----------------------------------------------------------------------
-    // basics
-    //-----------------------------------------------------------------------
     @Test(dataProvider="rules")
     public void test_getOffset_Instant(ZoneRules test, ZoneOffset expectedOffset) {
         assertEquals(test.getOffset(INSTANT), expectedOffset);
--- a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java	Fri Oct 11 09:17:18 2013 -0400
@@ -127,7 +127,6 @@
         assertEquals(test.getOffsetBefore(), OFFSET_0200);
         assertEquals(test.getOffsetAfter(), OFFSET_0300);
         assertEquals(test.getDuration(), Duration.of(1, HOURS));
-        assertSerializable(test);
     }
 
     @Test
@@ -143,23 +142,8 @@
         assertEquals(test.getOffsetBefore(), OFFSET_0300);
         assertEquals(test.getOffsetAfter(), OFFSET_0200);
         assertEquals(test.getDuration(), Duration.of(-1, HOURS));
-        assertSerializable(test);
     }
 
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_serialization_unusual1() throws Exception {
-        LocalDateTime ldt = LocalDateTime.of(Year.MAX_VALUE, 12, 31, 1, 31, 53);
-        ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("-10:02:34"));
-        assertSerializable(test);
-    }
-
-    @Test
-    public void test_serialization_unusual2() throws Exception {
-        LocalDateTime ldt = LocalDateTime.of(Year.MIN_VALUE, 1, 1, 12, 1, 3);
-        ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("+10:02:34"));
-        assertSerializable(test);
-    }
 
     //-----------------------------------------------------------------------
     // isValidOffset()
--- a/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java	Fri Oct 11 09:17:18 2013 -0400
@@ -173,7 +173,6 @@
         assertEquals(test.getStandardOffset(), OFFSET_0200);
         assertEquals(test.getOffsetBefore(), OFFSET_0200);
         assertEquals(test.getOffsetAfter(), OFFSET_0300);
-        assertSerializable(test);
     }
 
     @Test
@@ -190,7 +189,6 @@
         assertEquals(test.getStandardOffset(), OFFSET_0200);
         assertEquals(test.getOffsetBefore(), OFFSET_0200);
         assertEquals(test.getOffsetAfter(), OFFSET_0300);
-        assertSerializable(test);
     }
 
     @Test
@@ -207,34 +205,8 @@
         assertEquals(test.getStandardOffset(), OFFSET_0200);
         assertEquals(test.getOffsetBefore(), OFFSET_0200);
         assertEquals(test.getOffsetAfter(), OFFSET_0300);
-        assertSerializable(test);
-    }
-
-    @Test
-    public void test_serialization_unusualOffsets() throws Exception {
-        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
-                Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD,
-                ZoneOffset.ofHoursMinutesSeconds(-12, -20, -50),
-                ZoneOffset.ofHoursMinutesSeconds(-4, -10, -34),
-                ZoneOffset.ofHours(-18));
-        assertSerializable(test);
     }
 
-    @Test
-    public void test_serialization_endOfDay() throws Exception {
-        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
-                Month.MARCH, 20, DayOfWeek.FRIDAY, LocalTime.MIDNIGHT, true, TimeDefinition.UTC,
-                OFFSET_0200, OFFSET_0200, OFFSET_0300);
-        assertSerializable(test);
-    }
-
-    @Test
-    public void test_serialization_unusualTime() throws Exception {
-        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
-                Month.MARCH, 20, DayOfWeek.WEDNESDAY, LocalTime.of(13, 34, 56), false, TimeDefinition.STANDARD,
-                OFFSET_0200, OFFSET_0200, OFFSET_0300);
-        assertSerializable(test);
-    }
 
     //-----------------------------------------------------------------------
     // createTransition()
--- a/jdk/test/java/time/tck/java/time/zone/TCKZoneRules.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneRules.java	Fri Oct 11 09:17:18 2013 -0400
@@ -103,28 +103,7 @@
     private static final int OVERLAP = 2;
     private static final int GAP = 0;
 
-    //-----------------------------------------------------------------------
-    // Basics
-    //-----------------------------------------------------------------------
-    public void test_serialization_loaded() throws Exception {
-        assertSerialization(europeLondon());
-        assertSerialization(europeParis());
-        assertSerialization(americaNewYork());
-    }
 
-    private void assertSerialization(ZoneRules test) throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(test);
-        baos.close();
-        byte[] bytes = baos.toByteArray();
-
-        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        ObjectInputStream in = new ObjectInputStream(bais);
-        ZoneRules result = (ZoneRules) in.readObject();
-
-        assertEquals(result, test);
-    }
 
     //-----------------------------------------------------------------------
     // Europe/London
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRulesSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2010-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.zone.serial;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.time.ZoneOffset;
+import java.time.zone.ZoneRules;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Test serialization of ZoneRules for fixed offset time-zones.
+ */
+@Test
+public class TCKFixedZoneRulesSerialization {
+
+    private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
+    private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
+    private static final ZoneOffset OFFSET_M18 = ZoneOffset.ofHours(-18);
+
+    private ZoneRules make(ZoneOffset offset) {
+        return offset.getRules();
+    }
+
+    @DataProvider(name="rules")
+    Object[][] data_rules() {
+        return new Object[][] {
+            {make(OFFSET_PONE), OFFSET_PONE},
+            {make(OFFSET_PTWO), OFFSET_PTWO},
+            {make(OFFSET_M18), OFFSET_M18},
+        };
+    }
+
+    //-----------------------------------------------------------------------
+    // Basics
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="rules")
+    public void test_serialization(ZoneRules test, ZoneOffset expectedOffset) throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream(baos);
+        out.writeObject(test);
+        baos.close();
+        byte[] bytes = baos.toByteArray();
+
+        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        ObjectInputStream in = new ObjectInputStream(bais);
+        ZoneRules result = (ZoneRules) in.readObject();
+
+        assertEquals(result, test);
+        assertEquals(result.getClass(), test.getClass());
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2010-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.zone.serial;
+
+import java.time.DayOfWeek;
+import java.time.LocalTime;
+import java.time.Month;
+import java.time.ZoneOffset;
+import java.time.zone.ZoneOffsetTransitionRule;
+import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition;
+
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+/**
+ * Test ZoneOffsetTransitionRule serialization.
+ */
+@Test
+public class TCKZoneOffsetTransitionRuleSerialization extends AbstractTCKTest {
+
+    private static final LocalTime TIME_0100 = LocalTime.of(1, 0);
+    private static final ZoneOffset OFFSET_0200 = ZoneOffset.ofHours(2);
+    private static final ZoneOffset OFFSET_0300 = ZoneOffset.ofHours(3);
+
+
+    //-----------------------------------------------------------------------
+    // Test serialization
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization_unusualOffsets() throws Exception {
+        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
+                Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.STANDARD,
+                ZoneOffset.ofHoursMinutesSeconds(-12, -20, -50),
+                ZoneOffset.ofHoursMinutesSeconds(-4, -10, -34),
+                ZoneOffset.ofHours(-18));
+        assertSerializable(test);
+    }
+
+    @Test
+    public void test_serialization_endOfDay() throws Exception {
+        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
+                Month.MARCH, 20, DayOfWeek.FRIDAY, LocalTime.MIDNIGHT, true, TimeDefinition.UTC,
+                OFFSET_0200, OFFSET_0200, OFFSET_0300);
+        assertSerializable(test);
+    }
+
+    @Test
+    public void test_serialization_unusualTime() throws Exception {
+        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
+                Month.MARCH, 20, DayOfWeek.WEDNESDAY, LocalTime.of(13, 34, 56), false, TimeDefinition.STANDARD,
+                OFFSET_0200, OFFSET_0200, OFFSET_0300);
+        assertSerializable(test);
+    }
+
+    @Test
+    public void test_serialization_floatingWeek() throws Exception {
+        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
+                Month.MARCH, 20, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
+                OFFSET_0200, OFFSET_0200, OFFSET_0300);
+        assertSerializable(test);
+    }
+
+    @Test
+    public void test_serialization_floatingWeekBackwards() throws Exception {
+        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
+                Month.MARCH, -1, DayOfWeek.SUNDAY, TIME_0100, false, TimeDefinition.WALL,
+                OFFSET_0200, OFFSET_0200, OFFSET_0300);
+        assertSerializable(test);
+    }
+
+    @Test
+    public void test_serialization_fixedDate() throws Exception {
+        ZoneOffsetTransitionRule test = ZoneOffsetTransitionRule.of(
+                Month.MARCH, 20, null, TIME_0100, false, TimeDefinition.WALL,
+                OFFSET_0200, OFFSET_0200, OFFSET_0300);
+        assertSerializable(test);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2010-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.zone.serial;
+
+import static java.time.temporal.ChronoUnit.HOURS;
+
+import java.time.Duration;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
+import java.time.LocalDateTime;
+import java.time.Year;
+import java.time.ZoneOffset;
+import java.time.zone.ZoneOffsetTransition;
+
+/**
+ * Test serialization of ZoneOffsetTransition.
+ */
+@Test
+public class TCKZoneOffsetTransitionSerialization extends AbstractTCKTest {
+
+    private static final ZoneOffset OFFSET_0200 = ZoneOffset.ofHours(2);
+    private static final ZoneOffset OFFSET_0300 = ZoneOffset.ofHours(3);
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_serialization_unusual1() throws Exception {
+        LocalDateTime ldt = LocalDateTime.of(Year.MAX_VALUE, 12, 31, 1, 31, 53);
+        ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("-10:02:34"));
+        assertSerializable(test);
+    }
+
+    @Test
+    public void test_serialization_unusual2() throws Exception {
+        LocalDateTime ldt = LocalDateTime.of(Year.MIN_VALUE, 1, 1, 12, 1, 3);
+        ZoneOffsetTransition test = ZoneOffsetTransition.of(ldt, ZoneOffset.of("+02:04:56"), ZoneOffset.of("+10:02:34"));
+        assertSerializable(test);
+    }
+
+    @Test
+    public void test_serialization_gap() throws Exception {
+        LocalDateTime before = LocalDateTime.of(2010, 3, 31, 1, 0);
+        LocalDateTime after = LocalDateTime.of(2010, 3, 31, 2, 0);
+        ZoneOffsetTransition test = ZoneOffsetTransition.of(before, OFFSET_0200, OFFSET_0300);
+        assertSerializable(test);
+    }
+
+    @Test
+    public void test_serialization_overlap() throws Exception {
+        LocalDateTime before = LocalDateTime.of(2010, 10, 31, 1, 0);
+        LocalDateTime after = LocalDateTime.of(2010, 10, 31, 0, 0);
+        ZoneOffsetTransition test = ZoneOffsetTransition.of(before, OFFSET_0300, OFFSET_0200);
+        assertSerializable(test);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.zone.serial;
+
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.time.ZoneId;
+import java.time.zone.ZoneRules;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Test serialization of ZoneRules.
+ */
+@Test
+public class TCKZoneRulesSerialization {
+
+    public void test_serialization_loaded() throws Exception {
+        assertSerialization(europeLondon());
+        assertSerialization(europeParis());
+        assertSerialization(americaNewYork());
+    }
+
+    private void assertSerialization(ZoneRules test) throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream(baos);
+        out.writeObject(test);
+        baos.close();
+        byte[] bytes = baos.toByteArray();
+
+        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        ObjectInputStream in = new ObjectInputStream(bais);
+        ZoneRules result = (ZoneRules) in.readObject();
+
+        assertEquals(result, test);
+    }
+
+    //-----------------------------------------------------------------------
+    // Europe/London
+    //-----------------------------------------------------------------------
+    private ZoneRules europeLondon() {
+        return ZoneId.of("Europe/London").getRules();
+    }
+
+
+    //-----------------------------------------------------------------------
+    // Europe/Paris
+    //-----------------------------------------------------------------------
+    private ZoneRules europeParis() {
+        return ZoneId.of("Europe/Paris").getRules();
+    }
+
+    //-----------------------------------------------------------------------
+    // America/New_York
+    //-----------------------------------------------------------------------
+    private ZoneRules americaNewYork() {
+        return ZoneId.of("America/New_York").getRules();
+    }
+
+
+}
--- a/jdk/test/java/time/test/java/time/AbstractTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/test/java/time/AbstractTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -63,11 +63,6 @@
 import static org.testng.Assert.assertSame;
 import static org.testng.Assert.assertTrue;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
@@ -87,27 +82,6 @@
         return true;
     }
 
-    protected static void assertSerializable(Object o) throws IOException, ClassNotFoundException {
-        Object deserialisedObject = writeThenRead(o);
-        assertEquals(deserialisedObject, o);
-    }
-
-    protected static void assertSerializableAndSame(Object o) throws IOException, ClassNotFoundException {
-        Object deserialisedObject = writeThenRead(o);
-        assertSame(deserialisedObject, o);
-    }
-
-    private static Object writeThenRead(Object o) throws IOException, ClassNotFoundException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (ObjectOutputStream oos = new ObjectOutputStream(baos) ) {
-            oos.writeObject(o);
-        }
-
-        try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
-            return ois.readObject();
-        }
-    }
-
     protected static void assertImmutable(Class<?> cls) {
         assertTrue(Modifier.isPublic(cls.getModifiers()));
         assertTrue(Modifier.isFinal(cls.getModifiers()));
--- a/jdk/test/java/time/test/java/time/TestDuration.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/test/java/time/TestDuration.java	Fri Oct 11 09:17:18 2013 -0400
@@ -63,11 +63,6 @@
 import static org.testng.Assert.assertSame;
 import static org.testng.Assert.assertTrue;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
 import java.time.Duration;
 
 import org.testng.annotations.Test;
@@ -84,29 +79,6 @@
         assertImmutable(Duration.class);
     }
 
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_interfaces() {
-        assertTrue(Serializable.class.isAssignableFrom(Duration.class));
-        assertTrue(Comparable.class.isAssignableFrom(Duration.class));
-    }
-
-    //-----------------------------------------------------------------------
-    // serialization
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_deserializationSingleton() throws Exception {
-        Duration orginal = Duration.ZERO;
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(baos);
-        out.writeObject(orginal);
-        out.close();
-        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-        ObjectInputStream in = new ObjectInputStream(bais);
-        Duration ser = (Duration) in.readObject();
-        assertSame(ser, Duration.ZERO);
-    }
-
     @Test
     public void plus_zeroReturnsThis() {
         Duration t = Duration.ofSeconds(-1);
--- a/jdk/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java	Fri Oct 11 09:17:18 2013 -0400
@@ -26,9 +26,9 @@
 package test.java.time.chrono;
 
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_YEAR;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.YEAR;
-import static java.time.temporal.ChronoField.DAY_OF_YEAR;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
@@ -39,12 +39,12 @@
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.OffsetDateTime;
-import java.time.Period;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.ChronoPeriod;
 import java.time.chrono.ChronoZonedDateTime;
 import java.time.chrono.Chronology;
 import java.time.chrono.HijrahChronology;
@@ -330,26 +330,26 @@
     @DataProvider(name="datesForPeriod")
     Object[][] data_Period() {
         return new Object[][] {
-            {HijrahDate.of(1350, 5, 15), HijrahDate.of(1434, 7, 20), Period.of(84, 2, 5)},
-            {HijrahDate.of(1403, 5, 28), HijrahDate.of(1434, 7, 20), Period.of(31, 1, 22)},
-            {HijrahDate.of(1434, 7, 20), HijrahDate.of(1484, 2, 15), Period.of(49, 6, 24)},
-            {HijrahDate.of(1500, 6, 12), HijrahDate.of(1450, 4, 21), Period.of(-50, -1, -20)},
-            {HijrahDate.of(1549, 3, 11), HijrahDate.of(1550, 3, 10), Period.of(0, 11, 28)},
+            {HijrahDate.of(1350, 5, 15), HijrahDate.of(1434, 7, 20), HijrahChronology.INSTANCE.period(84, 2, 5)},
+            {HijrahDate.of(1403, 5, 28), HijrahDate.of(1434, 7, 20), HijrahChronology.INSTANCE.period(31, 1, 22)},
+            {HijrahDate.of(1434, 7, 20), HijrahDate.of(1484, 2, 15), HijrahChronology.INSTANCE.period(49, 6, 24)},
+            {HijrahDate.of(1500, 6, 12), HijrahDate.of(1450, 4, 21), HijrahChronology.INSTANCE.period(-50, -1, -20)},
+            {HijrahDate.of(1549, 3, 11), HijrahDate.of(1550, 3, 10), HijrahChronology.INSTANCE.period(0, 11, 28)},
         };
     }
 
     // Test to get the Period between two given dates
     @Test(dataProvider="datesForPeriod")
-    public void test_until(HijrahDate h1, HijrahDate h2, Period p) {
-        Period period = h1.until(h2);
+    public void test_until(HijrahDate h1, HijrahDate h2, ChronoPeriod p) {
+        ChronoPeriod period = h1.until(h2);
         assertEquals(period, p);
     }
 
     // Test to get the Period between dates in different chronologies
     @Test(dataProvider="datesForPeriod")
-    public void test_periodUntilDiffChrono(HijrahDate h1, HijrahDate h2, Period p) {
+    public void test_periodUntilDiffChrono(HijrahDate h1, HijrahDate h2, ChronoPeriod p) {
         MinguoDate m = MinguoChronology.INSTANCE.date(h2);
-        Period period = h1.until(m);
+        ChronoPeriod period = h1.until(m);
         assertEquals(period, p);
     }
 
--- a/jdk/test/java/time/test/java/time/format/TestDateTimeFormatter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/test/java/time/format/TestDateTimeFormatter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -61,12 +61,32 @@
 
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
 import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
 
-import java.time.format.DecimalStyle;
+import java.time.DateTimeException;
+import java.time.DayOfWeek;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.Month;
+import java.time.MonthDay;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.Year;
+import java.time.YearMonth;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.chrono.ThaiBuddhistChronology;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.DecimalStyle;
 import java.time.format.SignStyle;
+import java.time.temporal.TemporalAccessor;
 import java.util.Locale;
+import java.util.function.Function;
 
 import org.testng.annotations.Test;
 
@@ -87,4 +107,93 @@
         assertSame(test, base);
     }
 
+    @Test
+    public void test_parse_errorMessage() throws Exception {
+        assertGoodErrorDate(DayOfWeek::from, "DayOfWeek");
+        assertGoodErrorDate(Month::from, "Month");
+        assertGoodErrorDate(YearMonth::from, "YearMonth");
+        assertGoodErrorDate(MonthDay::from, "MonthDay");
+        assertGoodErrorDate(LocalDate::from, "LocalDate");
+        assertGoodErrorDate(LocalTime::from, "LocalTime");
+        assertGoodErrorDate(LocalDateTime::from, "LocalDateTime");
+        assertGoodErrorDate(OffsetTime::from, "OffsetTime");
+        assertGoodErrorDate(OffsetDateTime::from, "OffsetDateTime");
+        assertGoodErrorDate(ZonedDateTime::from, "ZonedDateTime");
+        assertGoodErrorDate(Instant::from, "Instant");
+        assertGoodErrorDate(ZoneOffset::from, "ZoneOffset");
+        assertGoodErrorDate(ZoneId::from, "ZoneId");
+        assertGoodErrorDate(ThaiBuddhistChronology.INSTANCE::date, "");
+
+        assertGoodErrorTime(DayOfWeek::from, "DayOfWeek");
+        assertGoodErrorTime(Month::from, "Month");
+        assertGoodErrorTime(Year::from, "Year");
+        assertGoodErrorTime(YearMonth::from, "YearMonth");
+        assertGoodErrorTime(MonthDay::from, "MonthDay");
+        assertGoodErrorTime(LocalDate::from, "LocalDate");
+        assertGoodErrorTime(LocalTime::from, "LocalTime");
+        assertGoodErrorTime(LocalDateTime::from, "LocalDateTime");
+        assertGoodErrorTime(OffsetTime::from, "OffsetTime");
+        assertGoodErrorTime(OffsetDateTime::from, "OffsetDateTime");
+        assertGoodErrorTime(ZonedDateTime::from, "ZonedDateTime");
+        assertGoodErrorTime(Instant::from, "Instant");
+        assertGoodErrorTime(ZoneOffset::from, "ZoneOffset");
+        assertGoodErrorTime(ZoneId::from, "ZoneId");
+        assertGoodErrorTime(ThaiBuddhistChronology.INSTANCE::date, "");
+    }
+
+    private void assertGoodErrorDate(Function<TemporalAccessor, Object> function, String expectedText) {
+        DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-mm-dd");
+        TemporalAccessor temporal = f.parse("2010-06-30");
+        try {
+            function.apply(temporal);
+            fail("Should have failed");
+        } catch (DateTimeException ex) {
+            String msg = ex.getMessage();
+            assertTrue(msg.contains(expectedText), msg);
+            assertTrue(msg.contains("Year"), msg);
+            assertTrue(msg.contains("MinuteOfHour"), msg);
+            assertTrue(msg.contains("DayOfMonth"), msg);
+        }
+    }
+
+    private void assertGoodErrorTime(Function<TemporalAccessor, Object> function, String expectedText) {
+        DateTimeFormatter f = DateTimeFormatter.ofPattern("HH:MM:ss");
+        TemporalAccessor temporal = f.parse("11:30:56");
+        try {
+            function.apply(temporal);
+            fail("Should have failed");
+        } catch (DateTimeException ex) {
+            String msg = ex.getMessage();
+            assertTrue(msg.contains(expectedText), msg);
+            assertTrue(msg.contains("HourOfDay"), msg);
+            assertTrue(msg.contains("MonthOfYear"), msg);
+            assertTrue(msg.contains("SecondOfMinute"), msg);
+        }
+    }
+
+    @Test
+    public void test_parsed_toString_resolvedTime() {
+        DateTimeFormatter f = DateTimeFormatter.ofPattern("HH:mm:ss");
+        TemporalAccessor temporal = f.parse("11:30:56");
+        String msg = temporal.toString();
+        assertTrue(msg.contains("11:30:56"), msg);
+    }
+
+    @Test
+    public void test_parsed_toString_resolvedDate() {
+        DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        TemporalAccessor temporal = f.parse("2010-06-30");
+        String msg = temporal.toString();
+        assertTrue(msg.contains("2010-06-30"), msg);
+    }
+
+    @Test
+    public void test_parsed_toString_resolvedDateTime() {
+        DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        TemporalAccessor temporal = f.parse("2010-06-30 11:30:56");
+        String msg = temporal.toString();
+        assertTrue(msg.contains("2010-06-30"), msg);
+        assertTrue(msg.contains("11:30:56"), msg);
+    }
+
 }
--- a/jdk/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java	Fri Oct 11 09:17:18 2013 -0400
@@ -267,12 +267,12 @@
     //-----------------------------------------------------------------------
     @Test(expectedExceptions=NullPointerException.class)
     public void test_appendValueReduced_null() throws Exception {
-        builder.appendValueReduced(null, 2, 2000);
+        builder.appendValueReduced(null, 2, 2, 2000);
     }
 
     @Test
     public void test_appendValueReduced() throws Exception {
-        builder.appendValueReduced(YEAR, 2, 2000);
+        builder.appendValueReduced(YEAR, 2, 2, 2000);
         DateTimeFormatter f = builder.toFormatter();
         assertEquals(f.toString(), "ReducedValue(Year,2,2,2000)");
         TemporalAccessor parsed = f.parseUnresolved("12", new ParsePosition(0));
@@ -281,7 +281,7 @@
 
     @Test
     public void test_appendValueReduced_subsequent_parse() throws Exception {
-        builder.appendValue(MONTH_OF_YEAR, 1, 2, SignStyle.NORMAL).appendValueReduced(YEAR, 2, 2000);
+        builder.appendValue(MONTH_OF_YEAR, 1, 2, SignStyle.NORMAL).appendValueReduced(YEAR, 2, 2, 2000);
         DateTimeFormatter f = builder.toFormatter();
         assertEquals(f.toString(), "Value(MonthOfYear,1,2,NORMAL)ReducedValue(Year,2,2,2000)");
         ParsePosition ppos = new ParsePosition(0);
@@ -654,19 +654,19 @@
             {"GGGGG", "Text(Era,NARROW)"},
 
             {"u", "Value(Year)"},
-            {"uu", "ReducedValue(Year,2,2,2000)"},
+            {"uu", "ReducedValue(Year,2,2,2000-01-01)"},
             {"uuu", "Value(Year,3,19,NORMAL)"},
             {"uuuu", "Value(Year,4,19,EXCEEDS_PAD)"},
             {"uuuuu", "Value(Year,5,19,EXCEEDS_PAD)"},
 
             {"y", "Value(YearOfEra)"},
-            {"yy", "ReducedValue(YearOfEra,2,2,2000)"},
+            {"yy", "ReducedValue(YearOfEra,2,2,2000-01-01)"},
             {"yyy", "Value(YearOfEra,3,19,NORMAL)"},
             {"yyyy", "Value(YearOfEra,4,19,EXCEEDS_PAD)"},
             {"yyyyy", "Value(YearOfEra,5,19,EXCEEDS_PAD)"},
 
             {"Y", "Localized(WeekBasedYear)"},
-            {"YY", "Localized(ReducedValue(WeekBasedYear,2,2000))"},
+            {"YY", "Localized(ReducedValue(WeekBasedYear,2,2,2000-01-01))"},
             {"YYY", "Localized(WeekBasedYear,3,19,NORMAL)"},
             {"YYYY", "Localized(WeekBasedYear,4,19,EXCEEDS_PAD)"},
             {"YYYYY", "Localized(WeekBasedYear,5,19,EXCEEDS_PAD)"},
--- a/jdk/test/java/time/test/java/time/format/TestReducedParser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/test/java/time/format/TestReducedParser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -64,11 +64,20 @@
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoUnit.YEARS;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.assertNotNull;
 
 import java.text.ParsePosition;
+import java.time.LocalDate;
+import java.time.chrono.Chronology;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.HijrahChronology;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.ThaiBuddhistChronology;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.temporal.TemporalAccessor;
@@ -86,13 +95,17 @@
     private static final boolean LENIENT = false;
 
     private DateTimeFormatter getFormatter0(TemporalField field, int width, int baseValue) {
-        return builder.appendValueReduced(field, width, baseValue).toFormatter(locale).withDecimalStyle(decimalStyle);
+        return builder.appendValueReduced(field, width, width, baseValue).toFormatter(locale).withDecimalStyle(decimalStyle);
     }
 
     private DateTimeFormatter getFormatter0(TemporalField field, int minWidth, int maxWidth, int baseValue) {
         return builder.appendValueReduced(field, minWidth, maxWidth, baseValue).toFormatter(locale).withDecimalStyle(decimalStyle);
     }
 
+    private DateTimeFormatter getFormatterBaseDate(TemporalField field, int minWidth, int maxWidth, int baseValue) {
+        return builder.appendValueReduced(field, minWidth, maxWidth, LocalDate.of(baseValue, 1, 1)).toFormatter(locale).withDecimalStyle(decimalStyle);
+    }
+
     //-----------------------------------------------------------------------
     @DataProvider(name="error")
     Object[][] data_error() {
@@ -243,6 +256,10 @@
 
             // Negative baseValue
             {YEAR, 2, 4, -2005, "123", 0, strict(3, 123), lenient(3, 123)},
+
+            // Basics
+            {YEAR, 2, 4, 2010, "10", 0, strict(2, 2010), lenient(2, 2010)},
+            {YEAR, 2, 4, 2010, "09", 0, strict(2, 2109), lenient(2, 2109)},
         };
     }
 
@@ -264,6 +281,21 @@
         }
     }
 
+    @Test(dataProvider="ParseLenientSensitive")
+    public void test_parseStrict_baseDate(TemporalField field, int minWidth, int maxWidth, int baseValue, String input, int pos,
+                                 Pair strict, Pair lenient) {
+        ParsePosition ppos = new ParsePosition(pos);
+        setStrict(true);
+        TemporalAccessor parsed = getFormatterBaseDate(field, minWidth, maxWidth, baseValue).parseUnresolved(input, ppos);
+        if (ppos.getErrorIndex() != -1) {
+            assertEquals(ppos.getErrorIndex(), strict.parseLen, "error case parse position");
+            assertEquals(parsed, strict.parseVal, "unexpected parse result");
+        } else {
+            assertEquals(ppos.getIndex(), strict.parseLen, "parse position");
+            assertParsed(parsed, YEAR, strict.parseVal != null ? (long) strict.parseVal : null);
+        }
+    }
+
     //-----------------------------------------------------------------------
     // Parsing tests for lenient mode
     //-----------------------------------------------------------------------
@@ -282,6 +314,21 @@
         }
     }
 
+    @Test(dataProvider="ParseLenientSensitive")
+    public void test_parseLenient_baseDate(TemporalField field, int minWidth, int maxWidth, int baseValue, String input, int pos,
+                                  Pair strict, Pair lenient) {
+        ParsePosition ppos = new ParsePosition(pos);
+        setStrict(false);
+        TemporalAccessor parsed = getFormatterBaseDate(field, minWidth, maxWidth, baseValue).parseUnresolved(input, ppos);
+        if (ppos.getErrorIndex() != -1) {
+            assertEquals(ppos.getErrorIndex(), lenient.parseLen, "error case parse position");
+            assertEquals(parsed, lenient.parseVal, "unexpected parse result");
+        } else {
+            assertEquals(ppos.getIndex(), lenient.parseLen, "parse position");
+            assertParsed(parsed, YEAR, lenient.parseVal != null ? (long) lenient.parseVal : null);
+        }
+    }
+
     private void assertParsed(TemporalAccessor parsed, TemporalField field, Long value) {
         if (value == null) {
             assertEquals(parsed, null, "Parsed Value");
@@ -335,6 +382,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // Cases and values in reduced value parsing mode
+    //-----------------------------------------------------------------------
+    @DataProvider(name="ReducedWithChrono")
+    Object[][] provider_reducedWithChrono() {
+        LocalDate baseYear = LocalDate.of(2000, 1, 1);
+        return new Object[][] {
+            {IsoChronology.INSTANCE.date(baseYear)},
+            {IsoChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
+            {IsoChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
+            {HijrahChronology.INSTANCE.date(baseYear)},
+            {HijrahChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
+            {HijrahChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
+            {JapaneseChronology.INSTANCE.date(baseYear)},
+            {JapaneseChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
+            {JapaneseChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
+            {MinguoChronology.INSTANCE.date(baseYear)},
+            {MinguoChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
+            {MinguoChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
+            {ThaiBuddhistChronology.INSTANCE.date(baseYear)},
+            {ThaiBuddhistChronology.INSTANCE.date(baseYear).plus(1, YEARS)},
+            {ThaiBuddhistChronology.INSTANCE.date(baseYear).plus(99, YEARS)},
+        };
+    }
+
+    @Test(dataProvider="ReducedWithChrono")
+    public void test_reducedWithChronoYear(ChronoLocalDate date) {
+        Chronology chrono = date.getChronology();
+        DateTimeFormatter df
+                = new DateTimeFormatterBuilder().appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
+                .toFormatter()
+                .withChronology(chrono);
+        int expected = date.get(YEAR);
+        String input = df.format(date);
+
+        ParsePosition pos = new ParsePosition(0);
+        TemporalAccessor parsed = df.parseUnresolved(input, pos);
+        int actual = parsed.get(YEAR);
+        assertEquals(actual, expected,
+                String.format("Wrong date parsed, chrono: %s, input: %s",
+                chrono, input));
+
+    }
+    @Test(dataProvider="ReducedWithChrono")
+    public void test_reducedWithChronoYearOfEra(ChronoLocalDate date) {
+        Chronology chrono = date.getChronology();
+        DateTimeFormatter df
+                = new DateTimeFormatterBuilder().appendValueReduced(YEAR_OF_ERA, 2, 2, LocalDate.of(2000, 1, 1))
+                .toFormatter()
+                .withChronology(chrono);
+        int expected = date.get(YEAR_OF_ERA);
+        String input = df.format(date);
+
+        ParsePosition pos = new ParsePosition(0);
+        TemporalAccessor parsed = df.parseUnresolved(input, pos);
+        int actual = parsed.get(YEAR_OF_ERA);
+        assertEquals(actual, expected,
+                String.format("Wrong date parsed, chrono: %s, input: %s",
+                chrono, input));
+
+    }
+
+    //-----------------------------------------------------------------------
     // Class to structure the test data
     //-----------------------------------------------------------------------
 
--- a/jdk/test/java/time/test/java/time/format/TestReducedPrinter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/test/java/time/format/TestReducedPrinter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -59,19 +59,15 @@
  */
 package test.java.time.format;
 
-import java.text.ParsePosition;
 import static java.time.temporal.ChronoField.YEAR;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 
 import java.time.DateTimeException;
 import java.time.LocalDate;
+import java.time.chrono.MinguoDate;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
-import static java.time.temporal.ChronoField.DAY_OF_MONTH;
-import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
-import static java.time.temporal.ChronoField.YEAR_OF_ERA;
-import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalField;
 
 import org.testng.annotations.DataProvider;
@@ -85,13 +81,17 @@
 public class TestReducedPrinter extends AbstractTestPrinterParser {
 
     private DateTimeFormatter getFormatter0(TemporalField field, int width, int baseValue) {
-        return builder.appendValueReduced(field, width, baseValue).toFormatter(locale).withDecimalStyle(decimalStyle);
+        return builder.appendValueReduced(field, width, width, baseValue).toFormatter(locale).withDecimalStyle(decimalStyle);
     }
 
     private DateTimeFormatter getFormatter0(TemporalField field, int minWidth, int maxWidth, int baseValue) {
         return builder.appendValueReduced(field, minWidth, maxWidth, baseValue).toFormatter(locale).withDecimalStyle(decimalStyle);
     }
 
+    private DateTimeFormatter getFormatterBaseDate(TemporalField field, int minWidth, int maxWidth, int baseValue) {
+        return builder.appendValueReduced(field, minWidth, maxWidth, LocalDate.of(baseValue, 1, 1)).toFormatter(locale).withDecimalStyle(decimalStyle);
+    }
+
     //-----------------------------------------------------------------------
     @Test(expectedExceptions=DateTimeException.class)
     public void test_print_emptyCalendrical() throws Exception {
@@ -192,6 +192,58 @@
         }
     }
 
+    @Test(dataProvider="Pivot")
+    public void test_pivot_baseDate(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception {
+        try {
+            getFormatterBaseDate(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf);
+            if (result == null) {
+                fail("Expected exception");
+            }
+            assertEquals(buf.toString(), result);
+        } catch (DateTimeException ex) {
+            if (result == null || value < 0) {
+                assertEquals(ex.getMessage().contains(YEAR.toString()), true);
+            } else {
+                throw ex;
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    public void test_minguoChrono_fixedWidth() throws Exception {
+        // ISO 2021 is Minguo 110
+        DateTimeFormatter f = getFormatterBaseDate(YEAR, 2, 2, 2021);
+        MinguoDate date = MinguoDate.of(109, 6, 30);
+        assertEquals(f.format(date), "09");
+        date = MinguoDate.of(110, 6, 30);
+        assertEquals(f.format(date), "10");
+        date = MinguoDate.of(199, 6, 30);
+        assertEquals(f.format(date), "99");
+        date = MinguoDate.of(200, 6, 30);
+        assertEquals(f.format(date), "00");
+        date = MinguoDate.of(209, 6, 30);
+        assertEquals(f.format(date), "09");
+        date = MinguoDate.of(210, 6, 30);
+        assertEquals(f.format(date), "10");
+    }
+
+    public void test_minguoChrono_extendedWidth() throws Exception {
+        // ISO 2021 is Minguo 110
+        DateTimeFormatter f = getFormatterBaseDate(YEAR, 2, 4, 2021);
+        MinguoDate date = MinguoDate.of(109, 6, 30);
+        assertEquals(f.format(date), "109");
+        date = MinguoDate.of(110, 6, 30);
+        assertEquals(f.format(date), "10");
+        date = MinguoDate.of(199, 6, 30);
+        assertEquals(f.format(date), "99");
+        date = MinguoDate.of(200, 6, 30);
+        assertEquals(f.format(date), "00");
+        date = MinguoDate.of(209, 6, 30);
+        assertEquals(f.format(date), "09");
+        date = MinguoDate.of(210, 6, 30);
+        assertEquals(f.format(date), "210");
+    }
+
     //-----------------------------------------------------------------------
     public void test_toString() throws Exception {
         assertEquals(getFormatter0(YEAR, 2, 2, 2005).toString(), "ReducedValue(Year,2,2,2005)");
--- a/jdk/test/java/time/test/java/time/temporal/TestDateTimeValueRange.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/time/test/java/time/temporal/TestDateTimeValueRange.java	Fri Oct 11 09:17:18 2013 -0400
@@ -88,19 +88,6 @@
     }
 
     //-----------------------------------------------------------------------
-    // Serialization
-    //-----------------------------------------------------------------------
-    public void test_serialization() throws Exception {
-        Object obj = ValueRange.of(1, 2, 3, 4);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream oos = new ObjectOutputStream(baos);
-        oos.writeObject(obj);
-        oos.close();
-        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
-        assertEquals(ois.readObject(), obj);
-    }
-
-    //-----------------------------------------------------------------------
     // of(long,long)
     //-----------------------------------------------------------------------
     public void test_of_longlong() {
--- a/jdk/test/java/util/Collection/MOAT.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/util/Collection/MOAT.java	Fri Oct 11 09:17:18 2013 -0400
@@ -26,7 +26,7 @@
  * @bug     6207984 6272521 6192552 6269713 6197726 6260652 5073546 4137464
  *          4155650 4216399 4294891 6282555 6318622 6355327 6383475 6420753
  *          6431845 4802633 6570566 6570575 6570631 6570924 6691185 6691215
- *          4802647 7123424
+ *          4802647 7123424 8024709
  * @summary Run many tests on many Collection and Map implementations
  * @author  Martin Buchholz
  * @run main MOAT
@@ -1171,9 +1171,46 @@
             THROWS(NoSuchElementException.class,
                    new Fun(){void f(){it.next();}});
         }
+
+        prepMapForDescItrTests(m);
+        checkDescItrRmFirst(m.keySet(), m.navigableKeySet().descendingIterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmMid(m.keySet(), m.navigableKeySet().descendingIterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmLast(m.keySet(), m.navigableKeySet().descendingIterator());
+
+        prepMapForDescItrTests(m);
+        checkDescItrRmFirst(m.keySet(), m.descendingMap().keySet().iterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmMid(m.keySet(), m.descendingMap().keySet().iterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmLast(m.keySet(), m.descendingMap().keySet().iterator());
+
+        prepMapForDescItrTests(m);
+        checkDescItrRmFirst(m.keySet(), m.descendingKeySet().iterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmMid(m.keySet(), m.descendingKeySet().iterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmLast(m.keySet(), m.descendingKeySet().iterator());
+
+        prepMapForDescItrTests(m);
+        checkDescItrRmFirst(m.values(), m.descendingMap().values().iterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmMid(m.values(), m.descendingMap().values().iterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmLast(m.values(), m.descendingMap().values().iterator());
+
+        prepMapForDescItrTests(m);
+        checkDescItrRmFirst((Collection)m.entrySet(),
+                            m.descendingMap().entrySet().iterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmMid((Collection)m.entrySet(),
+                          m.descendingMap().entrySet().iterator());
+        prepMapForDescItrTests(m);
+        checkDescItrRmLast((Collection)m.entrySet(),
+                           m.descendingMap().entrySet().iterator());
     }
 
-
     private static void testNavigableSet(NavigableSet<Integer> s) {
         clear(s);
         checkNavigableSetKeys(s, 1, null, null, null, null);
@@ -1205,6 +1242,87 @@
             THROWS(NoSuchElementException.class,
                    new Fun(){void f(){it.next();}});
         }
+
+        prepSetForDescItrTests(s);
+        checkDescItrRmFirst(s, s.descendingIterator());
+        prepSetForDescItrTests(s);
+        checkDescItrRmMid(s, s.descendingIterator());
+        prepSetForDescItrTests(s);
+        checkDescItrRmLast(s, s.descendingIterator());
+
+        prepSetForDescItrTests(s);
+        checkDescItrRmFirst(s, s.descendingSet().iterator());
+        prepSetForDescItrTests(s);
+        checkDescItrRmMid(s, s.descendingSet().iterator());
+        prepSetForDescItrTests(s);
+        checkDescItrRmLast(s, s.descendingSet().iterator());
+    }
+
+    private static void prepSetForDescItrTests(Set s) {
+        clear(s);
+        check(s.add(1));
+        check(s.add(3));
+        check(s.add(5));
+    }
+
+    private static void prepMapForDescItrTests(Map m) {
+        clear(m);
+        equal(m.put(1, 2), null);
+        equal(m.put(3, 4), null);
+        equal(m.put(5, 9), null);
+    }
+
+    //--------------------------------------------------------------------
+    // Check behavior of descending iterator when first element is removed
+    //--------------------------------------------------------------------
+    private static <T> void checkDescItrRmFirst(Collection<T> ascColl,
+                                                Iterator<T> descItr) {
+        T[] expected = (T[]) ascColl.toArray();
+        int idx = expected.length -1;
+
+        equalNext(descItr, expected[idx--]);
+        descItr.remove();
+        while(idx >= 0 && descItr.hasNext()) {
+            equalNext(descItr, expected[idx--]);
+        }
+        equal(descItr.hasNext(), false);
+        equal(idx, -1);
+    }
+
+    //-----------------------------------------------------------------------
+    // Check behavior of descending iterator when a middle element is removed
+    //-----------------------------------------------------------------------
+    private static <T> void checkDescItrRmMid(Collection<T> ascColl,
+                                              Iterator<T> descItr) {
+        T[] expected = (T[]) ascColl.toArray();
+        int idx = expected.length -1;
+
+        while (idx >= expected.length / 2) {
+            equalNext(descItr, expected[idx--]);
+        }
+        descItr.remove();
+        while (idx >= 0 && descItr.hasNext()) {
+            equalNext(descItr, expected[idx--]);
+        }
+        equal(descItr.hasNext(), false);
+        equal(idx, -1);
+    }
+
+    //-----------------------------------------------------------------------
+    // Check behavior of descending iterator when the last element is removed
+    //-----------------------------------------------------------------------
+    private static <T> void checkDescItrRmLast(Collection<T> ascColl,
+                                               Iterator<T> descItr) {
+        T[] expected = (T[]) ascColl.toArray();
+        int idx = expected.length -1;
+
+        while (idx >= 0 && descItr.hasNext()) {
+            equalNext(descItr, expected[idx--]);
+        }
+        equal(idx, -1);
+        equal(descItr.hasNext(), false);
+        descItr.remove();
+        equal(ascColl.contains(expected[0]), false);
     }
 
     //--------------------- Infrastructure ---------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/HashSet/Serialization.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,111 @@
+/*
+ * 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.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
+
+/*
+ * @test
+ * @bug 8016252
+ * @summary Verify that a serialized HashSet may successfully be deserialized.
+ */
+public class Serialization {
+
+    private static final int NUM_SETS = 43;
+    private static final int MAX_CAPACITY = 257;
+    private static final float MAX_LOAD_FACTOR = 100.0F;
+
+    private static final Random rnd = ThreadLocalRandom.current();
+
+    private static HashSet<Integer> createHashSet() {
+        int capacity = rnd.nextInt(MAX_CAPACITY);
+        float loadFactor = Float.MIN_VALUE + rnd.nextFloat()*MAX_LOAD_FACTOR;
+        HashSet<Integer> hashSet = new HashSet<Integer>(capacity, loadFactor);
+        float multiplier = 2*rnd.nextFloat(); // range [0,2]
+        int size = (int)(capacity*loadFactor*multiplier);
+        for (int i = 0; i < size; i++) {
+            hashSet.add(rnd.nextInt());
+        }
+        return hashSet;
+    }
+
+    private static HashSet<Integer> serDeser(HashSet<Integer> hashSet) throws IOException, ClassNotFoundException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        oos.writeObject(hashSet);
+        oos.flush();
+
+        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        ObjectInputStream ois = new ObjectInputStream(bais);
+        HashSet<Integer> result = (HashSet<Integer>)ois.readObject();
+
+        oos.close();
+        ois.close();
+
+        return result;
+    }
+
+    private static void printHashSet(HashSet<Integer> hashSet) {
+        System.err.println("Size: "+hashSet.size());
+        for (Object o : hashSet) {
+            System.err.println(o);
+        }
+    }
+
+    public static void main(String[] args) {
+        int failures = 0;
+
+        for (int i = 0; i < NUM_SETS; i++) {
+            HashSet<Integer> hashSet = createHashSet();
+
+            HashSet<Integer> result = null;
+            try {
+                result = serDeser(hashSet);
+            } catch (IOException ioe) {
+                System.err.println(ioe);
+                failures++;
+            } catch (ClassNotFoundException cnfe) {
+                System.err.println(cnfe);
+                failures++;
+            }
+
+            if (!hashSet.equals(result)) {
+                System.err.println("Unequal HashSets!");
+                printHashSet(hashSet);
+                System.err.println();
+                failures++;
+            }
+        }
+
+        if (failures != 0) {
+            throw new RuntimeException("HashSet/Serialzation failed with "+
+                    failures+" failures!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Level/CustomLevel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,96 @@
+/*
+ * 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.io.*;
+import java.util.*;
+import java.util.logging.*;
+
+/*
+ * @test
+ * @bug 8026027
+ * @summary Test Level.parse to look up custom levels by name and its
+ *          localized name
+ *
+ * @run main/othervm CustomLevel
+ */
+
+public class CustomLevel extends Level {
+    public CustomLevel(String name, int value, String resourceBundleName) {
+        super(name, value, resourceBundleName);
+    }
+
+    private static final List<Level> levels = new ArrayList<>();
+    private static final String RB_NAME = "myresource";
+    public static void main(String[] args) throws Exception {
+        setupCustomLevels();
+
+        // Level.parse will return the custom Level instance
+        ResourceBundle rb = ResourceBundle.getBundle(RB_NAME);
+        for (Level level : levels) {
+            String name = level.getName();
+            if (!name.equals("WARNING") && !name.equals("INFO")) {
+                // custom level whose name doesn't conflict with any standard one
+                checkCustomLevel(Level.parse(name), level);
+            }
+            String localizedName = rb.getString(level.getName());
+            Level l = Level.parse(localizedName);
+            if (l != level) {
+                throw new RuntimeException("Unexpected level " + l + " " + l.getClass());
+            }
+        }
+    }
+
+    private static void setupCustomLevels() throws IOException {
+        levels.add(new CustomLevel("EMERGENCY", 1090, RB_NAME));
+        levels.add(new CustomLevel("ALERT", 1060, RB_NAME));
+        levels.add(new CustomLevel("CRITICAL", 1030, RB_NAME));
+        levels.add(new CustomLevel("WARNING", 1010, RB_NAME));
+        levels.add(new CustomLevel("INFO", 1000, RB_NAME));
+    }
+    static void checkCustomLevel(Level level, Level expected) {
+        // Level value must be the same
+        if (!level.equals(expected)) {
+            throw new RuntimeException(formatLevel(level) + " != " + formatLevel(expected));
+        }
+
+        if (!level.getName().equals(expected.getName())) {
+            throw new RuntimeException(formatLevel(level) + " != " + formatLevel(expected));
+        }
+
+        // Level.parse is expected to return the custom Level
+        if (level != expected) {
+            throw new RuntimeException(formatLevel(level) + " != " + formatLevel(expected));
+        }
+
+        ResourceBundle rb = ResourceBundle.getBundle(RB_NAME);
+        String name = rb.getString(level.getName());
+        if (!level.getLocalizedName().equals(name)) {
+            // must have the same localized name
+            throw new RuntimeException(level.getLocalizedName() + " != " + name);
+        }
+    }
+
+    static String formatLevel(Level l) {
+        return l + ":" + l.intValue() + ":" + l.getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/Level/myresource.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,5 @@
+EMERGENCY=localized.emergency
+ALERT=localized.alert
+CRITICAL=localized.critical
+WARNING=localized.warning
+INFO=localized.info
--- a/jdk/test/java/util/stream/bootlib/java/util/stream/OpTestCase.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/util/stream/bootlib/java/util/stream/OpTestCase.java	Fri Oct 11 09:17:18 2013 -0400
@@ -30,7 +30,6 @@
 import java.util.Collections;
 import java.util.EnumMap;
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -41,7 +40,6 @@
 import java.util.function.Consumer;
 import java.util.function.Function;
 
-import org.testng.Assert;
 import org.testng.annotations.Test;
 
 /**
@@ -397,14 +395,68 @@
 
     // Exercise terminal operations
 
-    static enum TerminalTestScenario {
-        SINGLE_SEQUENTIAL,
-        SINGLE_SEQUENTIAL_SHORT_CIRCUIT,
-        SINGLE_PARALLEL,
-        ALL_SEQUENTIAL,
-        ALL_SEQUENTIAL_SHORT_CIRCUIT,
-        ALL_PARALLEL,
-        ALL_PARALLEL_SEQUENTIAL,
+    interface BaseTerminalTestScenario<U, R, S_OUT extends BaseStream<U, S_OUT>> {
+        boolean requiresSingleStageSource();
+
+        boolean requiresParallelSource();
+
+        default R run(Function<S_OUT, R> terminalF, S_OUT source, StreamShape shape) {
+            return terminalF.apply(source);
+        }
+    }
+
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    static enum TerminalTestScenario implements BaseTerminalTestScenario {
+        SINGLE_SEQUENTIAL(true, false),
+
+        SINGLE_SEQUENTIAL_SHORT_CIRCUIT(true, false) {
+            @Override
+            public Object run(Function terminalF, BaseStream source, StreamShape shape) {
+                source = (BaseStream) chain(source, new ShortCircuitOp(shape));
+                return terminalF.apply(source);
+            }
+        },
+
+        SINGLE_PARALLEL(true, true),
+
+        ALL_SEQUENTIAL(false, false),
+
+        ALL_SEQUENTIAL_SHORT_CIRCUIT(false, false) {
+            @Override
+            public Object run(Function terminalF, BaseStream source, StreamShape shape) {
+                source = (BaseStream) chain(source, new ShortCircuitOp(shape));
+                return terminalF.apply(source);
+            }
+        },
+
+        ALL_PARALLEL(false, true),
+
+        ALL_PARALLEL_SEQUENTIAL(false, false) {
+            @Override
+            public Object run(Function terminalF, BaseStream source, StreamShape shape) {
+                return terminalF.apply(source.sequential());
+            }
+        },
+        ;
+
+        private final boolean requiresSingleStageSource;
+        private final boolean isParallel;
+
+        TerminalTestScenario(boolean requiresSingleStageSource, boolean isParallel) {
+            this.requiresSingleStageSource = requiresSingleStageSource;
+            this.isParallel = isParallel;
+        }
+
+        @Override
+        public boolean requiresSingleStageSource() {
+            return requiresSingleStageSource;
+        }
+
+        @Override
+        public boolean requiresParallelSource() {
+            return isParallel;
+        }
+
     }
 
     @SuppressWarnings({"rawtypes", "unchecked"})
@@ -415,8 +467,6 @@
 
         R refResult;
 
-        Set<TerminalTestScenario> testSet = EnumSet.allOf(TerminalTestScenario.class);
-
         ResultAsserter<R> resultAsserter = (act, exp, ord, par) -> LambdaTestHelpers.assertContentsEqual(act, exp);
 
         private ExerciseDataTerminalBuilder(TestData<T, S_IN> data, Function<S_IN, S_OUT> streamF, Function<S_OUT, R> terminalF) {
@@ -442,27 +492,6 @@
             return this;
         }
 
-        public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> without(TerminalTestScenario... tests) {
-            return without(Arrays.asList(tests));
-        }
-
-        public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> without(Collection<TerminalTestScenario> tests) {
-            testSet.removeAll(tests);
-            if (testSet.isEmpty()) {
-                throw new IllegalStateException("Terminal test scenario set is empty");
-            }
-            return this;
-        }
-
-        public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> with(TerminalTestScenario... tests) {
-            return with(Arrays.asList(tests));
-        }
-
-        public ExerciseDataTerminalBuilder<T, U, R, S_IN, S_OUT> with(Collection<TerminalTestScenario> tests) {
-            testSet.addAll(tests);
-            return this;
-        }
-
         // Build method
 
         public R exercise() {
@@ -471,70 +500,36 @@
             boolean isOrdered = StreamOpFlag.ORDERED.isKnown(ap.getStreamFlags());
             StreamShape shape = ap.getOutputShape();
 
+            EnumSet<TerminalTestScenario> tests = EnumSet.allOf(TerminalTestScenario.class);
+            // Sequentially collect the output that will be input to the terminal op
             Node<U> node = ap.evaluateToArrayNode(size -> (U[]) new Object[size]);
             if (refResult == null) {
-                // Sequentially collect the output that will be input to the terminal op
-                refResult = terminalF.apply((S_OUT) createPipeline(shape, node.spliterator(),
-                                                                   StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
-                                                                   false));
-            } else if (testSet.contains(TerminalTestScenario.SINGLE_SEQUENTIAL)) {
-                S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
-                                                      StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
-                                                      false);
-                R result = terminalF.apply(source);
-                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
-                                                   () -> String.format("Single sequential: %s != %s", refResult, result));
-            }
-
-            if (testSet.contains(TerminalTestScenario.SINGLE_SEQUENTIAL_SHORT_CIRCUIT)) {
+                // Induce the reference result
                 S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
                                                       StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
                                                       false);
-                // Force short-circuit
-                source = (S_OUT) chain(source, new ShortCircuitOp<U>(shape));
-                R result = terminalF.apply(source);
-                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
-                                                   () -> String.format("Single sequential pull: %s != %s", refResult, result));
-            }
 
-            if (testSet.contains(TerminalTestScenario.SINGLE_PARALLEL)) {
-                S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
-                                                      StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
-                                                      true);
-                R result = terminalF.apply(source);
-                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, true),
-                                                   () -> String.format("Single parallel: %s != %s", refResult, result));
+                refResult = (R) TerminalTestScenario.SINGLE_SEQUENTIAL.run(terminalF, source, shape);
+                tests.remove(TerminalTestScenario.SINGLE_SEQUENTIAL);
             }
 
-            if (testSet.contains(TerminalTestScenario.ALL_SEQUENTIAL)) {
-                // This may forEach or tryAdvance depending on the terminal op implementation
-                S_OUT source = streamF.apply(data.stream());
-                R result = terminalF.apply(source);
-                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
-                                                   () -> String.format("All sequential: %s != %s", refResult, result));
-            }
+            for (BaseTerminalTestScenario test : tests) {
+                S_OUT source;
+                if (test.requiresSingleStageSource()) {
+                    source = (S_OUT) createPipeline(shape, node.spliterator(),
+                                                    StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
+                                                    test.requiresParallelSource());
+                }
+                else {
+                    source = streamF.apply(test.requiresParallelSource()
+                                           ? data.parallelStream() : data.stream());
+                }
 
-            if (testSet.contains(TerminalTestScenario.ALL_SEQUENTIAL_SHORT_CIRCUIT)) {
-                S_OUT source = streamF.apply(data.stream());
-                // Force short-circuit
-                source = (S_OUT) chain(source, new ShortCircuitOp<U>(shape));
-                R result = terminalF.apply(source);
-                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
-                                                   () -> String.format("All sequential pull: %s != %s", refResult, result));
-            }
+                R result = (R) test.run(terminalF, source, shape);
 
-            if (testSet.contains(TerminalTestScenario.ALL_PARALLEL)) {
-                S_OUT source = streamF.apply(data.parallelStream());
-                R result = terminalF.apply(source);
-                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, true),
-                                                   () -> String.format("All parallel: %s != %s", refResult, result));
-            }
-
-            if (testSet.contains(TerminalTestScenario.ALL_PARALLEL_SEQUENTIAL)) {
-                S_OUT source = streamF.apply(data.parallelStream());
-                R result = terminalF.apply(source.sequential());
-                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
-                                                   () -> String.format("All parallel then sequential: %s != %s", refResult, result));
+                LambdaTestHelpers.launderAssertion(
+                        () -> resultAsserter.assertResult(result, refResult, isOrdered, test.requiresParallelSource()),
+                        () -> String.format("%s: %s != %s", test, refResult, result));
             }
 
             return refResult;
@@ -596,10 +591,10 @@
 
     // Test data
 
-    private class ShortCircuitOp<T> implements StatelessTestOp<T,T> {
+    static class ShortCircuitOp<T> implements StatelessTestOp<T,T> {
         private final StreamShape shape;
 
-        private ShortCircuitOp(StreamShape shape) {
+        ShortCircuitOp(StreamShape shape) {
             this.shape = shape;
         }
 
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ExplodeOpTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ExplodeOpTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -64,6 +64,9 @@
         result = exerciseOps(data, s -> s.flatMap(mfNull));
         assertEquals(0, result.size());
 
+        result = exerciseOps(data, s-> s.flatMap(e -> Stream.empty()));
+        assertEquals(0, result.size());
+
         exerciseOps(data, s -> s.flatMap(mfLt));
         exerciseOps(data, s -> s.flatMap(integerRangeMapper));
         exerciseOps(data, s -> s.flatMap((Integer e) -> IntStream.range(0, e).boxed().limit(10)));
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/TabulatorsTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/TabulatorsTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -609,7 +609,7 @@
     @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
     public void testComposeFinisher(String name, TestData.OfRef<Integer> data) throws ReflectiveOperationException {
         List<Integer> asList = exerciseTerminalOps(data, s -> s.collect(toList()));
-        List<Integer> asImmutableList = exerciseTerminalOps(data, s -> s.collect(collectingAndThen(toList(), Collections::<Integer>unmodifiableList)));
+        List<Integer> asImmutableList = exerciseTerminalOps(data, s -> s.collect(collectingAndThen(toList(), Collections::unmodifiableList)));
         assertEquals(asList, asImmutableList);
         try {
             asImmutableList.add(0);
--- a/jdk/test/javax/management/monitor/CounterMonitorThresholdTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/management/monitor/CounterMonitorThresholdTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6229368
+ * @bug 6229368 8025207
  * @summary Wrong threshold value in CounterMonitor with offset and modulus.
  * @author Luis-Miguel Alventosa
  * @run clean CounterMonitorThresholdTest
@@ -144,16 +144,14 @@
         for (int i = 0; i < counter.length; i++) {
             mbean.setCounter(counter[i]);
             System.out.println("\nCounter = " + mbean.getCounter());
-            Thread.sleep(300);
-            Integer derivedGaugeValue = (Integer) cm.getDerivedGauge(name);
-            System.out.println("Derived Gauge = " + derivedGaugeValue);
-            if (derivedGaugeValue.intValue() != derivedGauge[i]) {
-                System.out.println("Wrong derived gauge! Current value = " +
-                    derivedGaugeValue + " Expected value = " + derivedGauge[i]);
-                System.out.println("\nStop monitoring...");
-                cm.stop();
-                throw new IllegalArgumentException("wrong derived gauge");
-            }
+            Integer derivedGaugeValue;
+            // either pass or test timeout (killed by test harness)
+            // see 8025207
+            do {
+                Thread.sleep(150);
+                derivedGaugeValue = (Integer) cm.getDerivedGauge(name);
+            } while (derivedGaugeValue.intValue() != derivedGauge[i]);
+
             Number thresholdValue = cm.getThreshold(name);
             System.out.println("Threshold = " + thresholdValue);
             if (thresholdValue.intValue() != threshold[i]) {
@@ -163,7 +161,6 @@
                 cm.stop();
                 throw new IllegalArgumentException("wrong threshold");
             }
-            Thread.sleep(300);
         }
 
         // Stop the monitor
--- a/jdk/test/javax/management/monitor/NullAttributeValueTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/management/monitor/NullAttributeValueTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,11 +23,12 @@
 
 /*
  * @test
- * @bug 6200031
+ * @bug 6200031 8025206
  * @summary Test that the counter/gauge/string monitors emit a
  *          jmx.monitor.error.type notification when the attribute
  *          being monitored returns a null value.
  * @author Luis-Miguel Alventosa
+ * @author Shanliang JIANG
  * @run clean NullAttributeValueTest
  * @run build NullAttributeValueTest
  * @run main NullAttributeValueTest
@@ -39,7 +40,7 @@
 public class NullAttributeValueTest implements NotificationListener {
 
     // Flag to notify that a message has been received
-    private boolean messageReceived = false;
+    private volatile boolean messageReceived = false;
 
     // MBean class
     public class ObservedObject implements ObservedObjectMBean {
@@ -83,7 +84,6 @@
      * Update the counter and check for notifications
      */
     public int counterMonitorNotification() throws Exception {
-
         CounterMonitor counterMonitor = null;
         try {
             MBeanServer server = MBeanServerFactory.newMBeanServer();
@@ -134,31 +134,17 @@
             echo(">>> START the CounterMonitor");
             counterMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
-            // Check if notification was received
-            //
-            if (messageReceived) {
-                echo("\tOK: CounterMonitor notification received");
-            } else {
-                echo("\tKO: CounterMonitor notification missed or not emitted");
-                return 1;
-            }
+            return checkReceived(granularityperiod, "CounterMonitor");
         } finally {
             if (counterMonitor != null)
                 counterMonitor.stop();
         }
-
-        return 0;
     }
 
     /**
      * Update the gauge and check for notifications
      */
     public int gaugeMonitorNotification() throws Exception {
-
         GaugeMonitor gaugeMonitor = null;
         try {
             MBeanServer server = MBeanServerFactory.newMBeanServer();
@@ -212,31 +198,17 @@
             echo(">>> START the GaugeMonitor");
             gaugeMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
-            // Check if notification was received
-            //
-            if (messageReceived) {
-                echo("\tOK: GaugeMonitor notification received");
-            } else {
-                echo("\tKO: GaugeMonitor notification missed or not emitted");
-                return 1;
-            }
+            return checkReceived(granularityperiod, "GaugeMonitor");
         } finally {
             if (gaugeMonitor != null)
                 gaugeMonitor.stop();
         }
-
-        return 0;
     }
 
     /**
      * Update the string and check for notifications
      */
     public int stringMonitorNotification() throws Exception {
-
         StringMonitor stringMonitor = null;
         try {
             MBeanServer server = MBeanServerFactory.newMBeanServer();
@@ -289,24 +261,11 @@
             echo(">>> START the StringMonitor");
             stringMonitor.start();
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
-
-            // Check if notification was received
-            //
-            if (messageReceived) {
-                echo("\tOK: StringMonitor notification received");
-            } else {
-                echo("\tKO: StringMonitor notification missed or not emitted");
-                return 1;
-            }
+            return checkReceived(granularityperiod, "StringMonitor");
         } finally {
             if (stringMonitor != null)
                 stringMonitor.stop();
         }
-
-        return 0;
     }
 
     /**
@@ -326,6 +285,21 @@
         return error;
     }
 
+    private int checkReceived(long granularityperiod, String caller) throws InterruptedException {
+        int i = 100;
+        do {
+            Thread.sleep(granularityperiod);
+        } while (!messageReceived && i-- > 0);
+
+        if (messageReceived) {
+            echo("\tOK: " + caller + " notification received");
+        } else {
+            echo("\tKO: " + caller + " notification missed or not emitted");
+        }
+
+        return messageReceived ? 0 : 1;
+    }
+
     /*
      * Print message
      */
--- a/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4940957
+ * @bug 4940957 8025205
  * @summary Tests behaviour when connections break
  * @author Eamonn McManus
  * @run clean BrokenConnectionTest
@@ -485,14 +485,13 @@
             }
             if (thisok) {
                 System.out.println("Waiting for failure notif");
-                long deadline = System.currentTimeMillis() + 5000;
-                while (failureListener.count < 1
-                       && System.currentTimeMillis() < deadline)
-                    Thread.sleep(500);
-                if (failureListener.count < 1) {
-                    System.out.println("Did not get failure notif!");
-                    thisok = false;
-                } else if (failureListener.count > 1) {
+                // pass or test timeout. see 8025205
+                do {
+                    Thread.sleep(100);
+                } while (failureListener.count < 1);
+
+                Thread.sleep(1000); // if more notif coming ...
+                if (failureListener.count > 1) {
                     System.out.println("Got too many failure notifs: " +
                                        failureListener.count);
                     thisok = false;
--- a/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/management/remote/mandatory/connection/IdleTimeoutTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4886838 4886830
+ * @bug 4886838 4886830 8025204
  * @summary Tests that idle timeouts happen at appropriate times
  * @author Eamonn McManus
  * @run clean IdleTimeoutTest
@@ -278,19 +278,11 @@
                 }
 
                 System.out.println("Waiting for id list to drop ours");
-                deadline = System.currentTimeMillis() + timeout*2 + 10000;
-                while (true) {
-                    ids = Arrays.asList(server.getConnectionIds());
-                    if (!ids.contains(connId)
-                        || System.currentTimeMillis() >= deadline)
-                        break;
-                    Thread.sleep(500);
-                }
-                if (ids.contains(connId)) {
-                    System.out.println("Client id still in list after " +
-                                       "deadline: " + ids);
-                    return false;
-                }
+                // pass or timed out by test harness - see 8025204
+                do {
+                   Thread.sleep(100);
+                   ids = Arrays.asList(server.getConnectionIds());
+                } while (ids.contains(connId));
 
                 conn.getDefaultDomain();
                 if (connId.equals(client.getConnectionId())) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/6236162/bug6236162.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 6236162
+   @summary Checks that there is no an inconsistence in combo box
+            behavior when user points an item in combo popup
+            by mouse and then uses UP/DOWN keys.
+   @library ../../regtesthelpers
+   @build Util
+   @author Mikhail Lapshin
+   @run main bug6236162
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.plaf.basic.*;
+import javax.swing.plaf.metal.MetalComboBoxUI;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class bug6236162 {
+    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+    private static JFrame frame;
+    private static JComboBox combo;
+    private static MyComboUI comboUI;
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+        toolkit.realSync();
+        test();
+        System.out.println("Test passed");
+    }
+
+    private static void createAndShowGUI() {
+        frame = new JFrame("bug6236162");
+
+        combo = new JComboBox(new String[]{"one", "two", "three", "four", "five"});
+        combo.setEditable(true);
+        comboUI = new MyComboUI();
+        combo.setUI(comboUI);
+        combo.setSelectedIndex(3);
+        frame.getContentPane().add(combo);
+
+        frame.pack();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    private static void test() throws AWTException {
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        // Open popup menu
+        realSync();
+        Util.hitKeys(robot, KeyEvent.VK_DOWN);
+
+        // Move mouse to the first popup menu item
+        realSync();
+        Point p = combo.getLocationOnScreen();
+        Dimension size = combo.getSize();
+        p.x += size.width / 2;
+        p.y += size.height;
+        float dy = 1;
+        robot.mouseMove(p.x, p.y - 5);
+        for (int i=1; i <= 10; i++) {
+            robot.mouseMove((int)(p.x), (int)(p.y - 5 + dy*i));
+        }
+
+        // Select the second popup menu item
+        realSync();
+        Util.hitKeys(robot, KeyEvent.VK_DOWN);
+
+        realSync();
+        JList list = comboUI.getComboPopup().getList();
+        if (list.getSelectedIndex() != 1) {
+            throw new RuntimeException("There is an inconsistence in combo box " +
+                    "behavior when user points an item in combo popup " +
+                    "by mouse and then uses UP/DOWN keys.");
+        }
+    }
+
+    private static void realSync() {
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+    }
+
+    // Gives access to BasicComboBoxUI.popup field
+    private static class MyComboUI extends MetalComboBoxUI {
+        public ComboPopup getComboPopup() {
+            return popup;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ */
+
+import java.awt.Component;
+import javax.swing.GroupLayout;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import javax.swing.plaf.basic.BasicComboBoxRenderer;
+
+import static javax.swing.SwingUtilities.invokeAndWait;
+
+/*
+ * @test
+ * @bug 7195179
+ * @summary Tests that combobox works with generified renderers
+ * @author Sergey Malenkov
+ */
+
+public class Test7195179 {
+    public static void main(String[] args) throws Exception {
+        invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                Integer[] items = {null, 1, 2, 3};
+                JComboBox<Integer> combo = new JComboBox<>(items);
+                JLabel label = new JLabel("choose:");
+                JPanel panel = new JPanel();
+                GroupLayout layout = new GroupLayout(panel);
+                panel.setLayout(layout);
+                label.setLabelFor(combo);
+                combo.setSelectedIndex(0);
+                combo.setRenderer(new ListCellRenderer<Integer>() {
+                    private final BasicComboBoxRenderer renderer = new BasicComboBoxRenderer();
+
+                    @Override
+                    public Component getListCellRendererComponent(JList<? extends Integer> list, Integer value, int index, boolean isSelected, boolean cellHasFocus) {
+                        return this.renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+                    }
+                });
+                layout.setAutoCreateContainerGaps(true);
+                layout.setAutoCreateGaps(true);
+                layout.setHorizontalGroup(layout.createSequentialGroup()
+                        .addGroup(layout.createParallelGroup().addComponent(label))
+                        .addGroup(layout.createParallelGroup().addComponent(combo)));
+                layout.setVerticalGroup(layout
+                        .createSequentialGroup()
+                        .addGroup(layout
+                                .createParallelGroup(GroupLayout.Alignment.BASELINE)
+                                .addComponent(label)
+                                .addComponent(combo)));
+
+                JFrame frame = new JFrame(getClass().getSimpleName());
+                frame.add(panel);
+                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+    }
+}
--- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html	Fri Oct 11 09:17:18 2013 -0400
@@ -1,6 +1,38 @@
 <html>
+<!--
+ 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 4150029 8006087
+ @summary BackSpace keyboard button does not lead to parent directory
+ @author Oleg Mokhovikov
+ @run applet/manual=done bug4150029.html
+-->
+
 <body>
 <applet  code="bug4150029.class" width=200 height=200></applet>
+Follow the instructions below.
 1.Go into 'subDir' folder.
 2.Press BACKSPACE key.
 3.Push OPEN button.
--- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -21,11 +21,10 @@
  * questions.
  */
 
-/* @test
-   @bug 4150029
-   @summary BackSpace keyboard button does not lead to parent directory
-   @author Oleg Mokhovikov
-   @run applet/manual=done bug4150029.html
+/*
+   bug 4150029 8006087
+   summary BackSpace keyboard button does not lead to parent directory
+   author Oleg Mokhovikov
 */
 
 import javax.swing.*;
@@ -36,6 +35,14 @@
     private boolean res;
 
     public void init() {
+        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) {
+            try {
+                UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+
         String tmpDir = System.getProperty("java.io.tmpdir");
 
         if (tmpDir.length() == 0) {//'java.io.tmpdir' isn't guaranteed to be defined
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,158 @@
+/*
+ * 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.awt.Component;
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+
+import java.nio.file.Files;
+import javax.swing.AbstractButton;
+import javax.swing.JTable;
+import javax.swing.UIManager;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 7199708
+ * @author Alexander Scherbatiy
+ * @summary FileChooser crashs when opening large folder
+ * @run main bug7199708
+ */
+public class bug7199708 {
+
+    private static int FILE_NUMBER = 30000;
+    private static volatile JFileChooser fileChooser;
+    private static volatile int locationX;
+    private static volatile int locationY;
+    private static volatile int width;
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        final File folder = createLargeFolder();
+        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                fileChooser = new JFileChooser(folder);
+                fileChooser.showSaveDialog(null);
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                final String detailsTooltip = UIManager.getString("FileChooser."
+                        + "detailsViewButtonToolTipText", fileChooser.getLocale());
+
+                doAction(fileChooser, new ComponentAction() {
+                    @Override
+                    public boolean accept(Component component) {
+                        return (component instanceof AbstractButton)
+                                && detailsTooltip.equals(
+                                ((AbstractButton) component).getToolTipText());
+                    }
+
+                    @Override
+                    public void perform(Component component) {
+                        ((AbstractButton) component).doClick();
+                    }
+                });
+
+                doAction(fileChooser, new ComponentAction() {
+                    @Override
+                    public boolean accept(Component component) {
+                        return (component instanceof JTable);
+                    }
+
+                    @Override
+                    public void perform(Component component) {
+                        Point tableLocation = component.getLocationOnScreen();
+                        locationX = (int) tableLocation.getX();
+                        locationY = (int) tableLocation.getY();
+                        width = (int) fileChooser.getBounds().getWidth();
+                    }
+                });
+            }
+        });
+
+        toolkit.realSync();
+
+        int d = 25;
+        for (int i = 0; i < width / d; i++) {
+            robot.mouseMove(locationX + i * d, locationY + 5);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            toolkit.realSync();
+        }
+
+        robot.keyPress(KeyEvent.VK_ESCAPE);
+        robot.keyRelease(KeyEvent.VK_ESCAPE);
+    }
+
+    static void doAction(Component component, ComponentAction action) {
+        if (action.accept(component)) {
+            action.perform(component);
+        } else if (component instanceof Container) {
+            for (Component comp : ((Container) component).getComponents()) {
+                doAction(comp, action);
+            }
+        }
+    }
+
+    private static File createLargeFolder() {
+        try {
+
+            File largeFolder = Files.createTempDirectory("large_folder").toFile();
+            largeFolder.deleteOnExit();
+
+            for (int i = 0; i < FILE_NUMBER; i++) {
+                File file = new File(largeFolder, "File_" + i + ".txt");
+                file.createNewFile();
+                file.deleteOnExit();
+            }
+            return largeFolder;
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    interface ComponentAction {
+
+        boolean accept(Component component);
+
+        void perform(Component component);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8002077
+ * @author Alexander Scherbatiy
+ * @summary Possible mnemonic issue on JFileChooser Save button on nimbus L&F
+ * @library ../../regtesthelpers/
+ * @build Util
+ * @run main bug8002077
+ */
+public class bug8002077 {
+
+    private static volatile int fileChooserState = JFileChooser.ERROR_OPTION;
+
+    public static void main(String[] args) throws Exception {
+        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
+            if ("Nimbus".equals(info.getName())) {
+                UIManager.setLookAndFeel(info.getClassName());
+                runTest();
+                break;
+            }
+        }
+    }
+
+    private static void runTest() throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                fileChooserState = new JFileChooser().showSaveDialog(null);
+            }
+        });
+        toolkit.realSync();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_N);
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        toolkit.realSync();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_S);
+        toolkit.realSync();
+
+        if (fileChooserState != JFileChooser.APPROVE_OPTION) {
+            throw new RuntimeException("Save button is not pressed!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,113 @@
+/*
+ * 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.io.File;
+import java.io.IOException;
+import java.awt.BorderLayout;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8021253
+ * @author Alexander Scherbatiy
+ * @summary JFileChooser does not react on pressing enter since java 7
+ * @run main bug8021253
+ */
+
+public class bug8021253 {
+
+    private static volatile boolean defaultKeyPressed;
+    private static JFileChooser fileChooser;
+    private static File file;
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                fileChooser.setSelectedFile(file);
+            }
+        });
+
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
+        toolkit.realSync();
+
+        if (!defaultKeyPressed) {
+            throw new RuntimeException("Default button is not pressed");
+        }
+    }
+
+    private static void createAndShowGUI() {
+
+        file = getTempFile();
+
+        final JFrame frame = new JFrame("Test");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(200, 300);
+
+        fileChooser = new JFileChooser(file.getParentFile());
+        fileChooser.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                defaultKeyPressed = true;
+                frame.dispose();
+            }
+        });
+
+        frame.getContentPane().add(BorderLayout.CENTER, fileChooser);
+        frame.setSize(fileChooser.getPreferredSize());
+        frame.setVisible(true);
+    }
+
+    private static File getTempFile() {
+        try {
+            File temp = File.createTempFile("test", ".txt");
+            temp.deleteOnExit();
+            return temp;
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/4193219/IconCoord.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,161 @@
+/*
+ * 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 4193219
+  @summary
+  @author Your Name: Hania Gajewska area=swing
+  @run main/manual IconCoord
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+public class IconCoord {
+    static Test test = new Test();
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                new IconCoord().createAndShowGUI();
+            }
+        });
+        test.waitTestResult();
+    }
+
+    private void createAndShowGUI() {
+        StringBuilder instrText = new StringBuilder();
+        instrText.append("First, iconify internal frame \"Frame 1\" by clicking on its iconify button.\n");
+        instrText.append("Now, maximize the top-level window \"IconCoord\".\n");
+        instrText.append("The \"Frame 1\" icon should stay in the lower left corner of the desktop; ");
+        instrText.append("if it doesn't, press \"Fail\".\n");
+        instrText.append("Now move the icon to the middle of the desktop by dragging it by its ");
+        instrText.append("bumpy left side. Then iconify \"Frame 2\" by clicking on its iconify button.\n");
+        instrText.append("If the icon for frame two gets placed in the lower left corner of the ");
+        instrText.append("desktop (where the icon for \"Frame 1\" used to be before you moved it), ");
+        instrText.append("press \"Pass\". Otherwise, press \"Fail\".\n");
+
+        JDesktopPane dt = new JDesktopPane();
+
+        JButton tf;
+        JInternalFrame if1 = new JInternalFrame("Frame 1", false, false, false, true);
+        JComponent c = (JComponent) if1.getContentPane();
+        c.setLayout(new BorderLayout());
+
+        tf = new JButton ("ignore");
+        c.add (tf, BorderLayout.NORTH);
+
+        tf = new JButton ("ignore");
+        c.add (tf, BorderLayout.CENTER);
+
+        JInternalFrame if2 = new JInternalFrame("Frame 2", false, false, false, true);
+        c = (JComponent) if2.getContentPane();
+        c.setLayout(new BorderLayout());
+
+        tf = new JButton ("ignore");
+        c.add (tf, BorderLayout.NORTH);
+
+        tf = new JButton ("ignore");
+        c.add (tf, BorderLayout.CENTER);
+
+        if1.pack();
+        if1.setBounds(300, 0, 300, 80);
+        if2.pack();
+        if2.setBounds(0, 0, 300, 80);
+        dt.add(if1);
+        dt.add(if2);
+
+        if1.setVisible(true);
+        if2.setVisible(true);
+
+        int frameHeight = 500;
+
+        JScrollPane dtScrollPane = new JScrollPane(dt);
+        JFrame frame = test.createTestFrame("IconCoord", dtScrollPane, instrText.toString(), 250);
+        dt.setPreferredSize(new Dimension(650, frameHeight - 250));
+        frame.setSize (600,500);
+        frame.setVisible(true);
+    }
+
+    static class Test {
+        private boolean pass;
+        JFrame createTestFrame(String name, Component topComponent, String instructions, int instrHeight) {
+            final String PASS = "Pass";
+            final String FAIL = "Fail";
+            JFrame frame = new JFrame(name);
+            frame.setLayout(new BorderLayout());
+
+            JPanel testButtonsPanel = new JPanel();
+            testButtonsPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 20));
+
+            ActionListener btnAL = new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    switch (event.getActionCommand()) {
+                        case PASS:
+                            pass();
+                            break;
+                        default:
+                            throw new RuntimeException("Test failed.");
+                    }
+                }
+            };
+            JButton passBtn = new JButton(PASS);
+            passBtn.addActionListener(btnAL);
+            passBtn.setActionCommand(PASS);
+
+            JButton failBtn = new JButton(FAIL);
+            failBtn.addActionListener(btnAL);
+            failBtn.setActionCommand(FAIL);
+
+            testButtonsPanel.add(BorderLayout.WEST, passBtn);
+            testButtonsPanel.add(BorderLayout.EAST, failBtn);
+
+            JTextArea instrText = new JTextArea();
+            instrText.setLineWrap(true);
+            instrText.setEditable(false);
+            JScrollPane instrScrollPane = new JScrollPane(instrText);
+            instrScrollPane.setMaximumSize(new Dimension(Integer.MAX_VALUE, instrHeight));
+            instrText.append(instructions);
+
+            JPanel servicePanel = new JPanel();
+            servicePanel.setLayout(new BorderLayout());
+            servicePanel.add(BorderLayout.CENTER, instrScrollPane);
+            servicePanel.add(BorderLayout.SOUTH, testButtonsPanel);
+
+            frame.add(BorderLayout.SOUTH, servicePanel);
+            frame.add(BorderLayout.CENTER, topComponent);
+            return frame;
+        }
+        synchronized void pass() {
+            pass = true;
+            notifyAll();
+        }
+        synchronized void waitTestResult() throws InterruptedException {
+            while (!pass) {
+                wait();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,139 @@
+/*
+ * 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 4251301
+   @summary Keybinding for show/hide the system menu.
+   @author Andrey Pikalev
+   @run main/manual bug4251301
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.*;
+import sun.awt.OSInfo;
+import sun.awt.SunToolkit;
+
+
+public class bug4251301 {
+    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+    static Test test = new Test();
+    public static void main(String[] args) throws Exception {
+        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
+            System.out.println("This test is not applicable for MacOS. Passed.");
+            return;
+        }
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+        toolkit.realSync();
+        test.waitTestResult();
+    }
+
+    public static void createAndShowGUI() {
+        final StringBuilder instructions = new StringBuilder();
+        instructions.append("Click with your mouse the content area of the internal frame with the title \"IFrame\" ");
+        instructions.append("and press Ctrl+Space. \n");
+        instructions.append("If the system menu shows up, press Esc. Then system menu should hide. \n");
+        instructions.append("If you success then press \"Pass\", else press \"Fail\".\n");
+
+        JDesktopPane dp = new JDesktopPane();
+        JInternalFrame jif = new JInternalFrame("IFrame",true,true,true,true);
+        dp.add(jif);
+        jif.setBounds(20, 20, 220, 100);
+        jif.setVisible(true);
+        try {
+            jif.setSelected(true);
+        } catch(PropertyVetoException pve) {
+            pve.printStackTrace();
+            throw new Error("Occures PropertyVetoException while set selection...");
+        }
+        JScrollPane dtScrollPane = new JScrollPane(dp);
+        JFrame testFrame = test.createTestFrame("Instructions", dtScrollPane, instructions.toString(), 500);
+        testFrame.setSize(500, 400);
+        testFrame.setVisible(true);
+    }
+    static class Test {
+        private boolean pass;
+        JFrame createTestFrame(String name, Component topComponent, String instructions, int instrHeight) {
+            final String PASS = "Pass";
+            final String FAIL = "Fail";
+            JFrame frame = new JFrame(name);
+            frame.setLayout(new BorderLayout());
+
+            JPanel testButtonsPanel = new JPanel();
+            testButtonsPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 20));
+
+            ActionListener btnAL = new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    switch (event.getActionCommand()) {
+                        case PASS:
+                            pass();
+                            break;
+                        default:
+                            throw new RuntimeException("Test failed.");
+                    }
+                }
+            };
+            JButton passBtn = new JButton(PASS);
+            passBtn.addActionListener(btnAL);
+            passBtn.setActionCommand(PASS);
+
+            JButton failBtn = new JButton(FAIL);
+            failBtn.addActionListener(btnAL);
+            failBtn.setActionCommand(FAIL);
+
+            testButtonsPanel.add(BorderLayout.WEST, passBtn);
+            testButtonsPanel.add(BorderLayout.EAST, failBtn);
+
+            JTextArea instrText = new JTextArea();
+            instrText.setLineWrap(true);
+            instrText.setEditable(false);
+            JScrollPane instrScrollPane = new JScrollPane(instrText);
+            instrScrollPane.setMaximumSize(new Dimension(Integer.MAX_VALUE, instrHeight));
+            instrText.append(instructions);
+
+            JPanel servicePanel = new JPanel();
+            servicePanel.setLayout(new BorderLayout());
+            servicePanel.add(BorderLayout.CENTER, instrScrollPane);
+            servicePanel.add(BorderLayout.SOUTH, testButtonsPanel);
+
+            frame.add(BorderLayout.SOUTH, servicePanel);
+            frame.add(BorderLayout.CENTER, topComponent);
+            return frame;
+        }
+        synchronized void pass() {
+            pass = true;
+            notifyAll();
+        }
+        synchronized void waitTestResult() throws InterruptedException {
+            while (!pass) {
+                wait();
+            }
+        }
+    }
+}
--- a/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -27,19 +27,19 @@
     @author mcherkas
     @run main InternalFrameIsNotCollectedTest
  */
-
 import sun.awt.SunToolkit;
 
 import javax.swing.*;
 import java.awt.*;
-import java.awt.event.KeyEvent;
 import java.beans.PropertyVetoException;
 import java.util.Date;
 
 public class InternalFrameIsNotCollectedTest {
 
-    public static final int waitTime = 10000;
+    public static final int maxWaitTime = 100000;
+    public static final int waitTime = 5000;
     private static Robot robot;
+    private static CustomInternalFrame iFrame;
 
     public static void sync() {
 
@@ -62,12 +62,13 @@
         });
         sync();
         invokeGC();
+        System.runFinalization();
         Thread.sleep(1000); // it's better to wait 1 sec now then 10 sec later
         Date startWaiting = new Date();
         synchronized (CustomInternalFrame.waiter) {
             // Sync with finalization thread.
             Date now = new Date();
-            while (now.getTime() - startWaiting.getTime() < waitTime && !CustomInternalFrame.finalized) {
+            while (now.getTime() - startWaiting.getTime() < maxWaitTime && !CustomInternalFrame.finalized) {
                 CustomInternalFrame.waiter.wait(waitTime);
                 now = new Date();
             }
@@ -83,10 +84,8 @@
     }
 
     private static void closeInternalFrame() throws PropertyVetoException {
-        robot.keyPress(KeyEvent.VK_CONTROL);
-        robot.keyPress(KeyEvent.VK_F4);
-        robot.keyRelease(KeyEvent.VK_F4);
-        robot.keyRelease(KeyEvent.VK_CONTROL);
+        iFrame.setClosed(true);
+        iFrame = null;
     }
 
     private static void initUI() {
@@ -96,7 +95,7 @@
         desktopPane.setDesktopManager(new DefaultDesktopManager());
         frame.getContentPane().add(desktopPane, BorderLayout.CENTER);
 
-        CustomInternalFrame iFrame = new CustomInternalFrame("Dummy Frame");
+        iFrame = new CustomInternalFrame("Dummy Frame");
 
         iFrame.setSize(200, 200);
         iFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,98 @@
+/*
+ * 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
+ @library ../../regtesthelpers
+ @build Util
+ @bug 4750590 8015597
+ @summary SwingSet: Cannot change Themes using menu accelerators
+ @author Alexander Zuev
+ @run main bug4750590
+ */
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+
+public class bug4750590 {
+
+    public static PassedListener pass = new PassedListener();
+    public static volatile boolean passed = false;
+
+    public static void main(String args[]) throws Throwable {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        sun.awt.SunToolkit toolkit = (sun.awt.SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        Robot robo = new Robot();
+        robo.setAutoDelay(500);
+        Util.hitMnemonics(robo, KeyEvent.VK_F);
+        robo.keyPress(KeyEvent.VK_M);
+        robo.keyRelease(KeyEvent.VK_M);
+
+        toolkit.realSync();
+
+        if (passed) {
+            System.out.println("Test passed!");
+        } else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+
+    private static void createAndShowGUI() {
+        JFrame mainFrame = new JFrame("Bug 4750590");
+        JMenuBar mbar = new JMenuBar();
+        JMenu menu = new JMenu("File");
+        menu.setMnemonic('F');
+        JMenu submenu = new JMenu("Submenu");
+        submenu.add(new JMenuItem("SubMenu Item 1")).setMnemonic('S');
+        submenu.add(new JMenuItem("SubMenu Item 2"));
+        menu.add(submenu);
+
+        menu.add(new JMenuItem("Menu Item 1"));
+        JMenuItem menuItem = menu.add(new JMenuItem("Menu Item 2"));
+        menuItem.setMnemonic('M');
+        menuItem.addActionListener(pass);
+        mbar.add(menu);
+        mainFrame.setJMenuBar(mbar);
+
+        mainFrame.setSize(200, 200);
+        mainFrame.setLocation(200, 200);
+        mainFrame.setVisible(true);
+        mainFrame.toFront();
+    }
+
+    public static class PassedListener implements ActionListener {
+        public void actionPerformed(ActionEvent ev) {
+            passed = true;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenuItem/4171437/bug4171437.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,108 @@
+/*
+ * 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 4171437
+   @library ../../regtesthelpers
+   @build Util
+   @author Georges Saab
+   @run main bug4171437
+*/
+import java.awt.*;
+import java.awt.event.*;
+import java.util.ArrayList;
+import javax.swing.*;
+import javax.swing.event.*;
+import sun.awt.SunToolkit;
+
+public class bug4171437 {
+    static volatile boolean closeActivated = false;
+    static volatile boolean customActivated = false;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        Util.hitMnemonics(robot, KeyEvent.VK_F);
+        Util.hitKeys(robot, KeyEvent.VK_C);
+
+        toolkit.realSync();
+        Thread.sleep(1000);
+
+        if (!closeActivated || customActivated) {
+            throw new RuntimeException("Didn't pass the muster");
+        }
+    }
+    public static void createAndShowGUI() {
+        JMenuBar menubar = new JMenuBar();
+
+        JMenu fileMenu = new JMenu("File");
+        fileMenu.setMnemonic('f');
+
+        JMenuItem fmi1 = new JMenuItem();
+        fmi1 = new JMenuItem("Open");
+        JMenuItem fmi2 = new JMenuItem();
+        fmi2 = new JMenuItem("Close");
+        fmi2.setMnemonic('c');
+        fmi2.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                closeActivated = true;
+            }
+        });
+
+        fileMenu.add( fmi1);
+        fileMenu.add( fmi2);
+
+        menubar.add( fileMenu);
+
+        JMenu custom = new JMenu("Custom");
+        custom.setMnemonic('c');
+        JMenuItem cmi = new JMenuItem();
+        cmi = new JMenuItem("Properties");
+        cmi.setMnemonic('p');
+        custom.add( cmi);
+        custom.addMenuListener(new MenuListener() {
+            public void menuSelected(MenuEvent e) {
+                customActivated = true;
+            }
+            public void menuDeselected(MenuEvent e) {}
+            public void menuCanceled(MenuEvent e) {}
+        });
+        menubar.add( custom);
+
+        JFrame frame = new JFrame();
+        frame.setJMenuBar( menubar);
+        frame.setSize(300, 300);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.pack();
+        frame.setVisible(true);
+    }
+}
--- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -35,12 +35,13 @@
 import javax.swing.*;
 
 public class ActionListenerCalledTwiceTest {
-    static String menuItems[] = { "Item1", "Item2", "Item3", "Item4" };
+    static String menuItems[] = { "Item1", "Item2", "Item3", "Item4", "Item5" };
     static KeyStroke keyStrokes[] = {
         KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK),
         KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
         KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK),
-        KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_MASK)
+        KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_MASK),
+        KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK)
     };
 
     static volatile int listenerCallCounter = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,110 @@
+/*
+ * 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 4458079
+   @library ../../regtesthelpers
+   @build Util
+   @summary Tests calling removeAll() from PopupMenuListener
+   @author Peter Zhelezniakov
+   @run main bug4458079
+*/
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.KeyEvent;
+import java.util.ArrayList;
+import sun.awt.SunToolkit;
+
+public class bug4458079 extends JFrame implements PopupMenuListener {
+    public JMenu menu;
+
+    static volatile boolean itemASelected = false;
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                new bug4458079().createAndShowGUI();
+            }
+        });
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        Util.hitMnemonics(robot, KeyEvent.VK_M);
+
+        toolkit.realSync();
+        Thread.sleep(1000);
+
+        Util.hitKeys(robot, KeyEvent.VK_DOWN);
+        Util.hitKeys(robot, KeyEvent.VK_ENTER);
+
+        toolkit.realSync();
+        Thread.sleep(1000);
+
+        if (!itemASelected) {
+            throw new RuntimeException("Test failed: arrow key traversal in JMenu broken!");
+        }
+    }
+    public void createAndShowGUI() {
+        JMenuBar bar = new JMenuBar();
+        menu = new JMenu("Menu");
+        menu.add(new JMenuItem("1"));
+        menu.add(new JMenuItem("2"));
+        menu.setMnemonic(KeyEvent.VK_M);
+        menu.getPopupMenu().addPopupMenuListener(this);
+        bar.add(menu);
+
+        setJMenuBar(bar);
+        getContentPane().add(new JButton(""));
+        setSize(300, 300);
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        pack();
+        setVisible(true);
+    }
+
+    public void rebuildMenu() {
+        menu.removeAll();
+        final String itemCommand = "A";
+        JMenuItem item = new JMenuItem(itemCommand);
+        item.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                JMenuItem item = ((JMenuItem)e.getSource());
+                if (e.getActionCommand() == itemCommand) {
+                    itemASelected = true;
+                }
+            }
+        });
+        menu.add(item);
+        menu.add(new JMenuItem("B"));
+    }
+
+    public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+        rebuildMenu();
+    }
+
+    public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
+    public void popupMenuCanceled(PopupMenuEvent e) {}
+}
--- a/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java	Fri Oct 11 09:17:18 2013 -0400
@@ -59,7 +59,8 @@
             UIManager.setLookAndFeel(info.getClassName());
 
             SwingUtilities.invokeAndWait(this);
-            toolkit.realSync(500); // after creation
+            toolkit.realSync(); // after creation
+            Thread.sleep(1000);
 
             Point point = this.bar.getLocation();
             SwingUtilities.convertPointToScreen(point, this.bar);
@@ -69,7 +70,8 @@
             robot.mousePress(InputEvent.BUTTON1_MASK);
             robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-            toolkit.realSync(500); // before validation
+            toolkit.realSync(); // before validation
+            Thread.sleep(1000);
             SwingUtilities.invokeAndWait(this);
 
             if (this.bar != null) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,152 @@
+/*
+ * 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 4816114
+   @summary REGRESSION: Regression in divider location behavior when JSplitPane is resized
+   @author Andrey Pikalev
+   @run main bug4816114
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.lang.reflect.*;
+import sun.awt.SunToolkit;
+
+
+public class bug4816114 {
+
+    JFrame fr;
+    JSplitPane splitPane;
+
+    boolean[] resized = new boolean[] { false, false, false,
+                                        false, false, false };
+    static int step = 0;
+    boolean h_passed = false;
+    boolean v_passed = false;
+
+    static bug4816114 test = new bug4816114();
+
+    public static void main(String[] args) throws InterruptedException, InvocationTargetException {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                test.createAndShowGUI();
+            }
+        });
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+        Thread.sleep(1000);
+        Thread.sleep(2000);
+
+        step++;
+        test.doTest(150, 300);
+
+        step++;
+        test.doTest(650, 300);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                test.splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
+            }
+        });
+
+        step++;
+        test.doTest(300, 650);
+
+        step++;
+        test.doTest(300, 150);
+
+        step++;
+        test.doTest(300, 650);
+
+        if ( !test.isPassed() ) {
+            throw new Error("The divider location is wrong.");
+        }
+    }
+    public void createAndShowGUI() {
+        fr = new JFrame("Test");
+
+        splitPane = new TestSplitPane();
+        splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
+        splitPane.setResizeWeight(0);
+        splitPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
+
+        JButton leftButton = new JButton("LEFT");
+        leftButton.setPreferredSize(new Dimension(300, 300));
+        leftButton.setMinimumSize(new Dimension(150, 150));
+        splitPane.setLeftComponent(leftButton);
+
+        JButton rightButton = new JButton("RIGHT");
+        rightButton.setPreferredSize(new Dimension(300, 300));
+        rightButton.setMinimumSize(new Dimension(150, 150));
+        splitPane.setRightComponent(rightButton);
+
+        fr.getContentPane().add(splitPane, BorderLayout.CENTER);
+
+        fr.pack();
+        fr.setVisible(true);
+    }
+
+    void doTest(final int width, final int height)  throws InterruptedException, InvocationTargetException {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                splitPane.setPreferredSize(new Dimension(width, height));
+                fr.pack();
+            }
+        });
+
+        synchronized (bug4816114.this) {
+            while (!resized[step]) {
+                bug4816114.this.wait();
+            }
+        }
+    }
+
+   synchronized void setPassed(int orientation, boolean passed) {
+       if (orientation == JSplitPane.HORIZONTAL_SPLIT) {
+           this.h_passed = passed;
+       }
+       else {
+           this.v_passed = passed;
+       }
+   }
+
+    synchronized boolean isPassed() {
+        return h_passed && v_passed;
+    }
+
+
+    class TestSplitPane extends JSplitPane {
+        public void setDividerLocation(int location) {
+            super.setDividerLocation(location);
+
+            if ( splitPane.getDividerLocation() == 151 ) {
+                setPassed(getOrientation(), true);
+            }
+
+            synchronized (bug4816114.this) {
+                resized[step] = true;
+                bug4816114.this.notifyAll();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,114 @@
+/*
+ * 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.awt.BorderLayout;
+import sun.awt.SunToolkit;
+
+import java.awt.Container;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JTabbedPane;
+
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+
+/*
+ * @test
+ * @bug 7024235
+ * @summary Tests JFrame.pack() with the JTabbedPane
+ * @author Sergey Malenkov
+ */
+
+public class Test7024235 implements Runnable {
+
+    private static final boolean AUTO = null != System.getProperty("test.src", null);
+
+    public static void main(String[] args) throws Exception {
+        Test7024235 test = new Test7024235();
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
+            UIManager.setLookAndFeel(info.getClassName());
+
+            test.test();
+            toolkit.realSync();
+            Thread.sleep(1000);
+            test.test();
+        }
+    }
+
+    private volatile JTabbedPane pane;
+    private volatile boolean passed;
+
+    public void run() {
+        if (this.pane == null) {
+            this.pane = new JTabbedPane();
+            this.pane.addTab("1", new Container());
+            this.pane.addTab("2", new JButton());
+            this.pane.addTab("3", new JCheckBox());
+
+            JFrame frame = new JFrame();
+            frame.add(BorderLayout.WEST, this.pane);
+            frame.pack();
+            frame.setVisible(true);
+
+            test("first");
+        }
+        else {
+            test("second");
+            if (this.passed || AUTO) { // do not close a frame for manual review
+                SwingUtilities.getWindowAncestor(this.pane).dispose();
+            }
+            this.pane = null;
+        }
+    }
+
+    private void test() throws Exception {
+        SwingUtilities.invokeAndWait(this);
+        if (!this.passed && AUTO) { // error reporting only for automatic testing
+            throw new Error("TEST FAILED");
+        }
+    }
+
+    private void test(String step) {
+        this.passed = true;
+        for (int index = 0; index < this.pane.getTabCount(); index++) {
+            Rectangle bounds = this.pane.getBoundsAt(index);
+            int centerX = bounds.x + bounds.width / 2;
+            int centerY = bounds.y + bounds.height / 2;
+            int actual = this.pane.indexAtLocation(centerX, centerY);
+            if (index != actual) {
+                System.out.println("name = " + UIManager.getLookAndFeel().getName());
+                System.out.println("step = " + step);
+                System.out.println("index = " + index);
+                System.out.println("bounds = " + bounds);
+                System.out.println("indexAtLocation(" + centerX + "," + centerX + ") returns " + actual);
+                this.passed = false;
+            }
+        }
+    }
+}
--- a/jdk/test/javax/swing/JTable/7068740/bug7068740.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/swing/JTable/7068740/bug7068740.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,6 +37,7 @@
 import java.awt.*;
 import java.awt.event.KeyEvent;
 import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.atomic.AtomicInteger;
 
 public class bug7068740 extends JFrame {
 
@@ -66,6 +67,7 @@
         };
 
         table = new JTable(model);
+        table.setRowSelectionInterval(0, 0);
         LayerUI<JComponent> layerUI = new LayerUI<>();
         JLayer<JComponent> layer = new JLayer<>(table, layerUI);
         JScrollPane scrollPane = new JScrollPane(layer);
@@ -78,7 +80,7 @@
         try {
             if (robot == null) {
                 robot = new Robot();
-                robot.setAutoDelay(20);
+                robot.setAutoDelay(50);
             }
 
             if (toolkit == null) {
@@ -104,24 +106,37 @@
         }
     }
 
-    private static void doTest() {
+    private static int getSelectedRow() throws Exception {
+        final AtomicInteger row = new AtomicInteger(-1);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                row.set(table.getSelectedRow());
+            }
+        });
+        return row.intValue();
+    }
+
+    private static void doTest() throws Exception {
         toolkit.realSync();
-        table.setRowSelectionInterval(0, 0);
 
         robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
         toolkit.realSync();
-        if (table.getSelectedRow() != 19) {
+
+        if (getSelectedRow() != 19) {
             throw new RuntimeException("Test failed");
         }
 
         robot.keyPress(KeyEvent.VK_PAGE_UP);
+        robot.keyRelease(KeyEvent.VK_PAGE_UP);
         toolkit.realSync();
-        if (table.getSelectedRow() != 0) {
+        if (getSelectedRow() != 0) {
             throw new RuntimeException("Test failed");
         }
     }
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         try {
             UIManager.setLookAndFeel(new MetalLookAndFeel());
             setUp();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/4927934/bug4927934.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,247 @@
+/*
+ * 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 4927934
+   @summary JTree traversal is unlike Native windows tree traversal
+   @author Andrey Pikalev
+   @run main bug4927934
+*/
+
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.tree.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.InvocationTargetException;
+import sun.awt.*;
+
+public class bug4927934 implements TreeSelectionListener, TreeExpansionListener, FocusListener {
+
+    final static Object listener = new bug4927934();
+
+    static boolean focusGained = false;
+    public static boolean selectionChanged = false;
+    public static boolean treeExpanded = false;
+    public static boolean treeCollapsed = false;
+
+    static JFrame frame;
+    static JTree tree;
+    static Robot robot;
+
+    public static void main(String args[]) throws Exception {
+        UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
+
+        robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new JFrame();
+
+                DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
+                createNodes(root);
+                tree = new JTree(root);
+                JScrollPane scrollPane = new JScrollPane(tree);
+                frame.getContentPane().add(scrollPane);
+
+                tree.addFocusListener((FocusListener)listener);
+                tree.addTreeSelectionListener((TreeSelectionListener)listener);
+                tree.addTreeExpansionListener((TreeExpansionListener)listener);
+
+                frame.setSize(300, 300);
+                frame.setVisible(true);
+            }
+        });
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+        Thread.sleep(1000);
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                tree.requestFocus();
+            }
+        });
+
+        synchronized(listener) {
+            if (!focusGained) {
+                System.out.println("waiting focusGained...");
+                try {
+                    listener.wait(10000);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        // GO TO RIGHT
+        selectionChanged = false;
+        hitKey(KeyEvent.VK_RIGHT);
+        toolkit.realSync();
+        if (!checkSelectionChanged(tree, 0)) {
+            throw new RuntimeException("Root should be selected");
+        }
+
+        selectionChanged = false;
+        hitKey(KeyEvent.VK_RIGHT);
+        toolkit.realSync();
+        if (!checkSelectionChanged(tree, 1)) {
+            throw new RuntimeException("Node should be selected");
+        }
+
+        treeExpanded = false;
+        hitKey(KeyEvent.VK_RIGHT);
+        toolkit.realSync();
+        if (!isTreeExpanded()) {
+            throw new RuntimeException("Node should be expanded");
+        }
+
+        selectionChanged = false;
+        hitKey(KeyEvent.VK_RIGHT);
+        toolkit.realSync();
+        if (!checkSelectionChanged(tree, 2)) {
+            throw new RuntimeException("Leaf1 should be selected");
+        }
+
+        selectionChanged = false;
+        hitKey(KeyEvent.VK_RIGHT);
+        toolkit.realSync();
+        if (!checkSelectionChanged(tree, 2)) {
+            throw new RuntimeException("Leaf1 should be selected");
+        }
+
+        // GO TO LEFT
+        selectionChanged = false;
+        hitKey(KeyEvent.VK_LEFT);
+        toolkit.realSync();
+        if (!checkSelectionChanged(tree, 1)) {
+            throw new RuntimeException("Node should be selected");
+        }
+
+        treeCollapsed = false;
+        hitKey(KeyEvent.VK_LEFT);
+        if (!isTreeCollapsed()) {
+            throw new RuntimeException("Node should be collapsed");
+        }
+
+        selectionChanged = false;
+        hitKey(KeyEvent.VK_LEFT);
+        toolkit.realSync();
+        if (!checkSelectionChanged(tree, 0)) {
+            throw new RuntimeException("Root should be selected");
+        }
+
+        treeCollapsed = false;
+        hitKey(KeyEvent.VK_LEFT);
+        toolkit.realSync();
+        if (!isTreeCollapsed()) {
+            throw new RuntimeException("Root should be collapsed");
+        }
+    }
+
+
+    synchronized public void focusLost(FocusEvent e) {
+    }
+
+    synchronized public void focusGained(FocusEvent e) {
+        focusGained = true;
+        System.out.println("focusGained");
+        listener.notifyAll();
+    }
+
+    private static void createNodes(DefaultMutableTreeNode root) {
+        DefaultMutableTreeNode node = new DefaultMutableTreeNode("Node");
+        node.add(new DefaultMutableTreeNode("Leaf1"));
+        node.add(new DefaultMutableTreeNode("Leaf2"));
+        root.add(node);
+        root.add(new DefaultMutableTreeNode("Leaf3"));
+    }
+
+    synchronized public void valueChanged(TreeSelectionEvent e) {
+        selectionChanged = true;
+        System.out.println("selectionChanged");
+        notifyAll();
+    }
+
+    synchronized public void treeCollapsed(TreeExpansionEvent e) {
+        System.out.println("treeCollapsed");
+        treeCollapsed = true;
+        notifyAll();
+    }
+
+    synchronized public void treeExpanded(TreeExpansionEvent e) {
+        System.out.println("treeExpanded");
+        treeExpanded = true;
+        notifyAll();
+    }
+
+    private static void hitKey(int key) {
+        System.out.println("key " + key + " pressed");
+        robot.keyPress(key);
+        robot.keyRelease(key);
+    }
+
+    private static boolean checkSelectionChanged(JTree tree, int shouldBeSel) {
+        synchronized(listener) {
+            if (!selectionChanged) {
+                System.out.println("waiting for selectionChanged...");
+                try {
+                    listener.wait(5000);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        int selRow = tree.getLeadSelectionRow();
+        System.out.println("Selected row: " + selRow);
+        return selRow == shouldBeSel;
+    }
+
+    private static boolean isTreeExpanded() {
+        synchronized(listener) {
+            if (!treeExpanded) {
+                System.out.println("waiting for treeExpanded...");
+                try {
+                    listener.wait(5000);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return treeExpanded;
+    }
+
+    private static boolean isTreeCollapsed() {
+        synchronized(listener) {
+            if (!treeCollapsed) {
+                System.out.println("waiting for treeCollapsed...");
+                try {
+                    listener.wait(5000);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return treeCollapsed;
+    }
+}
--- a/jdk/test/javax/swing/JTree/8013571/Test8013571.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/swing/JTree/8013571/Test8013571.java	Fri Oct 11 09:17:18 2013 -0400
@@ -27,8 +27,8 @@
 
 /*
  * @test
- * @bug 8016545
- * @summary Tests beans with public fields
+ * @bug 8013571
+ * @summary Tests null as a root of TreeModelEvent
  * @author Sergey Malenkov
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Popup/TaskbarPositionTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,340 @@
+/*
+ * 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.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+/**
+ * @test @bug 4245587 4474813 4425878 4767478 8015599
+ * @author Mark Davidson
+ * @summary Tests the location of the heavy weight popup portion of JComboBox,
+ * JMenu and JPopupMenu.
+ * @library ../regtesthelpers
+ * @build Util
+ * @run main TaskbarPositionTest
+ */
+public class TaskbarPositionTest extends JFrame implements ActionListener {
+
+    private boolean done;
+    private Throwable error;
+    private static TaskbarPositionTest test;
+    private static JPopupMenu popupMenu;
+    private static JPanel panel;
+    private static JComboBox<String> combo1;
+    private static JComboBox<String> combo2;
+    private static JMenuBar menubar;
+    private static JMenu menu1;
+    private static JMenu menu2;
+    private static Rectangle fullScreenBounds;
+    // The usable desktop space: screen size - screen insets.
+    private static Rectangle screenBounds;
+    private static String[] numData = {
+        "One", "Two", "Three", "Four", "Five", "Six", "Seven"
+    };
+    private static String[] dayData = {
+        "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
+    };
+    private static char[] mnDayData = {
+        'M', 'T', 'W', 'R', 'F', 'S', 'U'
+    };
+
+    public TaskbarPositionTest() {
+        super("Use CTRL-down to show a JPopupMenu");
+        setContentPane(panel = createContentPane());
+        setJMenuBar(createMenuBar("1 - First Menu", true));
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        // CTRL-down will show the popup.
+        panel.getInputMap().put(KeyStroke.getKeyStroke(
+                KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP");
+        panel.getActionMap().put("OPEN_POPUP", new PopupHandler());
+
+        pack();
+
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        fullScreenBounds = new Rectangle(new Point(), toolkit.getScreenSize());
+        screenBounds = new Rectangle(new Point(), toolkit.getScreenSize());
+
+        // Place the frame near the bottom. This is a pretty wild guess.
+        this.setLocation(0, (int) screenBounds.getHeight() - 2 * this.getHeight());
+
+        // Reduce the screen bounds by the insets.
+        GraphicsConfiguration gc = this.getGraphicsConfiguration();
+        if (gc != null) {
+            Insets screenInsets = toolkit.getScreenInsets(gc);
+            screenBounds = gc.getBounds();
+            screenBounds.width -= (screenInsets.left + screenInsets.right);
+            screenBounds.height -= (screenInsets.top + screenInsets.bottom);
+            screenBounds.x += screenInsets.left;
+            screenBounds.y += screenInsets.top;
+        }
+
+        setVisible(true);
+    }
+
+    public static class ComboPopupCheckListener implements PopupMenuListener {
+
+        public void popupMenuCanceled(PopupMenuEvent ev) {
+        }
+
+        public void popupMenuWillBecomeVisible(PopupMenuEvent ev) {
+        }
+
+        public void popupMenuWillBecomeInvisible(PopupMenuEvent ev) {
+            Point cpos = combo1.getLocation();
+            SwingUtilities.convertPointToScreen(cpos, panel);
+
+            JPopupMenu pm = (JPopupMenu) combo1.getUI().getAccessibleChild(combo1, 0);
+
+            if (pm != null) {
+                Point p = pm.getLocation();
+                SwingUtilities.convertPointToScreen(p, pm);
+                if (p.y < cpos.y) {
+                    throw new RuntimeException("ComboBox popup is wrongly aligned");
+                }  // check that popup was opened down
+            }
+        }
+    }
+
+    private class PopupHandler extends AbstractAction {
+
+        public void actionPerformed(ActionEvent e) {
+            if (!popupMenu.isVisible()) {
+                popupMenu.show((Component) e.getSource(), 40, 40);
+            }
+            isPopupOnScreen(popupMenu, fullScreenBounds);
+        }
+    }
+
+    class PopupListener extends MouseAdapter {
+
+        private JPopupMenu popup;
+
+        public PopupListener(JPopupMenu popup) {
+            this.popup = popup;
+        }
+
+        public void mousePressed(MouseEvent e) {
+            maybeShowPopup(e);
+        }
+
+        public void mouseReleased(MouseEvent e) {
+            maybeShowPopup(e);
+        }
+
+        private void maybeShowPopup(MouseEvent e) {
+            if (e.isPopupTrigger()) {
+                popup.show(e.getComponent(), e.getX(), e.getY());
+                isPopupOnScreen(popup, fullScreenBounds);
+            }
+        }
+    }
+
+    /**
+     * Tests if the popup is on the screen.
+     */
+    public static void isPopupOnScreen(JPopupMenu popup, Rectangle checkBounds) {
+        Dimension dim = popup.getSize();
+        Point pt = new Point();
+        SwingUtilities.convertPointToScreen(pt, popup);
+        Rectangle bounds = new Rectangle(pt, dim);
+
+        if (!SwingUtilities.isRectangleContainingRectangle(checkBounds, bounds)) {
+            throw new RuntimeException("We do not match! " + checkBounds + " / " + bounds);
+        }
+
+    }
+
+    private JPanel createContentPane() {
+        JPanel panel = new JPanel();
+
+        combo1 = new JComboBox<>(numData);
+        panel.add(combo1);
+        combo2 = new JComboBox<>(dayData);
+        combo2.setEditable(true);
+        panel.add(combo2);
+        panel.setSize(300, 200);
+
+        popupMenu = new JPopupMenu();
+        JMenuItem item;
+        for (int i = 0; i < dayData.length; i++) {
+            item = popupMenu.add(new JMenuItem(dayData[i], mnDayData[i]));
+            item.addActionListener(this);
+        }
+        panel.addMouseListener(new PopupListener(popupMenu));
+
+        JTextField field = new JTextField("CTRL+down for Popup");
+        // CTRL-down will show the popup.
+        field.getInputMap().put(KeyStroke.getKeyStroke(
+                KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP");
+        field.getActionMap().put("OPEN_POPUP", new PopupHandler());
+
+        panel.add(field);
+
+        return panel;
+    }
+
+    /**
+     * @param str name of Menu
+     * @param bFlag set mnemonics on menu items
+     */
+    private JMenuBar createMenuBar(String str, boolean bFlag) {
+        menubar = new JMenuBar();
+
+        menu1 = new JMenu(str);
+        menu1.setMnemonic(str.charAt(0));
+        menu1.addActionListener(this);
+
+        menubar.add(menu1);
+        for (int i = 0; i < 8; i++) {
+            JMenuItem menuitem = new JMenuItem("1 JMenuItem" + i);
+            menuitem.addActionListener(this);
+            if (bFlag) {
+                menuitem.setMnemonic('0' + i);
+            }
+            menu1.add(menuitem);
+        }
+
+        // second menu
+        menu2 = new JMenu("2 - Second Menu");
+        menu2.addActionListener(this);
+        menu2.setMnemonic('2');
+
+        menubar.add(menu2);
+        for (int i = 0; i < 5; i++) {
+            JMenuItem menuitem = new JMenuItem("2 JMenuItem" + i);
+            menuitem.addActionListener(this);
+
+            if (bFlag) {
+                menuitem.setMnemonic('0' + i);
+            }
+            menu2.add(menuitem);
+        }
+        JMenu submenu = new JMenu("Sub Menu");
+        submenu.setMnemonic('S');
+        submenu.addActionListener(this);
+        for (int i = 0; i < 5; i++) {
+            JMenuItem menuitem = new JMenuItem("S JMenuItem" + i);
+            menuitem.addActionListener(this);
+            if (bFlag) {
+                menuitem.setMnemonic('0' + i);
+            }
+            submenu.add(menuitem);
+        }
+        menu2.add(new JSeparator());
+        menu2.add(submenu);
+
+        return menubar;
+    }
+
+    public void actionPerformed(ActionEvent evt) {
+        Object obj = evt.getSource();
+        if (obj instanceof JMenuItem) {
+            // put the focus on the noneditable combo.
+            combo1.requestFocus();
+        }
+    }
+
+    public static void main(String[] args) throws Throwable {
+
+        sun.awt.SunToolkit toolkit = (sun.awt.SunToolkit) Toolkit.getDefaultToolkit();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                test = new TaskbarPositionTest();
+            }
+        });
+
+        // Use Robot to automate the test
+        Robot robot;
+        robot = new Robot();
+        robot.setAutoDelay(125);
+
+        // 1 - menu
+        Util.hitMnemonics(robot, KeyEvent.VK_1);
+
+        toolkit.realSync();
+        isPopupOnScreen(menu1.getPopupMenu(), screenBounds);
+
+        // 2 menu with sub menu
+        robot.keyPress(KeyEvent.VK_RIGHT);
+        robot.keyRelease(KeyEvent.VK_RIGHT);
+        Util.hitMnemonics(robot, KeyEvent.VK_S);
+
+        toolkit.realSync();
+        isPopupOnScreen(menu2.getPopupMenu(), screenBounds);
+
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
+
+        // Focus should go to non editable combo box
+        toolkit.realSync();
+        Thread.sleep(500);
+
+        robot.keyPress(KeyEvent.VK_DOWN);
+
+        // How do we check combo boxes?
+
+        // Editable combo box
+        robot.keyPress(KeyEvent.VK_TAB);
+        robot.keyRelease(KeyEvent.VK_TAB);
+        robot.keyPress(KeyEvent.VK_DOWN);
+        robot.keyRelease(KeyEvent.VK_DOWN);
+
+        // combo1.getUI();
+
+        // Popup from Text field
+        robot.keyPress(KeyEvent.VK_TAB);
+        robot.keyRelease(KeyEvent.VK_TAB);
+        robot.keyPress(KeyEvent.VK_CONTROL);
+        robot.keyPress(KeyEvent.VK_DOWN);
+        robot.keyRelease(KeyEvent.VK_DOWN);
+        robot.keyRelease(KeyEvent.VK_CONTROL);
+
+        // Popup from a mouse click.
+        Point pt = new Point(2, 2);
+        SwingUtilities.convertPointToScreen(pt, panel);
+        robot.mouseMove((int) pt.getX(), (int) pt.getY());
+        robot.mousePress(InputEvent.BUTTON3_MASK);
+        robot.mouseRelease(InputEvent.BUTTON3_MASK);
+
+        toolkit.realSync();
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                test.setLocation(-30, 100);
+                combo1.addPopupMenuListener(new ComboPopupCheckListener());
+                combo1.requestFocus();
+            }
+        });
+
+        robot.keyPress(KeyEvent.VK_DOWN);
+        robot.keyRelease(KeyEvent.VK_DOWN);
+        robot.keyPress(KeyEvent.VK_ESCAPE);
+        robot.keyRelease(KeyEvent.VK_ESCAPE);
+
+        toolkit.realSync();
+        Thread.sleep(500);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 4983388 8015600
+   @summary shortcuts on menus do not work on JDS
+   @author Oleg Mokhovikov
+   @library ../../../../regtesthelpers
+   @build Util
+   @run main bug4983388
+*/
+
+import sun.awt.*;
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.MenuListener;
+import javax.swing.event.MenuEvent;
+import java.awt.event.KeyEvent;
+
+public class bug4983388 {
+    static volatile boolean bMenuSelected = false;
+
+    private static class TestMenuListener implements MenuListener {
+        public void menuCanceled(MenuEvent e) {}
+        public void menuDeselected(MenuEvent e) {}
+        public void menuSelected(MenuEvent e) {
+            System.out.println("menuSelected");
+            bMenuSelected = true;
+        }
+    }
+
+    private static void createAndShowGUI() {
+        JMenuBar menuBar = new JMenuBar();
+        JMenu menu = new JMenu("File");
+        menu.setMnemonic('F');
+        menuBar.add(menu);
+        JFrame frame = new JFrame();
+        frame.setJMenuBar(menuBar);
+        frame.pack();
+        frame.setVisible(true);
+        MenuListener listener = new TestMenuListener();
+        menu.addMenuListener(listener);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        try {
+            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+        } catch (UnsupportedLookAndFeelException | ClassNotFoundException ex) {
+            System.err.println("GTKLookAndFeel is not supported on this platform. Using defailt LaF for this platform.");
+        }
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        Robot robot = new Robot();
+        Util.hitMnemonics(robot, KeyEvent.VK_F);
+
+        toolkit.realSync();
+
+        if (!bMenuSelected) {
+            throw new RuntimeException("shortcuts on menus do not work");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicTabbedPaneUI/Test6943780.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,56 @@
+/*
+ * 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 javax.swing.JButton;
+import javax.swing.JTabbedPane;
+import java.awt.Component;
+
+import static javax.swing.SwingUtilities.invokeAndWait;
+
+/*
+ * @test
+ * @bug 4873983 6943780
+ * @summary Tests JTabbedPane with SCROLL_TAB_LAYOUT
+ * @author Sergey Malenkov
+ */
+public class Test6943780 implements Runnable, Thread.UncaughtExceptionHandler {
+    public static void main(String[] args) throws Exception {
+        invokeAndWait(new Test6943780());
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable throwable) {
+        throwable.printStackTrace();
+        System.exit(1);
+    }
+
+    @Override
+    public void run() {
+        JTabbedPane pane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
+        pane.addTab("first", new JButton("first"));
+        pane.addTab("second", new JButton("second"));
+        for (Component component : pane.getComponents()) {
+            component.setSize(100, 100);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,174 @@
+/*
+ * 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 8023474
+ * @summary Tests that the first mouse press starts editing in JTree
+ * @author Dmitry Markov
+ * @run main bug8023474
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.event.CellEditorListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeCellEditor;
+import javax.swing.tree.TreeCellRenderer;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.util.EventObject;
+
+public class bug8023474 {
+    private static JTree tree;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        Point point = getRowPointToClick(1);
+        robot.mouseMove(point.x, point.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        toolkit.realSync();
+
+        Boolean result = (Boolean)tree.getCellEditor().getCellEditorValue();
+        if (!result) {
+            throw new RuntimeException("Test Failed!");
+        }
+    }
+
+    private static void createAndShowGUI() {
+        try {
+            UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
+        DefaultMutableTreeNode item = new DefaultMutableTreeNode("item");
+        DefaultMutableTreeNode subItem = new DefaultMutableTreeNode("subItem");
+
+        root.add(item);
+        item.add(subItem);
+
+        DefaultTreeModel model = new DefaultTreeModel(root);
+        tree = new JTree(model);
+
+        tree.setCellEditor(new Editor());
+        tree.setEditable(true);
+        tree.setRowHeight(30);
+        tree.setCellRenderer(new CheckboxCellRenderer());
+
+        JFrame frame = new JFrame("bug8023474");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.add(new JScrollPane(tree));
+        frame.setSize(400, 300);
+        frame.setVisible(true);
+    }
+
+    private static Point getRowPointToClick(final int row) throws Exception {
+        final Point[] result = new Point[1];
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                Rectangle rect = tree.getRowBounds(row);
+                Point point = new Point(rect.x + 10, rect.y + rect.height / 2);
+                SwingUtilities.convertPointToScreen(point, tree);
+                result[0] = point;
+            }
+        });
+        return result[0];
+    }
+
+    private static class Editor extends JPanel implements TreeCellEditor {
+        private JCheckBox checkbox;
+
+        public Editor() {
+            setOpaque(false);
+            checkbox = new JCheckBox();
+            add(checkbox);
+        }
+
+        public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected,
+                                                    boolean expanded, boolean leaf, int row) {
+            checkbox.setText(value.toString());
+            checkbox.setSelected(false);
+            return this;
+        }
+
+        public Object getCellEditorValue() {
+            return checkbox.isSelected();
+        }
+
+        public boolean isCellEditable(EventObject anEvent) {
+            return true;
+        }
+
+        public boolean shouldSelectCell(EventObject anEvent) {
+            return true;
+        }
+
+        public boolean stopCellEditing() {
+            return true;
+        }
+
+        public void cancelCellEditing() {
+        }
+
+        public void addCellEditorListener(CellEditorListener l) {
+        }
+
+        public void removeCellEditorListener(CellEditorListener l) {
+        }
+    }
+
+    private static class CheckboxCellRenderer extends JPanel implements TreeCellRenderer {
+        private JCheckBox checkbox;
+
+        public CheckboxCellRenderer() {
+            setOpaque(false);
+            checkbox = new JCheckBox();
+            add(checkbox);
+        }
+
+        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
+                                                      boolean leaf, int row, boolean hasFocus) {
+            checkbox.setText(value.toString());
+            checkbox.setSelected(false);
+            return this;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,241 @@
+/*
+ * 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.awt.SunToolkit;
+
+import java.awt.Robot;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import javax.swing.event.DocumentListener;
+import javax.swing.event.UndoableEditListener;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.Element;
+import javax.swing.text.PlainDocument;
+import javax.swing.text.Position;
+import javax.swing.text.Segment;
+
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_LEFT;
+import static javax.swing.SwingUtilities.invokeAndWait;
+
+/*
+ * @test
+ * @bug 6968363
+ * @summary Ensures that a custom document may not extend AbstractDocument
+ * @author Sergey Malenkov
+ */
+public class Test6968363 implements Runnable, Thread.UncaughtExceptionHandler {
+    private JFrame frame;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) getDefaultToolkit();
+        Runnable task = new Test6968363();
+        invokeAndWait(task);
+        toolkit.realSync(100);
+        new Robot().keyPress(VK_LEFT);
+        toolkit.realSync(100);
+        invokeAndWait(task);
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable throwable) {
+        throwable.printStackTrace();
+        System.exit(1);
+    }
+
+    @Override
+    public void run() {
+        if (this.frame == null) {
+            Thread.setDefaultUncaughtExceptionHandler(this);
+            this.frame = new JFrame(getClass().getSimpleName());
+            this.frame.add(NORTH, new JLabel("Copy Paste a HINDI text into the field below"));
+            this.frame.add(SOUTH, new JTextField(new MyDocument(), "\u0938", 10));
+            this.frame.pack();
+            this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+            this.frame.setLocationRelativeTo(null);
+            this.frame.setVisible(true);
+        } else {
+            this.frame.dispose();
+            this.frame = null;
+        }
+    }
+
+    private static class MyDocument implements Document {
+        private final Document document = new PlainDocument();
+
+        @Override
+        public int getLength() {
+            return this.document.getLength();
+        }
+
+        @Override
+        public void addDocumentListener(DocumentListener listener) {
+            this.document.addDocumentListener(listener);
+        }
+
+        @Override
+        public void removeDocumentListener(DocumentListener listener) {
+            this.document.removeDocumentListener(listener);
+        }
+
+        @Override
+        public void addUndoableEditListener(UndoableEditListener listener) {
+            this.document.addUndoableEditListener(listener);
+        }
+
+        @Override
+        public void removeUndoableEditListener(UndoableEditListener listener) {
+            this.document.removeUndoableEditListener(listener);
+        }
+
+        @Override
+        public Object getProperty(Object key) {
+            return this.document.getProperty(key);
+        }
+
+        @Override
+        public void putProperty(Object key, Object value) {
+            this.document.putProperty(key, value);
+        }
+
+        @Override
+        public void remove(int offset, int length) throws BadLocationException {
+            this.document.remove(offset, length);
+        }
+
+        @Override
+        public void insertString(int offset, String string, AttributeSet set) throws BadLocationException {
+            for (int i = 0; i < string.length(); i++) {
+                System.out.println("i: " + i + "; ch: " + Integer.toHexString(string.charAt(i)));
+            }
+            this.document.insertString(offset, string, set);
+        }
+
+        @Override
+        public String getText(int offset, int length) throws BadLocationException {
+            return this.document.getText(offset, length);
+        }
+
+        @Override
+        public void getText(int offset, int length, Segment segment) throws BadLocationException {
+            this.document.getText(offset, length, segment);
+        }
+
+        @Override
+        public Position getStartPosition() {
+            return this.document.getStartPosition();
+        }
+
+        @Override
+        public Position getEndPosition() {
+            return this.document.getEndPosition();
+        }
+
+        @Override
+        public Position createPosition(int offset) throws BadLocationException {
+            return this.document.createPosition(offset);
+        }
+
+        @Override
+        public Element[] getRootElements() {
+            Element[] elements = this.document.getRootElements();
+            Element[] wrappers = new Element[elements.length];
+            for (int i = 0; i < elements.length; i++) {
+                wrappers[i] = new MyElement(elements[i]);
+            }
+            return wrappers;
+        }
+
+        @Override
+        public Element getDefaultRootElement() {
+            return new MyElement(this.document.getDefaultRootElement());
+        }
+
+        @Override
+        public void render(Runnable task) {
+            this.document.render(task);
+        }
+
+        private class MyElement implements Element {
+            private final Element element;
+
+            private MyElement(Element element) {
+                this.element = element;
+            }
+
+            @Override
+            public Document getDocument() {
+                return MyDocument.this;
+            }
+
+            @Override
+            public Element getParentElement() {
+                return new MyElement(this.element.getParentElement());
+            }
+
+            @Override
+            public String getName() {
+                return this.element.getName();
+            }
+
+            @Override
+            public AttributeSet getAttributes() {
+                return this.element.getAttributes();
+            }
+
+            @Override
+            public int getStartOffset() {
+                return this.element.getStartOffset();
+            }
+
+            @Override
+            public int getEndOffset() {
+                return this.element.getEndOffset();
+            }
+
+            @Override
+            public int getElementIndex(int offset) {
+                return this.element.getElementIndex(offset);
+            }
+
+            @Override
+            public int getElementCount() {
+                return this.element.getElementCount();
+            }
+
+            @Override
+            public Element getElement(int index) {
+                return new MyElement(this.element.getElement(index));
+            }
+
+            @Override
+            public boolean isLeaf() {
+                return this.element.isLeaf();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/DefaultCaret/7083457/bug7083457.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ */
+
+import javax.swing.text.DefaultCaret;
+
+/**
+ * @test
+ * @bug 7083457
+ * @author Alexander Scherbatiy
+ * @summary  Incomplete specification for javax/swing/text/DefaultCaret.html#setVisible(boolean)
+ * @run main bug7083457
+ */
+public class bug7083457 {
+
+    public static void main(String[] args) {
+        DefaultCaret caret = new DefaultCaret();
+
+        for (int i = 0; i < 10; i++) {
+            boolean active = (i % 2 == 0);
+            caret.setVisible(active);
+            if (caret.isActive() != active) {
+                throw new RuntimeException("caret.isActive() does not equal: " + active);
+            }
+        }
+    }
+}
--- a/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Fri Oct 11 09:17:18 2013 -0400
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8014863
+ * @bug 8024395
  * @summary  Tests the calculation of the line breaks when a text is inserted
  * @author Dmitry Markov
  * @library ../../../regtesthelpers
@@ -34,91 +35,107 @@
 import sun.awt.SunToolkit;
 
 import javax.swing.*;
+import javax.swing.text.GlyphView;
+import javax.swing.text.View;
 import javax.swing.text.html.HTMLEditorKit;
 import java.awt.*;
 import java.awt.event.KeyEvent;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
 
 public class bug8014863 {
 
     private static JEditorPane editorPane;
+    private static JFrame frame;
     private static Robot robot;
     private static SunToolkit toolkit;
 
+    private static String text1 = "<p>one two qqqq <em>this is a test sentence</em> qqqq <em>pp</em> qqqq <em>pp</em> " +
+            "qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>";
+    private static String text2 = "<p>qqqq <em>this is a test sentence</em> qqqq <em>pp</em> qqqq <em>pp</em> " +
+            "qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>";
+
+    private static ArrayList<GlyphView> glyphViews;
+
     public static void main(String[] args) throws Exception {
         toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
+        robot.setAutoDelay(50);
+        glyphViews = new ArrayList<GlyphView>();
 
-        createAndShowGUI();
+        createAndShowGUI(text1);
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                retrieveGlyphViews(editorPane.getUI().getRootView(editorPane));
+            }
+        });
+        GlyphView [] arr1 = glyphViews.toArray(new GlyphView[glyphViews.size()]);
+
+        frame.dispose();
+        glyphViews.clear();
+
+        createAndShowGUI(text2);
 
         toolkit.realSync();
 
         Util.hitKeys(robot, KeyEvent.VK_HOME);
-        Util.hitKeys(robot, KeyEvent.VK_O);
-
         toolkit.realSync();
 
-        if (3 != getNumberOfTextLines()) {
-            throw new RuntimeException("The number of texts lines does not meet the expectation");
-        }
-
+        Util.hitKeys(robot, KeyEvent.VK_O);
         Util.hitKeys(robot, KeyEvent.VK_N);
-
-        toolkit.realSync();
-
-        if (3 != getNumberOfTextLines()) {
-            throw new RuntimeException("The number of texts lines does not meet the expectation");
-        }
-
         Util.hitKeys(robot, KeyEvent.VK_E);
         Util.hitKeys(robot, KeyEvent.VK_SPACE);
         Util.hitKeys(robot, KeyEvent.VK_T);
         Util.hitKeys(robot, KeyEvent.VK_W);
+        Util.hitKeys(robot, KeyEvent.VK_O);
+        Util.hitKeys(robot, KeyEvent.VK_SPACE);
 
         toolkit.realSync();
 
-        if (3 != getNumberOfTextLines()) {
-            throw new RuntimeException("The number of texts lines does not meet the expectation");
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                retrieveGlyphViews(editorPane.getUI().getRootView(editorPane));
+            }
+        });
+        GlyphView [] arr2 = glyphViews.toArray(new GlyphView[glyphViews.size()]);
+
+        if (arr1.length != arr2.length) {
+            throw new RuntimeException("Test Failed!");
+        }
+
+        for (int i=0; i<arr1.length; i++) {
+            GlyphView v1 = arr1[i];
+            GlyphView v2 = arr2[i];
+            Field field = GlyphView.class.getDeclaredField("breakSpots");
+            field.setAccessible(true);
+            int[] breakSpots1 = (int[])field.get(v1);
+            int[] breakSpots2 = (int[])field.get(v2);
+            if (!Arrays.equals(breakSpots1,breakSpots2)) {
+                throw new RuntimeException("Test Failed!");
+            }
+        }
+
+        frame.dispose();
+    }
+
+    private static void retrieveGlyphViews(View root) {
+        for (int i=0; i<= root.getViewCount()-1; i++) {
+            View view = root.getView(i);
+            if (view instanceof GlyphView && view.isVisible()) {
+                if (!glyphViews.contains(view)) {
+                    glyphViews.add((GlyphView)view);
+                }
+            } else {
+                retrieveGlyphViews(view);
+            }
         }
     }
 
-    private static int getNumberOfTextLines() throws Exception {
-        int numberOfLines = 0;
-        int caretPosition = getCaretPosition();
-        int current = 1;
-        int previous;
-
-        setCaretPosition(current);
-        do {
-            previous = current;
-            Util.hitKeys(robot, KeyEvent.VK_DOWN);
-            toolkit.realSync();
-            current = getCaretPosition();
-            numberOfLines++;
-        } while (current != previous);
-
-        setCaretPosition(caretPosition);
-        return numberOfLines;
-    }
-
-    private static int getCaretPosition() throws Exception {
-        final int[] result = new int[1];
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                result[0] = editorPane.getCaretPosition();
-            }
-        });
-        return result[0];
-    }
-
-    private static void setCaretPosition(final int position) throws Exception {
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                editorPane.setCaretPosition(position);
-            }
-        });
-    }
-
-    private static void createAndShowGUI() throws Exception {
+    private static void createAndShowGUI(String text) throws Exception {
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 try {
@@ -126,22 +143,17 @@
                 } catch (Exception ex) {
                     throw new RuntimeException(ex);
                 }
-                JFrame frame = new JFrame();
+                frame = new JFrame();
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
                 editorPane = new JEditorPane();
                 HTMLEditorKit editorKit = new HTMLEditorKit();
                 editorPane.setEditorKit(editorKit);
-                editorPane.setText("<p>qqqq <em>pp</em> qqqq <em>pp</em> " +
-                        "qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp" +
-                        "</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>");
+                editorPane.setText(text);
                 editorPane.setCaretPosition(1);
-                // An actual font size depends on OS and might be differnet on various OSs.
-                // It is necessary to calculate the width to meet the expected number of lines.
-                int width = SwingUtilities.computeStringWidth(editorPane.getFontMetrics(editorPane.getFont()),
-                        "qqqq pp qqqq pp qqqq pp qqqqqqqq");
+
                 frame.add(editorPane);
-                frame.setSize(width, 200);
+                frame.setSize(200, 200);
                 frame.setVisible(true);
             }
         });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/ws/clientjar/TestService.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.jws.WebService;
+
+@WebService(serviceName ="TestService", targetNamespace = "http://test/jaxws/sample/")
+public class TestService {
+    public void foo() {
+        try {
+            bar();
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    private void bar() {
+        // nothing done
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/ws/clientjar/TestWsImport.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,151 @@
+/*
+ * 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 8016271
+ * @summary wsimport -clientjar does not create portable jar on windows due to hardcoded '\'
+ * @run main/othervm TestWsImport
+ */
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.File;
+import java.net.InetSocketAddress;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import static java.nio.file.FileVisitResult.*;
+import java.util.Enumeration;
+import java.util.jar.JarFile;
+
+import com.sun.net.httpserver.HttpContext;
+import com.sun.net.httpserver.HttpServer;
+
+public class TestWsImport {
+
+    public static void main(String[] args) throws IOException {
+
+        String javaHome = System.getProperty("java.home");
+        if (javaHome.endsWith("jre")) {
+            javaHome = new File(javaHome).getParent();
+        }
+        String wsimport = javaHome + File.separator + "bin" + File.separator + "wsimport";
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            wsimport = wsimport.concat(".exe");
+        }
+
+        Endpoint endpoint = Endpoint.create(new TestService());
+        HttpServer httpServer = null;
+        try {
+            // Manually create HttpServer here using ephemeral address for port
+            // so as to not end up with attempt to bind to an in-use port
+            httpServer = HttpServer.create(new InetSocketAddress(0), 0);
+            HttpContext httpContext = httpServer.createContext("/hello");
+            int port = httpServer.getAddress().getPort();
+            System.out.println("port = " + port);
+            httpServer.start();
+            endpoint.publish(httpContext);
+            String address = "http://localhost:" + port + "/hello";
+
+            Service service = Service.create(new URL(address + "?wsdl"),
+                new QName("http://test/jaxws/sample/",
+                "TestService"));
+
+            String[] wsargs = {
+                wsimport,
+                "-p",
+                "wstest",
+                "-J-Djavax.xml.accessExternalSchema=all",
+                address + "?wsdl",
+                "-clientjar",
+                "wsjar.jar"
+            };
+            ProcessBuilder pb = new ProcessBuilder(wsargs);
+            pb.redirectErrorStream(true);
+            Process p = pb.start();
+            BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+            String s = r.readLine();
+            while (s != null) {
+                System.out.println(s.trim());
+                s = r.readLine();
+            }
+            p.waitFor();
+            p.destroy();
+
+            try (JarFile jarFile = new JarFile("wsjar.jar")) {
+                for (Enumeration em = jarFile.entries(); em.hasMoreElements();) {
+                    String fileName = em.nextElement().toString();
+                    if (fileName.contains("\\")) {
+                        throw new RuntimeException("\"\\\" character detected in jar file: " + fileName);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException(e.getMessage());
+        } finally {
+            endpoint.stop();
+            if (httpServer != null) {
+                httpServer.stop(0);
+            }
+            Path p = Paths.get("wsjar.jar");
+            Files.deleteIfExists(p);
+            p = Paths.get("wstest");
+            if (Files.exists(p)) {
+                try {
+                    Files.walkFileTree(p, new SimpleFileVisitor<Path>() {
+                        @Override
+                        public FileVisitResult visitFile(Path file,
+                            BasicFileAttributes attrs) throws IOException {
+
+                            Files.delete(file);
+                            return CONTINUE;
+                        }
+                        @Override
+                        public FileVisitResult postVisitDirectory(Path dir,
+                            IOException exc) throws IOException {
+
+                            if (exc == null) {
+                                Files.delete(dir);
+                                return CONTINUE;
+                            } else {
+                                throw exc;
+                            }
+                        }
+                    });
+                } catch (IOException ioe) {
+                    ioe.printStackTrace();
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/KeyPairGenerator/TestDH2048.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 7196382
+ * @summary Ensure that 2048-bit DH key pairs can be generated
+ * @author Valerie Peng
+ * @library ..
+ */
+
+import java.io.*;
+import java.util.*;
+
+import java.security.*;
+
+import javax.crypto.*;
+
+public class TestDH2048 extends PKCS11Test {
+
+    private static void checkUnsupportedKeySize(KeyPairGenerator kpg, int ks)
+        throws Exception {
+        try {
+            kpg.initialize(ks);
+            throw new Exception("Expected IPE not thrown for " + ks);
+        } catch (InvalidParameterException ipe) {
+        }
+    }
+
+    public void main(Provider p) throws Exception {
+        if (p.getService("KeyPairGenerator", "DH") == null) {
+            System.out.println("KPG for DH not supported, skipping");
+            return;
+        }
+        KeyPairGenerator kpg = KeyPairGenerator.getInstance("DH", p);
+        kpg.initialize(2048);
+        KeyPair kp1 = kpg.generateKeyPair();
+        checkUnsupportedKeySize(kpg, 1536);
+        checkUnsupportedKeySize(kpg, 2176);
+        checkUnsupportedKeySize(kpg, 3072);
+    }
+
+    public static void main(String[] args) throws Exception {
+        main(new TestDH2048());
+    }
+}
--- a/jdk/test/sun/security/provider/KeyStore/DKSTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/security/provider/KeyStore/DKSTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -81,8 +81,7 @@
         int expected;
         KeyStore keystore = KeyStore.getInstance("DKS");
         // load entries
-        keystore.load(
-            new KeyStore.DomainLoadStoreParameter(config, PASSWORDS));
+        keystore.load(new DomainLoadStoreParameter(config, PASSWORDS));
         cacertsCount = expected = keystore.size();
         System.out.println("\nLoading domain keystore: " + config + "\t[" +
             expected + " entries]");
@@ -95,8 +94,7 @@
         expected = cacertsCount + 1;
         keystore = KeyStore.getInstance("DKS");
         // load entries
-        keystore.load(
-            new KeyStore.DomainLoadStoreParameter(config, PASSWORDS));
+        keystore.load(new DomainLoadStoreParameter(config, PASSWORDS));
         System.out.println("\nLoading domain keystore: " + config + "\t[" +
             expected + " entries]");
         checkEntries(keystore, expected);
@@ -109,7 +107,7 @@
         keystore = KeyStore.getInstance("DKS");
         // load entries
         keystore.load(
-            new KeyStore.DomainLoadStoreParameter(config,
+            new DomainLoadStoreParameter(config,
                 Collections.<String, KeyStore.ProtectionParameter>emptyMap()));
         System.out.println("\nLoading domain keystore: " + config + "\t[" +
             expected + " entries]");
@@ -129,8 +127,7 @@
         expected = 0;
         keystore = KeyStore.getInstance("DKS");
         // load entries
-        keystore.load(
-            new KeyStore.DomainLoadStoreParameter(config, PASSWORDS));
+        keystore.load(new DomainLoadStoreParameter(config, PASSWORDS));
         System.out.println("\nLoading domain keystore: " + config + "\t[" +
             expected + " entries]");
         checkEntries(keystore, expected);
@@ -142,8 +139,7 @@
         expected = 2 + 1 + 1 + 1;
         keystore = KeyStore.getInstance("DKS");
         // load entries
-        keystore.load(
-            new KeyStore.DomainLoadStoreParameter(config, PASSWORDS));
+        keystore.load(new DomainLoadStoreParameter(config, PASSWORDS));
         System.out.println("\nLoading domain keystore: " + config + "\t[" +
             expected + " entries]");
         checkEntries(keystore, expected);
@@ -158,12 +154,10 @@
         config = new URI(CONFIG + "#keystores_tmp");
         System.out.println("Storing domain keystore: " + config + "\t[" +
             expected + " entries]");
-        keystore.store(
-            new KeyStore.DomainLoadStoreParameter(config, PASSWORDS));
+        keystore.store(new DomainLoadStoreParameter(config, PASSWORDS));
         keystore = KeyStore.getInstance("DKS");
         // reload entries
-        keystore.load(
-            new KeyStore.DomainLoadStoreParameter(config, PASSWORDS));
+        keystore.load(new DomainLoadStoreParameter(config, PASSWORDS));
         System.out.println("Reloading domain keystore: " + config + "\t[" +
             expected + " entries]");
         checkEntries(keystore, expected);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/DHKeyExchange/DHEKeySizing.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,477 @@
+/*
+ * 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.
+ */
+
+//
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+//
+
+/*
+ * @test
+ * @bug 6956398
+ * @summary make ephemeral DH key match the length of the certificate key
+ * @run main/othervm
+ *      DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1318 75
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched
+ *      DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1318 75
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy
+ *      DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1318 75
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024
+ *      DHEKeySizing SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA true 1318 75
+ *
+ * @run main/othervm
+ *      DHEKeySizing SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA true 292 75
+ *
+ * @run main/othervm
+ *      DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA  false 1510 139
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy
+ *      DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA  false 1414 107
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched
+ *      DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA  false 1894 267
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024
+ *      DHEKeySizing TLS_DHE_RSA_WITH_AES_128_CBC_SHA  false 1510 139
+ *
+ * @run main/othervm
+ *      DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5  false 484 139
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=legacy
+ *      DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5  false 388 107
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=matched
+ *      DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5  false 484 139
+ * @run main/othervm -Djdk.tls.ephemeralDHKeySize=1024
+ *      DHEKeySizing SSL_DH_anon_WITH_RC4_128_MD5  false 484 139
+ */
+
+/*
+ * This is a simple hack to test key sizes of Diffie-Hellman key exchanging
+ * during SSL/TLS handshaking.
+ *
+ * The record length of DH ServerKeyExchange and ClientKeyExchange.
+ * ServerKeyExchange message are wrapped in ServerHello series messages, which
+ * contains ServerHello, Certificate and ServerKeyExchange message.
+ *
+ *    struct {
+ *        opaque dh_p<1..2^16-1>;
+ *        opaque dh_g<1..2^16-1>;
+ *        opaque dh_Ys<1..2^16-1>;
+ *    } ServerDHParams;     // Ephemeral DH parameters
+ *
+ *    struct {
+ *        select (PublicValueEncoding) {
+ *            case implicit: struct { };
+ *            case explicit: opaque dh_Yc<1..2^16-1>;
+ *        } dh_public;
+ *    } ClientDiffieHellmanPublic;
+ *
+ * Fomr above structures, it is clear that if the DH key size increasing 128
+ * bits (16 bytes), the ServerHello series messages increases 48 bytes
+ * (becuase dh_p, dh_g and dh_Ys each increase 16 bytes) and ClientKeyExchange
+ * increases 16 bytes (because of the size increasing of dh_Yc).
+ *
+ * Here is a summary of the record length in the test case.
+ *
+ *            |  ServerHello Series  |  ClientKeyExchange | ServerHello Anon
+ *   512-bit  |          1318 bytes  |           75 bytes |        292 bytes
+ *   768-bit  |          1414 bytes  |          107 bytes |        388 bytes
+ *  1024-bit  |          1510 bytes  |          139 bytes |        484 bytes
+ *  2048-bit  |          1894 bytes  |          267 bytes |        484 bytes
+ */
+
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import java.io.*;
+import java.nio.*;
+import java.security.KeyStore;
+import java.security.KeyFactory;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.*;
+import java.security.interfaces.*;
+import java.util.Base64;
+
+public class DHEKeySizing {
+
+    private static boolean debug = true;
+
+    private SSLContext sslc;
+    private SSLEngine ssle1;    // client
+    private SSLEngine ssle2;    // server
+
+    private ByteBuffer appOut1;         // write side of ssle1
+    private ByteBuffer appIn1;          // read side of ssle1
+    private ByteBuffer appOut2;         // write side of ssle2
+    private ByteBuffer appIn2;          // read side of ssle2
+
+    private ByteBuffer oneToTwo;        // "reliable" transport ssle1->ssle2
+    private ByteBuffer twoToOne;        // "reliable" transport ssle2->ssle1
+
+    /*
+     * Where do we find the keystores?
+     */
+    // Certificates and key used in the test.
+    static String trustedCertStr =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIC8jCCAdqgAwIBAgIEUjkuRzANBgkqhkiG9w0BAQUFADA7MR0wGwYDVQQLExRT\n" +
+        "dW5KU1NFIFRlc3QgU2VyaXZjZTENMAsGA1UEChMESmF2YTELMAkGA1UEBhMCVVMw\n" +
+        "HhcNMTMwOTE4MDQzODMxWhcNMTMxMjE3MDQzODMxWjA7MR0wGwYDVQQLExRTdW5K\n" +
+        "U1NFIFRlc3QgU2VyaXZjZTENMAsGA1UEChMESmF2YTELMAkGA1UEBhMCVVMwggEi\n" +
+        "MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCO+IGeaskJAvEcYc7pCl9neK3E\n" +
+        "a28fwWLtChufYNaC9hQfZlUdETWYjV7fZJVJKT/oLzdDNMWuVA0LKXArpI3thLNK\n" +
+        "QLXisdF9hKPlZRDazACL9kWUUtJ0FzpEySK4e8wW/z9FuU6e6iO19FbjxAfInJqk\n" +
+        "3EDiEhB5g73S2vtvPCxgq2DvWw9TDl/LIqdKG2JCS93koXCCaHmQ7MrIOqHPd+8r\n" +
+        "RbGpatXT9qyHKppUv9ATxVygO4rA794mgCFxpT+fkhz+NEB0twTkM65T1hnnOv5n\n" +
+        "ZIxkcjBggt85UlZtnP3b9P7SYxsWIa46Oc38Od2f3YejfVg6B+PqPgWNl3+/AgMB\n" +
+        "AAEwDQYJKoZIhvcNAQEFBQADggEBAAlrP6DFLRPSy0IgQhcI2i56tR/na8pezSte\n" +
+        "ZHcCdaCZPDy4UP8mpLJ9QCjEB5VJv8hPm4xdK7ULnKGOGHgYqDpV2ZHvQlhV1woQ\n" +
+        "TZGb/LM3c6kAs0j4j9KM2fq3iYUYexjIkS1KzsziflxMM6igS9BRMBR2LQyU+cYq\n" +
+        "YEsFzkF7Aj2ET4v/+tgot9mRr2NioJcaJkdsPDpMU3IKB1cczfu+OuLQ/GCG0Fqu\n" +
+        "6ijCeCqfnaAbemHbJeVZZ6Qgka3uC2YMntLBmLkhqEo1d9zGYLoh7oWL77y5ibQZ\n" +
+        "LK5/H/zikcu579TWjlDHcqL3arCwBcrtsjSaPrRSWMrWV/6c0qw=\n" +
+        "-----END CERTIFICATE-----";
+
+    // Private key in the format of PKCS#8
+    static String targetPrivateKey =
+        "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCO+IGeaskJAvEc\n" +
+        "Yc7pCl9neK3Ea28fwWLtChufYNaC9hQfZlUdETWYjV7fZJVJKT/oLzdDNMWuVA0L\n" +
+        "KXArpI3thLNKQLXisdF9hKPlZRDazACL9kWUUtJ0FzpEySK4e8wW/z9FuU6e6iO1\n" +
+        "9FbjxAfInJqk3EDiEhB5g73S2vtvPCxgq2DvWw9TDl/LIqdKG2JCS93koXCCaHmQ\n" +
+        "7MrIOqHPd+8rRbGpatXT9qyHKppUv9ATxVygO4rA794mgCFxpT+fkhz+NEB0twTk\n" +
+        "M65T1hnnOv5nZIxkcjBggt85UlZtnP3b9P7SYxsWIa46Oc38Od2f3YejfVg6B+Pq\n" +
+        "PgWNl3+/AgMBAAECggEAPdb5Ycc4m4A9QBSCRcRpzbyiFLKPh0HDg1n65q4hOtYr\n" +
+        "kAVYTVFTSF/lqGS+Ob3w2YIKujQKSUQrvCc5UHdFuHXMgxKIWbymK0+DAMb9SlYw\n" +
+        "6lkkcWp9gx9E4dnJ/df2SAAxovvrKMuHlL1SFASHhVtPfH2URvSfUaANLDXxyYOs\n" +
+        "8BX0Nr6wazhWjLjXo9yIGnKSvFfB8XisYcA78kEgas43zhmIGCDPqaYyyffOfRbx\n" +
+        "pM1KNwGmlN86iWR1CbwA/wwhcMySWQueS+s7cHbpRqZIYJF9jEeELiwi0vxjealS\n" +
+        "EMuHYedIRFMWaDIq9XyjrvXamHb0Z25jlXBNZHaM0QKBgQDE9adl+zAezR/n79vw\n" +
+        "0XiX2Fx1UEo3ApZHuoA2Q/PcBk+rlKqqQ3IwTcy6Wo648wK7v6Nq7w5nEWcsf0dU\n" +
+        "QA2Ng/AJEev/IfF34x7sKGYxtk1gcE0EuSBA3R+ocEZxnNw1Ryd5nUU24s8d4jCP\n" +
+        "Mkothnyaim+zE2raDlEtVc0CaQKBgQC509av+02Uq5oMjzbQp5PBJfQFjATOQT15\n" +
+        "eefYnVYurkQ1kcVfixkrO2ORhg4SjmI2Z5hJDgGtXdwgidpzkad+R2epS5qLMyno\n" +
+        "lQVpY6bMpEZ7Mos0yQygxnm8uNohEcTExOe+nP5fNJVpzBsGmfeyYOhnPQlf6oqf\n" +
+        "0cHizedb5wKBgQC/l5LyMil6HOGHlhzmIm3jj7VI7QR0hJC5T6N+phVml8ESUDjA\n" +
+        "DYHbmSKouISTRtkG14FY+RiSjCxH7bvuKazFV2289PETquogTA/9e8MFYqfcQwG4\n" +
+        "sXi9gBxWlnj/9a2EKiYtOB5nKLR/BlNkSHA93tAA6N+FXEMZwMmYhxk42QKBgAuY\n" +
+        "HQgD3PZOsqDf+qKQIhbmAFCsSMx5o5VFtuJ8BpmJA/Z3ruHkMuDQpsi4nX4o5hXQ\n" +
+        "5t6AAjjH52kcUMXvK40kdWJJtk3DFnVNfvXxYsHX6hHbuHXFqYUKfSP6QJnZmvZP\n" +
+        "9smcz/4usLfWJUWHK740b6upUkFqx9Vq5/b3s9y3AoGAdM5TW7LkkOFsdMGVAUzR\n" +
+        "9iXmCWElHTK2Pcp/3yqDBHSfiQx6Yp5ANyPnE9NBM0yauCfOyBB2oxLO4Rdv3Rqk\n" +
+        "9V9kyR/YAGr7dJaPcQ7pZX0OpkzgueAOJYPrx5VUzPYUtklYV1ycFZTfKlpFCxT+\n" +
+        "Ei6KUo0NXSdUIcB4yib1J10=";
+
+    static char passphrase[] = "passphrase".toCharArray();
+
+    /*
+     * Majority of the test case is here, setup is done below.
+     */
+
+    private void createSSLEngines() throws Exception {
+        ssle1 = sslc.createSSLEngine("client", 1);
+        ssle1.setUseClientMode(true);
+
+        ssle2 = sslc.createSSLEngine("server", 2);
+        ssle2.setUseClientMode(false);
+    }
+
+    private boolean isHandshaking(SSLEngine e) {
+        return (e.getHandshakeStatus() != HandshakeStatus.NOT_HANDSHAKING);
+    }
+
+    private void checkResult(ByteBuffer bbIn, ByteBuffer bbOut,
+            SSLEngineResult result,
+            Status status, HandshakeStatus hsStatus,
+            int consumed, int produced)
+            throws Exception {
+
+        if ((status != null) && (result.getStatus() != status)) {
+            throw new Exception("Unexpected Status: need = " + status +
+                " got = " + result.getStatus());
+        }
+
+        if ((hsStatus != null) && (result.getHandshakeStatus() != hsStatus)) {
+            throw new Exception("Unexpected hsStatus: need = " + hsStatus +
+                " got = " + result.getHandshakeStatus());
+        }
+
+        if ((consumed != -1) && (consumed != result.bytesConsumed())) {
+            throw new Exception("Unexpected consumed: need = " + consumed +
+                " got = " + result.bytesConsumed());
+        }
+
+        if ((produced != -1) && (produced != result.bytesProduced())) {
+            throw new Exception("Unexpected produced: need = " + produced +
+                " got = " + result.bytesProduced());
+        }
+
+        if ((consumed != -1) && (bbIn.position() != result.bytesConsumed())) {
+            throw new Exception("Consumed " + bbIn.position() +
+                " != " + consumed);
+        }
+
+        if ((produced != -1) && (bbOut.position() != result.bytesProduced())) {
+            throw new Exception("produced " + bbOut.position() +
+                " != " + produced);
+        }
+    }
+
+    private void test(String cipherSuite, boolean exportable,
+            int lenServerKeyEx, int lenClientKeyEx) throws Exception {
+
+        createSSLEngines();
+        createBuffers();
+
+        SSLEngineResult result1;        // ssle1's results from last operation
+        SSLEngineResult result2;        // ssle2's results from last operation
+
+        String[] suites = new String [] {cipherSuite};
+
+        ssle1.setEnabledCipherSuites(suites);
+        ssle2.setEnabledCipherSuites(suites);
+
+        log("======================================");
+        log("===================");
+        log("client hello");
+        result1 = ssle1.wrap(appOut1, oneToTwo);
+        checkResult(appOut1, oneToTwo, result1,
+            Status.OK, HandshakeStatus.NEED_UNWRAP, 0, -1);
+        oneToTwo.flip();
+
+        result2 = ssle2.unwrap(oneToTwo, appIn2);
+        checkResult(oneToTwo, appIn2, result2,
+            Status.OK, HandshakeStatus.NEED_TASK, result1.bytesProduced(), 0);
+        runDelegatedTasks(ssle2);
+        oneToTwo.compact();
+
+        log("===================");
+        log("ServerHello");
+        result2 = ssle2.wrap(appOut2, twoToOne);
+        checkResult(appOut2, twoToOne, result2,
+            Status.OK, HandshakeStatus.NEED_UNWRAP, 0, -1);
+        twoToOne.flip();
+
+        log("Message length of ServerHello series: " + twoToOne.remaining());
+        if (lenServerKeyEx != twoToOne.remaining()) {
+            throw new Exception(
+                "Expected to generate ServerHello series messages of " +
+                lenServerKeyEx + " bytes, but not " + twoToOne.remaining());
+        }
+
+        result1 = ssle1.unwrap(twoToOne, appIn1);
+        checkResult(twoToOne, appIn1, result1,
+            Status.OK, HandshakeStatus.NEED_TASK, result2.bytesProduced(), 0);
+        runDelegatedTasks(ssle1);
+        twoToOne.compact();
+
+        log("===================");
+        log("Key Exchange");
+        result1 = ssle1.wrap(appOut1, oneToTwo);
+        checkResult(appOut1, oneToTwo, result1,
+            Status.OK, HandshakeStatus.NEED_WRAP, 0, -1);
+        oneToTwo.flip();
+
+        log("Message length of ClientKeyExchange: " + oneToTwo.remaining());
+        if (lenClientKeyEx != oneToTwo.remaining()) {
+            throw new Exception(
+                "Expected to generate ClientKeyExchange message of " +
+                lenClientKeyEx + " bytes, but not " + oneToTwo.remaining());
+        }
+        result2 = ssle2.unwrap(oneToTwo, appIn2);
+        checkResult(oneToTwo, appIn2, result2,
+            Status.OK, HandshakeStatus.NEED_TASK, result1.bytesProduced(), 0);
+        runDelegatedTasks(ssle2);
+        oneToTwo.compact();
+
+        log("===================");
+        log("Client CCS");
+        result1 = ssle1.wrap(appOut1, oneToTwo);
+        checkResult(appOut1, oneToTwo, result1,
+            Status.OK, HandshakeStatus.NEED_WRAP, 0, -1);
+        oneToTwo.flip();
+
+        result2 = ssle2.unwrap(oneToTwo, appIn2);
+        checkResult(oneToTwo, appIn2, result2,
+            Status.OK, HandshakeStatus.NEED_UNWRAP,
+            result1.bytesProduced(), 0);
+        oneToTwo.compact();
+
+        log("===================");
+        log("Client Finished");
+        result1 = ssle1.wrap(appOut1, oneToTwo);
+        checkResult(appOut1, oneToTwo, result1,
+            Status.OK, HandshakeStatus.NEED_UNWRAP, 0, -1);
+        oneToTwo.flip();
+
+        result2 = ssle2.unwrap(oneToTwo, appIn2);
+        checkResult(oneToTwo, appIn2, result2,
+            Status.OK, HandshakeStatus.NEED_WRAP,
+            result1.bytesProduced(), 0);
+        oneToTwo.compact();
+
+        log("===================");
+        log("Server CCS");
+        result2 = ssle2.wrap(appOut2, twoToOne);
+        checkResult(appOut2, twoToOne, result2,
+            Status.OK, HandshakeStatus.NEED_WRAP, 0, -1);
+        twoToOne.flip();
+
+        result1 = ssle1.unwrap(twoToOne, appIn1);
+        checkResult(twoToOne, appIn1, result1,
+            Status.OK, HandshakeStatus.NEED_UNWRAP, result2.bytesProduced(), 0);
+        twoToOne.compact();
+
+        log("===================");
+        log("Server Finished");
+        result2 = ssle2.wrap(appOut2, twoToOne);
+        checkResult(appOut2, twoToOne, result2,
+            Status.OK, HandshakeStatus.FINISHED, 0, -1);
+        twoToOne.flip();
+
+        result1 = ssle1.unwrap(twoToOne, appIn1);
+        checkResult(twoToOne, appIn1, result1,
+            Status.OK, HandshakeStatus.FINISHED, result2.bytesProduced(), 0);
+        twoToOne.compact();
+
+        log("===================");
+        log("Check Session/Ciphers");
+        String cs = ssle1.getSession().getCipherSuite();
+        if (!cs.equals(suites[0])) {
+            throw new Exception("suites not equal: " + cs + "/" + suites[0]);
+        }
+
+        cs = ssle2.getSession().getCipherSuite();
+        if (!cs.equals(suites[0])) {
+            throw new Exception("suites not equal: " + cs + "/" + suites[0]);
+        }
+
+        log("===================");
+        log("Done with SSL/TLS handshaking");
+    }
+
+    public static void main(String args[]) throws Exception {
+        if (args.length != 4) {
+            System.out.println(
+                "Usage: java DHEKeySizing cipher-suite " +
+                "exportable(true|false)\n" +
+                "    size-of-server-hello-record size-of-client-key-exchange");
+            throw new Exception("Incorrect usage!");
+        }
+
+        (new DHEKeySizing()).test(args[0],
+                Boolean.parseBoolean(args[1]),
+                Integer.parseInt(args[2]),
+                Integer.parseInt(args[3]));
+        System.out.println("Test Passed.");
+    }
+
+    /*
+     * **********************************************************
+     * Majority of the test case is above, below is just setup stuff
+     * **********************************************************
+     */
+
+    public DHEKeySizing() throws Exception {
+        sslc = getSSLContext();
+    }
+
+    /*
+     * Create an initialized SSLContext to use for this test.
+     */
+    private SSLContext getSSLContext() throws Exception {
+
+        // generate certificate from cert string
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+        // create a key store
+        KeyStore ts = KeyStore.getInstance("JKS");
+        KeyStore ks = KeyStore.getInstance("JKS");
+        ts.load(null, null);
+        ks.load(null, null);
+
+        // import the trused cert
+        ByteArrayInputStream is =
+                    new ByteArrayInputStream(trustedCertStr.getBytes());
+        Certificate trusedCert = cf.generateCertificate(is);
+        is.close();
+        ts.setCertificateEntry("rsa-trusted-2048", trusedCert);
+
+        // generate the private key.
+        String keySpecStr = targetPrivateKey;
+        PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec(
+                            Base64.getMimeDecoder().decode(keySpecStr));
+        KeyFactory kf = KeyFactory.getInstance("RSA");
+        RSAPrivateKey priKey = (RSAPrivateKey)kf.generatePrivate(priKeySpec);
+
+        Certificate[] chain = new Certificate[1];
+        chain[0] = trusedCert;
+
+        // import the key entry.
+        ks.setKeyEntry("rsa-key-2048", priKey, passphrase, chain);
+
+        // create SSL context
+        KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+        kmf.init(ks, passphrase);
+
+        TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+        tmf.init(ts);
+
+        SSLContext sslCtx = SSLContext.getInstance("TLS");
+        sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+        return sslCtx;
+    }
+
+    private void createBuffers() {
+        // Size the buffers as appropriate.
+
+        SSLSession session = ssle1.getSession();
+        int appBufferMax = session.getApplicationBufferSize();
+        int netBufferMax = session.getPacketBufferSize();
+
+        appIn1 = ByteBuffer.allocateDirect(appBufferMax + 50);
+        appIn2 = ByteBuffer.allocateDirect(appBufferMax + 50);
+
+        oneToTwo = ByteBuffer.allocateDirect(netBufferMax);
+        twoToOne = ByteBuffer.allocateDirect(netBufferMax);
+
+        appOut1 = ByteBuffer.wrap("Hi Engine2, I'm SSLEngine1".getBytes());
+        appOut2 = ByteBuffer.wrap("Hello Engine1, I'm SSLEngine2".getBytes());
+
+        log("AppOut1 = " + appOut1);
+        log("AppOut2 = " + appOut2);
+        log("");
+    }
+
+    private static void runDelegatedTasks(SSLEngine engine) throws Exception {
+
+        Runnable runnable;
+        while ((runnable = engine.getDelegatedTask()) != null) {
+            log("running delegated task...");
+            runnable.run();
+        }
+    }
+
+    private static void log(String str) {
+        if (debug) {
+            System.out.println(str);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/tools/keytool/StorePasswords.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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 8008296
+ * @summary Store and retrieve user passwords using PKCS#12 keystore
+ */
+
+import java.io.*;
+import java.security.*;
+import java.util.*;
+import javax.crypto.*;
+import javax.crypto.spec.*;
+
+/*
+ * Store and retrieve passwords protected by a selection of PBE algorithms,
+ * using a PKCS#12 keystore.
+ */
+public class StorePasswords {
+
+    private static final String[] PBE_ALGORITHMS = new String[] {
+        "default PBE algorithm",
+        "PBEWithMD5AndDES",
+        "PBEWithSHA1AndDESede",
+        "PBEWithSHA1AndRC2_40",
+        "PBEWithSHA1AndRC2_128",
+        "PBEWithSHA1AndRC4_40",
+        "PBEWithSHA1AndRC4_128",
+        "PBEWithHmacSHA1AndAES_128",
+        "PBEWithHmacSHA224AndAES_128",
+        "PBEWithHmacSHA256AndAES_128",
+        "PBEWithHmacSHA384AndAES_128",
+        "PBEWithHmacSHA512AndAES_128",
+        "PBEWithHmacSHA1AndAES_256",
+        "PBEWithHmacSHA224AndAES_256",
+        "PBEWithHmacSHA256AndAES_256",
+        "PBEWithHmacSHA384AndAES_256",
+        "PBEWithHmacSHA512AndAES_256"
+    };
+
+    private static final String KEYSTORE = "mykeystore.p12";
+    private static final char[] KEYSTORE_PWD = "changeit".toCharArray();
+    private static final char[] ENTRY_PWD = "protectit".toCharArray();
+    private static final char[] USER_PWD = "hello1".toCharArray();
+
+    public static void main(String[] args) throws Exception {
+
+        new File(KEYSTORE).delete();
+
+        int storeCount = store();
+        int recoverCount = recover();
+
+        if (recoverCount != storeCount) {
+            throw new Exception("Stored " + storeCount + " user passwords, " +
+                "recovered " + recoverCount + " user passwords");
+        }
+        System.out.println("\nStored " + storeCount + " user passwords, " +
+            "recovered " + recoverCount + " user passwords");
+    }
+
+    private static int store() throws Exception {
+        int count = 0;
+        // Load an empty PKCS#12 keystore
+        KeyStore keystore = KeyStore.getInstance("PKCS12");
+        System.out.println("\nLoading PKCS#12 keystore...");
+        keystore.load(null, null);
+
+        // Derive a PBE key from the password
+        PBEKeySpec keySpec = new PBEKeySpec(USER_PWD);
+        SecretKeyFactory factory = SecretKeyFactory.getInstance("PBE");
+        SecretKey key = factory.generateSecret(keySpec);
+        PBEParameterSpec specWithEightByteSalt =
+            new PBEParameterSpec("NaClNaCl".getBytes(), 1024);
+
+        // Store the user password in a keystore entry (for each algorithm)
+        for (String algorithm : PBE_ALGORITHMS) {
+
+            try {
+                System.out.println("Storing user password '" +
+                    new String(USER_PWD) + "' (protected by " + algorithm +
+                    ")");
+
+                if (algorithm.equals("default PBE algorithm")) {
+                     keystore.setKeyEntry(
+                         "this entry is protected by " + algorithm, key,
+                         ENTRY_PWD, null);
+                } else {
+                    keystore.setEntry(
+                        "this entry is protected by " + algorithm,
+                        new KeyStore.SecretKeyEntry(key),
+                        new KeyStore.PasswordProtection(ENTRY_PWD, algorithm,
+                            null));
+                }
+                count++;
+
+            } catch (KeyStoreException e) {
+                Throwable inner = e.getCause();
+                if (inner instanceof UnrecoverableKeyException) {
+                    Throwable inner2 = inner.getCause();
+                    if (inner2 instanceof InvalidAlgorithmParameterException) {
+                        System.out.println("...re-trying due to: " +
+                            inner2.getMessage());
+
+                        // Some PBE algorithms demand an 8-byte salt
+                        keystore.setEntry(
+                            "this entry is protected by " + algorithm,
+                            new KeyStore.SecretKeyEntry(key),
+                            new KeyStore.PasswordProtection(ENTRY_PWD,
+                                algorithm, specWithEightByteSalt));
+                        count++;
+
+                    } else if (inner2  instanceof InvalidKeyException) {
+                        System.out.println("...skipping due to: " +
+                            inner2.getMessage());
+                        // Unsupported crypto keysize
+                        continue;
+                    }
+                } else {
+                    throw e;
+                }
+            }
+        }
+
+        // Store the PKCS#12 keystore
+        System.out.println("Storing PKCS#12 keystore to: " + KEYSTORE);
+        keystore.store(new FileOutputStream(KEYSTORE), KEYSTORE_PWD);
+
+        return count;
+    }
+
+    private static int recover() throws Exception {
+        int count = 0;
+        // Load the PKCS#12 keystore
+        KeyStore keystore = KeyStore.getInstance("PKCS12");
+        System.out.println("\nLoading PKCS#12 keystore from: " + KEYSTORE);
+        keystore.load(new FileInputStream(KEYSTORE), KEYSTORE_PWD);
+
+        SecretKey key;
+        SecretKeyFactory factory;
+        PBEKeySpec keySpec;
+
+        // Retrieve each user password from the keystore
+        for (String algorithm : PBE_ALGORITHMS) {
+            key = (SecretKey) keystore.getKey("this entry is protected by " +
+                algorithm, ENTRY_PWD);
+
+            if (key != null) {
+                count++;
+                factory = SecretKeyFactory.getInstance(key.getAlgorithm());
+                keySpec =
+                    (PBEKeySpec) factory.getKeySpec(key, PBEKeySpec.class);
+                char[] pwd = keySpec.getPassword();
+                System.out.println("Recovered user password '" +
+                     new String(pwd) + "' (protected by " + algorithm + ")");
+
+                if (!Arrays.equals(USER_PWD, pwd)) {
+                    throw new Exception("Failed to recover the user password " +
+                        "protected by " + algorithm);
+                }
+            }
+        }
+
+        return count;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/tools/keytool/StorePasswordsByShell.sh	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,140 @@
+#
+# 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 8008296
+# @summary confirm that keytool correctly imports user passwords
+#
+# @run shell StorePasswordsByShell.sh
+
+# set a few environment variables so that the shell-script can run stand-alone
+# in the source directory
+if [ "${TESTSRC}" = "" ] ; then
+   TESTSRC="."
+fi 
+  
+if [ "${TESTCLASSES}" = "" ] ; then
+   TESTCLASSES="." 
+fi
+  
+if [ "${TESTJAVA}" = "" ] ; then
+   echo "TESTJAVA not set.  Test cannot execute."
+   echo "FAILED!!!"
+   exit 1
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  SunOS )
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
+  Linux )
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
+  Darwin ) 
+    PATHSEP=":"
+    FILESEP="/"
+    ;;
+  CYGWIN* )
+    PATHSEP=";"
+    FILESEP="/"
+    ;;
+  Windows* )
+    PATHSEP=";"
+    FILESEP="\\"
+    ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1;
+    ;;
+esac
+
+PBE_ALGORITHMS="\
+ default-PBE-algorithm \
+ PBEWithMD5AndDES \
+ PBEWithSHA1AndDESede \
+ PBEWithSHA1AndRC2_40 \
+ PBEWithSHA1AndRC2_128 
+ PBEWithSHA1AndRC4_40 \
+ PBEWithSHA1AndRC4_128 \
+ PBEWithHmacSHA1AndAES_128 \
+ PBEWithHmacSHA224AndAES_128 \
+ PBEWithHmacSHA256AndAES_128 \
+ PBEWithHmacSHA384AndAES_128 \
+ PBEWithHmacSHA512AndAES_128 \
+ PBEWithHmacSHA1AndAES_256 \
+ PBEWithHmacSHA224AndAES_256 \
+ PBEWithHmacSHA256AndAES_256 \
+ PBEWithHmacSHA384AndAES_256 \
+ PBEWithHmacSHA512AndAES_256"
+
+USER_PWD="hello1\n"
+ALIAS_PREFIX="this entry is protected by "
+COUNTER=0
+
+# cleanup
+rm mykeystore.p12 > /dev/null 2>&1
+
+echo
+for i in $PBE_ALGORITHMS; do
+
+    if [ $i = "default-PBE-algorithm" ]; then
+        KEYALG=""
+    else
+        KEYALG="-keyalg ${i}"
+    fi
+
+    if [ $COUNTER -lt 5 ]; then
+        IMPORTPASSWORD="-importpassword"
+    else
+        IMPORTPASSWORD="-importpass"
+    fi
+
+    echo "Storing user password (protected by ${i})"
+    echo "${USER_PWD}" | \
+        ${TESTJAVA}${FILESEP}bin${FILESEP}keytool ${IMPORTPASSWORD} \
+            -storetype pkcs12 -keystore mykeystore.p12 -storepass changeit \
+            -alias "${ALIAS_PREFIX}${i}" ${KEYALG} > /dev/null 2>&1
+    if [ $? -ne 0 ]; then
+        echo Error
+    else
+        echo OK
+        COUNTER=`expr ${COUNTER} + 1`
+    fi
+done
+echo
+
+COUNTER2=`${TESTJAVA}${FILESEP}bin${FILESEP}keytool -list -storetype pkcs12 \
+  -keystore mykeystore.p12 -storepass changeit | grep -c "${ALIAS_PREFIX}"`
+
+RESULT="stored ${COUNTER} user passwords, detected ${COUNTER2} user passwords"
+if [ $COUNTER -ne $COUNTER2 -o $COUNTER -lt 11 ]; then
+    echo "ERROR: $RESULT"
+    exit 1
+else
+    echo "OK: $RESULT"
+    exit 0
+fi
--- a/jdk/test/sun/security/tools/keytool/autotest.sh	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/autotest.sh	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2012, 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
@@ -53,18 +53,24 @@
   done
 }
 
+FS="/"
+${TESTJAVA}${FS}bin${FS}java -XshowSettings:properties -version 2> allprop
+cat allprop | grep sun.arch.data.model | grep 32
+if [ "$?" != "0" ]; then
+  B32=false
+else
+  B32=true
+fi
+
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
   SunOS )
     FS="/"
-    LIBNAME="/usr/lib/mps/libsoftokn3.so"
+    LIBNAME="/usr/lib/mps/`isainfo -n`/libsoftokn3.so"
     ;;
   Linux )
-    FS="/"
-    ${TESTJAVA}${FS}bin${FS}java -XshowSettings:properties -version 2> allprop
-    cat allprop | grep os.arch | grep 64
-    if [ "$?" != "0" ]; then
+    if [ $B32 = true ]; then
         LIBNAME=`find_one \
             "/usr/lib/libsoftokn3.so" \
             "/usr/lib/i386-linux-gnu/nss/libsoftokn3.so"`
@@ -82,7 +88,7 @@
 
 if [ "$LIBNAME" = "" ]; then
   echo "Cannot find libsoftokn3.so"
-  exit 1
+  exit 0
 fi
 
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . -XDignore.symbol.file \
--- a/jdk/test/sun/tools/jhat/HatRun.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/tools/jhat/HatRun.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -167,28 +167,23 @@
         String cdir      = System.getProperty("test.classes", ".");
         String os_arch   = System.getProperty("os.arch");
         String os_name   = System.getProperty("os.name");
-        boolean d64      = os_name.equals("SunOS") && (
-                             os_arch.equals("sparcv9") ||
-                             os_arch.equals("amd64"));
-        String isa_dir   = d64?(File.separator+os_arch):"";
         String java      = jre_home
-                             + File.separator + "bin" + isa_dir
+                             + File.separator + "bin"
                              + File.separator + "java";
         String jhat      = sdk_home + File.separator + "bin"
                            + File.separator + "jhat";
         /* Array of strings to be passed in for exec:
          *   1. java
          *   2. -Dtest.classes=.
-         *   3. -d64                 (optional)
-         *   4. -Xcheck:jni          (Just because it finds bugs)
-         *   5. -Xverify:all         (Make sure verification is on full blast)
-         *   6. -agent
+         *   3. -Xcheck:jni          (Just because it finds bugs)
+         *   4. -Xverify:all         (Make sure verification is on full blast)
+         *   5. -agent
          *       vm_options
-         *   7+i. classname
+         *   6+i. classname
          */
         int nvm_options = 0;
         if ( vm_options != null ) nvm_options = vm_options.length;
-        String cmd[]     = new String[1 + (d64?1:0) + 7 + nvm_options];
+        String cmd[]     = new String[1 + 7 + nvm_options];
         int i,j;
 
         i = 0;
@@ -196,9 +191,6 @@
         cmd[i++] = "-cp";
         cmd[i++] = cdir;
         cmd[i++] = "-Dtest.classes=" + cdir;
-        if ( d64 ) {
-            cmd[i++] = "-d64";
-        }
         cmd[i++] = "-Xcheck:jni";
         cmd[i++] = "-Xverify:all";
         dumpfile= cdir + File.separator + class_name + ".hdump";
--- a/jdk/test/sun/tools/jstat/gcCauseOutput1.awk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/tools/jstat/gcCauseOutput1.awk	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 # or more letters and spaces. It also provides for the ".", "(", and ")"
 # characters to allow for the string "System.gc()".
 #
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*$/	{
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*[ ]*[a-zA-Z]+[a-zA-Z \.\(\)]*$/	{
 	    datalines++;
 	}
 
--- a/jdk/test/sun/tools/jstat/lineCounts1.awk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/tools/jstat/lineCounts1.awk	Fri Oct 11 09:17:18 2013 -0400
@@ -18,7 +18,7 @@
 	    headerlines++;
 	}
 
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
 	    datalines++;
 	}
 
--- a/jdk/test/sun/tools/jstat/lineCounts2.awk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/tools/jstat/lineCounts2.awk	Fri Oct 11 09:17:18 2013 -0400
@@ -14,7 +14,7 @@
 	    headerlines++;
 	}
 
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
 	    datalines++;
 	}
 
--- a/jdk/test/sun/tools/jstat/lineCounts3.awk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/tools/jstat/lineCounts3.awk	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 	    headerlines++;
 	}
 
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
 	    datalines++;
 	}
 
--- a/jdk/test/sun/tools/jstat/lineCounts4.awk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/tools/jstat/lineCounts4.awk	Fri Oct 11 09:17:18 2013 -0400
@@ -26,7 +26,7 @@
 	    headerlines++;
 	}
 
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
 	    if (headerlines == 2) {
 	        datalines2++;
 	    }
--- a/jdk/test/sun/tools/jstat/timeStamp1.awk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/tools/jstat/timeStamp1.awk	Fri Oct 11 09:17:18 2013 -0400
@@ -14,7 +14,7 @@
 	    headerlines++;
 	}
 
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
 	    datalines++;
 	}
 
--- a/jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk	Fri Oct 11 09:17:18 2013 -0400
@@ -18,7 +18,7 @@
 	    headerlines++;
 	}
 
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
+/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
 	    datalines++;
 	}
 
--- a/jdk/test/tools/launcher/6842838/Test6842838.sh	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/tools/launcher/6842838/Test6842838.sh	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -48,16 +48,16 @@
     NULL=/dev/null
     PS=":"
     FS="/"
-    JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
+    JAVA_EXE=${TESTJAVA}${FS}bin${FS}java
     ;;
   * )
-    printf "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)\n"
+    printf "Only testing on solaris 64-bit (use libumem to reliably catch buffer overrun)\n"
     exit 0;
     ;;
 esac
 
 if [ ! -x ${JAVA_EXE} ]; then
-    printf "Warning: sparcv9 components not installed - skipping test.\n"
+    printf "Warning: 64-bit components not installed - skipping test.\n"
     exit 0
 fi
 
--- a/jdk/test/tools/launcher/ChangeDataModel.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/tools/launcher/ChangeDataModel.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -30,8 +30,6 @@
  * @author Joseph D. Darcy, ksrini
  */
 import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
 
 public class ChangeDataModel extends TestHelper {
     private static final File TestJar      = new File("test" + JAR_FILE_EXT);
@@ -54,48 +52,14 @@
             throw new Error("unsupported data model");
         }
 
-        // test dual mode systems
-        if (isDualMode) {
-            // albeit dual mode we may not have the 64 bit components present
-            if (dualModePresent()) {
-                // 32-bit -> 64-bit
-                checkExecCount(javaCmd, "-d64");
-                // 64-bit -> 32-bit
-                checkExecCount(java64Cmd, "-d32");
-
-                checkAcceptance(javaCmd, "-d64");
-                checkAcceptance(java64Cmd, "-d32");
-            } else {
-                System.out.println("Warning: no 64-bit components found;" +
-                    " only one data model tested.");
-            }
+        // Negative tests: ensure that non-dual mode systems reject the
+        // complementary (other) data model
+        if (is32Bit) {
+            checkRejection(javaCmd, "-d64");
+        } else if (is64Bit) {
+            checkRejection(javaCmd, "-d32");
         } else {
-            // Negative tests: ensure that non-dual mode systems reject the
-            // complementary (other) data model
-            if (is32Bit) {
-                checkRejection(javaCmd, "-d64");
-            } else if (is64Bit) {
-                checkRejection(javaCmd, "-d32");
-            } else {
-                throw new Error("unsupported data model");
-            }
-        }
-    }
-
-    static void checkExecCount(String cmd, String dmodel) {
-        Map<String, String> envMap = new HashMap<>();
-        envMap.put(JLDEBUG_KEY, "true");
-        TestResult tr = doExec(envMap, javaCmd, "-d64",
-                "-jar", TestJar.getAbsolutePath());
-        int count = 0;
-        for (String x : tr.testOutput) {
-            if (x.contains(EXPECTED_MARKER)) {
-                count++;
-                if (count > 1) {
-                    System.out.println(tr);
-                    throw new RuntimeException("Maximum exec count of 1 execeeded");
-                }
-            }
+            throw new Error("unsupported data model");
         }
     }
 
--- a/jdk/test/tools/launcher/ExecutionEnvironment.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/tools/launcher/ExecutionEnvironment.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
  * @bug 4780570 4731671 6354700 6367077 6670965 4882974
  * @summary Checks for LD_LIBRARY_PATH and execution  on *nixes
  * @compile -XDignore.symbol.file ExecutionEnvironment.java
- * @run main ExecutionEnvironment
+ * @run main/othervm ExecutionEnvironment
  */
 
 /*
@@ -46,6 +46,9 @@
  *            b. LD_LIBRARY_PATH32 is ignored if set
  *   5. no extra symlink exists on Solaris ie.
  *      jre/lib/$arch/libjvm.so -> client/libjvm.so
+ *   6. Since 32-bit Solaris is no longer supported we continue to ensure that
+ *      the appropriate paths are ignored or used, additionally we also test to
+ *      ensure the 64-bit isadir exists and contains appropriate links.
  * TODO:
  *      a. perhaps we need to add a test to audit all environment variables are
  *         in pristine condition after the launch, there may be a few that the
@@ -54,10 +57,16 @@
  */
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import static java.nio.file.LinkOption.*;
+import java.util.regex.Pattern;
 
 
 public class ExecutionEnvironment extends TestHelper {
@@ -80,13 +89,14 @@
 
     static final File testJarFile = new File("EcoFriendly.jar");
 
-    static int errors = 0;
-    static int passes = 0;
-
     static final String LIBJVM = TestHelper.isWindows
             ? "jvm.dll"
             : "libjvm" + (TestHelper.isMacOSX ? ".dylib" : ".so");
 
+    public ExecutionEnvironment() {
+        createTestJar();
+    }
+
     static void createTestJar() {
         try {
             List<String> codeList = new ArrayList<>();
@@ -111,13 +121,17 @@
             throw new RuntimeException(fnfe);
         }
     }
-
+    private void flagError(TestResult tr, String message) {
+        System.err.println(tr);
+        throw new RuntimeException(message);
+    }
     /*
      * tests if the launcher pollutes the LD_LIBRARY_PATH variables ie. there
      * should not be any new variables or pollution/mutations of any kind, the
      * environment should be pristine.
      */
-    private static void ensureEcoFriendly() {
+    @Test
+    void testEcoFriendly() {
         TestResult tr = null;
 
         Map<String, String> env = new HashMap<>();
@@ -129,17 +143,12 @@
         tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
 
         if (!tr.isNotZeroOutput()) {
-            System.out.println(tr);
-            throw new RuntimeException("Error: No output at all. Did the test execute ?");
+            flagError(tr, "Error: No output at all. Did the test execute ?");
         }
 
         for (String x : LD_PATH_STRINGS) {
             if (!tr.contains(x)) {
-                System.out.println("FAIL: did not get <" + x + ">");
-                System.out.println(tr);
-                errors++;
-            } else {
-                passes++;
+                flagError(tr, "FAIL: did not get <" + x + ">");
             }
         }
     }
@@ -148,19 +157,15 @@
      * ensures that there are no execs as long as we are in the same
      * data model
      */
-    static void ensureNoExec() {
+    @Test
+    void testNoExec() {
         Map<String, String> env = new HashMap<>();
         env.put(JLDEBUG_KEY, "true");
         TestResult tr = doExec(env, javaCmd, "-version");
         if (tr.testOutput.contains(EXPECTED_MARKER)) {
-            System.out.println("FAIL: EnsureNoExecs: found expected warning <" +
-                    EXPECTED_MARKER +
+            flagError(tr, "testNoExec: found  warning <" + EXPECTED_MARKER +
                     "> the process execing ?");
-            errors++;
-        } else {
-            passes++;
         }
-        return;
     }
 
     /*
@@ -173,8 +178,8 @@
      * For Solaris 64-bit
      *    * The LD_LIBRARY_PATH_64 should override LD_LIBRARY_PATH if specified
      */
-
-    static void verifyJavaLibraryPath() {
+    @Test
+    void testJavaLibraryPath() {
         TestResult tr = null;
 
         Map<String, String> env = new HashMap<>();
@@ -200,88 +205,33 @@
                 env.put(pairs[0], pairs[1]);
             }
 
-            // verify the override occurs, since we know the invocation always
-            // uses by default is 32-bit, therefore we also set the test
-            // expectation to be the same.
+            // verify the override occurs for 64-bit system
             tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
-            verifyJavaLibraryPathOverride(tr, true);
-
-            // try changing the model from 32 to 64 bit
-            if (dualModePresent() && is32Bit) {
-                // verify the override occurs
-                env.clear();
-                for (String x : LD_PATH_STRINGS) {
-                    String pairs[] = x.split("=");
-                    env.put(pairs[0], pairs[1]);
-                }
-                tr = doExec(env, javaCmd, "-d64", "-jar",
-                    testJarFile.getAbsolutePath());
-                verifyJavaLibraryPathOverride(tr, false);
-
-                // no override
-                env.clear();
-                env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
-                tr = doExec(env, javaCmd, "-jar",
-                        testJarFile.getAbsolutePath());
-                verifyJavaLibraryPathGeneric(tr);
-            }
-
-            // try changing the model from 64 to 32 bit
-            if (java64Cmd != null && is64Bit) {
-                // verify the override occurs
-                env.clear();
-                for (String x : LD_PATH_STRINGS) {
-                    String pairs[] = x.split("=");
-                    env.put(pairs[0], pairs[1]);
-                }
-                tr = doExec(env, java64Cmd, "-d32", "-jar",
-                    testJarFile.getAbsolutePath());
-                verifyJavaLibraryPathOverride(tr, true);
-
-                // no override
-                env.clear();
-                env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
-                tr = doExec(env, java64Cmd, "-d32", "-jar",
-                        testJarFile.getAbsolutePath());
-                verifyJavaLibraryPathGeneric(tr);
-            }
+            verifyJavaLibraryPathOverride(tr, false);
         }
     }
 
-    private static void verifyJavaLibraryPathGeneric(TestResult tr) {
+    private void verifyJavaLibraryPathGeneric(TestResult tr) {
         if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
-            System.out.print("FAIL: verifyJavaLibraryPath: ");
-            System.out.println(" java.library.path does not contain " +
+            flagError(tr, "testJavaLibraryPath: java.library.path does not contain " +
                     LD_LIBRARY_PATH_VALUE);
-            System.out.println(tr);
-            errors++;
-        } else {
-            passes++;
         }
     }
 
-    private static void verifyJavaLibraryPathOverride(TestResult tr,
+    private void verifyJavaLibraryPathOverride(TestResult tr,
             boolean is32Bit) {
         // make sure the 32/64 bit value exists
         if (!tr.matches("java.library.path=.*" +
                 (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE) + ".*")) {
-            System.out.print("FAIL: verifyJavaLibraryPathOverride: ");
-            System.out.println(" java.library.path does not contain " +
+            flagError(tr, "verifyJavaLibraryPathOverride: " +
+                " java.library.path does not contain " +
                     (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE));
-            System.out.println(tr);
-            errors++;
-        } else {
-            passes++;
+
         }
         // make sure the generic value is absent
-        if (tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
-            System.out.print("FAIL: verifyJavaLibraryPathOverride: ");
-            System.out.println(" java.library.path contains " +
-                    LD_LIBRARY_PATH_VALUE);
-            System.out.println(tr);
-            errors++;
-        } else {
-            passes++;
+        if (!tr.notMatches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
+            flagError(tr, "verifyJavaLibraryPathOverride: " +
+                    " java.library.path contains " + LD_LIBRARY_PATH_VALUE);
         }
     }
 
@@ -289,34 +239,28 @@
      * ensures we have indeed exec'ed the correct vm of choice, all VMs support
      * -server, however 32-bit VMs support -client and -server.
      */
-    static void verifyVmSelection() {
+    @Test
+    void testVmSelection() {
 
         TestResult tr = null;
 
         if (is32Bit) {
             tr = doExec(javaCmd, "-client", "-version");
             if (!tr.matches(".*Client VM.*")) {
-                System.out.println("FAIL: the expected vm -client did not launch");
-                System.out.println(tr);
-                errors++;
-            } else {
-                passes++;
+                flagError(tr, "the expected vm -client did not launch");
             }
         }
         tr = doExec(javaCmd, "-server", "-version");
         if (!tr.matches(".*Server VM.*")) {
-            System.out.println("FAIL: the expected vm -server did not launch");
-            System.out.println(tr);
-            errors++;
-        } else {
-            passes++;
+            flagError(tr, "the expected vm -server did not launch");
         }
     }
 
     /*
      * checks to see there is no extra libjvm.so than needed
      */
-    static void verifyNoSymLink() {
+    @Test
+    void testNoSymLink() {
         if (is64Bit) {
             return;
         }
@@ -326,31 +270,65 @@
         symLink = new File(JAVAHOME, libPathPrefix +
                 getJreArch() + "/" + LIBJVM);
         if (symLink.exists()) {
-            System.out.println("FAIL: The symlink exists " +
-                    symLink.getAbsolutePath());
-            errors++;
-        } else {
-            passes++;
+            throw new RuntimeException("symlink exists " + symLink.getAbsolutePath());
         }
     }
 
+    /*
+     * verify if all the symlinks in the images are created correctly,
+     * only on solaris, this test works only on images.
+     */
+    @Test
+    void testSymLinks() throws Exception {
+        if (!isSolaris)
+            return;
+        verifySymLinks(JAVA_BIN);
+        verifySymLinks(JAVA_JRE_BIN);
+    }
+    // exclude non-consequential binaries or scripts co-packaged in other
+    // build phases
+    private final String excludeRE =
+            ".*jvisualvm.*" +
+            "|.*javaws.*" +
+            "|.*ControlPanel.*" +
+            "|.*java-rmi.cgi" +
+            "|.*jcontrol.*";
+    private final Pattern symlinkExcludes = Pattern.compile(excludeRE);
+
+    private void verifySymLinks(String bindir) throws IOException {
+        File binDir = new File(bindir);
+        System.err.println("verifying links in: " + bindir);
+        File isaDir = new File(binDir, getArch()).getAbsoluteFile();
+        if (!isaDir.exists()) {
+            throw new RuntimeException("dir: " + isaDir + " does not exist");
+        }
+        try (DirectoryStream<Path> ds = Files.newDirectoryStream(binDir.toPath())) {
+            for (Path p : ds) {
+                if (symlinkExcludes.matcher(p.toString()).matches() ||
+                        Files.isDirectory(p, NOFOLLOW_LINKS)) {
+                    continue;
+                }
+                Path link = new File(isaDir, p.getFileName().toString()).toPath();
+                if (Files.isSymbolicLink(link)) {
+                    Path target = Files.readSymbolicLink(link);
+                    if (target.startsWith("..") && p.endsWith(target.getFileName())) {
+                        // System.out.println(target + " OK");
+                        continue;
+                    }
+                    System.err.println("target:" + target);
+                    System.err.println("file:" + p);
+                }
+                throw new RuntimeException("could not find link to " + p);
+            }
+        }
+
+    }
     public static void main(String... args) throws Exception {
         if (isWindows) {
-            System.out.println("Warning: noop on windows");
+            System.err.println("Warning: test not applicable to windows");
             return;
         }
-        // create our test jar first
-        createTestJar();
-        ensureNoExec();
-        verifyVmSelection();
-        ensureEcoFriendly();
-        verifyJavaLibraryPath();
-        verifyNoSymLink();
-        if (errors > 0) {
-            throw new Exception("ExecutionEnvironment: FAIL: with " +
-                    errors + " errors and passes " + passes );
-        } else {
-            System.out.println("ExecutionEnvironment: PASS " + passes);
-        }
+        ExecutionEnvironment ee = new ExecutionEnvironment();
+        ee.run(args);
     }
 }
--- a/jdk/test/tools/launcher/FXLauncherTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/tools/launcher/FXLauncherTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -405,7 +405,7 @@
             }
         } else {
             System.err.println("Warning: JavaFX components missing or not supported");
-            System.err.println("         test passes vacuosly.");
+            System.err.println("         test passes vacuously.");
          }
     }
 }
--- a/jdk/test/tools/launcher/RunpathTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/tools/launcher/RunpathTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -64,15 +64,9 @@
     }
 
     void testRpath() {
-        if (isDualMode && is64Bit) {
-            String expectedRpath = ".*RPATH.*\\$ORIGIN/../../lib/" + getJreArch()
-                    + ":\\$ORIGIN/../../jre/lib/" + getJreArch() + ".*";
-            elfCheck(java64Cmd, expectedRpath);
-        } else {
-            String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch()
-                    + ":\\$ORIGIN/../jre/lib/" + getJreArch() + ".*";
-            elfCheck(javaCmd, expectedRpath);
-        }
+        String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch()
+                + ":\\$ORIGIN/../jre/lib/" + getJreArch() + ".*";
+        elfCheck(javaCmd, expectedRpath);
     }
 
     public static void main(String... args) throws Exception {
--- a/jdk/test/tools/launcher/Test7029048.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/tools/launcher/Test7029048.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -30,8 +30,8 @@
  */
 
 /*
- * 7029048: test for LD_LIBRARY_PATH set to different paths pointing which may
- * contain a libjvm.so and may not, but we test to ensure that the launcher
+ * 7029048: test for LD_LIBRARY_PATH set to different paths which may or
+ * may not contain a libjvm.so, but we test to ensure that the launcher
  * behaves correctly in all cases.
  */
 import java.io.File;
@@ -50,8 +50,6 @@
     private static final String LIBJVM = ExecutionEnvironment.LIBJVM;
     private static final String LD_LIBRARY_PATH =
             ExecutionEnvironment.LD_LIBRARY_PATH;
-    private static final String LD_LIBRARY_PATH_32 =
-            ExecutionEnvironment.LD_LIBRARY_PATH_32;
     private static final String LD_LIBRARY_PATH_64 =
             ExecutionEnvironment.LD_LIBRARY_PATH_64;
 
@@ -70,24 +68,8 @@
     private static final File dstClientDir = new File(dstLibArchDir, "client");
     private static final File dstClientLibjvm = new File(dstClientDir, LIBJVM);
 
-    // used primarily to test the solaris variants in dual mode
-    private static final File dstOtherArchDir;
-    private static final File dstOtherServerDir;
-    private static final File dstOtherServerLibjvm;
-
     private static final Map<String, String> env = new HashMap<>();
 
-    static {
-        if (isDualMode) {
-            dstOtherArchDir = new File(dstLibDir, getComplementaryJreArch());
-            dstOtherServerDir = new File(dstOtherArchDir, "server");
-            dstOtherServerLibjvm = new File(dstOtherServerDir, LIBJVM);
-        } else {
-            dstOtherArchDir = null;
-            dstOtherServerDir = null;
-            dstOtherServerLibjvm = null;
-        }
-    }
 
     static String getValue(String name, List<String> in) {
         for (String x : in) {
@@ -99,45 +81,20 @@
         return null;
     }
 
-    static void run(boolean want32, String dflag, Map<String, String> env,
+    static void run(Map<String, String> env,
             int nLLPComponents, String caseID) {
-        final boolean want64 = want32 == false;
         env.put(ExecutionEnvironment.JLDEBUG_KEY, "true");
         List<String> cmdsList = new ArrayList<>();
-
-        // only for a dual-mode system
-        if (want64 && isDualMode) {
-            cmdsList.add(java64Cmd);
-        } else {
-            cmdsList.add(javaCmd); // a 32-bit java command for all
-        }
-
-        /*
-         * empty or null strings can confuse the ProcessBuilder. A null flag
-         * indicates that the appropriate data model is enforced on the chosen
-         * launcher variant.
-         */
-
-        if (dflag != null) {
-            cmdsList.add(dflag);
-        } else {
-            cmdsList.add(want32 ? "-d32" : "-d64");
-        }
+        cmdsList.add(javaCmd);
         cmdsList.add("-server");
         cmdsList.add("-jar");
         cmdsList.add(ExecutionEnvironment.testJarFile.getAbsolutePath());
         String[] cmds = new String[cmdsList.size()];
         TestResult tr = doExec(env, cmdsList.toArray(cmds));
+        System.out.println(tr);
         analyze(tr, nLLPComponents, caseID);
     }
 
-    // no cross launch, ie. no change to the data model.
-    static void run(Map<String, String> env, int nLLPComponents, String caseID)
-            throws IOException {
-        boolean want32 = is32Bit;
-        run(want32, null, env, nLLPComponents, caseID);
-    }
-
     static void analyze(TestResult tr, int nLLPComponents, String caseID) {
         String envValue = getValue(LD_LIBRARY_PATH, tr.testOutput);
        /*
@@ -192,10 +149,6 @@
                     copyFile(srcLibjvmSo, dstServerLibjvm);
                     // does not matter if it is client or a server
                     copyFile(srcLibjvmSo, dstClientLibjvm);
-                    // does not matter if the arch do not match either
-                    if (isDualMode) {
-                        copyFile(srcLibjvmSo, dstOtherServerLibjvm);
-                    }
                     desc = "LD_LIBRARY_PATH should be set";
                     break;
                 case LLP_SET_EMPTY_PATH:
@@ -211,14 +164,6 @@
                         Files.deleteIfExists(dstServerLibjvm.toPath());
                     }
 
-                    if (isDualMode) {
-                        if (!dstOtherServerDir.exists()) {
-                            Files.createDirectories(dstOtherServerDir.toPath());
-                        } else {
-                            Files.deleteIfExists(dstOtherServerLibjvm.toPath());
-                        }
-                    }
-
                     desc = "LD_LIBRARY_PATH should not be set";
                     break;
                 case LLP_SET_NON_EXISTENT_PATH:
@@ -245,40 +190,14 @@
             env.put(LD_LIBRARY_PATH, dstClientDir.getAbsolutePath());
             run(env, v.value + 1, "Case 2: " + desc);
 
-            if (!isDualMode) {
-                continue; // nothing more to do for Linux
-            }
-
-            // Tests applicable only to solaris.
-
-            // initialize test variables for dual mode operations
-            final File dst32ServerDir = is32Bit
-                    ? dstServerDir
-                    : dstOtherServerDir;
-
-            final File dst64ServerDir = is64Bit
-                    ? dstServerDir
-                    : dstOtherServerDir;
-
-            /*
-             * Case 3: set the appropriate LLP_XX flag,
-             * java32 -d32, LLP_32 is relevant, LLP_64 is ignored
-             * java64 -d64, LLP_64 is relevant, LLP_32 is ignored
-             */
-            env.clear();
-            env.put(LD_LIBRARY_PATH_32, dst32ServerDir.getAbsolutePath());
-            env.put(LD_LIBRARY_PATH_64, dst64ServerDir.getAbsolutePath());
-            run(is32Bit, null, env, v.value + 1, "Case 3: " + desc);
-
-            /*
-             * Case 4: we are in dual mode environment, running 64-bit then
-             * we have the following scenarios:
-             * java32 -d64, LLP_64 is relevant, LLP_32 is ignored
-             * java64 -d32, LLP_32 is relevant, LLP_64 is ignored
-             */
-            if (dualModePresent()) {
-                run(true, "-d64", env, v.value + 1, "Case 4A: " + desc);
-                run(false,"-d32", env, v.value + 1, "Case 4B: " + desc);
+            if (isSolaris) {
+                /*
+                 * Case 3: set the appropriate LLP_XX flag,
+                 * java64 -d64, LLP_64 is relevant, LLP_32 is ignored
+                 */
+                env.clear();
+                env.put(LD_LIBRARY_PATH_64, dstServerDir.getAbsolutePath());
+                run(env, v.value + 1, "Case 3: " + desc);
             }
         }
         return;
@@ -297,9 +216,6 @@
         if (errors > 0) {
             throw new Exception("Test7029048: FAIL: with "
                     + errors + " errors and passes " + passes);
-        } else if (dualModePresent() && passes < 15) {
-            throw new Exception("Test7029048: FAIL: " +
-                    "all tests did not run, expected " + 15 + " got " + passes);
         } else if (isSolaris && passes < 9) {
             throw new Exception("Test7029048: FAIL: " +
                     "all tests did not run, expected " + 9 + " got " + passes);
--- a/jdk/test/tools/launcher/TestHelper.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/jdk/test/tools/launcher/TestHelper.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,10 +66,10 @@
 
     static final String JAVAHOME = System.getProperty("java.home");
     static final String JAVA_BIN;
+    static final String JAVA_JRE_BIN;
     static final boolean isSDK = JAVAHOME.endsWith("jre");
     static final String javaCmd;
     static final String javawCmd;
-    static final String java64Cmd;
     static final String javacCmd;
     static final String jarCmd;
 
@@ -88,7 +88,7 @@
             System.getProperty("os.name", "unknown").startsWith("SunOS");
     static final boolean isLinux =
             System.getProperty("os.name", "unknown").startsWith("Linux");
-    static final boolean isDualMode = isSolaris;
+
     static final boolean isSparc = System.getProperty("os.arch").startsWith("sparc");
 
     // make a note of the golden default locale
@@ -124,9 +124,12 @@
             throw new RuntimeException("arch model is not 32 or 64 bit ?");
         }
         compiler = ToolProvider.getSystemJavaCompiler();
-        File binDir = (isSDK) ? new File((new File(JAVAHOME)).getParentFile(), "bin")
-            : new File(JAVAHOME, "bin");
+        File binDir = (isSDK)
+                ? new File((new File(JAVAHOME)).getParentFile(), "bin")
+                : new File(JAVAHOME, "bin");
         JAVA_BIN = binDir.getAbsolutePath();
+        JAVA_JRE_BIN = new File((new File(JAVAHOME)).getParentFile(),
+                        (isSDK) ? "jre/bin" : "bin").getAbsolutePath();
         File javaCmdFile = (isWindows)
                 ? new File(binDir, "java.exe")
                 : new File(binDir, "java");
@@ -165,17 +168,6 @@
             throw new RuntimeException("java <" + javacCmd +
                     "> must exist and should be executable");
         }
-        if (isSolaris) {
-            File sparc64BinDir = new File(binDir,isSparc ? "sparcv9" : "amd64");
-            File java64CmdFile= new File(sparc64BinDir, "java");
-            if (java64CmdFile.exists() && java64CmdFile.canExecute()) {
-                java64Cmd = java64CmdFile.getAbsolutePath();
-            } else {
-                java64Cmd = null;
-            }
-        } else {
-            java64Cmd = null;
-        }
     }
     void run(String[] args) throws Exception {
         int passed = 0, failed = 0;
@@ -194,7 +186,13 @@
                     System.out.printf("Passed: %d, Failed: %d, ExitValue: %d%n",
                                       passed, failed, testExitValue);
                 } catch (Throwable ex) {
-                    System.out.printf("Test %s failed: %s %n", m, ex.getCause());
+                    System.out.printf("Test %s failed: %s %n", m, ex);
+                    System.out.println("----begin detailed exceptions----");
+                    ex.printStackTrace(System.out);
+                    for (Throwable t : ex.getSuppressed()) {
+                        t.printStackTrace(System.out);
+                    }
+                    System.out.println("----end detailed exceptions----");
                     failed++;
                 }
             }
@@ -210,41 +208,15 @@
     }
 
     /*
-     * is a dual mode available in the test jdk
-     */
-    static boolean dualModePresent() {
-        return isDualMode && java64Cmd != null;
-    }
-
-    /*
      * usually the jre/lib/arch-name is the same as os.arch, except for x86.
      */
     static String getJreArch() {
         String arch = System.getProperty("os.arch");
         return arch.equals("x86") ? "i386" : arch;
     }
-
-    /*
-     * get the complementary jre arch ie. if sparc then return sparcv9 and
-     * vice-versa.
-     */
-    static String getComplementaryJreArch() {
-        String arch = System.getProperty("os.arch");
-        if (arch != null) {
-            switch (arch) {
-                case "sparc":
-                    return "sparcv9";
-                case "sparcv9":
-                    return "sparc";
-                case "x86":
-                    return "amd64";
-                case "amd64":
-                    return "i386";
-            }
-        }
-        return null;
+    static String getArch() {
+        return System.getProperty("os.arch");
     }
-
     static File getClassFile(File javaFile) {
         String s = javaFile.getAbsolutePath().replace(JAVA_FILE_EXT, CLASS_FILE_EXT);
         return new File(s);
@@ -623,6 +595,16 @@
             appendError("string <" + stringToMatch + "> not found");
             return false;
         }
+
+        boolean notMatches(String stringToMatch) {
+            for (String x : testOutput) {
+                if (!x.matches(stringToMatch)) {
+                    return true;
+                }
+            }
+            appendError("string <" + stringToMatch + "> found");
+            return false;
+        }
     }
     /**
     * Indicates that the annotated method is a test method.
--- a/langtools/.hgtags	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/.hgtags	Fri Oct 11 09:17:18 2013 -0400
@@ -230,3 +230,5 @@
 fcd768844b9926c5f994292ec6350c20cc7c0f76 jdk8-b106
 3f274927ec1863544b8214262ab02b7de2970da6 jdk8-b107
 252f872b8a2f81a416f9127e77924ca56a4578b0 jdk8-b108
+985abf1cd327169a317d4ff4f318a8162a5cd47d jdk8-b109
+41541097533aa3933a018c8c1c426c1871dfd76e jdk8-b110
--- a/langtools/make/netbeans/langtools/build.xml	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/make/netbeans/langtools/build.xml	Fri Oct 11 09:17:18 2013 -0400
@@ -55,18 +55,17 @@
         description="Build one or all langtools tools"
         />
 
-    <condition property="bootstrap" value="bootstrap-" else="">
+    <condition property="use_bootstrap" value="bootstrap-" else="">
         <isset property="langtools.tool.bootstrap"/>
     </condition>
-
-    <condition property="bcp" value="${build.bootstrap.dir}/classes" else="${build.classes.dir}">
+    <condition property="with_bootclasspath" value="${build.bootstrap.dir}/classes" else="${build.classes.dir}">
         <isset property="langtools.tool.bootstrap"/>
     </condition>
 
     <target name="-build-tool" if="langtools.tool.name">
-        <echo level="info" message="Building ${bootstrap}${langtools.tool.name}"/>
+        <echo level="info" message="Building ${use_bootstrap}${langtools.tool.name}"/>
         <echo level="verbose" message="(Unset langtools.tool.name to build all tools)"/>
-        <antcall target="build-${bootstrap}${langtools.tool.name}"/>
+        <antcall target="build-${use_bootstrap}${langtools.tool.name}"/>
     </target>
 
     <target name="-build-all" unless="langtools.tool.name">
@@ -97,9 +96,9 @@
 
     <target name="run" depends="-check-target.java.home,build,-def-run,-get-tool-and-args"
             description="run tool">
-        <echo level="info" message="${bcp}"/>
-        <echo level="info" message="Run ${bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
-        <run bcp="${bcp}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}"/>
+        <echo level="info" message="${with_bootclasspath}"/>
+        <echo level="info" message="Run ${use_bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
+        <run bcp="${with_bootclasspath}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}"/>
     </target>
 
     <!-- Run a selected class. (action: run.single;  shift-F6) -->
@@ -145,9 +144,9 @@
     <!-- Debug tool in NetBeans. -->
 
     <target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,build" if="netbeans.home">
-        <echo level="info" message="Debug ${boostrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
+        <echo level="info" message="Debug ${use_bootstrap}${langtools.tool.name} with args ${langtools.tool.args}"/>
         <start-debugger/>
-        <run bcp="${bcp}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/>
+        <run bcp="${with_bootclasspath}" mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/>
     </target>
 
     <!-- Debug a selected class . -->
@@ -237,12 +236,12 @@
         <macrodef name="run">
             <attribute name="mainclass"/>
             <attribute name="args" default=""/>
-            <attribute name="bcp" default="${build.classes.dir}"/>
+            <attribute name="bcp" default="${with_bootclasspath}"/>
             <attribute name="jpda.jvmargs" default=""/>
 
             <sequential>
                 <java fork="true" jvm="${target.java}" classname="@{mainclass}">
-                    <jvmarg line="-Xbootclasspath/p:${bcp}"/>
+                    <jvmarg line="-Xbootclasspath/p:@{bcp}"/>
                     <jvmarg line="@{jpda.jvmargs}"/>
                     <arg line="@{args}"/>
                 </java>
--- a/langtools/make/tools/anttasks/SelectToolTask.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/make/tools/anttasks/SelectToolTask.java	Fri Oct 11 09:17:18 2013 -0400
@@ -87,8 +87,9 @@
             this(toolName, false);
         }
 
-        ToolChoices(String toolName, boolean boostrap) {
+        ToolChoices(String toolName, boolean bootstrap) {
             this.toolName = toolName;
+            this.bootstrap = bootstrap;
         }
 
         @Override
--- a/langtools/src/share/classes/com/sun/tools/classfile/Code_attribute.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Code_attribute.java	Fri Oct 11 09:17:18 2013 -0400
@@ -61,9 +61,9 @@
         code_length = cr.readInt();
         code = new byte[code_length];
         cr.readFully(code);
-        exception_table_langth = cr.readUnsignedShort();
-        exception_table = new Exception_data[exception_table_langth];
-        for (int i = 0; i < exception_table_langth; i++)
+        exception_table_length = cr.readUnsignedShort();
+        exception_table = new Exception_data[exception_table_length];
+        for (int i = 0; i < exception_table_length; i++)
             exception_table[i] = new Exception_data(cr);
         attributes = new Attributes(cr);
     }
@@ -139,7 +139,7 @@
     public final int max_locals;
     public final int code_length;
     public final byte[] code;
-    public final int exception_table_langth;
+    public final int exception_table_length;
     public final Exception_data[] exception_table;
     public final Attributes attributes;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,301 @@
+/*
+ * 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.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+
+/**
+ * Writes annotation type field documentation in HTML format.
+ *
+ *  <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 AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
+    implements AnnotationTypeFieldWriter, MemberSummaryWriter {
+
+    /**
+     * Construct a new AnnotationTypeFieldWriterImpl.
+     *
+     * @param writer         the writer that will write the output.
+     * @param annotationType the AnnotationType that holds this member.
+     */
+    public AnnotationTypeFieldWriterImpl(SubWriterHolderWriter writer,
+            AnnotationTypeDoc annotationType) {
+        super(writer, annotationType);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getMemberSummaryHeader(ClassDoc classDoc,
+            Content memberSummaryTree) {
+        memberSummaryTree.addContent(
+                HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY);
+        Content memberTree = writer.getMemberTreeHeader();
+        writer.addSummaryHeader(this, classDoc, memberTree);
+        return memberTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getMemberTreeHeader() {
+        return writer.getMemberTreeHeader();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAnnotationFieldDetailsMarker(Content memberDetails) {
+        memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_DETAILS);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
+            Content memberDetailsTree) {
+        if (!writer.printedAnnotationFieldHeading) {
+            memberDetailsTree.addContent(writer.getMarkerAnchor(
+                    "annotation_type_field_detail"));
+            Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
+                    writer.fieldDetailsLabel);
+            memberDetailsTree.addContent(heading);
+            writer.printedAnnotationFieldHeading = true;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDocTreeHeader(MemberDoc member,
+            Content annotationDetailsTree) {
+        annotationDetailsTree.addContent(
+                writer.getMarkerAnchor(member.name()));
+        Content annotationDocTree = writer.getMemberTreeHeader();
+        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
+        heading.addContent(member.name());
+        annotationDocTree.addContent(heading);
+        return annotationDocTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSignature(MemberDoc member) {
+        Content pre = new HtmlTree(HtmlTag.PRE);
+        writer.addAnnotationInfo(member, pre);
+        addModifiers(member, pre);
+        Content link =
+                writer.getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.Kind.MEMBER, getType(member)));
+        pre.addContent(link);
+        pre.addContent(writer.getSpace());
+        if (configuration.linksource) {
+            Content memberName = new StringContent(member.name());
+            writer.addSrcLink(member, memberName, pre);
+        } else {
+            addName(member.name(), pre);
+        }
+        return pre;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addDeprecated(MemberDoc member, Content annotationDocTree) {
+        addDeprecatedInfo(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addComments(MemberDoc member, Content annotationDocTree) {
+        addComment(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addTags(MemberDoc member, Content annotationDocTree) {
+        writer.addTagsInfo(member, annotationDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDetails(Content annotationDetailsTree) {
+        return getMemberTree(annotationDetailsTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getAnnotationDoc(Content annotationDocTree,
+            boolean isLastContent) {
+        return getMemberTree(annotationDocTree, isLastContent);
+    }
+
+    /**
+     * Close the writer.
+     */
+    public void close() throws IOException {
+        writer.close();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryLabel(Content memberTree) {
+        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
+                writer.getResource("doclet.Field_Summary"));
+        memberTree.addContent(label);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getTableSummary() {
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Field_Summary"),
+                configuration.getText("doclet.fields"));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getCaption() {
+        return configuration.getResource("doclet.Fields");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+        String[] header = new String[] {
+            writer.getModifierTypeHeader(),
+            configuration.getText("doclet.0_and_1",
+                    configuration.getText("doclet.Fields"),
+                    configuration.getText("doclet.Description"))
+        };
+        return header;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
+        memberTree.addContent(writer.getMarkerAnchor(
+                "annotation_type_field_summary"));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
+            Content tdSummary) {
+        Content strong = HtmlTree.SPAN(HtmlStyle.strong,
+                writer.getDocLink(context, (MemberDoc) member, member.name(), false));
+        Content code = HtmlTree.CODE(strong);
+        tdSummary.addContent(code);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addInheritedSummaryLink(ClassDoc cd,
+            ProgramElementDoc member, Content linksTree) {
+        //Not applicable.
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
+        MemberDoc m = (MemberDoc)member;
+        addModifierAndType(m, getType(m), tdSummaryType);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getDeprecatedLink(ProgramElementDoc member) {
+        return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
+                (MemberDoc) member, ((MemberDoc)member).qualifiedName());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+        if (link) {
+            return writer.getHyperLink("annotation_type_field_summary",
+                    writer.getResource("doclet.navField"));
+        } else {
+            return writer.getResource("doclet.navField");
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavDetailLink(boolean link, Content liNav) {
+        if (link) {
+            liNav.addContent(writer.getHyperLink("annotation_type_field_detail",
+                    writer.getResource("doclet.navField")));
+        } else {
+            liNav.addContent(writer.getResource("doclet.navField"));
+        }
+    }
+
+    private Type getType(MemberDoc member) {
+        if (member instanceof FieldDoc) {
+            return ((FieldDoc) member).type();
+        } else {
+            return ((MethodDoc) member).returnType();
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -71,6 +71,20 @@
     /**
      * {@inheritDoc}
      */
+    public Content getMemberTreeHeader() {
+        return writer.getMemberTreeHeader();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAnnotationDetailsMarker(Content memberDetails) {
+        memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
             Content memberDetailsTree) {
         if (!writer.printedAnnotationHeading) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -278,13 +278,6 @@
     /**
      * {@inheritDoc}
      */
-    public void addAnnotationDetailsMarker(Content memberDetails) {
-        memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     protected Content getNavLinkTree() {
         Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
                 treeLabel, "", "");
@@ -319,6 +312,12 @@
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
+        Content liNavField = new HtmlTree(HtmlTag.LI);
+        addNavSummaryLink(memberSummaryBuilder,
+                "doclet.navField",
+                VisibleMemberMap.ANNOTATION_TYPE_FIELDS, liNavField);
+        addNavGap(liNavField);
+        ulNav.addContent(liNavField);
         Content liNavReq = new HtmlTree(HtmlTag.LI);
         addNavSummaryLink(memberSummaryBuilder,
                 "doclet.navAnnotationTypeRequiredMember",
@@ -364,12 +363,23 @@
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
+        AbstractMemberWriter writerField =
+                ((AbstractMemberWriter) memberSummaryBuilder.
+                getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_FIELDS));
         AbstractMemberWriter writerOptional =
                 ((AbstractMemberWriter) memberSummaryBuilder.
                 getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL));
         AbstractMemberWriter writerRequired =
                 ((AbstractMemberWriter) memberSummaryBuilder.
                 getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED));
+        Content liNavField = new HtmlTree(HtmlTag.LI);
+        if (writerField != null){
+            writerField.addNavDetailLink(annotationType.fields().length > 0, liNavField);
+        } else {
+            liNavField.addContent(getResource("doclet.navField"));
+        }
+        addNavGap(liNavField);
+        ulNav.addContent(liNavField);
         if (writerOptional != null){
             Content liNavOpt = new HtmlTree(HtmlTag.LI);
             writerOptional.addNavDetailLink(annotationType.elements().length > 0, liNavOpt);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -85,6 +85,11 @@
     protected boolean printedAnnotationHeading = false;
 
     /**
+     * To check whether annotation field heading is printed or not.
+     */
+    protected boolean printedAnnotationFieldHeading = false;
+
+    /**
      * To check whether the repeated annotations is documented or not.
      */
     private boolean isAnnotationDocumented = false;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -107,6 +107,16 @@
     /**
      * {@inheritDoc}
      */
+    public AnnotationTypeFieldWriter
+            getAnnotationTypeFieldWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception {
+        return new AnnotationTypeFieldWriterImpl(
+            (SubWriterHolderWriter) annotationTypeWriter,
+            annotationTypeWriter.getAnnotationTypeDoc());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public AnnotationTypeOptionalMemberWriter
             getAnnotationTypeOptionalMemberWriter(
         AnnotationTypeWriter annotationTypeWriter) throws Exception {
@@ -202,6 +212,9 @@
         AnnotationTypeWriter annotationTypeWriter, int memberType)
     throws Exception {
         switch (memberType) {
+            case VisibleMemberMap.ANNOTATION_TYPE_FIELDS:
+                return (AnnotationTypeFieldWriterImpl)
+                    getAnnotationTypeFieldWriter(annotationTypeWriter);
             case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL:
                 return (AnnotationTypeOptionalMemberWriterImpl)
                     getAnnotationTypeOptionalMemberWriter(annotationTypeWriter);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Fri Oct 11 09:17:18 2013 -0400
@@ -94,6 +94,12 @@
             new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ===========");
 
     /**
+     * Marker to identify start of annotation type required member summary.
+     */
+    public static final Content START_OF_ANNOTATION_TYPE_FIELD_SUMMARY =
+            new Comment("=========== ANNOTATION TYPE FIELD SUMMARY ===========");
+
+    /**
      * Marker to identify start of constructor summary.
      */
     public static final Content START_OF_CONSTRUCTOR_SUMMARY =
@@ -130,6 +136,12 @@
             new Comment("============ ANNOTATION TYPE MEMBER DETAIL ===========");
 
     /**
+     * Marker to identify start of annotation type field details.
+     */
+    public static final Content START_OF_ANNOTATION_TYPE_FIELD_DETAILS =
+            new Comment("============ ANNOTATION TYPE FIELD DETAIL ===========");
+
+    /**
      * Marker to identify start of method details.
      */
     public static final Content START_OF_METHOD_DETAILS =
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Fri Oct 11 09:17:18 2013 -0400
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.Writer;
 import java.util.*;
+import java.nio.charset.*;
 
 import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -164,6 +165,46 @@
     }
 
     /**
+     * A set of ASCII URI characters to be left unencoded.
+     */
+    public static final BitSet NONENCODING_CHARS = new BitSet(256);
+
+    static {
+        // alphabetic characters
+        for (int i = 'a'; i <= 'z'; i++) {
+            NONENCODING_CHARS.set(i);
+        }
+        for (int i = 'A'; i <= 'Z'; i++) {
+            NONENCODING_CHARS.set(i);
+        }
+        // numeric characters
+        for (int i = '0'; i <= '9'; i++) {
+            NONENCODING_CHARS.set(i);
+        }
+        // Reserved characters as per RFC 3986. These are set of delimiting characters.
+        String noEnc = ":/?#[]@!$&'()*+,;=";
+        // Unreserved characters as per RFC 3986 which should not be percent encoded.
+        noEnc += "-._~";
+        for (int i = 0; i < noEnc.length(); i++) {
+            NONENCODING_CHARS.set(noEnc.charAt(i));
+        }
+    }
+
+    private static String encodeURL(String url) {
+        byte[] urlBytes = url.getBytes(Charset.forName("UTF-8"));
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < urlBytes.length; i++) {
+            int c = urlBytes[i];
+            if (NONENCODING_CHARS.get(c & 0xFF)) {
+                sb.append((char) c);
+            } else {
+                sb.append(String.format("%%%02X", c & 0xFF));
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
      * Generates an HTML anchor tag.
      *
      * @param ref reference url for the anchor tag
@@ -172,7 +213,7 @@
      */
     public static HtmlTree A(String ref, Content body) {
         HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body));
-        htmltree.addAttr(HtmlAttr.HREF, ref);
+        htmltree.addAttr(HtmlAttr.HREF, encodeURL(ref));
         return htmltree;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -335,6 +335,12 @@
                 "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
                 "        targetPage = \"undefined\";" + DocletConstants.NL +
                 "    function validURL(url) {" + DocletConstants.NL +
+                "        try {" + DocletConstants.NL +
+                "            url = decodeURIComponent(url);" + DocletConstants.NL +
+                "        }" + DocletConstants.NL +
+                "        catch (error) {" + DocletConstants.NL +
+                "            return false;" + DocletConstants.NL +
+                "        }" + DocletConstants.NL +
                 "        var pos = url.indexOf(\".html\");" + DocletConstants.NL +
                 "        if (pos == -1 || pos != url.length - 5)" + DocletConstants.NL +
                 "            return false;" + DocletConstants.NL +
@@ -346,7 +352,8 @@
                 "            if ('a' <= ch && ch <= 'z' ||" + DocletConstants.NL +
                 "                    'A' <= ch && ch <= 'Z' ||" + DocletConstants.NL +
                 "                    ch == '$' ||" + DocletConstants.NL +
-                "                    ch == '_') {" + DocletConstants.NL +
+                "                    ch == '_' ||" + DocletConstants.NL +
+                "                    ch.charCodeAt(0) > 127) {" + DocletConstants.NL +
                 "                allowNumber = true;" + DocletConstants.NL +
                 "                allowSep = true;" + DocletConstants.NL +
                 "            } else if ('0' <= ch && ch <= '9'" + DocletConstants.NL +
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -185,9 +185,9 @@
 doclet.Groupname_already_used=-group\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u304A\u3044\u3066\u3001\u3059\u3067\u306B\u30B0\u30EB\u30FC\u30D7\u540D\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0}
 doclet.Same_package_name_used=\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u5F62\u5F0F\u304C2\u56DE\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0}
 doclet.exception_encountered={1}\u306E\u51E6\u7406\u4E2D\u306B\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\n{0}
-doclet.usage=\u6A19\u6E96\u306Edoclet\u306B\u3088\u308A\u63D0\u4F9B\u3055\u308C\u308B\u3082\u306E:\n-d <directory>                    \u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n-use                              \u30AF\u30E9\u30B9\u3068\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u4F7F\u7528\u30DA\u30FC\u30B8\u3092\u4F5C\u6210\u3059\u308B\n-version                          @version\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-author                           @author\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-docfilessubdirs                  doc-file\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u518D\u5E30\u7684\u306B\u30B3\u30D4\u30FC\u3059\u308B\n-splitindex                       1\u5B57\u3054\u3068\u306B1\u30D5\u30A1\u30A4\u30EB\u306B\u7D22\u5F15\u3092\u5206\u5272\u3059\u308B\n-windowtitle <text>               \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u7528\u306E\u30D6\u30E9\u30A6\u30B6\u30FB\u30A6\u30A3\u30F3\u30C9\u30A6\u30FB\u30BF\u30A4\u30C8\u30EB\n-doctitle <html-code>             \u6982\u8981\u30DA\u30FC\u30B8\u306B\u30BF\u30A4\u30C8\u30EB\u3092\u542B\u3081\u308B\n-header <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u30D8\u30C3\u30C0\u30FC\u3092\u542B\u3081\u308B\n-footer <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u30D5\u30C3\u30BF\u30FC\u3092\u542B\u3081\u308B\n-top    <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u4E0A\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-bottom <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u4E0B\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-link <url>                       <url>\u306Bjavadoc\u51FA\u529B\u3078\u306E\u30EA\u30F3\u30AF\u3092\u4F5C\u6210\u3059\u308B\n-linkoffline <url> <url2>         <url2>\u306B\u3042\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u4F7F\u7528\u3057\u3066<url>\u306Edocs\u306B\u30EA\u30F3\u30AF\u3059\u308B\n-excludedocfilessubdir <name1>:.. \u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u306Edoc-files\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u3059\u3079\u3066\u9664\u5916\u3059\u308B\n-group <name> <p1>:<p2>..         \u6307\u5B9A\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6982\u8981\u30DA\u30FC\u30B8\u306B\u304A\u3044\u3066\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B\n-nocomment                        \u8A18\u8FF0\u304A\u3088\u3073\u30BF\u30B0\u3092\u6291\u5236\u3057\u3066\u5BA3\u8A00\u306E\u307F\u3092\u751F\u6210\u3059\u308B\n-nodeprecated                     @deprecated\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-noqualifier <name1>:<name2>:...  \u51FA\u529B\u304B\u3089\u4FEE\u98FE\u5B50\u306E\u30EA\u30B9\u30C8\u3092\u9664\u5916\u3059\u308B\n-nosince                          @since\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-notimestamp                      \u975E\u8868\u793A\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3092\u9664\u5916\u3059\u308B\n-nodeprecatedlist                 \u975E\u63A8\u5968\u306E\u30EA\u30B9\u30C8\u3092\u751F\u6210\u3057\u306A\u3044\n-notree                           \u30AF\u30E9\u30B9\u968E\u5C64\u3092\u751F\u6210\u3057\u306A\u3044\n-noindex                          \u7D22\u5F15\u3092\u751F\u6210\u3057\u306A\u3044\n-nohelp                           \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u3092\u751F\u6210\u3057\u306A\u3044\n-nonavbar                         \u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u3092\u751F\u6210\u3057\u306A\u3044\n-serialwarn                       @serial\u30BF\u30B0\u306B\u95A2\u3059\u308B\u8B66\u544A\u3092\u751F\u6210\u3059\u308B\n-tag <name>:<locations>:<header>  \u5358\u4E00\u306E\u5F15\u6570\u3092\u6301\u3064\u30AB\u30B9\u30BF\u30E0\u30FB\u30BF\u30B0\u3092\u6307\u5B9A\u3059\u308B\n-taglet                           \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u5B8C\u5168\u4FEE\u98FE\u540D\u3092\u767B\u9332\u3059\u308B\n-tagletpath                       \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u30D1\u30B9\n-Xdocrootparent \
-<url>             \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B3\u30E1\u30F3\u30C8\u5185\u306E@docRoot(\u3053\u306E\u5F8C\u306B\u306F/..\u304C\u7D9A\u304F)\u306E\u3059\u3079\u3066\u306E\u51FA\u73FE\u7B87\u6240\u3092<url>\u3067\u7F6E\u63DB\u3059\u308B\n-charset <charset>                \u751F\u6210\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30AF\u30ED\u30B9\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u3067\u306E\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\n-helpfile <file>                  \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u306E\u30EA\u30F3\u30AF\u5148\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B\n-linksource                       HTML\u5F62\u5F0F\u3067\u30BD\u30FC\u30B9\u3092\u751F\u6210\u3059\u308B\n-sourcetab <tab length>           \u30BD\u30FC\u30B9\u5185\u306E\u30BF\u30D6\u306E\u7A7A\u767D\u6587\u5B57\u306E\u6570\u3092\u6307\u5B9A\u3059\u308B\n-keywords                         HTML\u306Emeta\u30BF\u30B0\u306B\u3001\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u60C5\u5831\u3092\u542B\u3081\u308B\n-stylesheetfile <path>            \u751F\u6210\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B9\u30BF\u30A4\u30EB\u5909\u66F4\u7528\u30D5\u30A1\u30A4\u30EB\n-docencoding <name>               \u51FA\u529B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D
+doclet.usage=\u6A19\u6E96\u306Edoclet\u306B\u3088\u308A\u63D0\u4F9B\u3055\u308C\u308B\u3082\u306E:\n-d <directory>                    \u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n-use                              \u30AF\u30E9\u30B9\u3068\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u4F7F\u7528\u30DA\u30FC\u30B8\u3092\u4F5C\u6210\u3059\u308B\n-version                          @version\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-author                           @author\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-docfilessubdirs                  doc-file\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u518D\u5E30\u7684\u306B\u30B3\u30D4\u30FC\u3059\u308B\n-splitindex                       1\u5B57\u3054\u3068\u306B1\u30D5\u30A1\u30A4\u30EB\u306B\u7D22\u5F15\u3092\u5206\u5272\u3059\u308B\n-windowtitle <text>               \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u7528\u306E\u30D6\u30E9\u30A6\u30B6\u30FB\u30A6\u30A3\u30F3\u30C9\u30A6\u30FB\u30BF\u30A4\u30C8\u30EB\n-doctitle <html-code>             \u6982\u8981\u30DA\u30FC\u30B8\u306B\u30BF\u30A4\u30C8\u30EB\u3092\u542B\u3081\u308B\n-header <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u30D8\u30C3\u30C0\u30FC\u3092\u542B\u3081\u308B\n-footer <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u30D5\u30C3\u30BF\u30FC\u3092\u542B\u3081\u308B\n-top    <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u4E0A\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-bottom <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u4E0B\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-link <url>                       <url>\u306Bjavadoc\u51FA\u529B\u3078\u306E\u30EA\u30F3\u30AF\u3092\u4F5C\u6210\u3059\u308B\n-linkoffline <url> <url2>         <url2>\u306B\u3042\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u4F7F\u7528\u3057\u3066<url>\u306Edocs\u306B\u30EA\u30F3\u30AF\u3059\u308B\n-excludedocfilessubdir <name1>:.. \u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u306Edoc-files\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u3059\u3079\u3066\u9664\u5916\u3059\u308B\n-group <name> <p1>:<p2>..         \u6307\u5B9A\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6982\u8981\u30DA\u30FC\u30B8\u306B\u304A\u3044\u3066\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B\n-nocomment                        \u8A18\u8FF0\u304A\u3088\u3073\u30BF\u30B0\u3092\u6291\u5236\u3057\u3066\u5BA3\u8A00\u306E\u307F\u3092\u751F\u6210\u3059\u308B\n-nodeprecated                     @deprecated\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-noqualifier <name1>:<name2>:...  \u51FA\u529B\u304B\u3089\u4FEE\u98FE\u5B50\u306E\u30EA\u30B9\u30C8\u3092\u9664\u5916\u3059\u308B\n-nosince                          @since\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-notimestamp                      \u975E\u8868\u793A\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3092\u9664\u5916\u3059\u308B\n-nodeprecatedlist                 \u975E\u63A8\u5968\u306E\u30EA\u30B9\u30C8\u3092\u751F\u6210\u3057\u306A\u3044\n-notree                           \u30AF\u30E9\u30B9\u968E\u5C64\u3092\u751F\u6210\u3057\u306A\u3044\n-noindex                          \u7D22\u5F15\u3092\u751F\u6210\u3057\u306A\u3044\n-nohelp                           \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u3092\u751F\u6210\u3057\u306A\u3044\n-nonavbar                         \u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u3092\u751F\u6210\u3057\u306A\u3044\n-serialwarn                       @serial\u30BF\u30B0\u306B\u95A2\u3059\u308B\u8B66\u544A\u3092\u751F\u6210\u3059\u308B\n-tag <name>:<locations>:<header>  \u5358\u4E00\u306E\u5F15\u6570\u3092\u6301\u3064\u30AB\u30B9\u30BF\u30E0\u30FB\u30BF\u30B0\u3092\u6307\u5B9A\u3059\u308B\n-taglet                           \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u5B8C\u5168\u4FEE\u98FE\u540D\u3092\u767B\u9332\u3059\u308B\n-tagletpath                       \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u30D1\u30B9\n-charset \
+<charset>                \u751F\u6210\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30AF\u30ED\u30B9\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u3067\u306E\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\n-helpfile <file>                  \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u306E\u30EA\u30F3\u30AF\u5148\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B\n-linksource                       HTML\u5F62\u5F0F\u3067\u30BD\u30FC\u30B9\u3092\u751F\u6210\u3059\u308B\n-sourcetab <tab length>           \u30BD\u30FC\u30B9\u5185\u306E\u30BF\u30D6\u306E\u7A7A\u767D\u6587\u5B57\u306E\u6570\u3092\u6307\u5B9A\u3059\u308B\n-keywords                         HTML\u306Emeta\u30BF\u30B0\u306B\u3001\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u60C5\u5831\u3092\u542B\u3081\u308B\n-stylesheetfile <path>            \u751F\u6210\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B9\u30BF\u30A4\u30EB\u5909\u66F4\u7528\u30D5\u30A1\u30A4\u30EB\n-docencoding <name>               \u51FA\u529B\u306E\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3059\u308B
 
 
-
-
+# L10N: do not localize these words: all none accessibility html missing reference syntax
+doclet.X.usage=\u6A19\u6E96\u306Edoclet\u306B\u3088\u308A\u63D0\u4F9B\u3055\u308C\u308B\u3082\u306E:\n  -Xdocrootparent <url>            doc\u30B3\u30E1\u30F3\u30C8\u5185\u306E/..\u304C\u5F8C\u306B\u7D9A\u304F@docRoot\u306E\u3059\u3079\u3066\u3092\n                                   <url>\u3067\u7F6E\u63DB\u3057\u307E\u3059\n  -Xdoclint                        javadoc\u30B3\u30E1\u30F3\u30C8\u5185\u306E\u554F\u984C\u306B\u5BFE\u3059\u308B\u63A8\u5968\u3055\u308C\u308B\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3057\u307E\u3059\n  -Xdoclint:(all|none|[-]<group>) \n        javadoc\u30B3\u30E1\u30F3\u30C8\u5185\u306E\u554F\u984C\u306B\u5BFE\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n        \u3053\u3053\u3067\u3001<group>\u306Fhtml\u3001missing\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002\n
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_zh_CN.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_zh_CN.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -185,8 +185,8 @@
 doclet.Groupname_already_used=\u5728 -group \u9009\u9879\u4E2D, groupname \u5DF2\u4F7F\u7528: {0}
 doclet.Same_package_name_used=\u7A0B\u5E8F\u5305\u540D\u79F0\u5F62\u5F0F\u4F7F\u7528\u4E86\u4E24\u6B21: {0}
 doclet.exception_encountered=\u5904\u7406{1}\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\n{0}
-doclet.usage=\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n-d <directory>                    \u8F93\u51FA\u6587\u4EF6\u7684\u76EE\u6807\u76EE\u5F55\n-use                              \u521B\u5EFA\u7C7B\u548C\u7A0B\u5E8F\u5305\u7528\u6CD5\u9875\u9762\n-version                          \u5305\u542B @version \u6BB5\n-author                           \u5305\u542B @author \u6BB5\n-docfilessubdirs                  \u9012\u5F52\u590D\u5236\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\n-splitindex                       \u5C06\u7D22\u5F15\u5206\u4E3A\u6BCF\u4E2A\u5B57\u6BCD\u5BF9\u5E94\u4E00\u4E2A\u6587\u4EF6\n-windowtitle <text>               \u6587\u6863\u7684\u6D4F\u89C8\u5668\u7A97\u53E3\u6807\u9898\n-doctitle <html-code>             \u5305\u542B\u6982\u89C8\u9875\u9762\u7684\u6807\u9898\n-header <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u7709\u6587\u672C\n-footer <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u811A\u6587\u672C\n-top    <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9876\u90E8\u6587\u672C\n-bottom <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u5E95\u90E8\u6587\u672C\n-link <url>                       \u521B\u5EFA\u6307\u5411\u4F4D\u4E8E <url> \u7684 javadoc \u8F93\u51FA\u7684\u94FE\u63A5\n-linkoffline <url> <url2>         \u5229\u7528\u4F4D\u4E8E <url2> \u7684\u7A0B\u5E8F\u5305\u5217\u8868\u94FE\u63A5\u81F3\u4F4D\u4E8E <url> \u7684\u6587\u6863\n-excludedocfilessubdir <name1>:.. \u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\u3002\n-group <name> <p1>:<p2>..         \u5728\u6982\u89C8\u9875\u9762\u4E2D, \u5C06\u6307\u5B9A\u7684\u7A0B\u5E8F\u5305\u5206\u7EC4\n-nocomment                        \u4E0D\u751F\u6210\u8BF4\u660E\u548C\u6807\u8BB0, \u53EA\u751F\u6210\u58F0\u660E\u3002\n-nodeprecated                     \u4E0D\u5305\u542B @deprecated \u4FE1\u606F\n-noqualifier <name1>:<name2>:...  \u8F93\u51FA\u4E2D\u4E0D\u5305\u62EC\u9650\u5B9A\u7B26\u7684\u5217\u8868\u3002\n-nosince                          \u4E0D\u5305\u542B @since \u4FE1\u606F\n-notimestamp                      \u4E0D\u5305\u542B\u9690\u85CF\u65F6\u95F4\u6233\n-nodeprecatedlist                 \u4E0D\u751F\u6210\u5DF2\u8FC7\u65F6\u7684\u5217\u8868\n-notree                           \u4E0D\u751F\u6210\u7C7B\u5206\u5C42\u7ED3\u6784\n-noindex                          \u4E0D\u751F\u6210\u7D22\u5F15\n-nohelp                           \u4E0D\u751F\u6210\u5E2E\u52A9\u94FE\u63A5\n-nonavbar                         \u4E0D\u751F\u6210\u5BFC\u822A\u680F\n-serialwarn                       \u751F\u6210\u6709\u5173 @serial \u6807\u8BB0\u7684\u8B66\u544A\n-tag <name>:<locations>:<header>  \u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0\n-taglet                           \u8981\u6CE8\u518C\u7684 Taglet \u7684\u5168\u9650\u5B9A\u540D\u79F0\n-tagletpath                       Taglet \u7684\u8DEF\u5F84\n-Xdocrootparent <url>             \u5C06\u6587\u6863\u6CE8\u91CA\u4E2D\u51FA\u73B0\u7684\u6240\u6709\u540E\u8DDF /.. \u7684 @docRoot \u66FF\u6362\u4E3A <url>\n-charset <charset>                \u7528\u4E8E\u8DE8\u5E73\u53F0\u67E5\u770B\u751F\u6210\u7684\u6587\u6863\u7684\u5B57\u7B26\u96C6\u3002\n-helpfile <file>                  \u5305\u542B\u5E2E\u52A9\u94FE\u63A5\u6240\u94FE\u63A5\u5230\u7684\u6587\u4EF6\n-linksource                       \u4EE5 HTML \u683C\u5F0F\u751F\u6210\u6E90\u6587\u4EF6\n-sourcetab <tab length>           \u6307\u5B9A\u6E90\u4E2D\u6BCF\u4E2A\u5236\u8868\u7B26\u5360\u636E\u7684\u7A7A\u683C\u6570\n-keywords                         \u4F7F\u7A0B\u5E8F\u5305, \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u9644\u5E26 HTML \u5143\u6807\u8BB0\n-stylesheetfile <path>            \u7528\u4E8E\u66F4\u6539\u751F\u6210\u6587\u6863\u7684\u6837\u5F0F\u7684\u6587\u4EF6\n-docencoding <name>               \u8F93\u51FA\u7F16\u7801\u540D\u79F0
+doclet.usage=\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n  -d <directory>                   \u8F93\u51FA\u6587\u4EF6\u7684\u76EE\u6807\u76EE\u5F55\n  -use                             \u521B\u5EFA\u7C7B\u548C\u7A0B\u5E8F\u5305\u7528\u6CD5\u9875\u9762\n  -version                         \u5305\u542B @version \u6BB5\n  -author                          \u5305\u542B @author \u6BB5\n  -docfilessubdirs                 \u9012\u5F52\u590D\u5236\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\n  -splitindex                      \u5C06\u7D22\u5F15\u5206\u4E3A\u6BCF\u4E2A\u5B57\u6BCD\u5BF9\u5E94\u4E00\u4E2A\u6587\u4EF6\n  -windowtitle <text>              \u6587\u6863\u7684\u6D4F\u89C8\u5668\u7A97\u53E3\u6807\u9898\n  -doctitle <html-code>            \u5305\u542B\u6982\u89C8\u9875\u9762\u7684\u6807\u9898\n  -header <html-code>              \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u7709\u6587\u672C\n  -footer <html-code>              \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u811A\u6587\u672C\n  -top    <html-code>              \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9876\u90E8\u6587\u672C\n  -bottom <html-code>              \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u5E95\u90E8\u6587\u672C\n  -link <url>                      \u521B\u5EFA\u6307\u5411\u4F4D\u4E8E <url> \u7684 javadoc \u8F93\u51FA\u7684\u94FE\u63A5\n  -linkoffline <url> <url2>        \u5229\u7528\u4F4D\u4E8E <url2> \u7684\u7A0B\u5E8F\u5305\u5217\u8868\u94FE\u63A5\u81F3\u4F4D\u4E8E <url> \u7684\u6587\u6863\n  -excludedocfilessubdir <name1>:.. \u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\u3002\n  -group <name> <p1>:<p2>..        \u5728\u6982\u89C8\u9875\u9762\u4E2D, \u5C06\u6307\u5B9A\u7684\u7A0B\u5E8F\u5305\u5206\u7EC4\n  -nocomment                       \u4E0D\u751F\u6210\u8BF4\u660E\u548C\u6807\u8BB0, \u53EA\u751F\u6210\u58F0\u660E\u3002\n  -nodeprecated                    \u4E0D\u5305\u542B @deprecated \u4FE1\u606F\n  -noqualifier <name1>:<name2>:... \u8F93\u51FA\u4E2D\u4E0D\u5305\u62EC\u6307\u5B9A\u9650\u5B9A\u7B26\u7684\u5217\u8868\u3002\n  -nosince                         \u4E0D\u5305\u542B @since \u4FE1\u606F\n  -notimestamp                     \u4E0D\u5305\u542B\u9690\u85CF\u65F6\u95F4\u6233\n  -nodeprecatedlist                \u4E0D\u751F\u6210\u5DF2\u8FC7\u65F6\u7684\u5217\u8868\n  -notree                          \u4E0D\u751F\u6210\u7C7B\u5206\u5C42\u7ED3\u6784\n  -noindex                         \u4E0D\u751F\u6210\u7D22\u5F15\n  -nohelp                          \u4E0D\u751F\u6210\u5E2E\u52A9\u94FE\u63A5\n  -nonavbar                        \u4E0D\u751F\u6210\u5BFC\u822A\u680F\n  -serialwarn                      \u751F\u6210\u6709\u5173 @serial \u6807\u8BB0\u7684\u8B66\u544A\n  -tag <name>:<locations>:<header> \u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0\n  -taglet                          \u8981\u6CE8\u518C\u7684 Taglet \u7684\u5168\u9650\u5B9A\u540D\u79F0\n  -tagletpath                      Taglet \u7684\u8DEF\u5F84\n  -charset <charset>               \u7528\u4E8E\u8DE8\u5E73\u53F0\u67E5\u770B\u751F\u6210\u7684\u6587\u6863\u7684\u5B57\u7B26\u96C6\u3002\n  -helpfile <file>                 \u5305\u542B\u5E2E\u52A9\u94FE\u63A5\u6240\u94FE\u63A5\u5230\u7684\u6587\u4EF6\n  -linksource                      \u4EE5 HTML \u683C\u5F0F\u751F\u6210\u6E90\u6587\u4EF6\n  -sourcetab <tab length>          \u6307\u5B9A\u6E90\u4E2D\u6BCF\u4E2A\u5236\u8868\u7B26\u5360\u636E\u7684\u7A7A\u683C\u6570\n  -keywords                        \u4F7F\u7A0B\u5E8F\u5305, \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u9644\u5E26 HTML \u5143\u6807\u8BB0\n  -stylesheetfile <path>           \u7528\u4E8E\u66F4\u6539\u751F\u6210\u6587\u6863\u7684\u6837\u5F0F\u7684\u6587\u4EF6\n  -docencoding <name>              \u6307\u5B9A\u8F93\u51FA\u7684\u5B57\u7B26\u7F16\u7801
 
 
-
-
+# L10N: do not localize these words: all none accessibility html missing reference syntax
+doclet.X.usage=\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n  -Xdocrootparent <url>            \u4F7F\u7528 <url> \u66FF\u6362\u6587\u6863\u6CE8\u91CA\u4E2D\u51FA\u73B0\u7684\n                                   \u6240\u6709\u5176\u540E\u8DDF\u968F /.. \u7684 @docRoot\n  -Xdoclint                        \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u5EFA\u8BAE\u7684\u68C0\u67E5\n  -Xdoclint:(all|none|[-]<group>) \n        \u5BF9 javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5\u3002\n        \u5176\u4E2D <group> \u662F accessibility, html, missing, reference \u6216 syntax \u4E4B\u4E00\u3002\n
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeFieldWriter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,132 @@
+/*
+ * 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 annotation type field 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
+ * @since 1.8
+ */
+
+public interface AnnotationTypeFieldWriter {
+
+    /**
+     * Add the annotation type member tree header.
+     *
+     * @return content tree for the member tree header
+     */
+    public Content getMemberTreeHeader();
+
+    /**
+     * Add the annotation type field details marker.
+     *
+     * @param memberDetails the content tree representing field details marker
+     */
+    public void addAnnotationFieldDetailsMarker(Content memberDetails);
+
+    /**
+     * Add the annotation type details tree header.
+     *
+     * @param classDoc the annotation type being documented
+     * @param memberDetailsTree the content tree representing member details
+     */
+    public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
+            Content memberDetailsTree);
+
+    /**
+     * Get the annotation type documentation tree header.
+     *
+     * @param member the annotation type being documented
+     * @param annotationDetailsTree the content tree representing annotation type details
+     * @return content tree for the annotation type documentation header
+     */
+    public Content getAnnotationDocTreeHeader(MemberDoc member,
+            Content annotationDetailsTree);
+
+    /**
+     * Get the annotation type details tree.
+     *
+     * @param annotationDetailsTree the content tree representing annotation type details
+     * @return content tree for the annotation type details
+     */
+    public Content getAnnotationDetails(Content annotationDetailsTree);
+
+    /**
+     * Get the annotation type documentation.
+     *
+     * @param annotationDocTree the content tree representing annotation type documentation
+     * @param isLastContent true if the content to be added is the last content
+     * @return content tree for the annotation type documentation
+     */
+    public Content getAnnotationDoc(Content annotationDocTree, boolean isLastContent);
+
+    /**
+     * Get the signature for the given member.
+     *
+     * @param member the member being documented
+     * @return content tree for the annotation type signature
+     */
+    public Content getSignature(MemberDoc member);
+
+    /**
+     * Add the deprecated output for the given member.
+     *
+     * @param member the member being documented
+     * @param annotationDocTree content tree to which the deprecated information will be added
+     */
+    public void addDeprecated(MemberDoc member, Content annotationDocTree);
+
+    /**
+     * Add the comments for the given member.
+     *
+     * @param member the member being documented
+     * @param annotationDocTree the content tree to which the comments will be added
+     */
+    public void addComments(MemberDoc member, Content annotationDocTree);
+
+    /**
+     * Add the tags for the given member.
+     *
+     * @param member the member being documented
+     * @param annotationDocTree the content tree to which the tags will be added
+     */
+    public void addTags(MemberDoc member, Content annotationDocTree);
+
+    /**
+     * Close the writer.
+     */
+    public void close() throws IOException;
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -45,6 +45,20 @@
 public interface AnnotationTypeRequiredMemberWriter {
 
     /**
+     * Add the annotation type member tree header.
+     *
+     * @return content tree for the member tree header
+     */
+    public Content getMemberTreeHeader();
+
+    /**
+     * Add the annotation type details marker.
+     *
+     * @param memberDetails the content tree representing details marker
+     */
+    public void addAnnotationDetailsMarker(Content memberDetails);
+
+    /**
      * Add the annotation type details tree header.
      *
      * @param classDoc the annotation type being documented
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -104,13 +104,6 @@
     public void addAnnotationTypeDeprecationInfo (Content annotationInfoTree);
 
     /**
-     * Add the annotation type details marker.
-     *
-     * @param memberDetails the content tree representing member details marker
-     */
-    public void addAnnotationDetailsMarker(Content memberDetails);
-
-    /**
      * Get the member tree header for the annotation type.
      *
      * @return a content tree for the member tree header
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Fri Oct 11 09:17:18 2013 -0400
@@ -130,6 +130,18 @@
             throws Exception;
 
     /**
+     * Return the annotation type field writer for a given annotation type.
+     *
+     * @param annotationTypeWriter the writer for the annotation type
+     *        being documented.
+     * @return the member writer for the given annotation type.  Return null if
+     *         this writer is not supported by the doclet.
+     */
+    public abstract AnnotationTypeFieldWriter
+            getAnnotationTypeFieldWriter(
+        AnnotationTypeWriter annotationTypeWriter) throws Exception;
+
+    /**
      * Return the annotation type optional member writer for a given annotation
      * type.
      *
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Fri Oct 11 09:17:18 2013 -0400
@@ -223,14 +223,23 @@
         Content memberDetailsTree = writer.getMemberTreeHeader();
         buildChildren(node, memberDetailsTree);
         if (memberDetailsTree.isValid()) {
-            Content memberDetails = writer.getMemberTreeHeader();
-            writer.addAnnotationDetailsMarker(memberDetails);
-            memberDetails.addContent(writer.getMemberTree(memberDetailsTree));
-            annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetails));
+            annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
         }
     }
 
     /**
+     * Build the annotation type field documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param memberDetailsTree the content tree to which the documentation will be added
+     */
+    public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree)
+            throws Exception {
+        configuration.getBuilderFactory().
+                getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree);
+    }
+
+    /**
      * Build the annotation type optional member documentation.
      *
      * @param node the XML element that specifies which components to document
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.  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.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds documentation for annotation type fields.
+ *
+ *  <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
+ * @since 1.8
+ */
+public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
+
+    /**
+     * The annotation type whose members are being documented.
+     */
+    protected ClassDoc classDoc;
+
+    /**
+     * The visible members for the given class.
+     */
+    protected VisibleMemberMap visibleMemberMap;
+
+    /**
+     * The writer to output the member documentation.
+     */
+    protected AnnotationTypeFieldWriter writer;
+
+    /**
+     * The list of members being documented.
+     */
+    protected List<ProgramElementDoc> members;
+
+    /**
+     * The index of the current member that is being documented at this point
+     * in time.
+     */
+    protected int currentMemberIndex;
+
+    /**
+     * Construct a new AnnotationTypeFieldsBuilder.
+     *
+     * @param context  the build context.
+     * @param classDoc the class whose members are being documented.
+     * @param writer the doclet specific writer.
+     * @param memberType the type of member that is being documented.
+     */
+    protected AnnotationTypeFieldBuilder(Context context,
+            ClassDoc classDoc,
+            AnnotationTypeFieldWriter writer,
+            int memberType) {
+        super(context);
+        this.classDoc = classDoc;
+        this.writer = writer;
+        this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType,
+            configuration);
+        this.members = new ArrayList<ProgramElementDoc>(
+            this.visibleMemberMap.getMembersFor(classDoc));
+        if (configuration.getMemberComparator() != null) {
+            Collections.sort(this.members, configuration.getMemberComparator());
+        }
+    }
+
+
+    /**
+     * Construct a new AnnotationTypeFieldBuilder.
+     *
+     * @param context  the build context.
+     * @param classDoc the class whose members are being documented.
+     * @param writer the doclet specific writer.
+     */
+    public static AnnotationTypeFieldBuilder getInstance(
+            Context context, ClassDoc classDoc,
+            AnnotationTypeFieldWriter writer) {
+        return new AnnotationTypeFieldBuilder(context, classDoc,
+                    writer, VisibleMemberMap.ANNOTATION_TYPE_FIELDS);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return "AnnotationTypeFieldDetails";
+    }
+
+    /**
+     * Returns a list of members that will be documented for the given class.
+     * This information can be used for doclet specific documentation
+     * generation.
+     *
+     * @param classDoc the {@link ClassDoc} we want to check.
+     * @return a list of members that will be documented.
+     */
+    public List<ProgramElementDoc> members(ClassDoc classDoc) {
+        return visibleMemberMap.getMembersFor(classDoc);
+    }
+
+    /**
+     * Returns the visible member map for the members of this class.
+     *
+     * @return the visible member map for the members of this class.
+     */
+    public VisibleMemberMap getVisibleMemberMap() {
+        return visibleMemberMap;
+    }
+
+    /**
+     * summaryOrder.size()
+     */
+    public boolean hasMembersToDocument() {
+        return members.size() > 0;
+    }
+
+    /**
+     * Build the annotation type field documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param memberDetailsTree the content tree to which the documentation will be added
+     */
+    public void buildAnnotationTypeField(XMLNode node, Content memberDetailsTree) {
+        buildAnnotationTypeMember(node, memberDetailsTree);
+    }
+
+    /**
+     * Build the member documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param memberDetailsTree the content tree to which the documentation will be added
+     */
+    public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) {
+        if (writer == null) {
+            return;
+        }
+        int size = members.size();
+        if (size > 0) {
+            writer.addAnnotationFieldDetailsMarker(memberDetailsTree);
+            for (currentMemberIndex = 0; currentMemberIndex < size;
+                    currentMemberIndex++) {
+                Content detailsTree = writer.getMemberTreeHeader();
+                writer.addAnnotationDetailsTreeHeader(classDoc, detailsTree);
+                Content annotationDocTree = writer.getAnnotationDocTreeHeader(
+                        (MemberDoc) members.get(currentMemberIndex),
+                        detailsTree);
+                buildChildren(node, annotationDocTree);
+                detailsTree.addContent(writer.getAnnotationDoc(
+                        annotationDocTree, (currentMemberIndex == size - 1)));
+                memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
+            }
+        }
+    }
+
+    /**
+     * Build the signature.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param annotationDocTree the content tree to which the documentation will be added
+     */
+    public void buildSignature(XMLNode node, Content annotationDocTree) {
+        annotationDocTree.addContent(
+                writer.getSignature((MemberDoc) members.get(currentMemberIndex)));
+    }
+
+    /**
+     * Build the deprecation information.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param annotationDocTree the content tree to which the documentation will be added
+     */
+    public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
+        writer.addDeprecated((MemberDoc) members.get(currentMemberIndex),
+                annotationDocTree);
+    }
+
+    /**
+     * Build the comments for the member.  Do nothing if
+     * {@link Configuration#nocomment} is set to true.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param annotationDocTree the content tree to which the documentation will be added
+     */
+    public void buildMemberComments(XMLNode node, Content annotationDocTree) {
+        if(! configuration.nocomment){
+            writer.addComments((MemberDoc) members.get(currentMemberIndex),
+                    annotationDocTree);
+        }
+    }
+
+    /**
+     * Build the tag information.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param annotationDocTree the content tree to which the documentation will be added
+     */
+    public void buildTagInfo(XMLNode node, Content annotationDocTree) {
+        writer.addTags((MemberDoc) members.get(currentMemberIndex),
+                annotationDocTree);
+    }
+
+    /**
+     * Return the annotation type field writer for this builder.
+     *
+     * @return the annotation type field writer for this builder.
+     */
+    public AnnotationTypeFieldWriter getWriter() {
+        return writer;
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Fri Oct 11 09:17:18 2013 -0400
@@ -167,16 +167,17 @@
         }
         int size = members.size();
         if (size > 0) {
-            writer.addAnnotationDetailsTreeHeader(
-                    classDoc, memberDetailsTree);
+            writer.addAnnotationDetailsMarker(memberDetailsTree);
             for (currentMemberIndex = 0; currentMemberIndex < size;
-            currentMemberIndex++) {
+                    currentMemberIndex++) {
+                Content detailsTree = writer.getMemberTreeHeader();
+                writer.addAnnotationDetailsTreeHeader(classDoc, detailsTree);
                 Content annotationDocTree = writer.getAnnotationDocTreeHeader(
-                        (MemberDoc) members.get(currentMemberIndex),
-                        memberDetailsTree);
+                        (MemberDoc) members.get(currentMemberIndex), detailsTree);
                 buildChildren(node, annotationDocTree);
-                memberDetailsTree.addContent(writer.getAnnotationDoc(
+                detailsTree.addContent(writer.getAnnotationDoc(
                         annotationDocTree, (currentMemberIndex == size - 1)));
+                memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Fri Oct 11 09:17:18 2013 -0400
@@ -174,10 +174,26 @@
     }
 
     /**
+     * Return an instance of the annotation type fields builder for the given
+     * class.
+     *
+     * @return an instance of the annotation type field builder for the given
+     *         annotation type.
+     */
+    public AbstractBuilder getAnnotationTypeFieldsBuilder(
+            AnnotationTypeWriter annotationTypeWriter)
+    throws Exception {
+        return AnnotationTypeFieldBuilder.getInstance(context,
+            annotationTypeWriter.getAnnotationTypeDoc(),
+            writerFactory.getAnnotationTypeFieldWriter(
+                annotationTypeWriter));
+    }
+
+    /**
      * Return an instance of the annotation type member builder for the given
      * class.
      *
-     * @return an instance of the annotation type memebr builder for the given
+     * @return an instance of the annotation type member builder for the given
      *         annotation type.
      */
     public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
@@ -193,7 +209,7 @@
      * Return an instance of the annotation type member builder for the given
      * class.
      *
-     * @return an instance of the annotation type memebr builder for the given
+     * @return an instance of the annotation type member builder for the given
      *         annotation type.
      */
     public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Fri Oct 11 09:17:18 2013 -0400
@@ -213,6 +213,20 @@
     }
 
     /**
+     * Build the summary for fields.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param memberSummaryTree the content tree to which the documentation will be added
+     */
+    public void buildAnnotationTypeFieldsSummary(XMLNode node, Content memberSummaryTree) {
+        MemberSummaryWriter writer =
+                memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_FIELDS];
+        VisibleMemberMap visibleMemberMap =
+                visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_FIELDS];
+        addSummary(writer, visibleMemberMap, false, memberSummaryTree);
+    }
+
+    /**
      * Build the summary for the optional members.
      *
      * @param node the XML element that specifies which components to document
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Fri Oct 11 09:17:18 2013 -0400
@@ -66,10 +66,19 @@
             <AnnotationTypeTagInfo/>
         </AnnotationTypeInfo>
         <MemberSummary>
+            <AnnotationTypeFieldsSummary/>
             <AnnotationTypeRequiredMemberSummary/>
             <AnnotationTypeOptionalMemberSummary/>
         </MemberSummary>
         <AnnotationTypeMemberDetails>
+            <AnnotationTypeFieldDetails>
+                <AnnotationTypeField>
+                    <Signature/>
+                    <DeprecationInfo/>
+                    <MemberComments/>
+                    <TagInfo/>
+                </AnnotationTypeField>
+            </AnnotationTypeFieldDetails>
             <AnnotationTypeRequiredMemberDetails>
                 <AnnotationTypeRequiredMember>
                     <Signature/>
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -136,6 +136,7 @@
 doclet.Groupname_already_used=In -group option, groupname already used: {0}
 doclet.value_tag_invalid_reference={0} (referenced by @value tag) is an unknown reference.
 doclet.value_tag_invalid_constant=@value tag (which references {0}) can only be used in constants.
+doclet.value_tag_invalid_use=@value tag cannot be used here.
 doclet.dest_dir_create=Creating destination directory: "{0}"
 doclet.in={0} in {1}
 doclet.Use_Table_Summary=Use table, listing {0}, and an explanation
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -174,6 +174,16 @@
 doclet.0_and_1={0}\u3068{1}
 
 #Documentation for Enums
-doclet.enum_values_doc=\n\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u542B\u3080\u914D\u5217\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\u8FD4\u3057\u307E\u3059\u3002\n\u3053\u306E\u30E1\u30BD\u30C3\u30C9\u306F\u6B21\u306E\u3088\u3046\u306B\u3057\u3066\u5B9A\u6570\u3092\u53CD\u5FA9\u3059\u308B\u305F\u3081\u306B\n\u4F7F\u7528\u3067\u304D\u307E\u3059:\n<pre>\nfor({0} c: {0}.values())\n&nbsp; System.out.println(c);\n</pre>\n@return\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\n\u542B\u3080\u914D\u5217
+doclet.enum_values_doc.main=\n\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u542B\u3080\u914D\u5217\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\u8FD4\u3057\u307E\u3059\u3002\n\u3053\u306E\u30E1\u30BD\u30C3\u30C9\u306F\u6B21\u306E\u3088\u3046\u306B\u3057\u3066\u5B9A\u6570\u3092\u53CD\u5FA9\u3059\u308B\u305F\u3081\u306B\n\u4F7F\u7528\u3067\u304D\u307E\u3059:\n<pre>\nfor({0} c: {0}.values())\n&nbsp; System.out.println(c);\n</pre>\n
+
+doclet.enum_values_doc.return=\n\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u542B\u3080\u3001\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\u306E\u914D\u5217
+
+doclet.enum_valueof_doc.main=\n\u6307\u5B9A\u3057\u305F\u540D\u524D\u3092\u6301\u3064\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u6587\u5B57\u5217\u306F\u3001\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u5BA3\u8A00\u3059\u308B\u306E\u306B\u4F7F\u7528\u3057\u305F\u8B58\u5225\u5B50\u3068<i>\u6B63\u78BA\u306B</i>\n\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n(\u4F59\u5206\u306A\u7A7A\u767D\u6587\u5B57\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002)\n
 
-doclet.enum_valueof_doc=\n\u6307\u5B9A\u3057\u305F\u540D\u524D\u3092\u6301\u3064\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u6587\u5B57\u5217\u306F\u3001\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u5BA3\u8A00\u3059\u308B\u306E\u306B\u4F7F\u7528\u3057\u305F\u8B58\u5225\u5B50\u3068<i>\u6B63\u78BA\u306B</i>\n\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n(\u4F59\u5206\u306A\u7A7A\u767D\u6587\u5B57\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002)\n\n@param name\u8FD4\u3055\u308C\u308B\u5217\u6319\u578B\u5B9A\u6570\u306E\u540D\u524D\n@return\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u3092\u6301\u3064\u5217\u6319\u578B\u5B9A\u6570\n@throws IllegalArgumentException\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u3092\u6301\u3064\u5B9A\u6570\u3092\n\u3053\u306E\u5217\u6319\u578B\u304C\u6301\u3063\u3066\u3044\u306A\u3044\u5834\u5408\n@throws NullPointerException\u5F15\u6570\u304Cnull\u306E\u5834\u5408
+doclet.enum_valueof_doc.param_name=\u8FD4\u3055\u308C\u308B\u5217\u6319\u578B\u5B9A\u6570\u306E\u540D\u524D\u3002
+
+doclet.enum_valueof_doc.return=\u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u5217\u6319\u578B\u5B9A\u6570
+
+doclet.enum_valueof_doc.throws_ila=\u3053\u306E\u5217\u6319\u578B\u306B\u3001\u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u5B9A\u6570\u304C\u306A\u3044\u5834\u5408
+
+doclet.enum_valueof_doc.throws_npe=\u5F15\u6570\u304Cnull\u306E\u5834\u5408
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -174,6 +174,16 @@
 doclet.0_and_1={0}\u548C{1}
 
 #Documentation for Enums
-doclet.enum_values_doc=\n\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4\u3002\u8BE5\u65B9\u6CD5\u53EF\u7528\u4E8E\u8FED\u4EE3\n\u5E38\u91CF, \u5982\u4E0B\u6240\u793A:\n<pre>\nfor ({0} c : {0}.values())\n&nbsp;   System.out.println(c);\n</pre>\n@return \u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4
+doclet.enum_values_doc.main=\n\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4\u3002\u8BE5\u65B9\u6CD5\u53EF\u7528\u4E8E\u8FED\u4EE3\n\u5E38\u91CF, \u5982\u4E0B\u6240\u793A:\n<pre>\nfor ({0} c : {0}.values())\n&nbsp;   System.out.println(c);\n</pre>
+
+doclet.enum_values_doc.return=\n\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F\u8FD4\u56DE\u7684\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4
+
+doclet.enum_valueof_doc.main=\n\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u3002\n\u5B57\u7B26\u4E32\u5FC5\u987B\u4E0E\u7528\u4E8E\u58F0\u660E\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u7684\n\u6807\u8BC6\u7B26<i>\u5B8C\u5168</i>\u5339\u914D\u3002(\u4E0D\u5141\u8BB8\u6709\u591A\u4F59\n\u7684\u7A7A\u683C\u5B57\u7B26\u3002)
 
-doclet.enum_valueof_doc=\n\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u3002\n\u5B57\u7B26\u4E32\u5FC5\u987B\u4E0E\u7528\u4E8E\u58F0\u660E\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u7684\n\u6807\u8BC6\u7B26<i>\u5B8C\u5168</i>\u5339\u914D\u3002(\u4E0D\u5141\u8BB8\u6709\u591A\u4F59\n\u7684\u7A7A\u683C\u5B57\u7B26\u3002)\n\n@param name \u8981\u8FD4\u56DE\u7684\u679A\u4E3E\u5E38\u91CF\u7684\u540D\u79F0\u3002\n@return \u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u679A\u4E3E\u5E38\u91CF\n@throws \u5982\u679C\u8BE5\u679A\u4E3E\u7C7B\u578B\u6CA1\u6709\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u5E38\u91CF, \n\u5219\u629B\u51FA IllegalArgumentException\n@throws \u5982\u679C\u53C2\u6570\u4E3A\u7A7A\u503C, \u5219\u629B\u51FA NullPointerException
+doclet.enum_valueof_doc.param_name=\u8981\u8FD4\u56DE\u7684\u679A\u4E3E\u5E38\u91CF\u7684\u540D\u79F0\u3002
+
+doclet.enum_valueof_doc.return=\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u679A\u4E3E\u5E38\u91CF
+
+doclet.enum_valueof_doc.throws_ila=\u5982\u679C\u8BE5\u679A\u4E3E\u7C7B\u578B\u6CA1\u6709\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u5E38\u91CF
+
+doclet.enum_valueof_doc.throws_npe=\u5982\u679C\u53C2\u6570\u4E3A\u7A7A\u503C
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java	Fri Oct 11 09:17:18 2013 -0400
@@ -105,7 +105,9 @@
     }
 
     /**
-     * Given the name of the field, return the corresponding FieldDoc.
+     * Given the name of the field, return the corresponding FieldDoc. Return null
+     * due to invalid use of value tag if the name is null or empty string and if
+     * the value tag is not used on a field.
      *
      * @param config the current configuration of the doclet.
      * @param tag the value tag.
@@ -114,10 +116,8 @@
      * it is assumed that the field is in the current class.
      *
      * @return the corresponding FieldDoc. If the name is null or empty string,
-     * return field that the value tag was used in.
-     *
-     * @throws DocletAbortException if the value tag does not specify a name to
-     * a value field and it is not used within the comments of a valid field.
+     * return field that the value tag was used in. Return null if the name is null
+     * or empty string and if the value tag is not used on a field.
      */
     private FieldDoc getFieldDoc(Configuration config, Tag tag, String name) {
         if (name == null || name.length() == 0) {
@@ -125,8 +125,9 @@
             if (tag.holder() instanceof FieldDoc) {
                 return (FieldDoc) tag.holder();
             } else {
-                //This should never ever happen.
-                throw new DocletAbortException("should not happen");
+                // If the value tag does not specify a parameter which is a valid field and
+                // it is not used within the comments of a valid field, return null.
+                 return null;
             }
         }
         StringTokenizer st = new StringTokenizer(name, "#");
@@ -165,9 +166,15 @@
         FieldDoc field = getFieldDoc(
             writer.configuration(), tag, tag.text());
         if (field == null) {
-            //Reference is unknown.
-            writer.getMsgRetriever().warning(tag.holder().position(),
-                "doclet.value_tag_invalid_reference", tag.text());
+            if (tag.text().isEmpty()) {
+                //Invalid use of @value
+                writer.getMsgRetriever().warning(tag.holder().position(),
+                        "doclet.value_tag_invalid_use");
+            } else {
+                //Reference is unknown.
+                writer.getMsgRetriever().warning(tag.holder().position(),
+                        "doclet.value_tag_invalid_reference", tag.text());
+            }
         } else if (field.constantValue() != null) {
             return writer.valueTagOutput(field,
                 field.constantValueExpression(),
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Fri Oct 11 09:17:18 2013 -0400
@@ -55,14 +55,15 @@
     public static final int FIELDS          = 2;
     public static final int CONSTRUCTORS    = 3;
     public static final int METHODS         = 4;
-    public static final int ANNOTATION_TYPE_MEMBER_OPTIONAL = 5;
-    public static final int ANNOTATION_TYPE_MEMBER_REQUIRED = 6;
-    public static final int PROPERTIES      = 7;
+    public static final int ANNOTATION_TYPE_FIELDS = 5;
+    public static final int ANNOTATION_TYPE_MEMBER_OPTIONAL = 6;
+    public static final int ANNOTATION_TYPE_MEMBER_REQUIRED = 7;
+    public static final int PROPERTIES      = 8;
 
     /**
      * The total number of member types is {@value}.
      */
-    public static final int NUM_MEMBER_TYPES = 8;
+    public static final int NUM_MEMBER_TYPES = 9;
 
     public static final String STARTLEVEL = "start";
 
@@ -433,6 +434,9 @@
             }
             ProgramElementDoc[] members = null;
             switch (kind) {
+                case ANNOTATION_TYPE_FIELDS:
+                    members = cd.fields(filter);
+                    break;
                 case ANNOTATION_TYPE_MEMBER_OPTIONAL:
                     members = cd.isAnnotationType() ?
                         filter((AnnotationTypeDoc) cd, false) :
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Fri Oct 11 09:17:18 2013 -0400
@@ -44,6 +44,7 @@
 import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.Name;
+import javax.lang.model.element.VariableElement;
 import javax.lang.model.type.TypeKind;
 import javax.lang.model.type.TypeMirror;
 import javax.tools.Diagnostic.Kind;
@@ -93,7 +94,7 @@
 
     Set<Element> foundParams = new HashSet<>();
     Set<TypeMirror> foundThrows = new HashSet<>();
-    Map<JavaFileObject, Set<String>> foundAnchors = new HashMap<>();
+    Map<Element, Set<String>> foundAnchors = new HashMap<>();
     boolean foundInheritDoc = false;
     boolean foundReturn = false;
 
@@ -576,13 +577,30 @@
     }
 
     private boolean checkAnchor(String name) {
-        JavaFileObject fo = env.currPath.getCompilationUnit().getSourceFile();
-        Set<String> set = foundAnchors.get(fo);
+        Element e = getEnclosingPackageOrClass(env.currElement);
+        if (e == null)
+            return true;
+        Set<String> set = foundAnchors.get(e);
         if (set == null)
-            foundAnchors.put(fo, set = new HashSet<>());
+            foundAnchors.put(e, set = new HashSet<>());
         return set.add(name);
     }
 
+    private Element getEnclosingPackageOrClass(Element e) {
+        while (e != null) {
+            switch (e.getKind()) {
+                case CLASS:
+                case ENUM:
+                case INTERFACE:
+                case PACKAGE:
+                    return e;
+                default:
+                    e = e.getEnclosingElement();
+            }
+        }
+        return e;
+    }
+
     // http://www.w3.org/TR/html401/types.html#type-name
     private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*");
 
@@ -712,6 +730,10 @@
 
     @Override
     public Void visitReference(ReferenceTree tree, Void ignore) {
+        String sig = tree.getSignature();
+        if (sig.contains("<") || sig.contains(">"))
+            env.messages.error(REFERENCE, tree, "dc.type.arg.not.allowed");
+
         Element e = env.trees.getElement(getCurrentPath());
         if (e == null)
             env.messages.error(REFERENCE, tree, "dc.ref.not.found");
@@ -805,10 +827,33 @@
 
     @Override
     public Void visitValue(ValueTree tree, Void ignore) {
+        ReferenceTree ref = tree.getReference();
+        if (ref == null || ref.getSignature().isEmpty()) {
+            if (!isConstant(env.currElement))
+                env.messages.error(REFERENCE, tree, "dc.value.not.allowed.here");
+        } else {
+            Element e = env.trees.getElement(new DocTreePath(getCurrentPath(), ref));
+            if (!isConstant(e))
+                env.messages.error(REFERENCE, tree, "dc.value.not.a.constant");
+        }
+
         markEnclosingTag(Flag.HAS_INLINE_TAG);
         return super.visitValue(tree, ignore);
     }
 
+    private boolean isConstant(Element e) {
+        if (e == null)
+            return false;
+
+        switch (e.getKind()) {
+            case FIELD:
+                Object value = ((VariableElement) e).getConstantValue();
+                return (value != null); // can't distinguish "not a constant" from "constant is null"
+            default:
+                return false;
+        }
+    }
+
     @Override
     public Void visitVersion(VersionTree tree, Void ignore) {
         warnIfEmpty(tree, tree.getBody());
--- a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java	Fri Oct 11 09:17:18 2013 -0400
@@ -29,9 +29,14 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Queue;
+import java.util.Set;
 
 import javax.lang.model.element.Name;
+import javax.tools.JavaFileObject;
 import javax.tools.StandardLocation;
 
 import com.sun.source.doctree.DocCommentTree;
@@ -278,15 +283,25 @@
             TaskListener tl = new TaskListener() {
                 @Override
                 public void started(TaskEvent e) {
+                    switch (e.getKind()) {
+                        case ANALYZE:
+                            CompilationUnitTree tree;
+                            while ((tree = todo.poll()) != null)
+                                ds.scan(tree, null);
+                            break;
+                    }
                 }
 
                 @Override
                 public void finished(TaskEvent e) {
                     switch (e.getKind()) {
-                        case ENTER:
-                            ds.scan(e.getCompilationUnit(), null);
+                        case PARSE:
+                            todo.add(e.getCompilationUnit());
+                            break;
                     }
                 }
+
+                Queue<CompilationUnitTree> todo = new LinkedList<CompilationUnitTree>();
             };
 
             task.addTaskListener(tl);
--- a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Fri Oct 11 09:17:18 2013 -0400
@@ -86,6 +86,9 @@
     DD(BlockType.LIST_ITEM, EndKind.OPTIONAL,
             EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
 
+    DFN(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
+
     DIV(BlockType.BLOCK, EndKind.REQUIRED,
             EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
--- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -67,7 +67,10 @@
 dc.tag.start.unmatched = end tag missing: </{0}>
 dc.tag.unknown = unknown tag: {0}
 dc.text.not.allowed = text not allowed in <{0}> element
+dc.type.arg.not.allowed = type arguments not allowed here
 dc.unexpected.comment=documentation comment not expected here
+dc.value.not.allowed.here='{@value}' not allowed here
+dc.value.not.a.constant=value does not refer to a constant
 
 dc.main.ioerror=IO error: {0}
 dc.main.no.files.given=No files given
--- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_ja.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_ja.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -26,6 +26,7 @@
 dc.anchor.already.defined = \u30A2\u30F3\u30AB\u30FC\u304C\u3059\u3067\u306B\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059: {0}
 dc.anchor.value.missing = \u30A2\u30F3\u30AB\u30FC\u306B\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
 dc.attr.lacks.value = \u5C5E\u6027\u306B\u5024\u304C\u3042\u308A\u307E\u305B\u3093
+dc.attr.not.number = \u5C5E\u6027\u5024\u304C\u6570\u5B57\u3067\u306F\u3042\u308A\u307E\u305B\u3093
 dc.attr.obsolete = \u5C5E\u6027\u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u307E\u3059: {0}
 dc.attr.obsolete.use.css = \u5C5E\u6027\u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u304B\u308F\u308A\u306BCSS\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044: {0}
 dc.attr.repeated = \u7E70\u308A\u8FD4\u3055\u308C\u305F\u5C5E\u6027: {0}
@@ -46,7 +47,7 @@
 dc.missing.throws = {0}\u306E@throws\u304C\u3042\u308A\u307E\u305B\u3093
 dc.no.alt.attr.for.image = \u30A4\u30E1\u30FC\u30B8\u306E"alt"\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093
 dc.no.summary.or.caption.for.table=\u8868\u306E\u8981\u7D04\u307E\u305F\u306F\u30AD\u30E3\u30D7\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u305B\u3093
-dc.param.name.not.found = @param\u540D\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+dc.param.name.not.found = @param name\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
 dc.ref.not.found = \u53C2\u7167\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
 dc.tag.code.within.code = <code>\u5185\u306E'{@code'}
 dc.tag.empty = \u7A7A\u306E<{0}>\u30BF\u30B0
@@ -66,3 +67,9 @@
 dc.tag.start.unmatched = \u7D42\u4E86\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093: </{0}>
 dc.tag.unknown = \u4E0D\u660E\u306A\u30BF\u30B0: {0}
 dc.text.not.allowed = <{0}>\u8981\u7D20\u3067\u306F\u30C6\u30AD\u30B9\u30C8\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
+dc.unexpected.comment=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30B3\u30E1\u30F3\u30C8\u306F\u3053\u3053\u3067\u306F\u5FC5\u8981\u3042\u308A\u307E\u305B\u3093
+
+dc.main.ioerror=IO\u30A8\u30E9\u30FC: {0}
+dc.main.no.files.given=\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+dc.main.usage=\u4F7F\u7528\u65B9\u6CD5:\n    doclint [options] source-files...\n\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n  -Xmsgs  \n    -Xmsgs:all\u3068\u540C\u3058\n  -Xmsgs:values\n    \u30C1\u30A7\u30C3\u30AF\u3059\u308B\u554F\u984C\u306E\u30AB\u30C6\u30B4\u30EA\u3092\u6307\u5B9A\u3057\u307E\u3059\u3002\u3053\u3053\u3067\u306E''values''\u306F\u3001\n    \u30AB\u30F3\u30DE\u3067\u533A\u5207\u3089\u308C\u305F\u6B21\u306E\u5024\u306E\u30EA\u30B9\u30C8\u3067\u3059:\n      reference      Java\u30BD\u30FC\u30B9\u30FB\u30B3\u30FC\u30C9\u8981\u7D20\u3078\u306E\u4E0D\u6B63\u306A\u53C2\u7167\u3092\u542B\u3080\u30B3\u30E1\u30F3\u30C8\u306E\n                     \u5834\u6240\u3092\u8868\u793A\u3057\u307E\u3059\n      syntax         \u30B3\u30E1\u30F3\u30C8\u5185\u306E\u57FA\u672C\u69CB\u6587\u30A8\u30E9\u30FC\u3092\u8868\u793A\u3057\u307E\u3059\n      html           HTML\u30BF\u30D6\u304A\u3088\u3073\u5C5E\u6027\u306E\u554F\u984C\u3092\u8868\u793A\u3057\u307E\u3059\n      accessibility  \u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u306E\u554F\u984C\u3092\u8868\u793A\u3057\u307E\u3059\n      missing        \u6B20\u843D\u3057\u3066\u3044\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u554F\u984C\u3092\u8868\u793A\u3057\u307E\u3059\n      all            \u524D\u8FF0\u306E\u3059\u3079\u3066\n    \u3053\u308C\u3092\u5426\u5B9A\u3059\u308B\u306B\u306F\u3001\u5024\u306E\u524D\u306B''-''\u3092\u6307\u5B9A\u3057\u307E\u3059\n    \u30AB\u30C6\u30B4\u30EA\u306F\u3001\u6B21\u306E\u3044\u305A\u308C\u304B\u3067\u4FEE\u98FE\u3067\u304D\u307E\u3059:\n      /public /protected /package /private\n    \u6B63\u306E\u30AB\u30C6\u30B4\u30EA(''-''\u3067\u59CB\u307E\u3089\u306A\u3044)\u306E\u5834\u5408\n    \u4FEE\u98FE\u5B50\u306F\u3001\u305D\u306E\u30A2\u30AF\u30BB\u30B9\u30FB\u30EC\u30D9\u30EB\u4EE5\u4E0A\u306B\u9069\u7528\u3055\u308C\u307E\u3059\u3002\n    \u8CA0\u306E\u30AB\u30C6\u30B4\u30EA(''-''\u3067\u59CB\u307E\u308B)\u306E\u5834\u5408\n    \u4FEE\u98FE\u5B50\u306F\u3001\u305D\u306E\u30A2\u30AF\u30BB\u30B9\u30FB\u30EC\u30D9\u30EB\u4EE5\u4E0B\u306B\u9069\u7528\u3055\u308C\u307E\u3059\u3002\n    \u4FEE\u98FE\u5B50\u304C\u306A\u3044\u5834\u5408\u3001\u30AB\u30C6\u30B4\u30EA\u306F\u3059\u3079\u3066\u306E\u30A2\u30AF\u30BB\u30B9\u30FB\u30EC\u30D9\u30EB\u306B\n    \u9069\u7528\u3055\u308C\u307E\u3059\u3002\n    \u4F8B: -Xmsgs:all,-syntax/private\n    \u3053\u306E\u5834\u5408\u3001private\u30E1\u30BD\u30C3\u30C9\u306Edoc\u30B3\u30E1\u30F3\u30C8\u5185\u306E\u69CB\u6587\u30A8\u30E9\u30FC\u3092\u9664\u304D\u3001\n    \u3059\u3079\u3066\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u6709\u52B9\u5316\u3055\u308C\u307E\u3059\u3002\n    -Xmsgs\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u3001\n    -Xmsgs:all/protected\u3068\u540C\u7B49\u306B\u306A\u308A\u3001\u3053\u308C\u306F\n    \u3059\u3079\u3066\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u3001protected\u304A\u3088\u3073public\u306E\u5BA3\u8A00\u306E\u307F\u306B\u5831\u544A\u3055\u308C\u308B\u3053\u3068\u3092\n    \u610F\u5473\u3057\u307E\u3059\u3002\n  -stats\n    \u5831\u544A\u3055\u308C\u305F\u554F\u984C\u306B\u5BFE\u3057\u3066\u7D71\u8A08\u3092\u5831\u544A\u3057\u307E\u3059\u3002\n  -h -help --help -usage -?\n    \u3053\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002\n\n\u6B21\u306Ejavac\u30AA\u30D7\u30B7\u30E7\u30F3\u3082\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u3059\n  \
+-bootclasspath\u3001-classpath\u3001-cp\u3001-sourcepath\u3001-Xmaxerrs\u3001-Xmaxwarns\n\n\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u90E8\u306B\u5BFE\u3057\u3066doclint\u3092\u5B9F\u884C\u3059\u308B\u306B\u306F\u3001\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30B3\u30F3\u30D1\u30A4\u30EB\u3055\u308C\u305F\u30AF\u30E9\u30B9\u3092\n\u30AF\u30E9\u30B9\u30D1\u30B9(\u307E\u305F\u306F\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9)\u306B\u6307\u5B9A\u3057\u3001\u30B3\u30DE\u30F3\u30C9\u30FB\u30E9\u30A4\u30F3\u3067\n\u30C1\u30A7\u30C3\u30AF\u3059\u308B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u6307\u5B9A\u3057\u307E\u3059\u3002
--- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_zh_CN.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint_zh_CN.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -26,6 +26,7 @@
 dc.anchor.already.defined = \u951A\u5B9A\u70B9\u5DF2\u5B9A\u4E49: {0}
 dc.anchor.value.missing = \u6CA1\u6709\u4E3A\u951A\u5B9A\u70B9\u6307\u5B9A\u503C
 dc.attr.lacks.value = \u5C5E\u6027\u7F3A\u5C11\u503C
+dc.attr.not.number = \u5C5E\u6027\u503C\u4E0D\u662F\u6570\u5B57
 dc.attr.obsolete = \u5C5E\u6027\u5DF2\u8FC7\u65F6: {0}
 dc.attr.obsolete.use.css = \u5C5E\u6027\u5DF2\u8FC7\u65F6, \u8BF7\u6539\u7528 CSS: {0}
 dc.attr.repeated = \u5C5E\u6027\u91CD\u590D: {0}
@@ -46,7 +47,7 @@
 dc.missing.throws = {0}\u6CA1\u6709 @throws
 dc.no.alt.attr.for.image = \u56FE\u50CF\u6CA1\u6709 "alt" \u5C5E\u6027
 dc.no.summary.or.caption.for.table=\u8868\u6CA1\u6709\u6982\u8981\u6216\u6807\u9898
-dc.param.name.not.found = \u627E\u4E0D\u5230 @param \u540D\u79F0
+dc.param.name.not.found = @param name \u672A\u627E\u5230
 dc.ref.not.found = \u627E\u4E0D\u5230\u5F15\u7528
 dc.tag.code.within.code = '{@code'} \u5728 <code> \u4E2D
 dc.tag.empty = <{0}> \u6807\u8BB0\u4E3A\u7A7A
@@ -66,3 +67,8 @@
 dc.tag.start.unmatched = \u7F3A\u5C11\u7ED3\u675F\u6807\u8BB0: </{0}>
 dc.tag.unknown = \u672A\u77E5\u6807\u8BB0: {0}
 dc.text.not.allowed = <{0}> \u5143\u7D20\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u6587\u672C
+dc.unexpected.comment=\u6B64\u5904\u672A\u9884\u671F\u6587\u6863\u6CE8\u91CA
+
+dc.main.ioerror=IO \u9519\u8BEF: {0}
+dc.main.no.files.given=\u672A\u6307\u5B9A\u6587\u4EF6
+dc.main.usage=\u7528\u6CD5:\n    doclint [options] source-files...\n\n\u9009\u9879:\n  -Xmsgs  \n    \u4E0E -Xmsgs:all \u76F8\u540C\n  -Xmsgs:values\n    \u6307\u5B9A\u8981\u68C0\u67E5\u7684\u95EE\u9898\u7684\u7C7B\u522B, \u5176\u4E2D ''values''\n    \u662F\u4EFB\u610F\u4EE5\u4E0B\u5185\u5BB9\u7684\u4EE5\u9017\u53F7\u5206\u9694\u7684\u5217\u8868:\n      reference      \u663E\u793A\u5305\u542B\u5BF9 Java \u6E90\u4EE3\u7801\u5143\u7D20\n                     \u9519\u8BEF\u5F15\u7528\u7684\u6CE8\u91CA\u7684\u4F4D\u7F6E\n      syntax         \u663E\u793A\u6CE8\u91CA\u4E2D\u7684\u57FA\u672C\u8BED\u6CD5\u9519\u8BEF\n      html           \u663E\u793A HTML \u6807\u8BB0\u548C\u5C5E\u6027\u95EE\u9898\n      accessibility  \u663E\u793A\u53EF\u8BBF\u95EE\u6027\u7684\u95EE\u9898\n      missing        \u663E\u793A\u7F3A\u5C11\u6587\u6863\u7684\u95EE\u9898\n      all            \u6240\u6709\u4EE5\u4E0A\u5185\u5BB9\n    \u5728\u503C\u4E4B\u524D\u4F7F\u7528 ''-'' \u53EF\u4F7F\u7528\u5176\u53CD\u503C\n    \u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u4E00\u9879\u6765\u9650\u5B9A\u7C7B\u522B:\n      /public /protected /package /private\n    \u5BF9\u4E8E\u6B63\u7C7B\u522B (\u4E0D\u4EE5 ''-'' \u5F00\u5934)\n    \u9650\u5B9A\u7B26\u9002\u7528\u4E8E\u8BE5\u8BBF\u95EE\u7EA7\u522B\u53CA\u66F4\u9AD8\u7EA7\u522B\u3002\n    \u5BF9\u4E8E\u8D1F\u7C7B\u522B (\u4EE5 ''-'' \u5F00\u5934)\n    \u9650\u5B9A\u7B26\u9002\u7528\u4E8E\u8BE5\u8BBF\u95EE\u7EA7\u522B\u53CA\u66F4\u4F4E\u7EA7\u522B\u3002\n    \u5982\u679C\u6CA1\u6709\u9650\u5B9A\u7B26, \u5219\u8BE5\u7C7B\u522B\u9002\u7528\u4E8E\n    \u6240\u6709\u8BBF\u95EE\u7EA7\u522B\u3002\n    \u4F8B\u5982, -Xmsgs:all,-syntax/private\n    \u8FD9\u5C06\u5728\u4E13\u7528\u65B9\u6CD5\u7684\u6587\u6863\u6CE8\u91CA\u4E2D\n    \u542F\u7528\u9664\u8BED\u6CD5\u9519\u8BEF\u4E4B\u5916\u7684\u6240\u6709\u6D88\u606F\u3002\n    \u5982\u679C\u672A\u63D0\u4F9B -Xmsgs \u9009\u9879, \u5219\u9ED8\u8BA4\u503C\n    \u7B49\u540C\u4E8E -Xmsgs:all/protected, \u8868\u793A\n    \u4EC5\u62A5\u544A\u53D7\u4FDD\u62A4\u548C\u516C\u5171\u58F0\u660E\u4E2D\u7684\n    \u6240\u6709\u6D88\u606F\n  -stats\n    \u62A5\u544A\u6240\u62A5\u544A\u95EE\u9898\u7684\u7EDF\u8BA1\u4FE1\u606F\u3002\n  -h -help --help -usage -?\n    \u663E\u793A\u6B64\u6D88\u606F\u3002\n\n\u8FD8\u652F\u6301\u4EE5\u4E0B javac \u9009\u9879\n  -bootclasspath, -classpath, -cp, -sourcepath, -Xmaxerrs, -Xmaxwarns\n\n\u8981\u5728\u9879\u76EE\u7684\u4E00\u90E8\u5206\u4E0A\u8FD0\u884C doclint, \u8BF7\u5C06\u9879\u76EE\u4E2D\u5DF2\u7F16\u8BD1\u7684\u7C7B\n\u653E\u5728\u7C7B\u8DEF\u5F84 (\u6216\u5F15\u5BFC\u7C7B\u8DEF\u5F84) \u4E0A, \u7136\u540E\u5728\u547D\u4EE4\u884C\u4E0A\u6307\u5B9A\n\u8981\u68C0\u67E5\u7684\u6E90\u6587\u4EF6\u3002
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Fri Oct 11 09:17:18 2013 -0400
@@ -472,7 +472,7 @@
             for (TypeElement item: classes)
                 set.add(item);
 
-            ListBuffer<Env<AttrContext>> defer = ListBuffer.<Env<AttrContext>>lb();
+            ListBuffer<Env<AttrContext>> defer = new ListBuffer<>();
             while (list.peek() != null) {
                 Env<AttrContext> env = list.remove();
                 ClassSymbol csym = env.enclClass.sym;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -81,7 +81,7 @@
         } else {
             ListBuffer<LintLogger> loggers = loggersQueue.get(currentPos);
             if (loggers == null) {
-                loggersQueue.put(currentPos, loggers = ListBuffer.<LintLogger>lb());
+                loggersQueue.put(currentPos, loggers = new ListBuffer<>());
             }
             loggers.append(logger);
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java	Fri Oct 11 09:17:18 2013 -0400
@@ -261,7 +261,7 @@
     public static final long SIGNATURE_POLYMORPHIC = 1L<<46;
 
     /**
-     * Flag that marks inference variables used in a 'throws' clause
+     * Flag that indicates that an inference variable is used in a 'throws' clause.
      */
     public static final long THROWS = 1L<<47;
 
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -103,7 +103,7 @@
      * @return localized string representation
      */
     public String visitTypes(List<Type> ts, Locale locale) {
-        ListBuffer<String> sbuf = ListBuffer.lb();
+        ListBuffer<String> sbuf = new ListBuffer<>();
         for (Type t : ts) {
             sbuf.append(visit(t, locale));
         }
@@ -118,7 +118,7 @@
      * @return localized string representation
      */
     public String visitSymbols(List<Symbol> ts, Locale locale) {
-        ListBuffer<String> sbuf = ListBuffer.lb();
+        ListBuffer<String> sbuf = new ListBuffer<>();
         for (Symbol t : ts) {
             sbuf.append(visit(t, locale));
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Oct 11 09:17:18 2013 -0400
@@ -614,7 +614,7 @@
     }
 
     public List<TypeVariableSymbol> getTypeParameters() {
-        ListBuffer<TypeVariableSymbol> l = ListBuffer.lb();
+        ListBuffer<TypeVariableSymbol> l = new ListBuffer<>();
         for (Type t : type.getTypeArguments()) {
             Assert.check(t.tsym.getKind() == ElementKind.TYPE_PARAMETER);
             l.append((TypeVariableSymbol)t.tsym);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Oct 11 09:17:18 2013 -0400
@@ -433,7 +433,7 @@
     }
 
     public static List<Type> filter(List<Type> ts, Filter<Type> tf) {
-        ListBuffer<Type> buf = ListBuffer.lb();
+        ListBuffer<Type> buf = new ListBuffer<>();
         for (Type t : ts) {
             if (tf.accepts(t)) {
                 buf.append(t);
@@ -977,7 +977,7 @@
         }
 
         public java.util.List<? extends TypeMirror> getBounds() {
-            return Collections.unmodifiableList(getComponents());
+            return Collections.unmodifiableList(getExplicitComponents());
         }
 
         public List<Type> getComponents() {
@@ -1496,7 +1496,7 @@
 
         /** get all bounds of a given kind */
         public List<Type> getBounds(InferenceBound... ibs) {
-            ListBuffer<Type> buf = ListBuffer.lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             for (InferenceBound ib : ibs) {
                 buf.appendList(bounds.get(ib));
             }
@@ -1505,7 +1505,7 @@
 
         /** get the list of declared (upper) bounds */
         public List<Type> getDeclaredBounds() {
-            ListBuffer<Type> buf = ListBuffer.lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             int count = 0;
             for (Type b : getBounds(InferenceBound.UPPER)) {
                 if (count++ == declaredCount) break;
@@ -1565,8 +1565,8 @@
                 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();
+                    ListBuffer<Type> newBounds = new ListBuffer<>();
+                    ListBuffer<Type> deps = new ListBuffer<>();
                     //step 1 - re-add bounds that are not dependent on ivars
                     for (Type t : prevBounds) {
                         if (!t.containsAny(instVars)) {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Fri Oct 11 09:17:18 2013 -0400
@@ -304,7 +304,7 @@
      * @param list The bytecode representation of the type path.
      */
     public static List<TypePathEntry> getTypePathFromBinary(java.util.List<Integer> list) {
-        ListBuffer<TypePathEntry> loc = ListBuffer.lb();
+        ListBuffer<TypePathEntry> loc = new ListBuffer<>();
         Iterator<Integer> iter = list.iterator();
         while (iter.hasNext()) {
             Integer fst = iter.next();
@@ -316,7 +316,7 @@
     }
 
     public static List<Integer> getBinaryFromTypePath(java.util.List<TypePathEntry> locs) {
-        ListBuffer<Integer> loc = ListBuffer.lb();
+        ListBuffer<Integer> loc = new ListBuffer<>();
         for (TypePathEntry tpe : locs) {
             loc = loc.append(tpe.tag.tag);
             loc = loc.append(tpe.arg);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,10 +31,7 @@
 
 import javax.tools.JavaFileObject;
 
-import com.sun.tools.javac.code.Attribute;
 import com.sun.tools.javac.code.Attribute.TypeCompound;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Kinds;
 import com.sun.tools.javac.code.Type.AnnotatedType;
 import com.sun.tools.javac.code.Type.ArrayType;
 import com.sun.tools.javac.code.Type.CapturedType;
@@ -49,7 +46,6 @@
 import com.sun.tools.javac.code.Type.WildcardType;
 import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntry;
 import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntryKind;
-import com.sun.tools.javac.code.TypeTag;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
 import com.sun.tools.javac.comp.Annotate;
@@ -70,6 +66,7 @@
 import com.sun.tools.javac.tree.TreeScanner;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
@@ -83,8 +80,28 @@
  * and determine the TypeAnnotationPositions for all type annotations.
  */
 public class TypeAnnotations {
-    // Class cannot be instantiated.
-    private TypeAnnotations() {}
+    protected static final Context.Key<TypeAnnotations> typeAnnosKey =
+        new Context.Key<TypeAnnotations>();
+
+    public static TypeAnnotations instance(Context context) {
+        TypeAnnotations instance = context.get(typeAnnosKey);
+        if (instance == null)
+            instance = new TypeAnnotations(context);
+        return instance;
+    }
+
+    final Log log;
+    final Names names;
+    final Symtab syms;
+    final Annotate annotate;
+
+    protected TypeAnnotations(Context context) {
+        context.put(typeAnnosKey, this);
+        names = Names.instance(context);
+        log = Log.instance(context);
+        syms = Symtab.instance(context);
+        annotate = Annotate.instance(context);
+    }
 
     /**
      * Separate type annotations from declaration annotations and
@@ -95,15 +112,14 @@
      * adds an Annotator to the correct Annotate queue for
      * later processing.
      */
-    public static void organizeTypeAnnotationsSignatures(final Symtab syms, final Names names,
-            final Log log, final Env<AttrContext> env, final JCClassDecl tree, final Annotate annotate) {
+    public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
         annotate.afterRepeated( new Annotator() {
             @Override
             public void enterAnnotation() {
                 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
 
                 try {
-                    new TypeAnnotationPositions(syms, names, log, true).scan(tree);
+                    new TypeAnnotationPositions(true).scan(tree);
                 } finally {
                     log.useSource(oldSource);
                 }
@@ -115,8 +131,8 @@
      * This version only visits types in bodies, that is, field initializers,
      * top-level blocks, and method bodies, and should be called from Attr.
      */
-    public static void organizeTypeAnnotationsBodies(Symtab syms, Names names, Log log, JCClassDecl tree) {
-        new TypeAnnotationPositions(syms, names, log, false).scan(tree);
+    public void organizeTypeAnnotationsBodies(JCClassDecl tree) {
+        new TypeAnnotationPositions(false).scan(tree);
     }
 
     public enum AnnotationType { DECLARATION, TYPE, BOTH };
@@ -125,8 +141,7 @@
      * Determine whether an annotation is a declaration annotation,
      * a type annotation, or both.
      */
-    public static AnnotationType annotationType(Symtab syms, Names names,
-            Attribute.Compound a, Symbol s) {
+    public AnnotationType annotationType(Attribute.Compound a, Symbol s) {
         Attribute.Compound atTarget =
             a.type.tsym.attribute(syms.annotationTargetType.tsym);
         if (atTarget == null) {
@@ -215,17 +230,11 @@
     }
 
 
-    private static class TypeAnnotationPositions extends TreeScanner {
+    private class TypeAnnotationPositions extends TreeScanner {
 
-        private final Symtab syms;
-        private final Names names;
-        private final Log log;
         private final boolean sigOnly;
 
-        private TypeAnnotationPositions(Symtab syms, Names names, Log log, boolean sigOnly) {
-            this.syms = syms;
-            this.names = names;
-            this.log = log;
+        TypeAnnotationPositions(boolean sigOnly) {
             this.sigOnly = sigOnly;
         }
 
@@ -233,7 +242,7 @@
          * When traversing the AST we keep the "frames" of visited
          * trees in order to determine the position of annotations.
          */
-        private ListBuffer<JCTree> frames = ListBuffer.lb();
+        private ListBuffer<JCTree> frames = new ListBuffer<>();
 
         protected void push(JCTree t) { frames = frames.prepend(t); }
         protected JCTree pop() { return frames.next(); }
@@ -265,7 +274,7 @@
             ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<Attribute.TypeCompound>();
 
             for (Attribute.Compound a : annotations) {
-                switch (annotationType(syms, names, a, sym)) {
+                switch (annotationType(a, sym)) {
                 case DECLARATION:
                     declAnnos.append(a);
                     break;
@@ -301,7 +310,7 @@
             }
 
             // type is non-null and annotations are added to that type
-            type = typeWithAnnotations(typetree, type, typeAnnotations, log);
+            type = typeWithAnnotations(typetree, type, typeAnnotations);
 
             if (sym.getKind() == ElementKind.METHOD) {
                 sym.type.asMethodType().restype = type;
@@ -352,8 +361,8 @@
         //
         // 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) {
+        private Type typeWithAnnotations(final JCTree typetree, final Type type,
+                final List<Attribute.TypeCompound> annotations) {
             // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s)%n",
             //         typetree, type, annotations);
             if (annotations.isEmpty()) {
@@ -381,7 +390,7 @@
                 }
                 JCArrayTypeTree arTree = arrayTypeTree(typetree);
 
-                ListBuffer<TypePathEntry> depth = ListBuffer.lb();
+                ListBuffer<TypePathEntry> depth = new ListBuffer<>();
                 depth = depth.append(TypePathEntry.ARRAY);
                 while (arType.elemtype.hasTag(TypeTag.ARRAY)) {
                     if (arType.elemtype.isAnnotated()) {
@@ -400,7 +409,7 @@
                     arTree = arrayTypeTree(arTree.elemtype);
                     depth = depth.append(TypePathEntry.ARRAY);
                 }
-                Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, log);
+                Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations);
                 tomodify.elemtype = arelemType;
                 {
                     // All annotations share the same position; modify the first one.
@@ -417,7 +426,7 @@
                 // There is a TypeKind, but no TypeTag.
                 JCTypeUnion tutree = (JCTypeUnion) typetree;
                 JCExpression fst = tutree.alternatives.get(0);
-                Type res = typeWithAnnotations(fst, fst.type, annotations, log);
+                Type res = typeWithAnnotations(fst, fst.type, annotations);
                 fst.type = res;
                 // TODO: do we want to set res as first element in uct.alternatives?
                 // UnionClassType uct = (com.sun.tools.javac.code.Type.UnionClassType)type;
@@ -473,7 +482,7 @@
                 // the correct nesting.
 
                 // The genericLocation for the annotation.
-                ListBuffer<TypePathEntry> depth = ListBuffer.lb();
+                ListBuffer<TypePathEntry> depth = new ListBuffer<>();
 
                 Type topTy = enclTy;
                 while (enclEl != null &&
@@ -505,7 +514,7 @@
             }
         }
 
-        private static JCArrayTypeTree arrayTypeTree(JCTree typetree) {
+        private JCArrayTypeTree arrayTypeTree(JCTree typetree) {
             if (typetree.getKind() == JCTree.Kind.ARRAY_TYPE) {
                 return (JCArrayTypeTree) typetree;
             } else if (typetree.getKind() == JCTree.Kind.ANNOTATED_TYPE) {
@@ -532,7 +541,7 @@
          * @param annotations The annotations to insert.
          * @return A copy of type that contains the annotations.
          */
-        private static Type typeWithAnnotations(final Type type,
+        private Type typeWithAnnotations(final Type type,
                 final Type stopAt,
                 final List<Attribute.TypeCompound> annotations) {
             Visitor<Type, List<TypeCompound>> visitor =
@@ -619,7 +628,7 @@
             return type.accept(visitor, annotations);
         }
 
-        private static Attribute.TypeCompound toTypeCompound(Attribute.Compound a, TypeAnnotationPosition p) {
+        private Attribute.TypeCompound toTypeCompound(Attribute.Compound a, TypeAnnotationPosition p) {
             // It is safe to alias the position.
             return new Attribute.TypeCompound(a, p);
         }
@@ -793,7 +802,7 @@
                 }
 
                 case ARRAY_TYPE: {
-                    ListBuffer<TypePathEntry> index = ListBuffer.lb();
+                    ListBuffer<TypePathEntry> index = new ListBuffer<>();
                     index = index.append(TypePathEntry.ARRAY);
                     List<JCTree> newPath = path.tail;
                     while (true) {
@@ -953,10 +962,10 @@
             }
         }
 
-        private static void locateNestedTypes(Type type, TypeAnnotationPosition p) {
+        private void locateNestedTypes(Type type, TypeAnnotationPosition p) {
             // The number of "steps" to get from the full type to the
             // left-most outer type.
-            ListBuffer<TypePathEntry> depth = ListBuffer.lb();
+            ListBuffer<TypePathEntry> depth = new ListBuffer<>();
 
             Type encl = type.getEnclosingType();
             while (encl != null &&
@@ -970,7 +979,7 @@
             }
         }
 
-        private static int methodParamIndex(List<JCTree> path, JCTree param) {
+        private int methodParamIndex(List<JCTree> path, JCTree param) {
             List<JCTree> curr = path;
             while (curr.head.getTag() != Tag.METHODDEF &&
                     curr.head.getTag() != Tag.LAMBDA) {
@@ -1226,7 +1235,7 @@
         public void visitNewArray(JCNewArray tree) {
             findPosition(tree, tree, tree.annotations);
             int dimAnnosCount = tree.dimAnnotations.size();
-            ListBuffer<TypePathEntry> depth = ListBuffer.lb();
+            ListBuffer<TypePathEntry> depth = new ListBuffer<>();
 
             // handle annotations associated with dimensions
             for (int i = 0; i < dimAnnosCount; ++i) {
@@ -1284,7 +1293,7 @@
             }
         }
 
-        private static void setTypeAnnotationPos(List<JCAnnotation> annotations,
+        private void setTypeAnnotationPos(List<JCAnnotation> annotations,
                 TypeAnnotationPosition position) {
             for (JCAnnotation anno : annotations) {
                 // attribute might be null during DeferredAttr;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Oct 11 09:17:18 2013 -0400
@@ -51,7 +51,6 @@
 import static com.sun.tools.javac.code.Type.*;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.jvm.ClassFile.externalize;
-import static com.sun.tools.javac.util.ListBuffer.lb;
 
 /**
  * Utility class containing various operations on types.
@@ -411,7 +410,7 @@
                 throw failure("not.a.functional.intf", origin);
             }
 
-            final ListBuffer<Symbol> abstracts = ListBuffer.lb();
+            final ListBuffer<Symbol> abstracts = new ListBuffer<>();
             for (Symbol sym : membersCache.getElements(new DescriptorFilter(origin))) {
                 Type mtype = memberType(origin.type, sym);
                 if (abstracts.isEmpty() ||
@@ -434,7 +433,7 @@
                 FunctionDescriptor descRes = mergeDescriptors(origin, abstracts.toList());
                 if (descRes == null) {
                     //we can get here if the functional interface is ill-formed
-                    ListBuffer<JCDiagnostic> descriptors = ListBuffer.lb();
+                    ListBuffer<JCDiagnostic> descriptors = new ListBuffer<>();
                     for (Symbol desc : abstracts) {
                         String key = desc.type.getThrownTypes().nonEmpty() ?
                                 "descriptor.throws" : "descriptor";
@@ -596,7 +595,7 @@
         Type capturedSite = capture(site);
         if (capturedSite != site) {
             Type formalInterface = site.tsym.type;
-            ListBuffer<Type> typeargs = ListBuffer.lb();
+            ListBuffer<Type> typeargs = new ListBuffer<>();
             List<Type> actualTypeargs = site.getTypeArguments();
             List<Type> capturedTypeargs = capturedSite.getTypeArguments();
             //simply replace the wildcards with its bound
@@ -662,7 +661,7 @@
         Assert.check(isFunctionalInterface(origin));
         Symbol descSym = findDescriptorSymbol(origin);
         CompoundScope members = membersClosure(origin.type, false);
-        ListBuffer<Symbol> overridden = ListBuffer.lb();
+        ListBuffer<Symbol> overridden = new ListBuffer<>();
         outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) {
             if (m2 == descSym) continue;
             else if (descSym.overrides(m2, origin, Types.this, false)) {
@@ -885,12 +884,12 @@
             private Type rewriteSupers(Type t) {
                 if (!t.isParameterized())
                     return t;
-                ListBuffer<Type> from = lb();
-                ListBuffer<Type> to = lb();
+                ListBuffer<Type> from = new ListBuffer<>();
+                ListBuffer<Type> to = new ListBuffer<>();
                 adaptSelf(t, from, to);
                 if (from.isEmpty())
                     return t;
-                ListBuffer<Type> rewrite = lb();
+                ListBuffer<Type> rewrite = new ListBuffer<>();
                 boolean changed = false;
                 for (Type orig : to.toList()) {
                     Type s = rewriteSupers(orig);
@@ -2415,6 +2414,29 @@
             }
         };
 
+    public List<Type> directSupertypes(Type t) {
+        return directSupertypes.visit(t);
+    }
+    // where
+        private final UnaryVisitor<List<Type>> directSupertypes = new UnaryVisitor<List<Type>>() {
+
+            public List<Type> visitType(final Type type, final Void ignored) {
+                if (!type.isCompound()) {
+                    final Type sup = supertype(type);
+                    return (sup == Type.noType || sup == type || sup == null)
+                        ? interfaces(type)
+                        : interfaces(type).prepend(sup);
+                } else {
+                    return visitIntersectionType((IntersectionClassType) type);
+                }
+            }
+
+            private List<Type> visitIntersectionType(final IntersectionClassType it) {
+                return it.getExplicitComponents();
+            }
+
+        };
+
     public boolean isDirectSuperInterface(TypeSymbol isym, TypeSymbol origin) {
         for (Type i2 : interfaces(origin.type)) {
             if (isym == i2.tsym) return true;
@@ -2744,7 +2766,7 @@
         }
 
     public List<MethodSymbol> prune(List<MethodSymbol> methods) {
-        ListBuffer<MethodSymbol> methodsMin = ListBuffer.lb();
+        ListBuffer<MethodSymbol> methodsMin = new ListBuffer<>();
         for (MethodSymbol m1 : methods) {
             boolean isMin_m1 = true;
             for (MethodSymbol m2 : methods) {
@@ -3001,7 +3023,7 @@
                                   List<Type> to) {
         if (tvars.isEmpty())
             return tvars;
-        ListBuffer<Type> newBoundsBuf = lb();
+        ListBuffer<Type> newBoundsBuf = new ListBuffer<>();
         boolean changed = false;
         // calculate new bounds
         for (Type t : tvars) {
@@ -3013,7 +3035,7 @@
         }
         if (!changed)
             return tvars;
-        ListBuffer<Type> newTvars = lb();
+        ListBuffer<Type> newTvars = new ListBuffer<>();
         // create new type variables without bounds
         for (Type t : tvars) {
             newTvars.append(new TypeVar(t.tsym, null, syms.botType));
@@ -3440,15 +3462,15 @@
      * compoundMin or glb.
      */
     private List<Type> closureMin(List<Type> cl) {
-        ListBuffer<Type> classes = lb();
-        ListBuffer<Type> interfaces = lb();
+        ListBuffer<Type> classes = new ListBuffer<>();
+        ListBuffer<Type> interfaces = new ListBuffer<>();
         while (!cl.isEmpty()) {
             Type current = cl.head;
             if (current.isInterface())
                 interfaces.append(current);
             else
                 classes.append(current);
-            ListBuffer<Type> candidates = lb();
+            ListBuffer<Type> candidates = new ListBuffer<>();
             for (Type t : cl.tail) {
                 if (!isSubtypeNoCapture(current, t))
                     candidates.append(t);
@@ -3564,7 +3586,7 @@
     }
     // where
         List<Type> erasedSupertypes(Type t) {
-            ListBuffer<Type> buf = lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             for (Type sup : closure(t)) {
                 if (sup.hasTag(TYPEVAR)) {
                     buf.append(sup);
@@ -3914,7 +3936,7 @@
     }
     // where
         public List<Type> freshTypeVariables(List<Type> types) {
-            ListBuffer<Type> result = lb();
+            ListBuffer<Type> result = new ListBuffer<>();
             for (Type t : types) {
                 if (t.hasTag(WILDCARD)) {
                     t = t.unannotatedType();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Oct 11 09:17:18 2013 -0400
@@ -93,6 +93,7 @@
     final Types types;
     final JCDiagnostic.Factory diags;
     final Annotate annotate;
+    final TypeAnnotations typeAnnotations;
     final DeferredLintHandler deferredLintHandler;
 
     public static Attr instance(Context context) {
@@ -121,6 +122,7 @@
         types = Types.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         annotate = Annotate.instance(context);
+        typeAnnotations = TypeAnnotations.instance(context);
         deferredLintHandler = DeferredLintHandler.instance(context);
 
         Options options = Options.instance(context);
@@ -1724,7 +1726,7 @@
         boolean isConstructorCall =
             methName == names._this || methName == names._super;
 
-        ListBuffer<Type> argtypesBuf = ListBuffer.lb();
+        ListBuffer<Type> argtypesBuf = new ListBuffer<>();
         if (isConstructorCall) {
             // We are seeing a ...this(...) or ...super(...) call.
             // Check that this is the first statement in a constructor.
@@ -1989,7 +1991,7 @@
         }
 
         // Attribute constructor arguments.
-        ListBuffer<Type> argtypesBuf = ListBuffer.lb();
+        ListBuffer<Type> argtypesBuf = new ListBuffer<>();
         int pkind = attribArgs(tree.args, localEnv, argtypesBuf);
         List<Type> argtypes = argtypesBuf.toList();
         List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv);
@@ -2228,7 +2230,7 @@
         // empty annotations, if only declaration annotations were given.
         // This method will raise an error for such a type.
         for (JCAnnotation ai : annotations) {
-            if (TypeAnnotations.annotationType(syms, names, ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) {
+            if (typeAnnotations.annotationType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) {
                 log.error(ai.pos(), "annotation.type.not.applicable");
             }
         }
@@ -2476,8 +2478,8 @@
             }
 
             private TypeSymbol makeNotionalInterface(IntersectionClassType ict) {
-                ListBuffer<Type> targs = ListBuffer.lb();
-                ListBuffer<Type> supertypes = ListBuffer.lb();
+                ListBuffer<Type> targs = new ListBuffer<>();
+                ListBuffer<Type> supertypes = new ListBuffer<>();
                 for (Type i : ict.interfaces_field) {
                     if (i.isParameterized()) {
                         targs.appendList(i.tsym.type.allparams());
@@ -2907,7 +2909,7 @@
                 }
             });
         } else {
-            ListBuffer<Type> targets = ListBuffer.lb();
+            ListBuffer<Type> targets = new ListBuffer<>();
             if (pt.hasTag(CLASS)) {
                 if (pt.isCompound()) {
                     targets.append(types.removeWildcards(primaryTarget)); //this goes first
@@ -3102,8 +3104,14 @@
     public void visitTypeTest(JCInstanceOf tree) {
         Type exprtype = chk.checkNullOrRefType(
             tree.expr.pos(), attribExpr(tree.expr, env));
-        Type clazztype = chk.checkReifiableReferenceType(
-            tree.clazz.pos(), attribType(tree.clazz, env));
+        Type clazztype = attribType(tree.clazz, env);
+        if (!clazztype.hasTag(TYPEVAR)) {
+            clazztype = chk.checkClassOrArrayType(tree.clazz.pos(), clazztype);
+        }
+        if (!clazztype.isErroneous() && !types.isReifiable(clazztype)) {
+            log.error(tree.clazz.pos(), "illegal.generic.type.for.instof");
+            clazztype = types.createErrorType(clazztype);
+        }
         chk.validate(tree.clazz, env, false);
         chk.checkCastable(tree.expr.pos(), exprtype, clazztype);
         result = check(tree, syms.booleanType, VAL, resultInfo);
@@ -3903,7 +3911,7 @@
     }
 
     public void visitTypeUnion(JCTypeUnion tree) {
-        ListBuffer<Type> multicatchTypes = ListBuffer.lb();
+        ListBuffer<Type> multicatchTypes = new ListBuffer<>();
         ListBuffer<Type> all_multicatchTypes = null; // lazy, only if needed
         for (JCExpression typeTree : tree.alternatives) {
             Type ctype = attribType(typeTree, env);
@@ -3930,7 +3938,7 @@
                     all_multicatchTypes.append(ctype);
             } else {
                 if (all_multicatchTypes == null) {
-                    all_multicatchTypes = ListBuffer.lb();
+                    all_multicatchTypes = new ListBuffer<>();
                     all_multicatchTypes.appendList(multicatchTypes);
                 }
                 all_multicatchTypes.append(ctype);
@@ -4085,7 +4093,7 @@
         if (annotations.isEmpty())
             return List.nil();
 
-        ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb();
+        ListBuffer<Attribute.TypeCompound> buf = new ListBuffer<>();
         for (JCAnnotation anno : annotations) {
             if (anno.attribute != null) {
                 // TODO: this null-check is only needed for an obscure
@@ -4333,7 +4341,7 @@
         }
         if (allowTypeAnnos) {
             // Correctly organize the postions of the type annotations
-            TypeAnnotations.organizeTypeAnnotationsBodies(this.syms, this.names, this.log, tree);
+            typeAnnotations.organizeTypeAnnotationsBodies(tree);
 
             // Check type annotations applicability rules
             validateTypeAnnotations(tree);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Oct 11 09:17:18 2013 -0400
@@ -706,20 +706,6 @@
         return t;
     }
 
-    /** Check that type is a reifiable class, interface or array type.
-     *  @param pos           Position to be used for error reporting.
-     *  @param t             The type to be checked.
-     */
-    Type checkReifiableReferenceType(DiagnosticPosition pos, Type t) {
-        t = checkClassOrArrayType(pos, t);
-        if (!t.isErroneous() && !types.isReifiable(t)) {
-            log.error(pos, "illegal.generic.type.for.instof");
-            return types.createErrorType(t);
-        } else {
-            return t;
-        }
-    }
-
     /** Check that type is a reference type, i.e. a class, interface or array type
      *  or a type variable.
      *  @param pos           Position to be used for error reporting.
@@ -1245,6 +1231,7 @@
      */
     class Validator extends JCTree.Visitor {
 
+        boolean checkRaw;
         boolean isOuter;
         Env<AttrContext> env;
 
@@ -1254,7 +1241,7 @@
 
         @Override
         public void visitTypeArray(JCArrayTypeTree tree) {
-            tree.elemtype.accept(this);
+            validateTree(tree.elemtype, checkRaw, isOuter);
         }
 
         @Override
@@ -1345,15 +1332,20 @@
         }
 
         public void validateTree(JCTree tree, boolean checkRaw, boolean isOuter) {
-            try {
-                if (tree != null) {
-                    this.isOuter = isOuter;
+            if (tree != null) {
+                boolean prevCheckRaw = this.checkRaw;
+                this.checkRaw = checkRaw;
+                this.isOuter = isOuter;
+
+                try {
                     tree.accept(this);
                     if (checkRaw)
                         checkRaw(tree, env);
+                } catch (CompletionFailure ex) {
+                    completionError(tree.pos(), ex);
+                } finally {
+                    this.checkRaw = prevCheckRaw;
                 }
-            } catch (CompletionFailure ex) {
-                completionError(tree.pos(), ex);
             }
         }
 
@@ -2446,8 +2438,8 @@
             Assert.check(m.kind == MTH);
             List<MethodSymbol> prov = types.interfaceCandidates(site, (MethodSymbol)m);
             if (prov.size() > 1) {
-                ListBuffer<Symbol> abstracts = ListBuffer.lb();
-                ListBuffer<Symbol> defaults = ListBuffer.lb();
+                ListBuffer<Symbol> abstracts = new ListBuffer<>();
+                ListBuffer<Symbol> defaults = new ListBuffer<>();
                 for (MethodSymbol provSym : prov) {
                     if ((provSym.flags() & DEFAULT) != 0) {
                         defaults = defaults.append(provSym);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Oct 11 09:17:18 2013 -0400
@@ -637,7 +637,7 @@
                     Env<AttrContext> localEnv = env.dup(tree);
                     JCExpression exprTree = (JCExpression)attribSpeculative(tree.getQualifierExpression(), localEnv,
                             attr.memberReferenceQualifierResult(tree));
-                    ListBuffer<Type> argtypes = ListBuffer.lb();
+                    ListBuffer<Type> argtypes = new ListBuffer<>();
                     for (Type t : types.findDescriptorType(pt).getParameterTypes()) {
                         argtypes.append(Type.noType);
                     }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -288,7 +288,9 @@
                                                              JavaFileObject.Kind.SOURCE);
         if (tree.pid != null) {
             tree.packge = reader.enterPackage(TreeInfo.fullName(tree.pid));
-            if (tree.packageAnnotations.nonEmpty() || pkginfoOpt == PkgInfo.ALWAYS) {
+            if (tree.packageAnnotations.nonEmpty()
+                    || pkginfoOpt == PkgInfo.ALWAYS
+                    || tree.docComments != null) {
                 if (isPkgInfo) {
                     addEnv = true;
                 } else if (tree.packageAnnotations.nonEmpty()){
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Oct 11 09:17:18 2013 -0400
@@ -713,7 +713,7 @@
             ListBuffer<PendingExit> prevPending = pendingExits;
             boolean prevAlive = alive;
             try {
-                pendingExits = ListBuffer.lb();
+                pendingExits = new ListBuffer<>();
                 alive = true;
                 scanStat(tree.body);
                 tree.canCompleteNormally = alive;
@@ -1265,7 +1265,7 @@
             List<Type> prevThrown = thrown;
             ListBuffer<FlowPendingExit> prevPending = pendingExits;
             try {
-                pendingExits = ListBuffer.lb();
+                pendingExits = new ListBuffer<>();
                 caught = tree.getDescriptorType(types).getThrownTypes();
                 thrown = List.nil();
                 scan(tree.body);
@@ -1338,7 +1338,7 @@
             ListBuffer<FlowPendingExit> prevPending = pendingExits;
             inLambda = true;
             try {
-                pendingExits = ListBuffer.lb();
+                pendingExits = new ListBuffer<>();
                 caught = List.of(syms.throwableType);
                 thrown = List.nil();
                 scan(tree.body);
@@ -2030,7 +2030,7 @@
         void reportWarning(Lint.LintCategory lc, DiagnosticPosition pos, String key, Object ... args) {}
 
         public void visitTry(JCTry tree) {
-            ListBuffer<JCVariableDecl> resourceVarDecls = ListBuffer.lb();
+            ListBuffer<JCVariableDecl> resourceVarDecls = new ListBuffer<>();
             final Bits uninitsTryPrev = new Bits(uninitsTry);
             ListBuffer<P> prevPendingExits = pendingExits;
             pendingExits = new ListBuffer<>();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -277,7 +277,7 @@
       * Infer cyclic inference variables as described in 15.12.2.8.
       */
     private void instantiateAsUninferredVars(List<Type> vars, InferenceContext inferenceContext) {
-        ListBuffer<Type> todo = ListBuffer.lb();
+        ListBuffer<Type> todo = new ListBuffer<>();
         //step 1 - create fresh tvars
         for (Type t : vars) {
             UndetVar uv = (UndetVar)inferenceContext.asFree(t);
@@ -1832,7 +1832,7 @@
         }
 
         private List<Type> filterVars(Filter<UndetVar> fu) {
-            ListBuffer<Type> res = ListBuffer.lb();
+            ListBuffer<Type> res = new ListBuffer<>();
             for (Type t : undetvars) {
                 UndetVar uv = (UndetVar)t;
                 if (fu.accepts(uv)) {
@@ -1860,7 +1860,7 @@
          * Returns a list of free variables in a given type
          */
         final List<Type> freeVarsIn(Type t) {
-            ListBuffer<Type> buf = ListBuffer.lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             for (Type iv : inferenceVars()) {
                 if (t.contains(iv)) {
                     buf.add(iv);
@@ -1870,11 +1870,11 @@
         }
 
         final List<Type> freeVarsIn(List<Type> ts) {
-            ListBuffer<Type> buf = ListBuffer.lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             for (Type t : ts) {
                 buf.appendList(freeVarsIn(t));
             }
-            ListBuffer<Type> buf2 = ListBuffer.lb();
+            ListBuffer<Type> buf2 = new ListBuffer<>();
             for (Type t : buf) {
                 if (!buf2.contains(t)) {
                     buf2.add(t);
@@ -1893,7 +1893,7 @@
         }
 
         final List<Type> asFree(List<Type> ts) {
-            ListBuffer<Type> buf = ListBuffer.lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             for (Type t : ts) {
                 buf.append(asFree(t));
             }
@@ -1901,7 +1901,7 @@
         }
 
         List<Type> instTypes() {
-            ListBuffer<Type> buf = ListBuffer.lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             for (Type t : undetvars) {
                 UndetVar uv = (UndetVar)t;
                 buf.append(uv.inst != null ? uv.inst : uv.qtype);
@@ -1919,7 +1919,7 @@
         }
 
         List<Type> asInstTypes(List<Type> ts) {
-            ListBuffer<Type> buf = ListBuffer.lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             for (Type t : ts) {
                 buf.append(asInstType(t));
             }
@@ -1967,7 +1967,7 @@
          * Save the state of this inference context
          */
         List<Type> save() {
-            ListBuffer<Type> buf = ListBuffer.lb();
+            ListBuffer<Type> buf = new ListBuffer<>();
             for (Type t : undetvars) {
                 UndetVar uv = (UndetVar)t;
                 UndetVar uv2 = new UndetVar((TypeVar)uv.qtype, types);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Oct 11 09:17:18 2013 -0400
@@ -126,7 +126,7 @@
         private final VarSymbol deserParamSym;
 
         private KlassInfo(Symbol kSym) {
-            appendedMethodList = ListBuffer.lb();
+            appendedMethodList = new ListBuffer<>();
             deserializeCases = new HashMap<String, ListBuffer<JCStatement>>();
             long flags = PRIVATE | STATIC | SYNTHETIC;
             MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType,
@@ -153,6 +153,8 @@
         return instance;
     }
 
+    private Attr attr;
+
     private LambdaToMethod(Context context) {
         diags = JCDiagnostic.Factory.instance(context);
         log = Log.instance(context);
@@ -166,6 +168,7 @@
         analyzer = new LambdaAnalyzerPreprocessor();
         Options options = Options.instance(context);
         dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
+        attr = Attr.instance(context);
     }
     // </editor-fold>
 
@@ -188,7 +191,7 @@
     }
 
     <T extends JCTree> List<T> translate(List<T> trees, TranslationContext<?> newContext) {
-        ListBuffer<T> buf = ListBuffer.lb();
+        ListBuffer<T> buf = new ListBuffer<>();
         for (T tree : trees) {
             buf.append(translate(tree, newContext));
         }
@@ -301,7 +304,7 @@
         // * the "this" argument if it is an instance method
         // * enclosing locals captured by the lambda expression
 
-        ListBuffer<JCExpression> syntheticInits = ListBuffer.lb();
+        ListBuffer<JCExpression> syntheticInits = new ListBuffer<>();
 
         if (!sym.isStatic()) {
             syntheticInits.append(makeThis(
@@ -368,6 +371,7 @@
 
             case BOUND:             /** Expr :: instMethod */
                 init = tree.getQualifierExpression();
+                init = attr.makeNullCheck(init);
                 break;
 
             case UNBOUND:           /** Type :: instMethod */
@@ -465,7 +469,7 @@
         } else if (isLambda_void && isTarget_Void) {
             //void to Void conversion:
             // BODY; return null;
-            ListBuffer<JCStatement> stats = ListBuffer.lb();
+            ListBuffer<JCStatement> stats = new ListBuffer<>();
             stats.append(make.Exec(expr));
             stats.append(make.Return(make.Literal(BOT, null).setType(syms.botType)));
             return make.Block(0, stats.toList());
@@ -527,8 +531,8 @@
     }
 
     private JCMethodDecl makeDeserializeMethod(Symbol kSym) {
-        ListBuffer<JCCase> cases = ListBuffer.lb();
-        ListBuffer<JCBreak> breaks = ListBuffer.lb();
+        ListBuffer<JCCase> cases = new ListBuffer<>();
+        ListBuffer<JCBreak> breaks = new ListBuffer<>();
         for (Map.Entry<String, ListBuffer<JCStatement>> entry : kInfo.deserializeCases.entrySet()) {
             JCBreak br = make.Break(null);
             breaks.add(br);
@@ -590,11 +594,11 @@
         String implMethodSignature = methodSig(types.erasure(refSym.type));
 
         JCExpression kindTest = eqTest(syms.intType, deserGetter("getImplMethodKind", syms.intType), make.Literal(implMethodKind));
-        ListBuffer<JCExpression> serArgs = ListBuffer.lb();
+        ListBuffer<JCExpression> serArgs = new ListBuffer<>();
         int i = 0;
         for (Type t : indyType.getParameterTypes()) {
-            List<JCExpression> indexAsArg = ListBuffer.<JCExpression>lb().append(make.Literal(i)).toList();
-            List<Type> argTypes = ListBuffer.<Type>lb().append(syms.intType).toList();
+            List<JCExpression> indexAsArg = new ListBuffer<JCExpression>().append(make.Literal(i)).toList();
+            List<Type> argTypes = new ListBuffer<Type>().append(syms.intType).toList();
             serArgs.add(make.TypeCast(types.erasure(t), deserGetter("getCapturedArg", syms.objectType, argTypes, indexAsArg)));
             ++i;
         }
@@ -614,7 +618,7 @@
                 null);
         ListBuffer<JCStatement> stmts = kInfo.deserializeCases.get(implMethodName);
         if (stmts == null) {
-            stmts = ListBuffer.lb();
+            stmts = new ListBuffer<>();
             kInfo.deserializeCases.put(implMethodName, stmts);
         }
         /****
@@ -724,8 +728,8 @@
 
         private final JCMemberReference tree;
         private final ReferenceTranslationContext localContext;
-        private final ListBuffer<JCExpression> args = ListBuffer.lb();
-        private final ListBuffer<JCVariableDecl> params = ListBuffer.lb();
+        private final ListBuffer<JCExpression> args = new ListBuffer<>();
+        private final ListBuffer<JCVariableDecl> params = new ListBuffer<>();
 
         MemberReferenceBridger(JCMemberReference tree, ReferenceTranslationContext localContext) {
             this.tree = tree;
@@ -930,7 +934,7 @@
                 typeToMethodType(tree.getDescriptorType(types)));
 
         //computed indy arg types
-        ListBuffer<Type> indy_args_types = ListBuffer.lb();
+        ListBuffer<Type> indy_args_types = new ListBuffer<>();
         for (JCExpression arg : indy_args) {
             indy_args_types.append(arg.type);
         }
@@ -945,7 +949,7 @@
                 names.altMetafactory : names.metafactory;
 
         if (context.needsAltMetafactory()) {
-            ListBuffer<Object> markers = ListBuffer.lb();
+            ListBuffer<Object> markers = new ListBuffer<>();
             for (Type t : tree.targets.tail) {
                 if (t.tsym != syms.serializableType.tsym) {
                     markers.append(t.tsym);
@@ -1023,7 +1027,7 @@
     }
     //where
     private List<Type> bsmStaticArgToTypes(List<Object> args) {
-        ListBuffer<Type> argtypes = ListBuffer.lb();
+        ListBuffer<Type> argtypes = new ListBuffer<>();
         for (Object arg : args) {
             argtypes.append(bsmStaticArgToType(arg));
         }
@@ -1847,7 +1851,7 @@
                         (thisReferenced? (inInterface? DEFAULT : 0) : STATIC);
 
                 //compute synthetic params
-                ListBuffer<JCVariableDecl> params = ListBuffer.lb();
+                ListBuffer<JCVariableDecl> params = new ListBuffer<>();
 
                 // The signature of the method is augmented with the following
                 // synthetic parameters:
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Oct 11 09:17:18 2013 -0400
@@ -3725,7 +3725,7 @@
                 (JCVariableDecl)make.VarDef(dollar_tmp, make.Literal(INT, -1)).setType(dollar_tmp.type);
             dollar_tmp_def.init.type = dollar_tmp.type = syms.intType;
             stmtList.append(dollar_tmp_def);
-            ListBuffer<JCCase> caseBuffer = ListBuffer.lb();
+            ListBuffer<JCCase> caseBuffer = new ListBuffer<>();
             // hashCode will trigger nullcheck on original switch expression
             JCMethodInvocation hashCodeCall = makeCall(make.Ident(dollar_s),
                                                        names.hashCode,
@@ -3749,7 +3749,7 @@
                                        elsepart);
                 }
 
-                ListBuffer<JCStatement> lb = ListBuffer.lb();
+                ListBuffer<JCStatement> lb = new ListBuffer<>();
                 JCBreak breakStmt = make.Break(null);
                 breakStmt.target = switch1;
                 lb.append(elsepart).append(breakStmt);
@@ -3764,7 +3764,7 @@
             // with corresponding integer ones from the label to
             // position map.
 
-            ListBuffer<JCCase> lb = ListBuffer.lb();
+            ListBuffer<JCCase> lb = new ListBuffer<>();
             JCSwitch switch2 = make.Switch(make.Ident(dollar_tmp), lb.toList());
             for(JCCase oneCase : caseList ) {
                 // Rewire up old unlabeled break statements to the
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -79,6 +79,7 @@
     private final ClassReader reader;
     private final Todo todo;
     private final Annotate annotate;
+    private final TypeAnnotations typeAnnotations;
     private final Types types;
     private final JCDiagnostic.Factory diags;
     private final Source source;
@@ -105,6 +106,7 @@
         reader = ClassReader.instance(context);
         todo = Todo.instance(context);
         annotate = Annotate.instance(context);
+        typeAnnotations = TypeAnnotations.instance(context);
         types = Types.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         source = Source.instance(context);
@@ -1164,7 +1166,7 @@
             }
         }
         if (allowTypeAnnos) {
-            TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, env, tree, annotate);
+            typeAnnotations.organizeTypeAnnotationsSignatures(env, tree);
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Oct 11 09:17:18 2013 -0400
@@ -213,7 +213,7 @@
 
         int pos = 0;
         int mostSpecificPos = -1;
-        ListBuffer<JCDiagnostic> subDiags = ListBuffer.lb();
+        ListBuffer<JCDiagnostic> subDiags = new ListBuffer<>();
         for (Candidate c : currentResolutionContext.candidates) {
             if (currentResolutionContext.step != c.step ||
                     (c.isApplicable() && !verboseResolutionMode.contains(VerboseResolutionMode.APPLICABLE)) ||
@@ -783,7 +783,7 @@
     };
 
     List<Type> dummyArgs(int length) {
-        ListBuffer<Type> buf = ListBuffer.lb();
+        ListBuffer<Type> buf = new ListBuffer<>();
         for (int i = 0 ; i < length ; i++) {
             buf.append(Type.noType);
         }
@@ -3173,7 +3173,7 @@
     }
     //where
     private List<Type> pruneInterfaces(Type t) {
-        ListBuffer<Type> result = ListBuffer.lb();
+        ListBuffer<Type> result = new ListBuffer<>();
         for (Type t1 : types.interfaces(t)) {
             boolean shouldAdd = true;
             for (Type t2 : types.interfaces(t)) {
@@ -3286,7 +3286,7 @@
         if (argtypes == null || argtypes.isEmpty()) {
             return noArgs;
         } else {
-            ListBuffer<Object> diagArgs = ListBuffer.lb();
+            ListBuffer<Object> diagArgs = new ListBuffer<>();
             for (Type t : argtypes) {
                 if (t.hasTag(DEFERRED)) {
                     diagArgs.append(((DeferredAttr.DeferredType)t).tree);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Oct 11 09:17:18 2013 -0400
@@ -887,7 +887,7 @@
 
     private List<JCTree> addOverrideBridgesIfNeeded(DiagnosticPosition pos,
                                     final ClassSymbol c) {
-        ListBuffer<JCTree> buf = ListBuffer.lb();
+        ListBuffer<JCTree> buf = new ListBuffer<>();
         if (c.isInterface() || !boundsRestricted(c))
             return buf.toList();
         Type t = types.supertype(c.type);
--- a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Fri Oct 11 09:17:18 2013 -0400
@@ -40,6 +40,7 @@
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetDecoder;
 import javax.tools.JavaFileObject;
+import java.text.Normalizer;
 
 /**
  * A subclass of JavaFileObject representing regular files.
@@ -57,6 +58,7 @@
     private String name;
     final File file;
     private Reference<File> absFileRef;
+    final static boolean isMacOS = System.getProperty("os.name", "").contains("OS X");
 
     public RegularFileObject(JavacFileManager fileManager, File f) {
         this(fileManager, f.getName(), f);
@@ -180,7 +182,19 @@
         if (name.equals(n)) {
             return true;
         }
-        if (name.equalsIgnoreCase(n)) {
+        if (isMacOS && Normalizer.isNormalized(name, Normalizer.Form.NFD)
+            && Normalizer.isNormalized(n, Normalizer.Form.NFC)) {
+            // On Mac OS X it is quite possible to file name and class
+            // name normalized in a different way - in that case we have to normalize file name
+            // to the Normal Form Compised (NFC)
+            String normName = Normalizer.normalize(name, Normalizer.Form.NFC);
+            if (normName.equals(n)) {
+                this.name = normName;
+                return true;
+            }
+        }
+
+            if (name.equalsIgnoreCase(n)) {
             try {
                 // allow for Windows
                 return file.getCanonicalFile().getName().equals(n);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Oct 11 09:17:18 2013 -0400
@@ -56,6 +56,7 @@
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
+import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
 import static com.sun.tools.javac.jvm.ClassFile.*;
 import static com.sun.tools.javac.jvm.ClassFile.Version.*;
 
@@ -703,6 +704,12 @@
                 sigp++;
                 thrown = thrown.prepend(sigToType());
             }
+            // if there is a typevar in the throws clause we should state it.
+            for (List<Type> l = thrown; l.nonEmpty(); l = l.tail) {
+                if (l.head.hasTag(TYPEVAR)) {
+                    l.head.tsym.flags_field |= THROWS;
+                }
+            }
             return new MethodType(argtypes,
                                   restype,
                                   thrown.reverse(),
@@ -1439,8 +1446,7 @@
     void attachTypeAnnotations(final Symbol sym) {
         int numAttributes = nextChar();
         if (numAttributes != 0) {
-            ListBuffer<TypeAnnotationProxy> proxies =
-                ListBuffer.lb();
+            ListBuffer<TypeAnnotationProxy> proxies = new ListBuffer<>();
             for (int i = 0; i < numAttributes; i++)
                 proxies.append(readTypeAnnotation());
             annotate.normal(new TypeAnnotationCompleter(sym, proxies.toList()));
@@ -1589,7 +1595,7 @@
 
         { // See whether there is location info and read it
             int len = nextByte();
-            ListBuffer<Integer> loc = ListBuffer.lb();
+            ListBuffer<Integer> loc = new ListBuffer<>();
             for (int i = 0; i < len * TypeAnnotationPosition.TypePathEntry.bytesPerEntry; ++i)
                 loc = loc.append(nextByte());
             position.location = TypeAnnotationPosition.getTypePathFromBinary(loc.toList());
@@ -1939,7 +1945,7 @@
         }
 
         List<Attribute.TypeCompound> deproxyTypeCompoundList(List<TypeAnnotationProxy> proxies) {
-            ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb();
+            ListBuffer<Attribute.TypeCompound> buf = new ListBuffer<>();
             for (TypeAnnotationProxy proxy: proxies) {
                 Attribute.Compound compound = deproxyCompound(proxy.compound);
                 Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position);
@@ -2026,7 +2032,7 @@
         boolean isVarargs = (flags & VARARGS) != 0;
         if (isVarargs) {
             Type varargsElem = args.last();
-            ListBuffer<Type> adjustedArgs = ListBuffer.lb();
+            ListBuffer<Type> adjustedArgs = new ListBuffer<>();
             for (Type t : args) {
                 adjustedArgs.append(t != varargsElem ?
                     t :
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -766,8 +766,8 @@
     int writeTypeAnnotations(List<Attribute.TypeCompound> typeAnnos, boolean inCode) {
         if (typeAnnos.isEmpty()) return 0;
 
-        ListBuffer<Attribute.TypeCompound> visibles = ListBuffer.lb();
-        ListBuffer<Attribute.TypeCompound> invisibles = ListBuffer.lb();
+        ListBuffer<Attribute.TypeCompound> visibles = new ListBuffer<>();
+        ListBuffer<Attribute.TypeCompound> invisibles = new ListBuffer<>();
 
         for (Attribute.TypeCompound tc : typeAnnos) {
             if (tc.hasUnknownPosition()) {
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1595,7 +1595,7 @@
 
 
     public void compressCatchTable() {
-        ListBuffer<char[]> compressedCatchInfo = ListBuffer.lb();
+        ListBuffer<char[]> compressedCatchInfo = new ListBuffer<>();
         List<Integer> handlerPcs = List.nil();
         for (char[] catchEntry : catchInfo) {
             handlerPcs = handlerPcs.prepend((int)catchEntry[2]);
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Oct 11 09:17:18 2013 -0400
@@ -67,7 +67,6 @@
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.main.Option.*;
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
-import static com.sun.tools.javac.util.ListBuffer.lb;
 
 
 /** This class could be the main entry point for GJC when GJC is used as a
@@ -586,7 +585,7 @@
     }
 
     protected final <T> Queue<T> stopIfError(CompileState cs, Queue<T> queue) {
-        return shouldStop(cs) ? ListBuffer.<T>lb() : queue;
+        return shouldStop(cs) ? new ListBuffer<T>() : queue;
     }
 
     protected final <T> List<T> stopIfError(CompileState cs, List<T> list) {
@@ -952,7 +951,7 @@
            return List.nil();
 
         //parse all files
-        ListBuffer<JCCompilationUnit> trees = lb();
+        ListBuffer<JCCompilationUnit> trees = new ListBuffer<>();
         Set<JavaFileObject> filesSoFar = new HashSet<JavaFileObject>();
         for (JavaFileObject fileObject : fileObjects) {
             if (!filesSoFar.contains(fileObject)) {
@@ -1002,7 +1001,7 @@
         // then remember the classes declared in
         // the original compilation units listed on the command line.
         if (needRootClasses || sourceOutput || stubOutput) {
-            ListBuffer<JCClassDecl> cdefs = lb();
+            ListBuffer<JCClassDecl> cdefs = new ListBuffer<>();
             for (JCCompilationUnit unit : roots) {
                 for (List<JCTree> defs = unit.defs;
                      defs.nonEmpty();
@@ -1226,7 +1225,7 @@
      * @returns a list of environments for attributd classes.
      */
     public Queue<Env<AttrContext>> attribute(Queue<Env<AttrContext>> envs) {
-        ListBuffer<Env<AttrContext>> results = lb();
+        ListBuffer<Env<AttrContext>> results = new ListBuffer<>();
         while (!envs.isEmpty())
             results.append(attribute(envs.remove()));
         return stopIfError(CompileState.ATTR, results);
@@ -1291,7 +1290,7 @@
      * @returns the list of attributed parse trees
      */
     public Queue<Env<AttrContext>> flow(Queue<Env<AttrContext>> envs) {
-        ListBuffer<Env<AttrContext>> results = lb();
+        ListBuffer<Env<AttrContext>> results = new ListBuffer<>();
         for (Env<AttrContext> env: envs) {
             flow(env, results);
         }
@@ -1302,7 +1301,7 @@
      * Perform dataflow checks on an attributed parse tree.
      */
     public Queue<Env<AttrContext>> flow(Env<AttrContext> env) {
-        ListBuffer<Env<AttrContext>> results = lb();
+        ListBuffer<Env<AttrContext>> results = new ListBuffer<>();
         flow(env, results);
         return stopIfError(CompileState.FLOW, results);
     }
@@ -1356,7 +1355,7 @@
      * @returns a list containing the classes to be generated
      */
     public Queue<Pair<Env<AttrContext>, JCClassDecl>> desugar(Queue<Env<AttrContext>> envs) {
-        ListBuffer<Pair<Env<AttrContext>, JCClassDecl>> results = lb();
+        ListBuffer<Pair<Env<AttrContext>, JCClassDecl>> results = new ListBuffer<>();
         for (Env<AttrContext> env: envs)
             desugar(env, results);
         return stopIfError(CompileState.FLOW, results);
@@ -1605,7 +1604,7 @@
                 }
                 @Override
                 public void visitClassDef(JCClassDecl tree) {
-                    ListBuffer<JCTree> newdefs = lb();
+                    ListBuffer<JCTree> newdefs = new ListBuffer<>();
                     for (List<JCTree> it = tree.defs; it.tail != null; it = it.tail) {
                         JCTree t = it.head;
                         switch (t.getTag()) {
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java	Fri Oct 11 09:17:18 2013 -0400
@@ -207,7 +207,7 @@
         Attribute[] contained0 = null;
         if (container != null)
             contained0 = unpackAttributes(container);
-        ListBuffer<Attribute.Compound> compounds = ListBuffer.lb();
+        ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
         if (contained0 != null) {
             for (Attribute a : contained0)
                 if (a instanceof Attribute.Compound)
@@ -328,7 +328,7 @@
         Attribute[] contained0 = null;
         if (container != null)
             contained0 = unpackAttributes(container);
-        ListBuffer<Attribute.Compound> compounds = ListBuffer.lb();
+        ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
         if (contained0 != null) {
             for (Attribute a : contained0)
                 if (a instanceof Attribute.Compound)
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Fri Oct 11 09:17:18 2013 -0400
@@ -116,11 +116,7 @@
 
     public List<Type> directSupertypes(TypeMirror t) {
         validateTypeNotIn(t, EXEC_OR_PKG);
-        Type type = (Type) t;
-        Type sup = types.supertype(type);
-        return (sup == Type.noType || sup == type || sup == null)
-              ? types.interfaces(type)
-              : types.interfaces(type).prepend(sup);
+        return types.directSupertypes((Type) t);
     }
 
     public TypeMirror erasure(TypeMirror t) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -48,7 +48,6 @@
 import static com.sun.tools.javac.parser.Tokens.TokenKind.IMPORT;
 import static com.sun.tools.javac.parser.Tokens.TokenKind.LT;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
-import static com.sun.tools.javac.util.ListBuffer.lb;
 
 /** The parser maps a token sequence into an abstract syntax
  *  tree. It operates by recursive descent, with code derived
@@ -1767,7 +1766,7 @@
     /** Arguments = "(" [Expression { COMMA Expression }] ")"
      */
     List<JCExpression> arguments() {
-        ListBuffer<JCExpression> args = lb();
+        ListBuffer<JCExpression> args = new ListBuffer<>();
         if (token.kind == LPAREN) {
             nextToken();
             if (token.kind != RPAREN) {
@@ -1834,7 +1833,7 @@
                 nextToken();
                 return List.nil();
             } else {
-                ListBuffer<JCExpression> args = ListBuffer.lb();
+                ListBuffer<JCExpression> args = new ListBuffer<>();
                 args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
                 while (token.kind == COMMA) {
                     nextToken();
@@ -2175,7 +2174,7 @@
             ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>();
 
             // maintain array dimension type annotations
-            ListBuffer<List<JCAnnotation>> dimAnnotations = ListBuffer.lb();
+            ListBuffer<List<JCAnnotation>> dimAnnotations = new ListBuffer<>();
             dimAnnotations.append(annos);
 
             dims.append(parseExpression());
@@ -2626,7 +2625,7 @@
     }
 
     List<JCExpression> catchTypes() {
-        ListBuffer<JCExpression> catchTypes = ListBuffer.lb();
+        ListBuffer<JCExpression> catchTypes = new ListBuffer<>();
         catchTypes.add(parseType());
         while (token.kind == BAR) {
             checkMulticatch();
@@ -2708,7 +2707,7 @@
      *           |  { FINAL | '@' Annotation } Type VariableDeclarators
      */
     List<JCStatement> forInit() {
-        ListBuffer<JCStatement> stats = lb();
+        ListBuffer<JCStatement> stats = new ListBuffer<>();
         int pos = token.pos;
         if (token.kind == FINAL || token.kind == MONKEYS_AT) {
             return variableDeclarators(optFinal(0), parseType(), stats).toList();
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Tokens.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -402,7 +402,7 @@
             if (comments == null) {
                 return List.nil();
             } else {
-                ListBuffer<Comment> buf = ListBuffer.lb();
+                ListBuffer<Comment> buf = new ListBuffer<>();
                 for (Comment c : comments) {
                     if (c.getStyle() == style) {
                         buf.add(c);
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_ja.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_ja.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -525,9 +525,6 @@
 compiler.misc.incompatible.ret.type.in.mref=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u623B\u308A\u578B\u304C\u4E0D\u6B63\u3067\u3059\n{0}
 
 # 0: list of type
-compiler.err.incompatible.thrown.types.in.lambda=\u30E9\u30E0\u30C0\u5F0F\u3067\u30B9\u30ED\u30FC\u3055\u308C\u305F\u30BF\u30A4\u30D7{0}\u306F\u4E0D\u9069\u5408\u3067\u3059
-
-# 0: list of type
 compiler.err.incompatible.thrown.types.in.mref=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u30B9\u30ED\u30FC\u3055\u308C\u305F\u30BF\u30A4\u30D7{0}\u306F\u4E0D\u9069\u5408\u3067\u3059
 
 compiler.misc.incompatible.arg.types.in.lambda=\u30E9\u30E0\u30C0\u5F0F\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u578B\u306F\u4E0D\u9069\u5408\u3067\u3059
@@ -642,12 +639,18 @@
 # 0: symbol, 1: set of modifier, 2: symbol
 compiler.err.report.access={0}\u306F{2}\u3067{1}\u30A2\u30AF\u30BB\u30B9\u3055\u308C\u307E\u3059
 
+# 0: symbol, 1: set of modifier, 2: symbol
+compiler.misc.report.access={0}\u306F{2}\u3067{1}\u30A2\u30AF\u30BB\u30B9\u3055\u308C\u307E\u3059
+
 compiler.err.ret.outside.meth=\u30E1\u30BD\u30C3\u30C9\u306E\u5916\u306Ereturn\u6587\u3067\u3059
 
 compiler.err.signature.doesnt.match.supertype=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C{0}\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002\u4E0D\u9069\u5408\u306A\u30B9\u30FC\u30D1\u30FC\u30BF\u30A4\u30D7\u3067\u3059
 
 compiler.err.signature.doesnt.match.intf=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C{0}\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002\u4E0D\u9069\u5408\u306A\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3067\u3059
 
+# 0: number, 1: number
+compiler.err.method.invoked.with.incorrect.number.arguments=\u30E1\u30BD\u30C3\u30C9\u3092\u8D77\u52D5\u3057\u305F\u5F15\u6570\u306E\u6570\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u4E88\u671F\u3055\u308C\u308B\u6570\u306F{0}\u3067\u3059\u304C\u3001{1}\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F
+
 # 0: symbol, 1: symbol, 2: symbol
 compiler.err.does.not.override.abstract={0}\u306Fabstract\u3067\u306A\u304F\u3001{2}\u5185\u306Eabstract\u30E1\u30BD\u30C3\u30C9{1}\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u305B\u3093
 
@@ -756,6 +759,9 @@
 compiler.err.var.might.not.have.been.initialized=\u5909\u6570{0}\u306F\u521D\u671F\u5316\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059
 
 # 0: symbol
+compiler.err.var.not.initialized.in.default.constructor=\u5909\u6570{0}\u306F\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u3067\u521D\u671F\u5316\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+
+# 0: symbol
 compiler.err.var.might.be.assigned.in.loop=\u5909\u6570{0}\u306F\u30EB\u30FC\u30D7\u5185\u3067\u4EE3\u5165\u3055\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059
 
 # 0: symbol, 1: message segment
@@ -829,6 +835,14 @@
 
 compiler.note.potential.lambda.found=\u3053\u306E\u533F\u540D\u5185\u90E8\u30AF\u30E9\u30B9\u3092\u30E9\u30E0\u30C0\u5F0F\u306B\u5909\u63DB\u3067\u304D\u307E\u3059\u3002
 
+# 0: boolean, 1: symbol
+compiler.note.lambda.stat=\u30E9\u30E0\u30C0\u5F0F\u3092\u5909\u63DB\u3057\u3066\u3044\u307E\u3059\n\u4EE3\u66FFmetafactory = {0}\n\u5408\u6210\u30E1\u30BD\u30C3\u30C9 = {1}
+
+# 0: boolean, 1: unused
+compiler.note.mref.stat=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u3092\u5909\u63DB\u3057\u3066\u3044\u307E\u3059\n\u4EE3\u66FFmetafactory = {0}\n
+# 0: boolean, 1: symbol
+compiler.note.mref.stat.1=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u3092\u5909\u63DB\u3057\u3066\u3044\u307E\u3059\n\u4EE3\u66FFmetafactory = {0}\n\u30D6\u30EA\u30C3\u30B8\u30FB\u30E1\u30BD\u30C3\u30C9 = {1}
+
 compiler.note.note=\u6CE8\u610F:
 
 # 0: file name
@@ -1015,6 +1029,14 @@
 # 0: string
 compiler.warn.source.no.bootclasspath=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9\u304C-source {0}\u3068\u4E00\u7DD2\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
 
+# 0: string
+compiler.warn.option.obsolete.source=\u30BD\u30FC\u30B9\u5024{0}\u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u3066\u3001\u4ECA\u5F8C\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u524A\u9664\u3055\u308C\u308B\u4E88\u5B9A\u3067\u3059
+
+# 0: string
+compiler.warn.option.obsolete.target=\u30BF\u30FC\u30B2\u30C3\u30C8\u5024{0}\u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u3066\u3001\u4ECA\u5F8C\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u524A\u9664\u3055\u308C\u308B\u4E88\u5B9A\u3067\u3059
+
+compiler.warn.option.obsolete.suppression=\u5EC3\u6B62\u3055\u308C\u305F\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u3064\u3044\u3066\u306E\u8B66\u544A\u3092\u8868\u793A\u3057\u306A\u3044\u3088\u3046\u306B\u3059\u308B\u306B\u306F\u3001-Xlint:\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
+
 # 0: name, 1: number, 2: number, 3: number, 4: number
 compiler.warn.future.attr=\u30D0\u30FC\u30B8\u30E7\u30F3{1}.{2}\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3067\u5C0E\u5165\u3055\u308C\u305F{0}\u5C5E\u6027\u306F\u3001\u30D0\u30FC\u30B8\u30E7\u30F3{3}.{4}\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u7121\u8996\u3055\u308C\u307E\u3059
 
@@ -1550,7 +1572,7 @@
 
 compiler.warn.assert.as.identifier=\u30EA\u30EA\u30FC\u30B91.4\u304B\u3089''assert''\u306F\u30AD\u30FC\u30EF\u30FC\u30C9\u306A\u306E\u3067\u3001\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\n(''assert''\u3092\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u306B\u306F\u3001-source 1.4\u4EE5\u964D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
-compiler.warn.underscore.as.identifier=\u8B58\u5225\u5B50\u3068\u3057\u3066''_''\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F\n(\u8B58\u5225\u5B50\u3068\u3057\u3066\u306E''_''\u306E\u4F7F\u7528\u306F\u3001\u5C06\u6765\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059)
+compiler.warn.underscore.as.identifier=\u8B58\u5225\u5B50\u3068\u3057\u3066''_''\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F\n(\u8B58\u5225\u5B50\u3068\u3057\u3066\u306E''_''\u306E\u4F7F\u7528\u306F\u3001Java SE 8\u3088\u308A\u5F8C\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059)
 
 compiler.err.enum.as.identifier=\u30EA\u30EA\u30FC\u30B95\u304B\u3089''enum''\u306F\u30AD\u30FC\u30EF\u30FC\u30C9\u306A\u306E\u3067\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\n(''enum''\u3092\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u306B\u306F-source 1.4\u4EE5\u524D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
@@ -1567,7 +1589,7 @@
 
 # TODO 308: make a better error message
 # 0: unused
-compiler.err.cant.annotate.nested.type=\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30BF\u30A4\u30D7\u306F\u6CE8\u91C8\u4ED8\u3051\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
+compiler.err.cant.annotate.nested.type=static\u306E\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30BF\u30A4\u30D7\u306E\u30B9\u30B3\u30FC\u30D7\u30FB\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30C8\u306B\u306F\u6CE8\u91C8\u4ED8\u3051\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
 
 # 0: type, 1: type
 compiler.err.incorrect.receiver.name=\u53D7\u53D6\u308A\u5074\u306E\u540D\u524D\u304C\u3001\u5305\u542B\u3059\u308B\u30AF\u30E9\u30B9\u30FB\u30BF\u30A4\u30D7\u3068\u4E00\u81F4\u3057\u307E\u305B\u3093\n\u5FC5\u9808: {0}\n\u691C\u51FA: {1}
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -525,9 +525,6 @@
 compiler.misc.incompatible.ret.type.in.mref=\u65B9\u6CD5\u5F15\u7528\u4E2D\u7684\u8FD4\u56DE\u7C7B\u578B\u9519\u8BEF\n{0}
 
 # 0: list of type
-compiler.err.incompatible.thrown.types.in.lambda=lambda \u8868\u8FBE\u5F0F\u4E2D\u629B\u51FA\u7684\u7C7B\u578B{0}\u4E0D\u517C\u5BB9
-
-# 0: list of type
 compiler.err.incompatible.thrown.types.in.mref=\u65B9\u6CD5\u5F15\u7528\u4E2D\u629B\u51FA\u7684\u7C7B\u578B{0}\u4E0D\u517C\u5BB9
 
 compiler.misc.incompatible.arg.types.in.lambda=lambda \u8868\u8FBE\u5F0F\u4E2D\u7684\u53C2\u6570\u7C7B\u578B\u4E0D\u517C\u5BB9
@@ -642,12 +639,18 @@
 # 0: symbol, 1: set of modifier, 2: symbol
 compiler.err.report.access={0}\u53EF\u4EE5\u5728{2}\u4E2D\u8BBF\u95EE{1}
 
+# 0: symbol, 1: set of modifier, 2: symbol
+compiler.misc.report.access={0}\u53EF\u4EE5\u5728{2}\u4E2D\u8BBF\u95EE{1}
+
 compiler.err.ret.outside.meth=\u8FD4\u56DE\u5916\u90E8\u65B9\u6CD5
 
 compiler.err.signature.doesnt.match.supertype=\u7B7E\u540D\u4E0E{0}\u4E0D\u5339\u914D; \u4E0D\u517C\u5BB9\u7684\u8D85\u7C7B\u578B
 
 compiler.err.signature.doesnt.match.intf=\u7B7E\u540D\u4E0E{0}\u4E0D\u5339\u914D; \u4E0D\u517C\u5BB9\u7684\u63A5\u53E3
 
+# 0: number, 1: number
+compiler.err.method.invoked.with.incorrect.number.arguments=\u4F7F\u7528\u4E0D\u6B63\u786E\u6570\u91CF\u7684\u53C2\u6570\u8C03\u7528\u4E86\u65B9\u6CD5; \u9884\u671F\u4E3A {0} \u4E2A, \u627E\u5230 {1} \u4E2A
+
 # 0: symbol, 1: symbol, 2: symbol
 compiler.err.does.not.override.abstract={0}\u4E0D\u662F\u62BD\u8C61\u7684, \u5E76\u4E14\u672A\u8986\u76D6{2}\u4E2D\u7684\u62BD\u8C61\u65B9\u6CD5{1}
 
@@ -756,6 +759,9 @@
 compiler.err.var.might.not.have.been.initialized=\u53EF\u80FD\u5C1A\u672A\u521D\u59CB\u5316\u53D8\u91CF{0}
 
 # 0: symbol
+compiler.err.var.not.initialized.in.default.constructor=\u53D8\u91CF {0} \u672A\u5728\u9ED8\u8BA4\u6784\u9020\u5668\u4E2D\u521D\u59CB\u5316
+
+# 0: symbol
 compiler.err.var.might.be.assigned.in.loop=\u53EF\u80FD\u5728 loop \u4E2D\u5206\u914D\u4E86\u53D8\u91CF{0}
 
 # 0: symbol, 1: message segment
@@ -829,6 +835,14 @@
 
 compiler.note.potential.lambda.found=\u53EF\u5C06\u6B64\u533F\u540D\u5185\u90E8\u7C7B\u521B\u5EFA\u8F6C\u6362\u4E3A lambda \u8868\u8FBE\u5F0F\u3002
 
+# 0: boolean, 1: symbol
+compiler.note.lambda.stat=\u8F6C\u6362 lambda \u8868\u8FBE\u5F0F\n\u66FF\u4EE3 metafactory = {0}\n\u5408\u6210\u65B9\u6CD5 = {1}
+
+# 0: boolean, 1: unused
+compiler.note.mref.stat=\u8F6C\u6362\u65B9\u6CD5\u5F15\u7528\n\u66FF\u4EE3 metafactory = {0}\n
+# 0: boolean, 1: symbol
+compiler.note.mref.stat.1=\u8F6C\u6362\u65B9\u6CD5\u5F15\u7528\n\u66FF\u4EE3 metafactory = {0}\nbridge \u65B9\u6CD5 = {1}
+
 compiler.note.note=\u6CE8: 
 
 # 0: file name
@@ -1015,6 +1029,14 @@
 # 0: string
 compiler.warn.source.no.bootclasspath=\u672A\u4E0E -source {0} \u4E00\u8D77\u8BBE\u7F6E\u5F15\u5BFC\u7C7B\u8DEF\u5F84
 
+# 0: string
+compiler.warn.option.obsolete.source=\u6E90\u503C{0}\u5DF2\u8FC7\u65F6, \u5C06\u5728\u672A\u6765\u6240\u6709\u53D1\u884C\u7248\u4E2D\u5220\u9664
+
+# 0: string
+compiler.warn.option.obsolete.target=\u76EE\u6807\u503C{0}\u5DF2\u8FC7\u65F6, \u5C06\u5728\u672A\u6765\u6240\u6709\u53D1\u884C\u7248\u4E2D\u5220\u9664
+
+compiler.warn.option.obsolete.suppression=\u8981\u9690\u85CF\u6709\u5173\u5DF2\u8FC7\u65F6\u9009\u9879\u7684\u8B66\u544A, \u8BF7\u4F7F\u7528 -Xlint:-options\u3002
+
 # 0: name, 1: number, 2: number, 3: number, 4: number
 compiler.warn.future.attr={1}.{2} \u7248\u7C7B\u6587\u4EF6\u4E2D\u5F15\u5165\u7684 {0} \u5C5E\u6027\u5728 {3}.{4} \u7248\u7C7B\u6587\u4EF6\u4E2D\u88AB\u5FFD\u7565
 
@@ -1550,7 +1572,7 @@
 
 compiler.warn.assert.as.identifier=\u4ECE\u53D1\u884C\u7248 1.4 \u5F00\u59CB, ''assert'' \u662F\u4E00\u4E2A\u5173\u952E\u5B57, \u4F46\u4E0D\u80FD\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u8BF7\u4F7F\u7528 -source 1.4 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u5C06 ''assert'' \u7528\u4F5C\u5173\u952E\u5B57)
 
-compiler.warn.underscore.as.identifier=''_'' \u5DF2\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u4EE5\u540E\u7684\u53D1\u884C\u7248\u53EF\u80FD\u4E0D\u652F\u6301\u5C06 ''_'' \u7528\u4F5C\u6807\u8BC6\u7B26)
+compiler.warn.underscore.as.identifier=''_'' \u7528\u4F5C\u6807\u8BC6\u7B26\n(Java SE 8 \u4E4B\u540E\u7684\u53D1\u884C\u7248\u4E2D\u53EF\u80FD\u4E0D\u652F\u6301\u4F7F\u7528 ''_'' \u4F5C\u4E3A\u6807\u8BC6\u7B26)
 
 compiler.err.enum.as.identifier=\u4ECE\u53D1\u884C\u7248 5 \u5F00\u59CB, ''enum'' \u4E3A\u5173\u952E\u5B57, \u800C\u4E0D\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u8BF7\u4F7F\u7528 -source 1.4 \u6216\u66F4\u4F4E\u7248\u672C\u4EE5\u5C06 ''enum'' \u7528\u4F5C\u6807\u8BC6\u7B26)
 
@@ -1567,7 +1589,7 @@
 
 # TODO 308: make a better error message
 # 0: unused
-compiler.err.cant.annotate.nested.type=\u65E0\u6CD5\u5BF9\u5D4C\u5957\u7C7B\u578B\u8FDB\u884C\u6CE8\u91CA
+compiler.err.cant.annotate.nested.type=\u65E0\u6CD5\u6CE8\u91CA\u7528\u4E8E\u9759\u6001\u5D4C\u5957\u7C7B\u578B\u7684\u786E\u5B9A\u4F5C\u7528\u57DF\u7ED3\u6784
 
 # 0: type, 1: type
 compiler.err.incorrect.receiver.name=\u63A5\u6536\u65B9\u540D\u79F0\u4E0E\u5C01\u95ED\u7C7B\u7C7B\u578B\u4E0D\u5339\u914D\n\u9700\u8981: {0}\n\u627E\u5230: {1}
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -87,8 +87,12 @@
 javac.opt.Xlint=\u63A8\u5968\u306E\u8B66\u544A\u3092\u6709\u52B9\u306B\u3059\u308B
 javac.opt.Xlint.suboptlist=\u7279\u5B9A\u306E\u8B66\u544A\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3059\u308B
 javac.opt.Xdoclint=javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u63A8\u5968\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B
-javac.opt.Xdoclint.subopts = (all|[-]<group>)[/<access>]
-javac.opt.Xdoclint.custom=\n        javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n        \u3053\u3053\u3067\u3001<group>\u306Faccessibility\u3001html\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3001\n        <access>\u306Fpublic\u3001protected\u3001package\u307E\u305F\u306Fprivate\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002
+# L10N: do not localize: all none
+javac.opt.Xdoclint.subopts = (all|none|[-]<group>)[/<access>]
+
+# L10N: do not localize: accessibility html missing reference syntax
+# L10N: do not localize: public protected package private
+javac.opt.Xdoclint.custom=\n        javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n        \u3053\u3053\u3067\u3001<group>\u306Faccessibility\u3001html\u3001missing\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3001\n        <access>\u306Fpublic\u3001protected\u3001package\u307E\u305F\u306Fprivate\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002
 javac.opt.Xstdout=\u6A19\u6E96\u51FA\u529B\u3092\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3059\u308B
 javac.opt.X=\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B
 javac.opt.help=\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B
@@ -105,6 +109,7 @@
 javac.err.invalid.arg={0}\u306F\u7121\u52B9\u306A\u5F15\u6570\u3067\u3059
 javac.err.invalid.A.key=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3''{0}''\u306E\u30AD\u30FC\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B\u4E00\u9023\u306E\u8B58\u5225\u5B50\u304C\u3001\u30C9\u30C3\u30C8\u3067\u533A\u5207\u3089\u308C\u3066\u3044\u307E\u305B\u3093
 javac.err.invalid.flag={0}\u306F\u7121\u52B9\u306A\u30D5\u30E9\u30B0\u3067\u3059
+javac.err.profile.bootclasspath.conflict=profile\u3068bootclasspath\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u540C\u6642\u306B\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
 javac.err.invalid.profile=\u7121\u52B9\u306A\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB: {0}
 javac.err.invalid.target={0}\u306F\u7121\u52B9\u306A\u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30EA\u30EA\u30FC\u30B9\u3067\u3059
 javac.err.no.source.files=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -87,8 +87,12 @@
 javac.opt.Xlint=\u542F\u7528\u5EFA\u8BAE\u7684\u8B66\u544A
 javac.opt.Xlint.suboptlist=\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u7684\u8B66\u544A
 javac.opt.Xdoclint=\u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u5EFA\u8BAE\u7684\u68C0\u67E5
-javac.opt.Xdoclint.subopts = (all|[-]<group>)[/<access>]
-javac.opt.Xdoclint.custom=\n        \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5,\n        \u5176\u4E2D <group> \u4E3A\u53EF\u8BBF\u95EE\u6027, html, \u5F15\u7528\u6216\u8BED\u6CD5\u4E4B\u4E00,\n        <access> \u4E3A public, protected, package \u6216 private \u4E4B\u4E00\u3002
+# L10N: do not localize: all none
+javac.opt.Xdoclint.subopts = (all|none|[-]<group>)[/<access>]
+
+# L10N: do not localize: accessibility html missing reference syntax
+# L10N: do not localize: public protected package private
+javac.opt.Xdoclint.custom=\n        \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5,\n        \u5176\u4E2D <group> \u4E3A accessibility, html, missing, reference \u6216 syntax \u4E4B\u4E00\u3002\n        <access> \u4E3A public, protected, package \u6216 private \u4E4B\u4E00\u3002
 javac.opt.Xstdout=\u91CD\u5B9A\u5411\u6807\u51C6\u8F93\u51FA
 javac.opt.X=\u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981
 javac.opt.help=\u8F93\u51FA\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981
@@ -105,6 +109,7 @@
 javac.err.invalid.arg=\u65E0\u6548\u7684\u53C2\u6570: {0}
 javac.err.invalid.A.key=\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u9009\u9879 ''{0}'' \u4E2D\u7684\u5173\u952E\u5B57\u4E0D\u662F\u4EE5\u70B9\u5206\u9694\u7684\u6807\u8BC6\u7B26\u5E8F\u5217
 javac.err.invalid.flag=\u65E0\u6548\u7684\u6807\u8BB0: {0}
+javac.err.profile.bootclasspath.conflict=\u6982\u8981\u4FE1\u606F\u548C\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u9009\u9879\u4E0D\u80FD\u540C\u65F6\u4F7F\u7528
 javac.err.invalid.profile=\u914D\u7F6E\u6587\u4EF6\u65E0\u6548: {0}
 javac.err.invalid.target=\u65E0\u6548\u7684\u76EE\u6807\u53D1\u884C\u7248: {0}
 javac.err.no.source.files=\u65E0\u6E90\u6587\u4EF6
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Fri Oct 11 09:17:18 2013 -0400
@@ -234,7 +234,7 @@
     public JCTree visitLabeledStatement(LabeledStatementTree node, P p) {
         JCLabeledStatement t = (JCLabeledStatement) node;
         JCStatement body = copy(t.body, p);
-        return M.at(t.pos).Labelled(t.label, t.body);
+        return M.at(t.pos).Labelled(t.label, body);
     }
 
     public JCTree visitLiteral(LiteralTree node, P p) {
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Oct 11 09:17:18 2013 -0400
@@ -946,6 +946,7 @@
     boolean isUnqualifiable(Symbol sym) {
         if (sym.name == names.empty ||
             sym.owner == null ||
+            sym.owner == syms.rootPackage ||
             sym.owner.kind == MTH || sym.owner.kind == VAR) {
             return true;
         } else if (sym.kind == TYP && toplevel != null) {
--- a/langtools/src/share/classes/com/sun/tools/javac/util/GraphUtils.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/GraphUtils.java	Fri Oct 11 09:17:18 2013 -0400
@@ -103,8 +103,8 @@
      * 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();
+        ListBuffer<List<N>> cycles = new ListBuffer<>();
+        ListBuffer<N> stack = new ListBuffer<>();
         int index = 0;
         for (N node: nodes) {
             if (node.index == -1) {
@@ -132,7 +132,7 @@
         }
         if (v.lowlink == v.index) {
             N n;
-            ListBuffer<N> cycle = ListBuffer.lb();
+            ListBuffer<N> cycle = new ListBuffer<>();
             do {
                 n = stack.remove();
                 n.active = false;
--- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Fri Oct 11 09:17:18 2013 -0400
@@ -97,7 +97,7 @@
     }
 
     public List<A> intersect(List<A> that) {
-        ListBuffer<A> buf = ListBuffer.lb();
+        ListBuffer<A> buf = new ListBuffer<>();
         for (A el : this) {
             if (that.contains(el)) {
                 buf.append(el);
@@ -107,7 +107,7 @@
     }
 
     public List<A> diff(List<A> that) {
-        ListBuffer<A> buf = ListBuffer.lb();
+        ListBuffer<A> buf = new ListBuffer<>();
         for (A el : this) {
             if (!that.contains(el)) {
                 buf.append(el);
@@ -120,7 +120,7 @@
      * Create a new list from the first {@code n} elements of this list
      */
     public List<A> take(int n) {
-        ListBuffer<A> buf = ListBuffer.lb();
+        ListBuffer<A> buf = new ListBuffer<>();
         int count = 0;
         for (A el : this) {
             if (count++ == n) break;
@@ -167,7 +167,7 @@
     }
 
     public static <A> List<A> from(Iterable<? extends A> coll) {
-        ListBuffer<A> xs = ListBuffer.lb();
+        ListBuffer<A> xs = new ListBuffer<>();
         for (A a : coll) {
             xs.append(a);
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -40,10 +40,6 @@
  */
 public class ListBuffer<A> extends AbstractQueue<A> {
 
-    public static <T> ListBuffer<T> lb() {
-        return new ListBuffer<T>();
-    }
-
     public static <T> ListBuffer<T> of(T x) {
         ListBuffer<T> lb = new ListBuffer<T>();
         lb.add(x);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java	Fri Oct 11 09:17:18 2013 -0400
@@ -123,7 +123,7 @@
      * active diagnostic handler.
      */
     public static class DeferredDiagnosticHandler extends DiagnosticHandler {
-        private Queue<JCDiagnostic> deferred = ListBuffer.lb();
+        private Queue<JCDiagnostic> deferred = new ListBuffer<>();
         private final Filter<JCDiagnostic> filter;
 
         public DeferredDiagnosticHandler(Log log) {
--- a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -27,8 +27,13 @@
 main.error=\u30A8\u30E9\u30FC{0}\u500B
 main.warnings=\u8B66\u544A{0}\u500B
 main.warning=\u8B66\u544A{0}\u500B
-main.usage=\u4F7F\u7528\u65B9\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n-overview <file>          HTML\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u6982\u8981\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u8AAD\u307F\u8FBC\u3080\n-public                   public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u793A\u3059\n-protected                protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8)\n-package                  package/protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n-private                  \u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n-help                     \u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n-doclet <class>           \u4EE3\u66FFdoclet\u3092\u4ECB\u3057\u3066\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n-docletpath <path>        doclet\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u63A2\u3059\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n-sourcepath <pathlist>    \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n-classpath <pathlist>     \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n-exclude <pkglist>        \u9664\u5916\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u6307\u5B9A\u3059\u308B\n-subpackages <subpkglist> \u518D\u5E30\u7684\u306B\u30ED\u30FC\u30C9\u3059\u308B\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6307\u5B9A\u3059\u308B\n-breakiterator            BreakIterator\u3067\u6700\u521D\u306E\u6587\u3092\u8A08\u7B97\u3059\u308B\n-bootclasspath <pathlist> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u306B\u3088\u308A\u30ED\u30FC\u30C9\u3055\u308C\u305F\n\t\t\t  \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n-source <release>         \u6307\u5B9A\u3055\u308C\u305F\u30EA\u30EA\u30FC\u30B9\u3068\u30BD\u30FC\u30B9\u306E\u4E92\u63DB\u6027\u3092\u63D0\u4F9B\u3059\u308B\n-extdirs <dirlist>        \u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u305F\u62E1\u5F35\u6A5F\u80FD\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n-verbose                  Javadoc\u306E\u52D5\u4F5C\u306B\u3064\u3044\u3066\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n-locale <name>            en_US\u3084en_US_WIN\u306A\u3069\u306E\u4F7F\u7528\u3059\u308B\u30ED\u30B1\u30FC\u30EB\n-encoding <name>          \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D\n-quiet                    \u72B6\u614B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u306A\u3044\n-J<flag>                  <flag>\u3092\u5B9F\u884C\u6642\u30B7\u30B9\u30C6\u30E0\u306B\u76F4\u63A5\u6E21\u3059\n-X                        \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B\n
-main.Xusage=-Xmaxerrs <number>        \u51FA\u529B\u3059\u308B\u30A8\u30E9\u30FC\u306E\u6700\u5927\u6570\u3092\u8A2D\u5B9A\u3059\u308B\n-Xmaxwarns <number>       \u51FA\u529B\u3059\u308B\u8B66\u544A\u306E\u6700\u5927\u6570\u3092\u8A2D\u5B9A\u3059\u308B\n\n\u3053\u308C\u3089\u306F\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3042\u308A\u4E88\u544A\u306A\u3057\u306B\u5909\u66F4\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002
+
+main.usage=\u4F7F\u7528\u65B9\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n  -overview <file>          HTML\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u6982\u8981\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u8AAD\u307F\u8FBC\u3080\n  -public                   public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u793A\u3059\n  -protected                protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8)\n  -package                  package/protected/public\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n  -private                  \u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u793A\u3059\n  -help                     \u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n  -doclet <class>           \u4EE3\u66FFdoclet\u3092\u4ECB\u3057\u3066\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n  -docletpath <path>        doclet\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u63A2\u3059\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n  -sourcepath <pathlist>    \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n  -classpath <pathlist>     \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\n  -cp <pathlist>                   \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u3042\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B\r\n  -exclude <pkglist>        \u9664\u5916\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u6307\u5B9A\u3059\u308B\n  -subpackages <subpkglist> \u518D\u5E30\u7684\u306B\u30ED\u30FC\u30C9\u3059\u308B\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6307\u5B9A\u3059\u308B\n  -breakiterator            BreakIterator\u3067\u6700\u521D\u306E\u6587\u3092\u8A08\u7B97\u3059\u308B\n  -bootclasspath <pathlist> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u306B\u3088\u308A\u30ED\u30FC\u30C9\u3055\u308C\u305F\n                                   \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n  -source <release>         \u6307\u5B9A\u3055\u308C\u305F\u30EA\u30EA\u30FC\u30B9\u3068\u30BD\u30FC\u30B9\u306E\u4E92\u63DB\u6027\u3092\u63D0\u4F9B\u3059\u308B\n  -extdirs <dirlist>        \u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u305F\u62E1\u5F35\u6A5F\u80FD\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n  -verbose                  Javadoc\u306E\u52D5\u4F5C\u306B\u3064\u3044\u3066\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n  -locale <name>            en_US\u3084en_US_WIN\u306A\u3069\u306E\u4F7F\u7528\u3059\u308B\u30ED\u30B1\u30FC\u30EB\n  -encoding <name>          \u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D\n  -quiet                    \u72B6\u614B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u306A\u3044\n  -J<flag>                  <flag>\u3092\u5B9F\u884C\u6642\u30B7\u30B9\u30C6\u30E0\u306B\u76F4\u63A5\u6E21\u3059\n  -X                        \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3057\u7D42\u4E86\u3059\u308B\n
+
+main.Xusage=\  -Xmaxerrs <number>        \u51FA\u529B\u3059\u308B\u30A8\u30E9\u30FC\u306E\u6700\u5927\u6570\u3092\u8A2D\u5B9A\u3059\u308B\n  -Xmaxwarns <number>       \u51FA\u529B\u3059\u308B\u8B66\u544A\u306E\u6700\u5927\u6570\u3092\u8A2D\u5B9A\u3059\u308B\n
+
+main.Xusage.foot=\u3053\u308C\u3089\u306F\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3042\u308A\u4E88\u544A\u306A\u3057\u306B\u5909\u66F4\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002
+
 main.option.already.seen={0}\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u8907\u6570\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002
 main.requires_argument=\u30AA\u30D7\u30B7\u30E7\u30F3{0}\u306B\u306F\u5F15\u6570\u304C\u5FC5\u8981\u3067\u3059\u3002
 main.locale_first=\u30AA\u30D7\u30B7\u30E7\u30F3-locale\u306F\u3001\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u306E\u6700\u521D\u306B\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
--- a/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -27,8 +27,13 @@
 main.error={0} \u4E2A\u9519\u8BEF
 main.warnings={0} \u4E2A\u8B66\u544A
 main.warning={0} \u4E2A\u8B66\u544A
-main.usage=\u7528\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n-overview <file>          \u4ECE HTML \u6587\u4EF6\u8BFB\u53D6\u6982\u89C8\u6587\u6863\n-public                   \u4EC5\u663E\u793A public \u7C7B\u548C\u6210\u5458\n-protected                \u663E\u793A protected/public \u7C7B\u548C\u6210\u5458 (\u9ED8\u8BA4\u503C)\n-package                  \u663E\u793A package/protected/public \u7C7B\u548C\u6210\u5458\n-private                  \u663E\u793A\u6240\u6709\u7C7B\u548C\u6210\u5458\n-help                     \u663E\u793A\u547D\u4EE4\u884C\u9009\u9879\u5E76\u9000\u51FA\n-doclet <class>            \u901A\u8FC7\u66FF\u4EE3 doclet \u751F\u6210\u8F93\u51FA\n-docletpath <path>        \u6307\u5B9A\u67E5\u627E doclet \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n-sourcepath <pathlist>    \u6307\u5B9A\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E\n-classpath <pathlist>     \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n-exclude <pkglist>        \u6307\u5B9A\u8981\u6392\u9664\u7684\u7A0B\u5E8F\u5305\u5217\u8868\n-subpackages <subpkglist> \u6307\u5B9A\u8981\u9012\u5F52\u52A0\u8F7D\u7684\u5B50\u7A0B\u5E8F\u5305\n-breakiterator            \u8BA1\u7B97\u5E26\u6709 BreakIterator \u7684\u7B2C\u4E00\u4E2A\u8BED\u53E5\n-bootclasspath <pathlist> \u8986\u76D6\u7531\u5F15\u5BFC\u7C7B\u52A0\u8F7D\u5668\u6240\u52A0\u8F7D\u7684\n\t\t\t   \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n-source <release>         \u63D0\u4F9B\u4E0E\u6307\u5B9A\u53D1\u884C\u7248\u7684\u6E90\u517C\u5BB9\u6027\n-extdirs <dirlist>        \u8986\u76D6\u6240\u5B89\u88C5\u6269\u5C55\u7684\u4F4D\u7F6E\n-verbose                  \u8F93\u51FA\u6709\u5173 Javadoc \u6B63\u5728\u6267\u884C\u7684\u64CD\u4F5C\u7684\u4FE1\u606F\n-locale <name>            \u8981\u4F7F\u7528\u7684\u533A\u57DF\u8BBE\u7F6E, \u4F8B\u5982 en_US \u6216 en_US_WIN\n-encoding <name>          \u6E90\u6587\u4EF6\u7F16\u7801\u540D\u79F0\n-quiet                    \u4E0D\u663E\u793A\u72B6\u6001\u6D88\u606F\n-J<flag>                  \u76F4\u63A5\u5C06 <flag> \u4F20\u9012\u5230\u8FD0\u884C\u65F6\u7CFB\u7EDF\n-X                        \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981\n
-main.Xusage=-Xmaxerrs <number>        \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u6700\u5927\u9519\u8BEF\u6570\n-Xmaxwarns <number>       \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u6700\u5927\u8B66\u544A\u6570\n\n\u8FD9\u4E9B\u9009\u9879\u90FD\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002
+
+main.usage=\u7528\u6CD5: javadoc [options] [packagenames] [sourcefiles] [@files]\n  -overview <file>                 \u4ECE HTML \u6587\u4EF6\u8BFB\u53D6\u6982\u89C8\u6587\u6863\n  -public                          \u4EC5\u663E\u793A public \u7C7B\u548C\u6210\u5458\n  -protected                       \u663E\u793A protected/public \u7C7B\u548C\u6210\u5458 (\u9ED8\u8BA4\u503C)\n  -package                         \u663E\u793A package/protected/public \u7C7B\u548C\u6210\u5458\n  -private                         \u663E\u793A\u6240\u6709\u7C7B\u548C\u6210\u5458\n  -help                            \u663E\u793A\u547D\u4EE4\u884C\u9009\u9879\u5E76\u9000\u51FA\n  -doclet <class>                  \u901A\u8FC7\u66FF\u4EE3 doclet \u751F\u6210\u8F93\u51FA\n  -docletpath <path>               \u6307\u5B9A\u67E5\u627E doclet \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n  -sourcepath <pathlist>           \u6307\u5B9A\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E\n  -classpath <pathlist>            \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n  -cp <pathlist>                   \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n  -exclude <pkglist>               \u6307\u5B9A\u8981\u6392\u9664\u7684\u7A0B\u5E8F\u5305\u5217\u8868\n  -subpackages <subpkglist>        \u6307\u5B9A\u8981\u9012\u5F52\u52A0\u8F7D\u7684\u5B50\u7A0B\u5E8F\u5305\n  -breakiterator                   \u8BA1\u7B97\u5E26\u6709 BreakIterator \u7684\u7B2C\u4E00\u4E2A\u8BED\u53E5\n  -bootclasspath <pathlist>        \u8986\u76D6\u7531\u5F15\u5BFC\u7C7B\u52A0\u8F7D\u5668\u6240\u52A0\u8F7D\u7684\n                                   \u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n  -source <release>                \u63D0\u4F9B\u4E0E\u6307\u5B9A\u53D1\u884C\u7248\u7684\u6E90\u517C\u5BB9\u6027\n  -extdirs <dirlist>               \u8986\u76D6\u6240\u5B89\u88C5\u6269\u5C55\u7684\u4F4D\u7F6E\n  -verbose                         \u8F93\u51FA\u6709\u5173 Javadoc \u6B63\u5728\u6267\u884C\u7684\u64CD\u4F5C\u7684\u4FE1\u606F\n  -locale <name>                   \u8981\u4F7F\u7528\u7684\u533A\u57DF\u8BBE\u7F6E, \u4F8B\u5982 en_US \u6216 en_US_WIN\n  -encoding <name>                 \u6E90\u6587\u4EF6\u7F16\u7801\u540D\u79F0\n  -quiet                           \u4E0D\u663E\u793A\u72B6\u6001\u6D88\u606F\n  -J<flag>                         \u76F4\u63A5\u5C06 <flag> \u4F20\u9012\u5230\u8FD0\u884C\u65F6\u7CFB\u7EDF\n  -X                               \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981\n
+
+main.Xusage=\  -Xmaxerrs <number>               \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u6700\u5927\u9519\u8BEF\u6570\n  -Xmaxwarns <number>              \u8BBE\u7F6E\u8981\u8F93\u51FA\u7684\u6700\u5927\u8B66\u544A\u6570\n
+
+main.Xusage.foot=\u8FD9\u4E9B\u9009\u9879\u90FD\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002
+
 main.option.already.seen={0}\u9009\u9879\u53EA\u80FD\u6307\u5B9A\u4E00\u6B21\u3002
 main.requires_argument=\u9009\u9879{0}\u9700\u8981\u53C2\u6570\u3002
 main.locale_first=\u5728\u547D\u4EE4\u884C\u4E2D, \u9009\u9879 -locale \u5FC5\u987B\u4E3A\u7B2C\u4E00\u4E2A\u9009\u9879\u3002
--- a/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_ja.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_ja.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2010, 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
@@ -49,7 +49,7 @@
 #
 # Usage message.
 #
-usage=\u4F7F\u7528\u65B9\u6CD5: javah [options] <classes>\n\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n\n\t-help           \u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n\t-classpath <path>   \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-bootclasspath <path> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-d<dir>         \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n\t-o <file>         \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B)\n\t-jni           JNI\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\t-version         \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3059\u308B\n\t-verbose         \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n\t-force          \u5E38\u306B\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080\n\n<classes> \u306F\u5B8C\u5168\u6307\u5B9A\u306E\u540D\u524D\u3067\u6307\u5B9A\u3057\u307E\u3059\n(java.lang.Object\u306A\u3069)\u3002\n
+usage=\u4F7F\u7528\u65B9\u6CD5: javah [options] <classes>\n\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n\n\t-help           \u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n\t-classpath <path>   \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-cp <path>            \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\r\n\t-bootclasspath <path> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-d<dir>         \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n\t-o <file>         \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B)\n\t-jni           JNI\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\t-version         \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3059\u308B\n\t-verbose         \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n\t-force          \u5E38\u306B\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080\n\n<classes>\u306F\u5B8C\u5168\u6307\u5B9A\u306E\u540D\u524D\u3067\u6307\u5B9A\u3057\u307E\u3059\n(java.lang.Object\u306A\u3069)\u3002\n
 
 main.usage=\u4F7F\u7528\u65B9\u6CD5: \n  javah [options] <classes>\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002
 main.opt.o=\  -o <file>                \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B)
@@ -60,6 +60,7 @@
 main.opt.jni=\  -jni                     JNI\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)
 main.opt.force=\  -force                   \u5E38\u306B\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080
 main.opt.classpath=\  -classpath <path>        \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
+main.opt.cp=\  -cp <path>               \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
 main.opt.bootclasspath=\  -bootclasspath <path>    \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9
 main.usage.foot=<classes>\u306F\u5B8C\u5168\u6307\u5B9A\u306E\u540D\u524D\u3067\u6307\u5B9A\u3057\u307E\u3059\n(java.lang.Object\u306A\u3069)\u3002
 
@@ -90,7 +91,7 @@
 err.prefix=\u30A8\u30E9\u30FC:
 err.cant.use.option.for.fm=\u6307\u5B9A\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u30FB\u30DE\u30CD\u30FC\u30B8\u30E3\u3067{0}\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
 err.internal.error=\u5185\u90E8\u30A8\u30E9\u30FC: {0}
-err.ioerror=\u5165\u51FA\u529B\u30A8\u30E9\u30FC: {0}
+err.ioerror=IO\u30A8\u30E9\u30FC: {0}
 err.missing.arg={0}\u306E\u5024\u304C\u3042\u308A\u307E\u305B\u3093
 err.no.classes.specified=\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
 err.unknown.option=\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}
--- a/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2010, 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
@@ -49,7 +49,7 @@
 #
 # Usage message.
 #
-usage=\u7528\u6CD5: javah [options] <classes>\n\n\u5176\u4E2D, [options] \u5305\u62EC:\n\n\t-help                 \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\u5E76\u9000\u51FA\n\t-classpath <path>     \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84\n\t-bootclasspath <path> \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84\n\t-d <dir>              \u8F93\u51FA\u76EE\u5F55\n\t-o <file>             \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00)\n\t-jni                  \u751F\u6210 JNI \u6837\u5F0F\u7684\u6807\u5934\u6587\u4EF6 (\u9ED8\u8BA4\u503C)\n\t-version              \u8F93\u51FA\u7248\u672C\u4FE1\u606F\n\t-verbose              \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\t-force                \u59CB\u7EC8\u5199\u5165\u8F93\u51FA\u6587\u4EF6\n\n<classes> \u662F\u4F7F\u7528\u5176\u5168\u9650\u5B9A\u540D\u79F0\u6307\u5B9A\u7684,\n(\u4F8B\u5982 java.lang.Object)\u3002\n
+usage=\u7528\u6CD5: javah [options] <classes>\n\n\u5176\u4E2D, [options] \u5305\u62EC:\n\n\t-help                 \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\u5E76\u9000\u51FA\n\t-classpath <path>     \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84\n\t-cp <path>            \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84\n\t-bootclasspath <path> \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84\n\t-d <dir>              \u8F93\u51FA\u76EE\u5F55\n\t-o <file>             \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00)\n\t-jni                  \u751F\u6210 JNI \u6837\u5F0F\u7684\u6807\u5934\u6587\u4EF6 (\u9ED8\u8BA4\u503C)\n\t-version              \u8F93\u51FA\u7248\u672C\u4FE1\u606F\n\t-verbose              \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\t-force                \u59CB\u7EC8\u5199\u5165\u8F93\u51FA\u6587\u4EF6\n\n<classes> \u662F\u4F7F\u7528\u5176\u5168\u9650\u5B9A\u540D\u79F0\u6307\u5B9A\u7684,\n(\u4F8B\u5982, java.lang.Object)\u3002\n
 
 main.usage=\u7528\u6CD5: \n  javah [options] <classes>\n\u5176\u4E2D, [options] \u5305\u62EC:
 main.opt.o=\  -o <file>                \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00)
@@ -60,6 +60,7 @@
 main.opt.jni=\  -jni                     \u751F\u6210 JNI \u6837\u5F0F\u7684\u6807\u5934\u6587\u4EF6 (\u9ED8\u8BA4\u503C)
 main.opt.force=\  -force                   \u59CB\u7EC8\u5199\u5165\u8F93\u51FA\u6587\u4EF6
 main.opt.classpath=\  -classpath <path>        \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84
+main.opt.cp=\  -cp <path>               \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84
 main.opt.bootclasspath=\  -bootclasspath <path>    \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84
 main.usage.foot=<classes> \u662F\u4F7F\u7528\u5176\u5168\u9650\u5B9A\u540D\u79F0\u6307\u5B9A\u7684\n(\u4F8B\u5982, java.lang.Object)\u3002
 
--- a/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javap/CodeWriter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -208,7 +208,7 @@
 
 
     public void writeExceptionTable(Code_attribute attr) {
-        if (attr.exception_table_langth > 0) {
+        if (attr.exception_table_length > 0) {
             println("Exception table:");
             indent(+1);
             println(" from    to  target type");
--- a/langtools/src/share/classes/com/sun/tools/javap/resources/javap_ja.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javap/resources/javap_ja.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 
-err.prefix=\u30A8\u30E9\u30FC: 
+err.prefix=\u30A8\u30E9\u30FC:
 
 err.bad.constant.pool={0}\u306E\u5B9A\u6570\u30D7\u30FC\u30EB\u306E\u8AAD\u53D6\u308A\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {1}
 err.class.not.found=\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
@@ -55,6 +55,8 @@
 
 main.opt.classpath=\  -classpath <path>        \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
 
+main.opt.cp=\  -cp <path>               \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
+
 main.opt.bootclasspath=\  -bootclasspath <path>    \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
 
 main.opt.constants=\  -constants               \u9759\u7684final\u5B9A\u6570\u3092\u8868\u793A\u3059\u308B
--- a/langtools/src/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 
-err.prefix=\u9519\u8BEF: 
+err.prefix=\u9519\u8BEF:
 
 err.bad.constant.pool=\u8BFB\u53D6{0}\u7684\u5E38\u91CF\u6C60\u65F6\u51FA\u9519: {1}
 err.class.not.found=\u627E\u4E0D\u5230\u7C7B: {0}
@@ -55,6 +55,8 @@
 
 main.opt.classpath=\  -classpath <path>        \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
 
+main.opt.cp=\  -cp <path>               \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
+
 main.opt.bootclasspath=\  -bootclasspath <path>    \u8986\u76D6\u5F15\u5BFC\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
 
 main.opt.constants=\  -constants               \u663E\u793A\u9759\u6001\u6700\u7EC8\u5E38\u91CF
--- a/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/BuildState.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -81,12 +81,13 @@
     }
 
     /**
-     * Collect all packages, sources and artifacts for all modules
-     * into the build state.
+     * Store references to all packages, sources and artifacts for all modules
+     * into the build state. I.e. flatten the module tree structure
+     * into global maps stored in the BuildState for easy access.
      *
      * @param m The set of modules.
      */
-    public void collectPackagesSourcesAndArtifacts(Map<String,Module> m) {
+    public void flattenPackagesSourcesAndArtifacts(Map<String,Module> m) {
         modules = m;
         // Extract all the found packages.
         for (Module i : modules.values()) {
@@ -121,11 +122,12 @@
     }
 
     /**
-     * Collect all the artifacts of all modules and packages.
+     * Store references to all artifacts found in the module tree into the maps
+     * stored in the build state.
      *
      * @param m The set of modules.
      */
-    public void collectArtifacts(Map<String,Module> m) {
+    public void flattenArtifacts(Map<String,Module> m) {
         modules = m;
         // Extract all the found packages.
         for (Module i : modules.values()) {
@@ -270,6 +272,8 @@
             Module mnew = findModuleFromPackageName(pkg);
             Package pprev = prev.packages().get(pkg);
             mnew.addPackage(pprev);
+            // Do not forget to update the flattened data.
+            packages.put(pkg, pprev);
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Main.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Main.java	Fri Oct 11 09:17:18 2013 -0400
@@ -274,7 +274,7 @@
 //          findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true);
 
             // Add the set of sources to the build database.
-            javac_state.now().collectPackagesSourcesAndArtifacts(modules);
+            javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
             javac_state.now().checkInternalState("checking sources", false, sources);
             javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to);
             javac_state.setVisibleSources(sources_to_link_to);
@@ -311,7 +311,7 @@
             Map<String,Source> generated_sources = new HashMap<String,Source>();
             Source.scanRoot(gensrc_dir, Util.set(".java"), null, null, null, null,
                    generated_sources, modules, current_module, false, true, false);
-            javac_state.now().collectPackagesSourcesAndArtifacts(modules);
+            javac_state.now().flattenPackagesSourcesAndArtifacts(modules);
             // Recheck the the source files and their timestamps again.
             javac_state.checkSourceStatus(true);
 
@@ -336,8 +336,8 @@
             // Only update the state if the compile went well.
             if (rc[0]) {
                 javac_state.save();
-                // Collect all the artifacts.
-                javac_state.now().collectArtifacts(modules);
+                // Reflatten only the artifacts.
+                javac_state.now().flattenArtifacts(modules);
                 // Remove artifacts that were generated during the last compile, but not this one.
                 javac_state.removeSuperfluousArtifacts(recently_compiled);
             }
--- a/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java	Fri Oct 11 09:17:18 2013 -0400
@@ -464,7 +464,7 @@
             PrintStream err) {
         int rc = -3;
         try {
-            int port = portFile.getPort();
+            int port = portFile.containsPortInfo() ? portFile.getPort() : 0;
             if (port == 0) {
                 return ERROR_BUT_TRY_AGAIN;
             }
--- a/langtools/test/com/sun/javadoc/lib/JavadocTester.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/lib/JavadocTester.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,7 @@
     protected static final String SRC_DIR = System.getProperty("test.src", ".");
     protected static final String JAVA_VERSION = System.getProperty("java.version");
     protected static final String[][] NO_TEST = new String[][] {};
+    protected static final String[] NO_FILE_TEST = new String[] {};
 
     /**
      * Use this as the file name in the test array when you want to search
@@ -166,6 +167,26 @@
     }
 
     /**
+     * Execute the tests.
+     *
+     * @param tester               the tester to execute
+     * @param args                 the arguments to pass to Javadoc
+     * @param testArray            the array of tests
+     * @param negatedTestArray     the array of negated tests
+     * @param fileTestArray        the array of file tests
+     * @param negatedFileTestArray the array of negated file tests
+     * @return                     the return code for the execution of Javadoc
+     */
+    public static int run(JavadocTester tester, String[] args,
+            String[][] testArray, String[][] negatedTestArray, String[] fileTestArray,
+            String[] negatedFileTestArray) {
+        int returnCode = tester.runJavadoc(args);
+        tester.runTestsOnHTML(testArray, negatedTestArray);
+        tester.runTestsOnFile(fileTestArray, negatedFileTestArray);
+        return returnCode;
+    }
+
+    /**
      * Execute Javadoc using the default doclet.
      *
      * @param args  the arguments to pass to Javadoc
@@ -244,6 +265,19 @@
     }
 
     /**
+     * Run array of tests on the generated files.
+     * This method accepts a fileTestArray for testing if a file is generated
+     * and a negatedFileTestArray for testing if a file is not found.
+     *
+     * @param testArray         the array of file tests
+     * @param negatedTestArray  the array of negated file tests
+     */
+    public void runTestsOnFile(String[] fileTestArray, String[] negatedFileTestArray) {
+        runTestsOnFile(fileTestArray, false);
+        runTestsOnFile(negatedFileTestArray, true);
+    }
+
+    /**
      * Run the array of tests on the resulting HTML.
      *
      * @param testArray the array of tests
@@ -265,9 +299,11 @@
                 fileString = readFileToString(testArray[i][0]);
             } catch (Error e) {
                 if (isNegated) {
-                  numTestsPassed += 1;
-                  System.out.println("Passed\n not found:\n"
-                    + stringToFind + " in non-existent " + testArray[i][0] + "\n");
+                  System.out.println( "FAILED" + "\n"
+                                    + "for bug " + getBugId()
+                                    + " (" + getBugName() + ") "
+                                    + "due to "
+                                    + e + "\n");
                   continue;
                 }
                 throw e;
@@ -291,6 +327,39 @@
     }
 
     /**
+     * Run the array of file tests on the generated files.
+     *
+     * @param testArray the array of file tests
+     * @param isNegated true if test is negated; false otherwise
+     */
+    private void runTestsOnFile(String[] testArray, boolean isNegated) {
+        String fileName;
+        String failedString;
+        String passedString;
+        for (int i = 0; i < testArray.length; i++) {
+            numTestsRun++;
+            fileName = testArray[i];
+            failedString = "FAILED" + "\n"
+                    + "for bug " + getBugId() + " (" + getBugName() + ") "
+                    + "file (" + fileName + ") found" + "\n";
+            passedString = "Passed" + "\n" +
+                        "file (" + fileName + ") not found" + "\n";
+            System.out.print("Running subtest #" + numTestsRun + "... ");
+            try {
+                File file = new File(fileName);
+                if ((file.exists() && !isNegated) || (!file.exists() && isNegated)) {
+                    numTestsPassed += 1;
+                    System.out.println(passedString);
+                } else {
+                    System.out.println(failedString);
+                }
+            } catch (Error e) {
+                System.err.println(e);
+            }
+        }
+    }
+
+    /**
      * Iterate through the list of given file pairs and diff each file.
      *
      * @param filePairs the pairs of files to diff.
--- a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,20 +23,19 @@
 
 /*
  * @test
- * @bug      4973609
+ * @bug      4973609 8015249
  * @summary  Make sure that annotation types with 0 members does not have
  *           extra HR tags.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestAnnotationTypes
+ * @build    JavadocTester TestAnnotationTypes
  * @run main TestAnnotationTypes
  */
 
 public class TestAnnotationTypes extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4973609";
+    private static final String BUG_ID = "4973609-8015249";
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
@@ -44,7 +43,31 @@
     };
 
     //Input for string search tests.
-    private static final String[][] TEST = NO_TEST;
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
+            "<li>Summary:&nbsp;</li>" + NL + "<li><a href=\"#annotation_type_" +
+            "field_summary\">Field</a>&nbsp;|&nbsp;</li>"},
+        {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
+            "<li>Detail:&nbsp;</li>" + NL + "<li><a href=\"#annotation_type_" +
+            "field_detail\">Field</a>&nbsp;|&nbsp;</li>"},
+        {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
+            "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"},
+        {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
+            "<h3>Field Summary</h3>"},
+        {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
+            "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../" +
+            "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>" +
+            "</code>&nbsp;</td>"},
+        {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
+            "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->"},
+        {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
+            "<h4>DEFAULT_NAME</h4>" + NL + "<pre>public static final&nbsp;java." +
+            "lang.String&nbsp;DEFAULT_NAME</pre>"},
+        {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+            "<li>Summary:&nbsp;</li>" + NL + "<li>Field&nbsp;|&nbsp;</li>"},
+        {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
+            "<li>Detail:&nbsp;</li>" + NL + "<li>Field&nbsp;|&nbsp;</li>"},
+    };
     private static final String[][] NEGATED_TEST = {
         {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
             "<HR>" + NL + NL + "<P>" + NL + NL + "<P>" +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/pkg/AnnotationTypeField.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This is just a test for annotation type fields.
+ */
+@Documented public @interface AnnotationTypeField {
+    String DEFAULT_NAME = "test";
+
+    String name() default DEFAULT_NAME;
+}
--- a/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 4258405 4973606
+ * @bug 4258405 4973606 8024096
  * @summary This test verifies that the doc-file directory does not
  *          get overwritten when the sourcepath is equal to the destination
  *          directory.
@@ -47,25 +47,17 @@
         };
     private static final String[][] NEGATED_TEST1 = NO_TEST;
 
-    private static final String[][] TEST2 = {
-        {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used1" +
+    private static final String[] FILE_TEST2 = {
+        BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used1" +
             FS + "testfile.txt",
-            "passed"
-        },
-        {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used2" +
-            FS + "testfile.txt",
-            "passed"
-        },
+        BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used2" +
+            FS + "testfile.txt"
     };
-    private static final String[][] NEGATED_TEST2 = {
-        {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded1" +
+    private static final String[] FILE_NEGATED_TEST2 = {
+        BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded1" +
             FS + "testfile.txt",
-            "passed"
-        },
-        {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded2" +
-            FS + "testfile.txt",
-            "passed"
-        },
+        BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded2" +
+            FS + "testfile.txt"
     };
 
     private static final String[][] TEST0 = {
@@ -106,7 +98,7 @@
         run(tester, ARGS0, TEST0, NEGATED_TEST0);
         copyDir(SRC_DIR + FS + "pkg", BUG_ID + "-1");
         run(tester, ARGS1, TEST1, NEGATED_TEST1);
-        run(tester, ARGS2, TEST2, NEGATED_TEST2);
+        run(tester, ARGS2, NO_TEST, NO_TEST, FILE_TEST2, FILE_NEGATED_TEST2);
         tester.printSummary();
     }
 
--- a/langtools/test/com/sun/javadoc/testEncoding/EncodeTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testEncoding/EncodeTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 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
@@ -23,7 +23,9 @@
 
 
 /**
- * ±ñÉ¿í ¹©¢!
+ * Testing en\u00e7\u00f4ded string.
+ * In the encoded comment string, Unicode U+00E7 is "Latin small letter C with cedilla"
+ * and Unicode U+00F4 is "Latin small letter O with circumflex"
  */
 public class EncodeTest {
 }
--- a/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4661481
+ * @bug 4661481 8024096
  * @summary This test determines if the value of the -encoding option is
  * properly passed from Javadoc to the source file parser.
  * @author jamieh
@@ -40,12 +40,12 @@
 
     //If ??? is found in the output, the source file was not read with the correct encoding setting.
     private static final String[][] NEGATED_TEST = {
-        {BUG_ID + FS + "EncodeTest.html", "???"}
+        {BUG_ID + FS + "EncodeTest.html", "??"}
     };
     private static final String[] ARGS =
         new String[] {
             "-d", BUG_ID, "-sourcepath", SRC_DIR,
-            "-encoding", "SJIS", SRC_DIR + FS + "EncodeTest.java"
+            "-encoding", "iso-8859-1", SRC_DIR + FS + "EncodeTest.java"
         };
 
     /**
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4663254
+ * @bug      4663254 8016328
  * @summary  Verify that spaces do not appear in hrefs and anchors.
  * @author   jamieh
  * @library  ../lib/
@@ -46,11 +46,11 @@
     private static final String[][] TEST = {
         //External link.
         {BUG_ID + FS + "pkg" + FS + "C1.html",
-            "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long, int)\""
+            "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)\""
         },
         //Member summary table link.
         {BUG_ID + FS + "pkg" + FS + "C1.html",
-            "href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\""
+            "href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\""
         },
         //Anchor test.
         {BUG_ID + FS + "pkg" + FS + "C1.html",
@@ -66,11 +66,11 @@
         },
         //{@link} test.
         {BUG_ID + FS + "pkg" + FS + "C2.html",
-            "Link: <a href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
+            "Link: <a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">"
         },
         //@see test.
         {BUG_ID + FS + "pkg" + FS + "C2.html",
-            "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
+            "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">"
         },
 
         //Header does not link to the page itself.
--- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4665566 4855876 7025314 8012375 8015997
+ * @bug      4665566 4855876 7025314 8012375 8015997 8016328
  * @summary  Verify that the output has the right javascript.
  * @author   jamieh
  * @library  ../lib/
@@ -56,6 +56,12 @@
             "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL +
             "        targetPage = \"undefined\";" + NL +
             "    function validURL(url) {" + NL +
+            "        try {" + NL +
+            "            url = decodeURIComponent(url);" + NL +
+            "        }" + NL +
+            "        catch (error) {" + NL +
+            "            return false;" + NL +
+            "        }" + NL +
             "        var pos = url.indexOf(\".html\");" + NL +
             "        if (pos == -1 || pos != url.length - 5)" + NL +
             "            return false;" + NL +
@@ -67,7 +73,8 @@
             "            if ('a' <= ch && ch <= 'z' ||" + NL +
             "                    'A' <= ch && ch <= 'Z' ||" + NL +
             "                    ch == '$' ||" + NL +
-            "                    ch == '_') {" + NL +
+            "                    ch == '_' ||" + NL +
+            "                    ch.charCodeAt(0) > 127) {" + NL +
             "                allowNumber = true;" + NL +
             "                allowSep = true;" + NL +
             "            } else if ('0' <= ch && ch <= '9'" + NL +
--- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4732864 6280605 7064544 8014636
+ * @bug      4732864 6280605 7064544 8014636 8016328
  * @summary  Make sure that you can link from one member to another using
  *           non-qualified name, furthermore, ensure the right one is linked.
  * @author   jamieh
@@ -49,9 +49,9 @@
             "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
             " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
             " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
-            " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
-            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
-            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
+            " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
+            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
+            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
         },
         {BUG_ID + FS + "pkg" + FS + "C.InnerC.html",
             "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL +
--- a/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8002304
+ * @bug      8002304 8024096
  * @summary  Test for various method types in the method summary table
  * @author   Bhavesh Patel
  * @library  ../lib/
@@ -107,7 +107,7 @@
             "</caption>"
         },
 
-        {BUG_ID + FS + "pkg" + FS + "D.html",
+        {BUG_ID + FS + "pkg1" + FS + "D.html",
             "<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>" +
             "</caption>"
         },
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Fri Oct 11 09:17:18 2013 -0400
@@ -155,13 +155,13 @@
             //=================================
             //Make sure the summary links are correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
-                "<li>Summary:&nbsp;</li>" + NL +
+                "<li>Summary:&nbsp;</li>" + NL + "<li>Field&nbsp;|&nbsp;</li>" + NL +
                 "<li><a href=\"#annotation_type_required_element_summary\">" +
                 "Required</a>&nbsp;|&nbsp;</li>" + NL + "<li>" +
                 "<a href=\"#annotation_type_optional_element_summary\">Optional</a></li>"},
             //Make sure the detail links are correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
-                "<li>Detail:&nbsp;</li>" + NL +
+                "<li>Detail:&nbsp;</li>" + NL + "<li>Field&nbsp;|&nbsp;</li>" + NL +
                 "<li><a href=\"#annotation_type_element_detail\">Element</a></li>"},
             //Make sure the heading is correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4780441 4874845 4978816 8014017
+ * @bug      4780441 4874845 4978816 8014017 8016328
  * @summary  Make sure that when the -private flag is not used, members
  *           inherited from package private class are documented in the child.
  *
@@ -177,7 +177,7 @@
         // Should document that a method overrides method from private class.
        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
             "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
-            "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[], int, T, V, java.util.List)\">" +
+            "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[],%20int,%20T,%20V,%20java.util.List)\">" +
             "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>" +
             "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
             "PrivateParent</a></code></dd>"},
--- a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8006124 8009684 8016921 8023700
+ * @bug      8006124 8009684 8016921 8023700 8024096
  * @summary  Test javadoc support for profiles.
  * @author   Bhavesh Patel, Evgeniya Stepanova
  * @library  ../lib/
@@ -187,26 +187,6 @@
         }
     };
     private static final String[][] PACKAGES_NEGATED_TEST = {
-        {PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
-            "<span><a href=\"overview-frame.html\" "
-            + "target=\"packageListFrame\">All&nbsp;Packages</a></span>"
-        },
-        {PACKAGE_BUG_ID + FS + "compact2-frame.html",
-            "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
-            + "All&nbsp;Packages</a></span><span><a href=\"profile-overview-frame.html\" "
-            + "target=\"packageListFrame\">All&nbsp;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=\"packageListFrame\">All&nbsp;Profiles</a></span>"
@@ -222,6 +202,13 @@
             "</ul>"
         }
     };
+    private static final String[] PACKAGES_NEGATED_FILE_TEST = {
+        PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
+        PACKAGE_BUG_ID + FS + "compact2-frame.html",
+        PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
+        PACKAGE_BUG_ID + FS + "compact2-summary.html",
+        PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html"
+    };
 
     /**
      * The entry point of the test.
@@ -231,7 +218,7 @@
     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);
+        run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST, NO_FILE_TEST, PACKAGES_NEGATED_FILE_TEST);
         tester.printSummary();
     }
 
--- a/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4496290 4985072 7006178 7068595
+ * @bug 4496290 4985072 7006178 7068595 8016328
  * @summary A simple test to determine if -use works.
  * @author jamieh
  * @library ../lib/
@@ -60,7 +60,7 @@
                  "UsedInC</a> in <a href=\"../package-summary.html\">&lt;Unnamed&gt;</a>"
         },
         {BUG_ID + "-3" + FS + "package-use.html", "<td class=\"colOne\">" +
-                 "<a href=\"class-use/UsedInC.html#&lt;Unnamed&gt;\">UsedInC</a>&nbsp;</td>"
+                 "<a href=\"class-use/UsedInC.html#%3CUnnamed%3E\">UsedInC</a>&nbsp;</td>"
         }
     };
 
--- a/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,13 +23,12 @@
 
 /*
  * @test
- * @bug      4764045
+ * @bug      4764045 8004825
  * @summary  This test ensures that the value tag works in all
  * use cases. The explainations for each test case are written below.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestValueTag
+ * @build    JavadocTester TestValueTag
  * @run main TestValueTag
  */
 
@@ -41,8 +40,14 @@
     //Javadoc arguments.
     private static final String[] ARGS =
         new String[] {
+            "-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
+            "todo", "pkg1", "pkg2"
+        };
+
+    private static final String[] ARGS1 =
+        new String[] {
             "-Xdoclint:none",
-            "-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
+            "-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, "-tag",
             "todo", "pkg1", "pkg2"
         };
 
@@ -91,16 +96,58 @@
         {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
             "<dt><span class=\"strong\">Todo:</span></dt>" + NL +
                 "<dd>the value of this constant is 55.</dd>"},
+        //Test @value errors printed dues to invalid use or when used with
+        //non-constant or with bad references.
+        {ERROR_OUTPUT,"error: value does not refer to a constant" + NL +
+            "     * Result:  {@value TEST_12_ERROR}"
+        },
+        {ERROR_OUTPUT,"error: {@value} not allowed here" + NL +
+            "     * Result:  {@value}"
+        },
+        {ERROR_OUTPUT,"error: value does not refer to a constant" + NL +
+            "     * Result:  {@value NULL}"
+        },
+        {ERROR_OUTPUT,"error: {@value} not allowed here" + NL +
+            "     * Invalid (null): {@value}"
+        },
+        {ERROR_OUTPUT,"error: {@value} not allowed here" + NL +
+            "     * Invalid (non-constant field): {@value}"
+        },
+        {ERROR_OUTPUT,"error: value does not refer to a constant" + NL +
+            "     * Here is a bad value reference: {@value UnknownClass#unknownConstant}"
+        },
+        {ERROR_OUTPUT,"error: reference not found" + NL +
+            "     * Here is a bad value reference: {@value UnknownClass#unknownConstant}"
+        },
+        {ERROR_OUTPUT,"error: {@value} not allowed here" + NL +
+            "     * @todo the value of this constant is {@value}"
+        }
+    };
+    private static final String[][] TEST1 = {
         //Test @value warning printed when used with non-constant.
         {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " +
             "can only be used in constants."
         },
+        {WARNING_OUTPUT,"warning - @value tag (which references NULL) " +
+            "can only be used in constants."
+        },
+        {WARNING_OUTPUT,"warning - @value tag (which references TEST_12_ERROR) " +
+            "can only be used in constants."
+        },
         //Test warning printed for bad reference.
         {WARNING_OUTPUT,"warning - UnknownClass#unknownConstant (referenced by " +
             "@value tag) is an unknown reference."
         },
+        //Test warning printed for invalid use of @value.
+        {WARNING_OUTPUT,"warning - @value tag cannot be used here."
+        }
     };
-    private static final String[][] NEGATED_TEST = NO_TEST;
+    private static final String[][] NEGATED_TEST = {
+        //Base case:  using @value on a constant.
+        {BUG_ID + FS + "pkg1" + FS + "Class1.html",
+            "Result:  <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 " +
+            "generates an error message\"</a>"},
+    };
 
     /**
      * The entry point of the test.
@@ -109,9 +156,18 @@
     public static void main(String[] args) {
         TestValueTag tester = new TestValueTag();
         run(tester, ARGS, TEST, NEGATED_TEST);
+        checkForException(tester);
+        run(tester, ARGS1, TEST1, NO_TEST);
+        checkForException(tester);
         tester.printSummary();
     }
 
+    public static void checkForException(TestValueTag tester) {
+        if (tester.getErrorOutput().contains("DocletAbortException")) {
+            throw new AssertionError("javadoc threw DocletAbortException");
+        }
+    }
+
     /**
      * {@inheritDoc}
      */
--- a/langtools/test/com/sun/javadoc/testValueTag/pkg1/Class1.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/com/sun/javadoc/testValueTag/pkg1/Class1.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 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
@@ -45,6 +45,16 @@
     public static final String TEST_11_PASSES = "Test 11 passes";
 
     /**
+     * Invalid (non-constant field): {@value}
+     */
+    public static String TEST_12_ERROR = "Test 12 generates an error message";
+
+    /**
+     * Invalid (null): {@value}
+     */
+    public static final String NULL = null;
+
+    /**
      * Result:  {@value TEST_3_PASSES}
      */
     public int field;
@@ -60,6 +70,21 @@
     public void method() {}
 
     /**
+     * Result:  {@value TEST_12_ERROR}
+     */
+    public void invalidValueTag1() {}
+
+    /**
+     * Result:  {@value}
+     */
+    public void invalidValueTag2() {}
+
+    /**
+     * Result:  {@value NULL}
+     */
+    public void testNullConstant() {}
+
+    /**
      * Result:  {@value pkg1.Class1#TEST_6_PASSES}
      */
     public class NestedClass{}
--- a/langtools/test/tools/doclint/ReferenceTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/doclint/ReferenceTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832 8020556
+ * @bug 8004832 8020556 8002154
  * @summary Add new doclint package
  * @build DocLintTester
  * @run main DocLintTester -Xmsgs:-reference ReferenceTest.java
@@ -54,5 +54,13 @@
      * @throws T description
      */
     public <T extends Throwable> void valid_throws_generic() throws T { }
+
+    /**
+     * {@link java.util.List<String>}
+     * {@link java.util.List<String>#equals}
+     * @see java.util.List<String>
+     * @see java.util.List<String>#equals
+     */
+    public void invalid_type_args() { }
 }
 
--- a/langtools/test/tools/doclint/ReferenceTest.out	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/doclint/ReferenceTest.out	Fri Oct 11 09:17:18 2013 -0400
@@ -25,6 +25,18 @@
 ReferenceTest.java:48: error: exception not thrown: java.lang.Exception
      * @throws Exception description
                ^
-8 errors
+ReferenceTest.java:59: error: type arguments not allowed here
+     * {@link java.util.List<String>}
+              ^
+ReferenceTest.java:60: error: type arguments not allowed here
+     * {@link java.util.List<String>#equals}
+              ^
+ReferenceTest.java:61: error: type arguments not allowed here
+     * @see java.util.List<String>
+            ^
+ReferenceTest.java:62: error: type arguments not allowed here
+     * @see java.util.List<String>#equals
+            ^
+12 errors
 1 warning
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/ValueTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,67 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8025272
+ * @summary doclint needs to check for valid usage of at-value tag
+ * @build DocLintTester
+ * @run main DocLintTester -ref ValueTest.out ValueTest.java
+ */
+
+/** */
+public class ValueTest {
+    /*
+     * Tests for {@value} without a reference
+     */
+
+    /** valid: {@value} */
+    public static final boolean cBoolean = false;
+
+    /** valid: {@value} */
+    public static final byte cByte = 0;
+
+    /** valid: {@value} */
+    public static final short cShort = 0;
+
+    /** valid: {@value} */
+    public static final int cInt = 0;
+
+    /** valid: {@value} */
+    public static final long cLong = 0L;
+
+    /** valid: {@value} */
+    public static final float cFloat = 0.0f;
+
+    /** valid: {@value} */
+    public static final double cDouble = 0.0;
+
+    /** valid: {@value} */
+    public static final String cString = "";
+
+    /** invalid class C: {@value} */
+    public class C { }
+
+    /** invalid enum E: {@value} */
+    public enum E {
+        /** invalid enum constant E1: {@value} */
+        E1
+    }
+
+    /** invalid field 1: {@value} */
+    public int f1;
+
+    /** invalid field 2: {@value} */
+    public int f2 = 3;
+
+
+    /*
+     * Tests for {@value} with a reference
+     */
+
+    /** valid: {@value Integer#SIZE} */
+    public int intRef;
+
+    /** invalid method: {@value Object#toString} */
+    public int badMethod;
+
+    /** invalid enum constant: {@value Thread.State#NEW} */
+    public int badEnum;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/ValueTest.out	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,22 @@
+ValueTest.java:39: error: {@value} not allowed here
+    /** invalid class C: {@value} */
+                         ^
+ValueTest.java:42: error: {@value} not allowed here
+    /** invalid enum E: {@value} */
+                        ^
+ValueTest.java:44: error: {@value} not allowed here
+        /** invalid enum constant E1: {@value} */
+                                      ^
+ValueTest.java:48: error: {@value} not allowed here
+    /** invalid field 1: {@value} */
+                         ^
+ValueTest.java:51: error: {@value} not allowed here
+    /** invalid field 2: {@value} */
+                         ^
+ValueTest.java:62: error: value does not refer to a constant
+    /** invalid method: {@value Object#toString} */
+                        ^
+ValueTest.java:65: error: value does not refer to a constant
+    /** invalid enum constant: {@value Thread.State#NEW} */
+                               ^
+7 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/anchorTests/p/Test.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,53 @@
+/* @test /nodynamiccopyright/
+ * @bug 8025246
+ * @summary doclint is showing error on anchor already defined when it's not
+ * @library ../..
+ * @build DocLintTester
+ * @run main DocLintTester -ref Test.out Test.java
+ * @compile/fail/ref=Test.javac.out -XDrawDiagnostics -Werror -Xdoclint:all Test.java
+ */
+
+package p;
+
+/**
+ * <a name="dupTest">dupTest</a>
+ * <a name="dupTest">dupTest again</a>
+ *
+ * <a name="dupTestField">dupTestField</a>
+ * <a name="dupTestMethod">dupTestMethod</a>
+
+ * <a name="okClass">okClass</a>
+ * <a name="okField">okField</a>
+ * <a name="okMethod">okMethod</a>
+ */
+public class Test {
+    /** <a name="dupTestField">dupTestField again</a> */
+    public int f;
+
+    /** <a name="dupTestMethod">dupTestMethod again</a> */
+    public void m() { }
+
+    /**
+     * <a name="dupNested">dupNested</a>
+     * <a name="dupNested">dupNested again</a>
+     * <a name="dupNestedField">dupNestedField</a>
+     * <a name="dupNestedMethod">dupNestedMethod</a>
+     *
+     * <a name="okClass">okClass again</a>
+     */
+    public class Nested {
+        /**
+         * <a name="dupNestedField">dupNestedField</a>
+         *
+         * <a name="okField">okField again</a>
+         */
+        public int f;
+
+        /**
+         * <a name="dupNestedMethod">dupNestedMethod</a>
+         *
+         * <a name="okMethod">okMethod again</a>
+         */
+        public void m() { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/anchorTests/p/Test.javac.out	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,7 @@
+Test.java:14:7: compiler.err.proc.messager: anchor already defined: dupTest
+Test.java:24:12: compiler.err.proc.messager: anchor already defined: dupTestField
+Test.java:27:12: compiler.err.proc.messager: anchor already defined: dupTestMethod
+Test.java:32:11: compiler.err.proc.messager: anchor already defined: dupNested
+Test.java:40:15: compiler.err.proc.messager: anchor already defined: dupNestedField
+Test.java:47:15: compiler.err.proc.messager: anchor already defined: dupNestedMethod
+6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/anchorTests/p/Test.out	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,19 @@
+Test.java:14: error: anchor already defined: dupTest
+ * <a name="dupTest">dupTest again</a>
+      ^
+Test.java:24: error: anchor already defined: dupTestField
+    /** <a name="dupTestField">dupTestField again</a> */
+           ^
+Test.java:27: error: anchor already defined: dupTestMethod
+    /** <a name="dupTestMethod">dupTestMethod again</a> */
+           ^
+Test.java:32: error: anchor already defined: dupNested
+     * <a name="dupNested">dupNested again</a>
+          ^
+Test.java:40: error: anchor already defined: dupNestedField
+         * <a name="dupNestedField">dupNestedField</a>
+              ^
+Test.java:47: error: anchor already defined: dupNestedMethod
+         * <a name="dupNestedMethod">dupNestedMethod</a>
+              ^
+6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/anchorTests/p/package-info.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,15 @@
+/* @test /nodynamiccopyright/
+ * @bug 8025246
+ * @summary doclint is showing error on anchor already defined when it's not
+ * @library ../..
+ * @build DocLintTester
+ * @run main DocLintTester -ref package-info.out package-info.java
+ * @compile/fail/ref=package-info.javac.out -XDrawDiagnostics -Werror -Xdoclint:all package-info.java
+ */
+
+/**
+ * <a name=here>here</a>
+ * <a name=here>here again</a>
+ */
+package p;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/anchorTests/p/package-info.javac.out	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,2 @@
+package-info.java:12:7: compiler.err.proc.messager: anchor already defined: here
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/anchorTests/p/package-info.out	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,4 @@
+package-info.java:12: error: anchor already defined: here
+ * <a name=here>here again</a>
+      ^
+1 error
--- a/langtools/test/tools/doclint/html/InlineTagsTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/doclint/html/InlineTagsTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -39,6 +39,7 @@
      *  <br>
      *  <cite> abc </cite>
      *  <code> abc </code>
+     *  <dfn> abc </dfn>
      *  <em> abc </em>
      *  <font> abc </font>
      *  <i> abc </i>
--- a/langtools/test/tools/doclint/tidy/util/Main.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/doclint/tidy/util/Main.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,3 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
 package tidystats;
 
 import java.io.IOException;
@@ -17,6 +41,35 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+/**
+ * Generate statistics from the files generated by tidy.sh.
+ *
+ * <p>The tidy.sh script is used to run tidy on all the HTML files
+ * in a directory, creating files in a new directory, and for each
+ * HTML file, it writes the console output from tidy into a file
+ * beside the fixed up file, with an additional .tidy extension.
+ *
+ * <p>This program will scan a directory for *.tidy files and
+ * analyze the messages reported by tidy, in order to generate a
+ * report with statistics on the various messages that were
+ * reported by tidy.
+ *
+ * <p>Typical usage:
+ * <pre>
+ * $ bash /path/to/tidy.sh /path/to/htmldir
+ * $ javac -d /path/to/classes /path/to/Main.java
+ * $ java -cp /path/to/classes tidystats.Main /path/to/htmldir.tidy
+ * </pre>
+ *
+ * <p>Internally, the program works by matching lines in the *.tidy
+ * files against a series of regular expressions that are used to
+ * categorize the messages.  The set of regular expressions was
+ * empirically determined by running the program on the output from
+ * running tidy.sh on all the generated JDK documentation. It is
+ * possible that tidy may generate more/different messages on other
+ * doc sets, in which case, the set of regexes in the program should
+ * be updated.
+ */
 public class Main {
     public static void main(String... args) throws IOException {
         new Main().run(args);
--- a/langtools/test/tools/doclint/tidy/util/tidy.sh	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/doclint/tidy/util/tidy.sh	Fri Oct 11 09:17:18 2013 -0400
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
 #
-# 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
@@ -23,6 +23,7 @@
 #
 
 # Run the "tidy" program over the files in a directory.
+# The "tidy" program must be on your PATH.
 #
 # Usage:
 #   sh tidy.sh <dir>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T4881267.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 4881267
+ * @summary improve diagnostic for "instanceof T" for type parameter T
+ * @compile/fail/ref=T4881267.out -XDrawDiagnostics T4881267.java
+ */
+
+class T4881267 {
+    <T> void m(Object o) {
+        boolean b = o instanceof T;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T4881267.out	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,2 @@
+T4881267.java:10:34: compiler.err.illegal.generic.type.for.instof
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T7090499.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7090499
+ * @summary missing rawtypes warnings in anonymous inner class
+ * @compile/ref=T7090499.out -Xlint:rawtypes -XDrawDiagnostics T7090499.java
+ */
+
+class T7090499<X> {
+    {
+        new Object() {
+            T7090499 x;
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T7090499.out	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,2 @@
+T7090499.java:11:13: compiler.warn.raw.class.use: T7090499, T7090499<X>
+1 warning
--- a/langtools/test/tools/javac/T7093325.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/T7093325.java	Fri Oct 11 09:17:18 2013 -0400
@@ -208,7 +208,7 @@
             }
 
             int actualGapsCount = 0;
-            for (int i = 0; i < code.exception_table_langth ; i++) {
+            for (int i = 0; i < code.exception_table_length ; i++) {
                 int catchType = code.exception_table[i].catch_type;
                 if (catchType == 0) { //any
                     actualGapsCount++;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T7120463.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,11 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7120463
+ * @summary Fix method reference parser support in order to avoid ambiguities
+ * @compile/fail/ref=T7120463.out -XDrawDiagnostics T7120463.java
+ */
+
+class T7120463 {
+    void test() { that(i < len, "oopmap"); }
+    void that(int i, String s) { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T7120463.out	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,3 @@
+T7120463.java:9:24: compiler.err.cant.resolve.location: kindname.variable, i, , , (compiler.misc.location: kindname.class, T7120463, null)
+T7120463.java:9:28: compiler.err.cant.resolve.location: kindname.variable, len, , , (compiler.misc.location: kindname.class, T7120463, null)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T7126754.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7126754
+ * @summary Generics compilation failure casting List<? extends Set...> to List<Set...>
+ * @compile T7126754.java
+ */
+
+import java.util.List;
+import java.util.Set;
+
+public class T7126754 {
+  public static void main(String[] args) {
+    List<Set<? extends String>> a = null;
+    List<? extends Set<? extends String>> b = a;
+
+    List<? extends Set<? extends String>> c = null;
+    List<Set<? extends String>> d = (List<Set<? extends String>>)c;
+  }
+}
--- a/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -100,7 +100,7 @@
                 if (method.getName(classFile.constant_pool).equals(methodToFind)) {
                     numberOfmethodsFound++;
                     Code_attribute code = (Code_attribute) method.attributes.get("Code");
-                    Assert.check(code.exception_table_langth == expectedExceptionTable.length,
+                    Assert.check(code.exception_table_length == expectedExceptionTable.length,
                             "The ExceptionTable found has a length different to the expected one");
                     int i = 0;
                     for (Exception_data entry: code.exception_table) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,74 @@
+/*
+ * 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 8024437
+ * @summary Inferring the exception thrown by a lambda: sometimes fails to compile
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main ExceptionInferenceFromClassFileTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class ExceptionInferenceFromClassFileTest {
+
+    static final String ABSrc =
+            "class B {\n" +
+            "    public static <E extends Throwable> void t(A<E> a) throws E {\n" +
+            "        a.run();\n" +
+            "    }\n" +
+            "}\n" +
+
+            "interface A<E extends Throwable> {\n" +
+            "    void run() throws E;\n" +
+            "}";
+
+    static final String CSrc =
+            "class C {\n" +
+            "    public void d() {\n" +
+            "        B.t(null);\n" +
+            "    }\n" +
+            "}";
+
+    public static void main(String[] args) throws Exception {
+        Files.createDirectory(Paths.get("out"));
+
+        ToolBox.JavaToolArgs compileABParams =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-d", "out")
+                .setSources(ABSrc);
+        ToolBox.javac(compileABParams);
+
+        ToolBox.JavaToolArgs compileCParams =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-d", "out", "-cp", "out")
+                .setSources(CSrc);
+        ToolBox.javac(compileCParams);
+    }
+
+}
--- a/langtools/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -237,7 +237,7 @@
     }
 
     static List<CastInfo> allCastInfo() {
-        ListBuffer<CastInfo> buf = ListBuffer.lb();
+        ListBuffer<CastInfo> buf = new ListBuffer<>();
         for (CastKind kind : CastKind.values()) {
             for (ClassKind clazz : ClassKind.values()) {
                 if (kind == CastKind.INTERFACE && clazz != ClassKind.OBJECT) {
--- a/langtools/test/tools/javac/cast/intersection/model/Model01.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/cast/intersection/model/Model01.java	Fri Oct 11 09:17:18 2013 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8002099
+ * @bug 8002099 6499673
  * @summary Add support for intersection types in cast expression
  * @library /tools/javac/lib
  * @build JavacTestingAbstractProcessor ModelChecker
@@ -46,7 +46,7 @@
     }
 
     void test(){
-        @IntersectionTypeInfo({"java.lang.Object", "Test.A", "Test.B"})
+        @IntersectionTypeInfo({"Test.A", "Test.B"})
         Object o = (A & B)null;
     }
 }
--- a/langtools/test/tools/javac/cast/intersection/model/ModelChecker.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/cast/intersection/model/ModelChecker.java	Fri Oct 11 09:17:18 2013 -0400
@@ -97,7 +97,7 @@
                 }
             }
 
-            assertTrue(assertionCount == 10, "Expected 10 assertions - found " + assertionCount);
+            assertTrue(assertionCount == 9, "Expected 9 assertions - found " + assertionCount);
             return super.visitVariable(node, p);
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doclint/implicitSource/ImplicitSourceTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8024538
+ * @summary -Xdoclint + -Xprefer:source + incremental compilation == FAIL
+ * @compile -Xdoclint -Xprefer:source ImplicitSourceTest.java
+ */
+
+/** ImplicitSourceTest. */
+class ImplicitSourceTest {
+    /** <p> {@link Other} </p> */
+    int i;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doclint/implicitSource/Other.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+/** Other. */
+class Other { }
--- a/langtools/test/tools/javac/flow/LVTHarness.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/flow/LVTHarness.java	Fri Oct 11 09:17:18 2013 -0400
@@ -64,6 +64,7 @@
 
 import static javax.tools.StandardLocation.*;
 import static com.sun.tools.classfile.LocalVariableTable_attribute.Entry;
+import static javax.tools.JavaFileObject.Kind.SOURCE;
 
 public class LVTHarness {
 
@@ -73,10 +74,14 @@
     static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
 
     public static void main(String[] args) throws Exception {
-        fm.setLocation(SOURCE_PATH,
-                Arrays.asList(new File(System.getProperty("test.src"), "tests")));
-        for (JavaFileObject jfo : fm.list(SOURCE_PATH, "",
-                Collections.singleton(JavaFileObject.Kind.SOURCE), true)) {
+
+        String testDir = System.getProperty("test.src");
+        fm.setLocation(SOURCE_PATH, Arrays.asList(new File(testDir, "tests")));
+
+        // Make sure classes are written to scratch dir.
+        fm.setLocation(CLASS_OUTPUT, Arrays.asList(new File(".")));
+
+        for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", Collections.singleton(SOURCE), true)) {
             new LVTHarness(jfo).check();
         }
         if (nerrors > 0) {
@@ -86,8 +91,7 @@
 
 
     JavaFileObject jfo;
-    Map<ElementKey, AliveRanges> aliveRangeMap =
-            new HashMap<ElementKey, AliveRanges>();
+    Map<ElementKey, AliveRanges> aliveRangeMap = new HashMap<>();
     Set<String> declaredKeys = new HashSet<>();
     List<ElementKey> seenAliveRanges = new ArrayList<>();
 
@@ -96,15 +100,19 @@
     }
 
     protected void check() throws Exception {
-        JavacTask ct = (JavacTask)comp.getTask(null, fm, null, Arrays.asList("-g"),
-                null, Arrays.asList(jfo));
-        System.err.println("compiling code " + jfo.toString());
+
+        JavacTask ct = (JavacTask) comp.getTask(null, fm, null, Arrays.asList("-g"),
+                                                null, Arrays.asList(jfo));
+        System.err.println("compiling code " + jfo);
         ct.setProcessors(Collections.singleton(new AliveRangeFinder()));
         if (!ct.call()) {
             throw new AssertionError("Error during compilation");
         }
 
-        checkClassFile(new File(jfo.getName().replace(".java", ".class")));
+
+        File javaFile = new File(jfo.getName());
+        File classFile = new File(javaFile.getName().replace(".java", ".class"));
+        checkClassFile(classFile);
 
         //check all candidates have been used up
         for (Map.Entry<ElementKey, AliveRanges> entry : aliveRangeMap.entrySet()) {
--- a/langtools/test/tools/javac/lambda/8023558/T8023558a.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/lambda/8023558/T8023558a.java	Fri Oct 11 09:17:18 2013 -0400
@@ -31,8 +31,14 @@
         T get();
     }
 
+    static class K<T> implements SAM<T> {
+        public T get() {
+            return (T)this;
+        }
+    }
+
     public static void main(String[] args) {
-        SAM<SAM> sam = new SAM<SAM>() { public SAM get() { return null; } };
+        SAM<SAM> sam = new SAM<SAM>() { public SAM get() { return new K<>(); } };
         SAM temp = sam.get()::get;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/ByteCodeTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,647 @@
+/*
+ * 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     8011738
+ * @author  sogoel
+ * @summary Code translation test for Lambda expressions, method references
+ * @run main ByteCodeTest
+ */
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.BootstrapMethods_attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.ConstantPool.*;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+public class ByteCodeTest {
+
+    static boolean IS_DEBUG = false;
+    public static void main(String[] args) {
+        File classFile = null;
+        int err = 0;
+        boolean verifyResult = false;
+        for(TestCases tc : TestCases.values()) {
+            classFile = getCompiledFile(tc.name(), tc.srcCode);
+            if(classFile == null) { // either testFile or classFile was not created
+               err++;
+            } else {
+                verifyResult = verifyClassFileAttributes(classFile, tc);
+                if(!verifyResult)
+                    System.out.println("Bootstrap class file attributes did not match for " + tc.name());
+            }
+        }
+        if(err > 0)
+            throw new RuntimeException("Found " + err + " found");
+        else
+            System.out.println("Test passed");
+    }
+
+    private static boolean verifyClassFileAttributes(File classFile, TestCases tc) {
+        ClassFile c = null;
+        try {
+            c = ClassFile.read(classFile);
+        } catch (IOException | ConstantPoolException e) {
+            e.printStackTrace();
+        }
+        ConstantPoolVisitor cpv = new ConstantPoolVisitor(c, c.constant_pool.size());
+        Map<Integer, String> hm = cpv.getBSMMap();
+
+        List<String> expectedValList = tc.getExpectedArgValues();
+        expectedValList.add(tc.bsmSpecifier.specifier);
+        if(!(hm.values().containsAll(new HashSet<String>(expectedValList)))) {
+            System.out.println("Values do not match");
+            return false;
+        }
+        return true;
+    }
+
+    private static File getCompiledFile(String fname, String srcString) {
+        File testFile = null, classFile = null;
+        boolean isTestFileCreated = true;
+
+        try {
+            testFile = writeTestFile(fname+".java", srcString);
+        } catch(IOException ioe) {
+            isTestFileCreated = false;
+            System.err.println("fail to write" + ioe);
+        }
+
+        if(isTestFileCreated) {
+            try {
+                classFile = compile(testFile);
+            } catch (Error err) {
+                System.err.println("fail compile. Source:\n" + srcString);
+                throw err;
+            }
+        }
+        return classFile;
+    }
+
+    static File writeTestFile(String fname, String source) throws IOException {
+        File f = new File(fname);
+          PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+          out.println(source);
+          out.close();
+          return f;
+    }
+
+    static File compile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] {
+                "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+                throw new Error("compilation failed. rc=" + rc);
+            String path = f.getPath();
+            return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    static void debugln(String str) {
+        if(IS_DEBUG)
+            System.out.println(str);
+    }
+
+    enum BSMSpecifier {
+        SPECIFIER1("REF_invokeStatic java/lang/invoke/LambdaMetafactory metaFactory " +
+                "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;" +
+                "Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)" +
+                "Ljava/lang/invoke/CallSite;"),
+        SPECIFIER2("REF_invokeStatic java/lang/invoke/LambdaMetafactory altMetaFactory " +
+                        "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;" +
+                        "[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;");
+
+        String specifier;
+        private BSMSpecifier(String specifier) {
+            this.specifier = specifier;
+        }
+    }
+
+    enum TestCases {
+        // Single line lambda expression
+        TC1("class TC1 {\n" +
+            "    public static void main(String[] args) {\n" +
+            "        Object o = (Runnable) () -> { System.out.println(\"hi\");};\n" +
+            "    }\n"+
+            "}", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface java/lang/Runnable run ()V");
+                valList.add("REF_invokeStatic TC1 lambda$0 ()V");
+                valList.add("()V");
+                return valList;
+            }
+        },
+
+        // Lambda expression in a for loop
+        TC2("import java.util.*;\n" +
+            "public class TC2 {\n" +
+            "    void TC2_test() {\n" +
+            "        List<String> list = new ArrayList<>();\n" +
+            "        list.add(\"A\");\n" +
+            "        list.add(\"B\");\n" +
+            "        list.stream().forEach( s -> { System.out.println(s); } );\n" +
+            "    }\n" +
+            "    public static void main(String[] args) {\n" +
+            "        new TC2().TC2_test();\n" +
+            "    }\n" +
+            "}", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface java/util/function/Consumer accept (Ljava/lang/Object;)V");
+                valList.add("REF_invokeStatic TC2 lambda$0 (Ljava/lang/String;)V");
+                valList.add("(Ljava/lang/String;)V");
+                return valList;
+            }
+        },
+
+        // Lambda initializer
+        TC3("class TC3 {\n" +
+            "    interface SAM {\n" +
+            "        void m(int i);\n" +
+            "    }\n" +
+            "    SAM lambda_03 = (int pos) -> { };\n" +
+            "}", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface TC3$SAM m (I)V");
+                valList.add("REF_invokeStatic TC3 lambda$0 (I)V");
+                valList.add("(I)V");
+                return valList;
+            }
+        },
+
+        // Array initializer
+        TC4("class TC4 {\n" +
+            "    interface Block<T> {\n" +
+            "        void m(T t);\n" +
+            "     }\n" +
+            "     void test1() {\n" +
+            "         Block<?>[] arr1 =  { t -> { }, t -> { } };\n" +
+            "     }\n" +
+            "}", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface TC4$Block m (Ljava/lang/Object;)V");
+                valList.add("REF_invokeStatic TC4 lambda$0 (Ljava/lang/Object;)V");
+                valList.add("(Ljava/lang/Object;)V");
+                valList.add("REF_invokeStatic TC4 lambda$1 (Ljava/lang/Object;)V");
+                return valList;
+            }
+        },
+
+        //Lambda expression as a method arg
+        TC5("class TC5 {\n"+
+            "    interface MapFun<T,R> {  R m( T n); }\n" +
+            "    void meth( MapFun<String,Integer> mf ) {\n" +
+            "        assert( mf.m(\"four\") == 4);\n" +
+            "    }\n"+
+            "    void test(Integer i) {\n" +
+            "        meth(s -> { Integer len = s.length(); return len; } );\n" +
+            "    }\n"+
+            "}", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface TC5$MapFun m (Ljava/lang/Object;)Ljava/lang/Object;");
+                valList.add("REF_invokeStatic TC5 lambda$0 (Ljava/lang/String;)Ljava/lang/Integer;");
+                valList.add("(Ljava/lang/String;)Ljava/lang/Integer;");
+                return valList;
+            }
+        },
+
+        //Inner class of Lambda expression
+        TC6("class TC6 {\n" +
+            "    interface MapFun<T, R> {  R m( T n); }\n" +
+            "    MapFun<Class<?>,String> cs;\n" +
+            "    void test() {\n" +
+            "        cs = c -> {\n" +
+            "                 class innerClass   {\n" +
+            "                    Class<?> icc;\n" +
+            "                    innerClass(Class<?> _c) { icc = _c; }\n" +
+            "                    String getString() { return icc.toString(); }\n" +
+            "                  }\n" +
+            "             return new innerClass(c).getString();\n"+
+            "             };\n" +
+            "    }\n" +
+            "}\n", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface TC6$MapFun m (Ljava/lang/Object;)Ljava/lang/Object;");
+                valList.add("REF_invokeSpecial TC6 lambda$0 (Ljava/lang/Class;)Ljava/lang/String;");
+                valList.add("(Ljava/lang/Class;)Ljava/lang/String;");
+                return valList;
+            }
+        },
+
+        // Method reference
+        TC7("class TC7 {\n" +
+            "    static interface SAM {\n" +
+            "       void m(Integer i);\n" +
+            "    }\n" +
+            "    void m(Integer i) {}\n" +
+            "       SAM s = this::m;\n" +
+            "}\n", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface TC7$SAM m (Ljava/lang/Integer;)V");
+                valList.add("REF_invokeVirtual TC7 m (Ljava/lang/Integer;)V");
+                valList.add("(Ljava/lang/Integer;)V");
+                return valList;
+            }
+        },
+
+        // Constructor reference
+        TC8("public class TC8 {\n" +
+            "    static interface A {Fee<String> m();}\n" +
+            "    static class Fee<T> {\n" +
+            "        private T t;\n" +
+            "        public Fee() {}\n" +
+            "    }\n" +
+            "    public static void main(String[] args) {\n" +
+            "        A a = Fee<String>::new; \n" +
+            "    }\n" +
+            "}\n", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface TC8$A m ()LTC8$Fee;");
+                valList.add("REF_newInvokeSpecial TC8$Fee <init> ()V");
+                valList.add("()LTC8$Fee;");
+                return valList;
+            }
+        },
+
+        // Recursive lambda expression
+        TC9("class TC9 {\n" +
+            "    interface Recursive<T, R> { T apply(R n); };\n" +
+            "    Recursive<Integer,Integer> factorial;\n" +
+            "    void test(Integer j) {\n" +
+            "        factorial = i -> { return i == 0 ? 1 : i * factorial.apply( i - 1 ); };\n" +
+            "    }\n" +
+            "}\n", BSMSpecifier.SPECIFIER1) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeInterface TC9$Recursive apply (Ljava/lang/Object;)Ljava/lang/Object;");
+                valList.add("REF_invokeSpecial TC9 lambda$0 (Ljava/lang/Integer;)Ljava/lang/Integer;");
+                valList.add("(Ljava/lang/Integer;)Ljava/lang/Integer;");
+                return valList;
+            }
+        },
+
+        //Serializable Lambda
+        TC10("import java.io.Serializable;\n" +
+              "class TC10 {\n" +
+              "    interface Foo { int m(); }\n" +
+              "    public static void main(String[] args) {\n" +
+              "        Foo f1 = (Foo & Serializable)() -> 3;\n" +
+              "    }\n" +
+              "}\n", BSMSpecifier.SPECIFIER2) {
+
+            @Override
+            List<String> getExpectedArgValues() {
+                List<String> valList = new ArrayList<>();
+                valList.add("REF_invokeStatic java/lang/invoke/LambdaMetafactory altMetaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;");
+                valList.add("REF_invokeInterface TC10$Foo m ()I");
+                valList.add("REF_invokeStatic TC10 lambda$main$3231c38a$0 ()I");
+                valList.add("()I");
+                valList.add("1");
+                return valList;
+            }
+        };
+
+        String srcCode;
+        BSMSpecifier bsmSpecifier;
+
+        TestCases(String src, BSMSpecifier bsmSpecifier) {
+            this.srcCode = src;
+            // By default, all test cases will have bootstrap method specifier as Lambda.MetaFactory
+            // For serializable lambda test cases, bootstrap method specifier changed to altMetaFactory
+            this.bsmSpecifier = bsmSpecifier;
+        }
+
+        List<String> getExpectedArgValues() {
+            return null;
+        }
+
+        void setSrcCode(String src) {
+            srcCode = src;
+        }
+    }
+
+    static class ConstantPoolVisitor implements ConstantPool.Visitor<String, Integer> {
+        final List<String> slist;
+        final ClassFile cf;
+        final ConstantPool cfpool;
+        final Map<Integer, String> bsmMap;
+
+
+        public ConstantPoolVisitor(ClassFile cf, int size) {
+            slist = new ArrayList<>(size);
+            for (int i = 0 ; i < size; i++) {
+                slist.add(null);
+            }
+            this.cf = cf;
+            this.cfpool = cf.constant_pool;
+            bsmMap = readBSM();
+        }
+
+        public Map<Integer, String> getBSMMap() {
+            return Collections.unmodifiableMap(bsmMap);
+        }
+
+        public String visit(CPInfo c, int index) {
+            return c.accept(this, index);
+        }
+
+        private Map<Integer, String> readBSM() {
+            BootstrapMethods_attribute bsmAttr =
+                    (BootstrapMethods_attribute) cf.getAttribute(Attribute.BootstrapMethods);
+            if (bsmAttr != null) {
+                Map<Integer, String> out =
+                        new HashMap<>(bsmAttr.bootstrap_method_specifiers.length);
+                for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsms :
+                        bsmAttr.bootstrap_method_specifiers) {
+                    int index = bsms.bootstrap_method_ref;
+                    try {
+                        String value = slist.get(index);
+                        if (value == null) {
+                            value = visit(cfpool.get(index), index);
+                            debugln("[SG]: index " + index);
+                            debugln("[SG]: value " + value);
+                            slist.set(index, value);
+                            out.put(index, value);
+                        }
+                        for (int idx : bsms.bootstrap_arguments) {
+                            value = slist.get(idx);
+                            if (value == null) {
+                                value = visit(cfpool.get(idx), idx);
+                                debugln("[SG]: idx " + idx);
+                                debugln("[SG]: value " + value);
+                                slist.set(idx, value);
+                                out.put(idx, value);
+                            }
+                        }
+                    } catch (InvalidIndex ex) {
+                        ex.printStackTrace();
+                    }
+                }
+                return out;
+            }
+            return new HashMap<>(0);
+        }
+
+        @Override
+        public String visitClass(CONSTANT_Class_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = visit(cfpool.get(c.name_index), c.name_index);
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitDouble(CONSTANT_Double_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                value = Double.toString(c.value);
+                slist.set(p, value);
+            }
+            return value;
+        }
+
+        @Override
+        public String visitFieldref(CONSTANT_Fieldref_info c, Integer p) {
+
+        String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = visit(cfpool.get(c.class_index), c.class_index);
+                    value = value.concat(" " + visit(cfpool.get(c.name_and_type_index),
+                                         c.name_and_type_index));
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitFloat(CONSTANT_Float_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                value = Float.toString(c.value);
+                slist.set(p, value);
+            }
+            return value;
+        }
+
+        @Override
+        public String visitInteger(CONSTANT_Integer_info cnstnt, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                value = Integer.toString(cnstnt.value);
+                slist.set(p, value);
+            }
+            return value;
+        }
+
+        @Override
+        public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info c,
+                                              Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = visit(cfpool.get(c.class_index), c.class_index);
+                    value = value.concat(" " +
+                                         visit(cfpool.get(c.name_and_type_index),
+                                         c.name_and_type_index));
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitInvokeDynamic(CONSTANT_InvokeDynamic_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = bsmMap.get(c.bootstrap_method_attr_index) + " "
+                            + visit(cfpool.get(c.name_and_type_index), c.name_and_type_index);
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitLong(CONSTANT_Long_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                value = Long.toString(c.value);
+                slist.set(p, value);
+            }
+            return value;
+        }
+
+        @Override
+        public String visitNameAndType(CONSTANT_NameAndType_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = visit(cfpool.get(c.name_index), c.name_index);
+                    value = value.concat(" " +
+                            visit(cfpool.get(c.type_index), c.type_index));
+                    slist.set(p, value);
+                } catch (InvalidIndex ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitMethodref(CONSTANT_Methodref_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = visit(cfpool.get(c.class_index), c.class_index);
+                    value = value.concat(" " +
+                                         visit(cfpool.get(c.name_and_type_index),
+                                         c.name_and_type_index));
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitMethodHandle(CONSTANT_MethodHandle_info c, Integer p) {
+
+        String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = c.reference_kind.name();
+                    value = value.concat(" "
+                            + visit(cfpool.get(c.reference_index), c.reference_index));
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitMethodType(CONSTANT_MethodType_info c, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                try {
+                    value = visit(cfpool.get(c.descriptor_index), c.descriptor_index);
+                    slist.set(p, value);
+                } catch (ConstantPoolException ex) {
+                    ex.printStackTrace();
+                }
+            }
+            return value;
+        }
+
+        @Override
+        public String visitString(CONSTANT_String_info c, Integer p) {
+
+            try {
+                String value = slist.get(p);
+                if (value == null) {
+                    value = c.getString();
+                    slist.set(p, value);
+                }
+                return value;
+            } catch (ConstantPoolException ex) {
+                throw new RuntimeException("Fatal error", ex);
+            }
+        }
+
+        @Override
+        public String  visitUtf8(CONSTANT_Utf8_info cnstnt, Integer p) {
+
+            String value = slist.get(p);
+            if (value == null) {
+                value = cnstnt.value;
+                slist.set(p, value);
+            }
+            return value;
+        }
+    }
+}
+
--- a/langtools/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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
@@ -196,7 +196,7 @@
     }
 
     static List<CastInfo> allCastInfo() {
-        ListBuffer<CastInfo> buf = ListBuffer.lb();
+        ListBuffer<CastInfo> buf = new ListBuffer<>();
         for (CastKind kind : CastKind.values()) {
             for (TypeKind b1 : TypeKind.values()) {
                 if (kind.nbounds == 1) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -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.  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 8024696
+ * @summary Missing null check in bound method reference capture
+ */
+
+import com.sun.tools.javac.util.Assert;
+import java.util.function.*;
+
+public class MethodReferenceNullCheckTest {
+    public static void main(String[] args) {
+        String s = null;
+        boolean npeFired = false;
+        try {
+            Supplier<Boolean> ss = s::isEmpty;
+        } catch (NullPointerException npe) {
+            npeFired = true;
+        } finally {
+            Assert.check(npeFired, "NPE should have been thrown");
+        }
+    }
+}
--- a/langtools/test/tools/javac/multicatch/Pos05.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/multicatch/Pos05.java	Fri Oct 11 09:17:18 2013 -0400
@@ -95,7 +95,7 @@
                 throw new Error("Code attribute for test() method not found");
             }
             Exception_data firstExceptionTable = null;
-            for (int i = 0 ; i < ea.exception_table_langth; i++) {
+            for (int i = 0 ; i < ea.exception_table_length; i++) {
                 if (firstExceptionTable == null) {
                     firstExceptionTable = ea.exception_table[i];
                 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/type/BoundsTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6499673
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor BoundsTest
+ * @run main BoundsTest
+ * @summary Assertion check for TypeVariable.getUpperBound() fails
+ */
+
+import com.sun.source.util.*;
+import com.sun.tools.javac.api.*;
+import com.sun.tools.javac.file.*;
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.type.*;
+import javax.lang.model.util.ElementFilter;
+import javax.lang.model.element.*;
+import javax.tools.*;
+import java.util.*;
+import java.io.*;
+
+public class BoundsTest {
+
+    private int errors = 0;
+    private static final String Intersection_name = "IntersectionTest.java";
+    private static final String Intersection_contents =
+        "import java.util.List;\n" +
+        "import java.io.Serializable;\t" +
+        "public class IntersectionTest<S extends List & Serializable> {\n" +
+        "  void method(S s) { }\n" +
+        "}";
+    private static final String[] Intersection_bounds = {
+        "java.util.List",
+        "java.io.Serializable"
+    };
+    private static final String[] Intersection_supers = {
+        "java.util.List",
+        "java.io.Serializable"
+    };
+
+    private static final String Single_name = "SingleTest.java";
+    private static final String Single_contents =
+        "import java.util.List;\n" +
+        "public class SingleTest<S extends List> {\n" +
+        "  void method(S s) { }\n" +
+        "}";
+    private static final String[] Single_bounds = {
+        "java.util.List",
+    };
+    private static final String[] Single_supers = {
+        "java.lang.Object",
+        "java.util.Collection"
+    };
+
+    private static final String NoBounds_name = "NoBoundsTest.java";
+    private static final String NoBounds_contents =
+        "public class NoBoundsTest<S> {\n" +
+        "  void method(S s) { }\n" +
+        "}";
+    private static final String[] NoBounds_bounds = {
+        "java.lang.Object",
+    };
+    private static final String[] NoBounds_supers = {};
+
+    private HashSet<CharSequence> expected_bounds;
+    private HashSet<CharSequence> expected_supers;
+
+    private static final File classesdir = new File("intersectionproperties");
+    private static final JavaCompiler comp =
+        ToolProvider.getSystemJavaCompiler();
+    private static final StandardJavaFileManager fm =
+        comp.getStandardFileManager(null, null, null);
+
+    public void runOne(final String Test_name, final String Test_contents,
+                       final String[] Test_bounds, final String[] Test_supers)
+        throws IOException {
+        System.err.println("Testing " + Test_name);
+        expected_bounds = new HashSet<CharSequence>(Arrays.asList(Test_bounds));
+        expected_supers = new HashSet<CharSequence>(Arrays.asList(Test_supers));
+        final Iterable<? extends JavaFileObject> files =
+            fm.getJavaFileObjectsFromFiles(Collections.singleton(writeFile(classesdir, Test_name, Test_contents)));
+        final JavacTask ct =
+            (JavacTask)comp.getTask(null, fm, null, null, null, files);
+        ct.setProcessors(Collections.singleton(new TestProcessor()));
+
+        if (!ct.call()) {
+            System.err.println("Compilation unexpectedly failed");
+            errors++;
+        }
+    }
+
+    public void run() throws IOException {
+        runOne(Intersection_name, Intersection_contents,
+               Intersection_bounds, Intersection_supers);
+        runOne(Single_name, Single_contents,
+               Single_bounds, Single_supers);
+        runOne(NoBounds_name, NoBounds_contents,
+               NoBounds_bounds, NoBounds_supers);
+
+        if (0 != errors)
+            throw new RuntimeException(errors + " errors occurred");
+    }
+
+    public static void main(String... args) throws IOException {
+        new IntersectionPropertiesTest().run();
+    }
+
+    private static File writeFile(File dir, String path, String body)
+        throws IOException {
+        File f = new File(dir, path);
+        f.getParentFile().mkdirs();
+        try (FileWriter out = new FileWriter(f)) {
+            out.write(body);
+        }
+        return f;
+    }
+
+    private class TestProcessor extends JavacTestingAbstractProcessor {
+
+        private Set<? extends Element> rootElements;
+
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            rootElements = roundEnv.getRootElements();
+            if (!rootElements.isEmpty()) {
+                performCheck();
+            }
+            return true;
+        }
+
+        private void performCheck() {
+            TypeElement typeElement = (TypeElement) rootElements.iterator().next();
+            ExecutableElement method = ElementFilter.methodsIn(typeElement.getEnclosedElements()).get(0);
+            TypeVariable typeVariable = (TypeVariable) method.getParameters().get(0).asType();
+
+            final TypeMirror upperBound = typeVariable.getUpperBound();
+
+            TypeParameterElement typeParameterElement = ((TypeParameterElement) typeVariable.asElement());
+            final List<? extends TypeMirror> bounds = typeParameterElement.getBounds();
+            final List<? extends TypeMirror> supers = processingEnv.getTypeUtils().directSupertypes(upperBound);
+
+            final HashSet<CharSequence> actual_bounds = new HashSet<CharSequence>();
+            final HashSet<CharSequence> actual_supers = new HashSet<CharSequence>();
+
+            for(TypeMirror ty : bounds) {
+                actual_bounds.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName());
+            }
+
+            for(TypeMirror ty : supers) {
+                actual_supers.add(((TypeElement)((DeclaredType)ty).asElement()).getQualifiedName());
+            }
+
+
+            if (!expected_bounds.equals(actual_bounds)) {
+                System.err.println("Mismatched expected and actual bounds.");
+                System.err.println("Expected:");
+                for(CharSequence tm : expected_bounds)
+                    System.err.println("  " + tm);
+                System.err.println("Actual:");
+                for(CharSequence tm : actual_bounds)
+                    System.err.println("  " + tm);
+                errors++;
+            }
+
+            if (!expected_supers.equals(actual_supers)) {
+                System.err.println("Mismatched expected and actual bounds.");
+                System.err.println("Expected:");
+                for(CharSequence tm : expected_supers)
+                    System.err.println("  " + tm);
+                System.err.println("Actual:");
+                for(CharSequence tm : actual_supers)
+                    System.err.println("  " + tm);
+                errors++;
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/type/IntersectionPropertiesTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6499673
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor IntersectionPropertiesTest
+ * @run main IntersectionPropertiesTest
+ * @summary Assertion check for TypeVariable.getUpperBound() fails
+ */
+
+import com.sun.source.util.*;
+import com.sun.tools.javac.api.*;
+import com.sun.tools.javac.file.*;
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.type.*;
+import javax.lang.model.util.ElementFilter;
+import javax.lang.model.element.*;
+import javax.tools.*;
+import java.util.*;
+import java.io.*;
+
+public class IntersectionPropertiesTest {
+
+    private int errors = 0;
+    private static final String Intersection_name = "IntersectionTest.java";
+    private static final String Intersection_contents =
+        "import java.util.List;\n" +
+        "import java.io.Serializable;\t" +
+        "public class IntersectionTest<S extends List & Serializable> {\n" +
+        "  void method(S s) { }\n" +
+        "}";
+
+    private static final File classesdir = new File("intersectionproperties");
+    private static final JavaCompiler comp =
+        ToolProvider.getSystemJavaCompiler();
+    private static final StandardJavaFileManager fm =
+        comp.getStandardFileManager(null, null, null);
+
+    public void runOne(final String Test_name, final String Test_contents)
+        throws IOException {
+        System.err.println("Testing " + Test_name);
+        final Iterable<? extends JavaFileObject> files =
+            fm.getJavaFileObjectsFromFiles(Collections.singleton(writeFile(classesdir, Test_name, Test_contents)));
+        final JavacTask ct =
+            (JavacTask)comp.getTask(null, fm, null, null, null, files);
+        ct.setProcessors(Collections.singleton(new TestProcessor()));
+
+        if (!ct.call()) {
+            System.err.println("Compilation unexpectedly failed");
+            errors++;
+        }
+    }
+
+    public void run() throws IOException {
+        runOne(Intersection_name, Intersection_contents);
+
+        if (0 != errors)
+            throw new RuntimeException(errors + " errors occurred");
+    }
+
+    public static void main(String... args) throws IOException {
+        new IntersectionPropertiesTest().run();
+    }
+
+    private static File writeFile(File dir, String path, String body)
+        throws IOException {
+        File f = new File(dir, path);
+        f.getParentFile().mkdirs();
+        try (FileWriter out = new FileWriter(f)) {
+            out.write(body);
+        }
+        return f;
+    }
+
+    private class TestProcessor extends JavacTestingAbstractProcessor {
+
+        private Set<? extends Element> rootElements;
+
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            rootElements = roundEnv.getRootElements();
+            if (!rootElements.isEmpty()) {
+                performCheck();
+            }
+            return true;
+        }
+
+        private void performCheck() {
+            TypeElement typeElement = (TypeElement) rootElements.iterator().next();
+            ExecutableElement method = ElementFilter.methodsIn(typeElement.getEnclosedElements()).get(0);
+            TypeVariable typeVariable = (TypeVariable) method.getParameters().get(0).asType();
+
+            final TypeMirror upperBound = typeVariable.getUpperBound();
+
+            TypeParameterElement typeParameterElement = ((TypeParameterElement) typeVariable.asElement());
+            final List<? extends TypeMirror> bounds = typeParameterElement.getBounds();
+            final HashSet<TypeMirror> actual = new HashSet<TypeMirror>(processingEnv.getTypeUtils().directSupertypes(upperBound));
+            final HashSet<TypeMirror> expected = new HashSet<TypeMirror>(bounds);
+            if (!expected.equals(actual)) {
+                System.err.println("Mismatched expected and actual bounds.");
+                System.err.println("Expected:");
+                for(TypeMirror tm : expected)
+                    System.err.println("  " + tm);
+                System.err.println("Actual:");
+                for(TypeMirror tm : actual)
+                    System.err.println("  " + tm);
+                errors++;
+            }
+        }
+
+    }
+
+}
--- a/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -176,7 +176,7 @@
          */
         void checkElems(CompoundScope cs, Filter<Symbol> sf) {
             int count = 0;
-            ListBuffer<Symbol> found = ListBuffer.lb();
+            ListBuffer<Symbol> found = new ListBuffer<>();
             List<Symbol> allSymbols = sf == null ?
                     elems :
                     filter(elems, sf);
@@ -216,7 +216,7 @@
         }
 
         List<Symbol> filter(List<Symbol> elems, Filter<Symbol> sf) {
-            ListBuffer<Symbol> res = ListBuffer.lb();
+            ListBuffer<Symbol> res = new ListBuffer<>();
             for (Symbol s : elems) {
                 if (sf.accepts(s)) {
                     res.append(s);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/MakeQualIdent.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,77 @@
+/*
+ * 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     8023835
+ * @summary Verify that TreeMaker.QualIdent(Symbol) field access cascade ends with
+ *          the top-level package (when no toplevel is set in TreeMaker)
+ * @run main MakeQualIdent
+ */
+
+import com.sun.source.tree.IdentifierTree;
+import com.sun.source.tree.MemberSelectTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreeScanner;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.Context;
+import java.util.ArrayList;
+
+public class MakeQualIdent {
+    public static void main(String... args) throws Exception {
+        JavacTool tool = JavacTool.create();
+        JavacTask task = tool.getTask(null, null, null, new ArrayList<String>(), null, null);
+        Context ctx = ((JavacTaskImpl)task).getContext();
+        TreeMaker treeMaker = TreeMaker.instance(ctx);
+        Symtab syms = Symtab.instance(ctx);
+
+        String stringTree = printTree(treeMaker.QualIdent(syms.stringType.tsym));
+
+        if (!"java.lang.String".equals(stringTree)) {
+            throw new IllegalStateException(stringTree);
+        }
+    }
+
+    private static String printTree(Tree tree) {
+        final StringBuilder result = new StringBuilder();
+
+        new TreeScanner<Void, Void>() {
+            @Override public Void visitIdentifier(IdentifierTree node, Void p) {
+                result.append(node.getName());
+                return super.visitIdentifier(node, p);
+            }
+            @Override public Void visitMemberSelect(MemberSelectTree node, Void p) {
+                scan(node.getExpression(), null);
+                result.append(".");
+                result.append(node.getIdentifier());
+                return null;
+            }
+        }.scan(tree, null);
+
+        return result.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/ScopeTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,114 @@
+/*
+ * 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     8023835
+ * @summary Verify that implicit type of lambda parameter is correctly attributed
+ *          in Scope
+ * @run main ScopeTest
+ */
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.MemberSelectTree;
+import com.sun.source.tree.Scope;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.TreePathScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.model.JavacTypes;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import javax.lang.model.element.Element;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Types;
+import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
+import javax.tools.SimpleJavaFileObject;
+
+public class ScopeTest {
+
+    private static final String SOURCE_CODE =
+            "public class Test {\n" +
+            "    private static void test() {\n" +
+            "        InvokeOn f = null;\n" +
+            "        f.run(x -> { x.correct(); });\n" +
+            "    }\n" +
+            "    public static final class FooBar {\n" +
+            "        public void dontRun() { }\n" +
+            "    }\n" +
+            "}\n" +
+            "class InvokeOn {\n" +
+            "    public void run(I i) { }\n" +
+            "}\n" +
+            "class FooBar {\n" +
+            "    public void correct() { }\n" +
+            "}\n" +
+            "interface I {\n" +
+            "    public void run(FooBar f);\n" +
+            "}";
+
+    public static void main(String... args) throws Exception {
+        verifyLambdaScopeCorrect("");
+        verifyLambdaScopeCorrect("package test;");
+    }
+
+    private static void verifyLambdaScopeCorrect(final String packageClause) throws Exception {
+        JavacTool tool = JavacTool.create();
+        JavaFileObject source = new SimpleJavaFileObject(URI.create("mem://Test.java"), Kind.SOURCE) {
+            @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                return packageClause + SOURCE_CODE;
+            }
+            @Override public boolean isNameCompatible(String simpleName, Kind kind) {
+                return true;
+            }
+        };
+        Iterable<? extends JavaFileObject> fos = Collections.singletonList(source);
+        JavacTask task = tool.getTask(null, null, null, new ArrayList<String>(), null, fos);
+        final Types types = JavacTypes.instance(((JavacTaskImpl) task).getContext());
+        final Trees trees = Trees.instance(task);
+        CompilationUnitTree cu = task.parse().iterator().next();
+
+        task.analyze();
+
+        new TreePathScanner<Void, Void>() {
+            @Override public Void visitMemberSelect(MemberSelectTree node, Void p) {
+                if (node.getIdentifier().contentEquals("correct")) {
+                    TypeMirror xType = trees.getTypeMirror(new TreePath(getCurrentPath(), node.getExpression()));
+                    Scope scope = trees.getScope(getCurrentPath());
+                    for (Element l : scope.getLocalElements()) {
+                        if (!l.getSimpleName().contentEquals("x")) continue;
+                        if (!types.isSameType(xType, l.asType())) {
+                            throw new IllegalStateException("Incorrect variable type in scope: " + l.asType() + "; should be: " + xType);
+                        }
+                    }
+                }
+                return super.visitMemberSelect(node, p);
+            }
+        }.scan(cu, null);
+    }
+}
--- a/langtools/test/tools/javac/types/TypeHarness.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/types/TypeHarness.java	Fri Oct 11 09:17:18 2013 -0400
@@ -213,8 +213,8 @@
 
     /** compute a type substitution on 't' given a list of type mappings */
     public Type subst(Type t, Mapping... maps) {
-        ListBuffer<Type> from = ListBuffer.lb();
-        ListBuffer<Type> to = ListBuffer.lb();
+        ListBuffer<Type> from = new ListBuffer<>();
+        ListBuffer<Type> to = new ListBuffer<>();
         for (Mapping tm : maps) {
             from.append(tm.from);
             to.append(tm.to);
--- a/langtools/test/tools/javac/warnings/6747671/T6747671.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/warnings/6747671/T6747671.java	Fri Oct 11 09:17:18 2013 -0400
@@ -1,6 +1,6 @@
 /**
  * @test /nodynamiccopyright/
- * @bug 6747671
+ * @bug 6747671 8022567
  * @summary -Xlint:rawtypes
  * @compile/ref=T6747671.out -XDrawDiagnostics -Xlint:rawtypes T6747671.java
  */
@@ -32,4 +32,11 @@
         A a2 = new A() {};//raw warning (2)
         a2.new Z() {};//raw warning
     }
+
+    @TA B @TA[] arr = new @TA B @TA [0];//JDK-8022567: raw warning (2)
+    Class<B[]> classes1;//no warning
+    Class<B>[] classes2;//no warning
+
+    @java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE)
+    @interface TA { }
 }
--- a/langtools/test/tools/javac/warnings/6747671/T6747671.out	Fri Oct 11 08:43:07 2013 -0400
+++ b/langtools/test/tools/javac/warnings/6747671/T6747671.out	Fri Oct 11 09:17:18 2013 -0400
@@ -7,4 +7,6 @@
 T6747671.java:32:9: compiler.warn.raw.class.use: T6747671.A, T6747671<E>.A<X>
 T6747671.java:32:20: compiler.warn.raw.class.use: T6747671.A, T6747671<E>.A<X>
 T6747671.java:33:16: compiler.warn.raw.class.use: T6747671.A.Z, T6747671<E>.A<X>.Z<Y>
-9 warnings
+T6747671.java:36:9: compiler.warn.raw.class.use: @T6747671.TA T6747671.B, T6747671.B<X>
+T6747671.java:36:27: compiler.warn.raw.class.use: T6747671.B, T6747671.B<X>
+11 warnings
--- a/make/scripts/webrev.ksh	Fri Oct 11 08:43:07 2013 -0400
+++ b/make/scripts/webrev.ksh	Fri Oct 11 09:17:18 2013 -0400
@@ -2704,11 +2704,11 @@
         rm -f $WDIR/$DIR/$F.html
 
 	its_a_jar=
-	if expr $F : '.*\.jar' >/dev/null; then
+	if expr $F : '.*\.jar' \| $F : '.*\.zip' >/dev/null; then
 	    its_a_jar=1
-	    # It's a JAR file, let's do it differntly
+	    # It's a JAR or ZIP file, let's do it differently
 	    if [[ -z $JAR ]]; then
-		print "No access to jar, so can't produce diffs for jar files"
+		print "No access to jar, so can't produce diffs for jar or zip files"
 	    else
 		if [ -f $ofile ]; then
 		    $JAR -tvf $ofile >"$ofile".lst
--- a/nashorn/.hgtags	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/.hgtags	Fri Oct 11 09:17:18 2013 -0400
@@ -218,3 +218,5 @@
 bf70cbd2c8369fd97ffdfcbe1a80dbc2797408ee jdk8-b106
 f35e1255024b66f7cf82517798f45f6e194e5567 jdk8-b107
 445ad3f6d3b4ba62ebc483323e1919110a304053 jdk8-b108
+6ec2f9e5ed5bd60c2900976e6a54fdcac2f37e9e jdk8-b109
+d49a8c2173f5f90c9a39cc4af8e03cfa8f35ee4c jdk8-b110
--- a/nashorn/make/build-benchmark.xml	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/make/build-benchmark.xml	Fri Oct 11 09:17:18 2013 -0400
@@ -329,7 +329,7 @@
           fork="true"
           dir=".">
       <jvmarg line="${ext.class.path}"/>
-      <jvmarg line="${run.test.jvmargs.octane}"/>
+      <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
       <arg value="${octane-test-sys-prop.test.js.framework}"/>
       <arg value="--"/>
       <arg value="${octane-tests}"/>
@@ -357,7 +357,7 @@
           classpath="${run.test.classpath}"
           fork="true"
           dir=".">
-      <jvmarg line="${run.test.jvmargs.octane}"/>
+      <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/>
       <arg value="${octane-test-sys-prop.test.js.framework}"/>
       <arg value="${octane-tests}"/>
       <arg value="--runtime"/>
@@ -391,7 +391,7 @@
           fork="true"
           dir=".">
       <jvmarg line="${ext.class.path}"/>
-      <jvmarg line="${run.test.jvmargs}"/>
+      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
       <arg value="-timezone=PST"/>
       <arg value="--class-cache-size=50"/>
       <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
@@ -415,7 +415,7 @@
           classpath="${run.test.classpath}"
           fork="true"
           dir=".">
-      <jvmarg line="${run.test.jvmargs}"/>
+      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
       <arg value="${sunspider-test-sys-prop.test.js.framework}"/>
       <arg value="${sunspider-tests}/"/>
     </java>
--- a/nashorn/make/build.xml	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/make/build.xml	Fri Oct 11 09:17:18 2013 -0400
@@ -66,6 +66,8 @@
 
     <echo message="run.test.jvmargs=${run.test.jvmargs}"/>
     <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
+    <echo message="run.test.xms=${run.test.xms}"/>
+    <echo message="run.test.xmx=${run.test.xmx}"/>
 
   </target>
 
@@ -320,7 +322,7 @@
     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
       <jvmarg line="${ext.class.path}"/>
-      <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
+      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
       <propertyset>
         <propertyref prefix="test-sys-prop."/>
         <mapper from="test-sys-prop.*" to="*" type="glob"/>
@@ -336,7 +338,7 @@
       <!-- use just build.test.classes.dir to avoid referring to TestNG -->
       <java classname="${parallel.test.runner}" dir="${basedir}" classpath="${build.test.classes.dir}" failonerror="true" fork="true">
       <jvmarg line="${ext.class.path}"/>
-      <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
+      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
       <syspropertyset>
           <propertyref prefix="test-sys-prop."/>
           <mapper type="glob" from="test-sys-prop.*" to="*"/>
@@ -352,7 +354,7 @@
     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
       <jvmarg line="${ext.class.path}"/>
-      <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
+      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
       <propertyset>
         <propertyref prefix="test262-test-sys-prop."/>
         <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
@@ -369,7 +371,7 @@
     <!-- use just build.test.classes.dir to avoid referring to TestNG -->
     <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
       <jvmarg line="${ext.class.path}"/>
-      <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
+      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
       <classpath>
           <pathelement path="${run.test.classpath}"/>
       </classpath>
@@ -387,7 +389,7 @@
       description="Run the shell with a sample script">
     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
         <jvmarg line="${ext.class.path}"/>
-        <jvmarg line="${run.test.jvmargs}"/>
+        <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
         <arg value="-dump-on-error"/>
         <arg value="test.js"/>
     </java>
@@ -397,7 +399,7 @@
       description="Debug the shell with a sample script">
     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
         <jvmarg line="${ext.class.path}"/>
-        <jvmarg line="${run.test.jvmargs}"/>
+        <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
         <arg value="--print-code"/>
         <arg value="--verify-code"/>
         <arg value="--print-symbols"/>
--- a/nashorn/make/project.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/make/project.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -216,13 +216,14 @@
 src.dir=src
 test.src.dir=test/src
 
+# -Xmx is used for all tests, -Xms only for octane benchmark
 run.test.xmx=3G
 run.test.xms=2G
 
 run.test.user.language=tr
 run.test.user.country=TR
 
-run.test.jvmargs.common=-server -Xmx${run.test.xmx} -XX:+TieredCompilation -Dfile.encoding=UTF-8 -Duser.language=${run.test.user.language} -Duser.country=${run.test.user.country} -XX:+HeapDumpOnOutOfMemoryError
+run.test.jvmargs.common=-server -XX:+TieredCompilation -Dfile.encoding=UTF-8 -Duser.language=${run.test.user.language} -Duser.country=${run.test.user.country} -XX:+HeapDumpOnOutOfMemoryError
 
 #-XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M
 # -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMethods
@@ -231,12 +232,12 @@
 run.test.jvmargs.main=${run.test.jvmargs.common} -ea
 
 #-XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M  
-run.test.jvmargs.octane.main=-Xms${run.test.xms} ${run.test.jvmargs.common}
+run.test.jvmargs.octane.main=${run.test.jvmargs.common}
 
 run.test.jvmsecurityargs=-Xverify:all -Djava.security.properties=${basedir}/make/java.security.override -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy
 
 # VM options for script tests with @fork option
-test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} ${run.test.jvmsecurityargs}
+test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}
 
 # path of rhino.jar for benchmarks
 rhino.jar=
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Fri Oct 11 09:17:18 2013 -0400
@@ -185,21 +185,12 @@
 
     @Override
     public Object eval(final Reader reader, final ScriptContext ctxt) throws ScriptException {
-        try {
-            if (reader instanceof URLReader) {
-                final URL url = ((URLReader)reader).getURL();
-                final Charset cs = ((URLReader)reader).getCharset();
-                return evalImpl(compileImpl(new Source(url.toString(), url, cs), ctxt), ctxt);
-            }
-            return evalImpl(Source.readFully(reader), ctxt);
-        } catch (final IOException e) {
-            throw new ScriptException(e);
-        }
+        return evalImpl(makeSource(reader, ctxt), ctxt);
     }
 
     @Override
     public Object eval(final String script, final ScriptContext ctxt) throws ScriptException {
-        return evalImpl(script.toCharArray(), ctxt);
+        return evalImpl(makeSource(script, ctxt), ctxt);
     }
 
     @Override
@@ -221,16 +212,12 @@
 
     @Override
     public CompiledScript compile(final Reader reader) throws ScriptException {
-        try {
-            return asCompiledScript(compileImpl(Source.readFully(reader), context));
-        } catch (final IOException e) {
-            throw new ScriptException(e);
-        }
+        return asCompiledScript(makeSource(reader, context));
     }
 
     @Override
     public CompiledScript compile(final String str) throws ScriptException {
-        return asCompiledScript(compileImpl(str.toCharArray(), context));
+        return asCompiledScript(makeSource(str, context));
     }
 
     // Invocable methods
@@ -292,6 +279,29 @@
 
     // Implementation only below this point
 
+    private static Source makeSource(final Reader reader, final ScriptContext ctxt) throws ScriptException {
+        try {
+            if (reader instanceof URLReader) {
+                final URL url = ((URLReader)reader).getURL();
+                final Charset cs = ((URLReader)reader).getCharset();
+                return new Source(url.toString(), url, cs);
+            } else {
+                return new Source(getScriptName(ctxt), Source.readFully(reader));
+            }
+        } catch (final IOException ioExp) {
+            throw new ScriptException(ioExp);
+        }
+    }
+
+    private static Source makeSource(final String src, final ScriptContext ctxt) {
+        return new Source(getScriptName(ctxt), src);
+    }
+
+    private static String getScriptName(final ScriptContext ctxt) {
+        final Object val = ctxt.getAttribute(ScriptEngine.FILENAME);
+        return (val != null) ? val.toString() : "<eval>";
+    }
+
     private <T> T getInterfaceInner(final Object thiz, final Class<T> clazz) {
         if (clazz == null || !clazz.isInterface()) {
             throw new IllegalArgumentException(getMessage("interface.class.expected"));
@@ -429,7 +439,7 @@
         // current ScriptContext exposed as "context"
         // "context" is non-writable from script - but script engine still
         // needs to set it and so save the context Property object
-        contextProperty = newGlobal.addOwnProperty("context", NON_ENUMERABLE_CONSTANT, null);
+        contextProperty = newGlobal.addOwnProperty("context", NON_ENUMERABLE_CONSTANT, ctxt);
         // current ScriptEngine instance exposed as "engine". We added @SuppressWarnings("LeakingThisInConstructor") as
         // NetBeans identifies this assignment as such a leak - this is a false positive as we're setting this property
         // in the Global of a Context we just created - both the Context and the Global were just created and can not be
@@ -509,8 +519,8 @@
         throw new IllegalArgumentException(getMessage("interface.on.non.script.object"));
     }
 
-    private Object evalImpl(final char[] buf, final ScriptContext ctxt) throws ScriptException {
-        return evalImpl(compileImpl(buf, ctxt), ctxt);
+    private Object evalImpl(final Source src, final ScriptContext ctxt) throws ScriptException {
+        return evalImpl(compileImpl(src, ctxt), ctxt);
     }
 
     private Object evalImpl(final ScriptFunction script, final ScriptContext ctxt) throws ScriptException {
@@ -561,11 +571,20 @@
         }
     }
 
-    private CompiledScript asCompiledScript(final ScriptFunction script) {
+    private CompiledScript asCompiledScript(final Source source) throws ScriptException {
+        final ScriptFunction func = compileImpl(source, context);
         return new CompiledScript() {
             @Override
             public Object eval(final ScriptContext ctxt) throws ScriptException {
-                return evalImpl(script, ctxt);
+                final ScriptObject global = getNashornGlobalFrom(ctxt);
+                // Are we running the script in the correct global?
+                if (func.getScope() == global) {
+                    return evalImpl(func, ctxt, global);
+                } else {
+                    // ScriptContext with a different global. Compile again!
+                    // Note that we may still hit per-global compilation cache.
+                    return evalImpl(compileImpl(source, ctxt), ctxt, global);
+                }
             }
             @Override
             public ScriptEngine getEngine() {
@@ -574,12 +593,6 @@
         };
     }
 
-    private ScriptFunction compileImpl(final char[] buf, final ScriptContext ctxt) throws ScriptException {
-        final Object val = ctxt.getAttribute(ScriptEngine.FILENAME);
-        final String fileName = (val != null) ? val.toString() : "<eval>";
-        return compileImpl(new Source(fileName, buf), ctxt);
-    }
-
     private ScriptFunction compileImpl(final Source source, final ScriptContext ctxt) throws ScriptException {
         return compileImpl(source, getNashornGlobalFrom(ctxt));
     }
--- a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Fri Oct 11 09:17:18 2013 -0400
@@ -807,9 +807,11 @@
                     type = Type.OBJECT;
                 }
 
-                type = Type.widest(type, newCaseNode.getTest().getType());
-                if (type.isBoolean()) {
+                final Type newCaseType = newCaseNode.getTest().getType();
+                if (newCaseType.isBoolean()) {
                     type = Type.OBJECT; //booleans and integers aren't assignment compatible
+                } else {
+                    type = Type.widest(type, newCaseType);
                 }
             }
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Fri Oct 11 09:17:18 2013 -0400
@@ -852,7 +852,6 @@
         final Label  loopLabel = new Label("loop");
 
         final Expression init = forNode.getInit();
-        assert init instanceof IdentNode;
 
         load(modify);
         assert modify.getType().isObject();
@@ -2175,8 +2174,9 @@
             method.invoke(ScriptRuntime.OPEN_WITH);
             method.storeCompilerConstant(SCOPE);
         } else {
-            // We just loaded the expression for its side effect; discard it
-            method.pop();
+            // We just loaded the expression for its side effect and to check
+            // for null or undefined value.
+            globalCheckObjectCoercible();
         }
 
 
@@ -3258,6 +3258,10 @@
         return method.invokestatic(GLOBAL_OBJECT, "isEval", methodDescriptor(boolean.class, Object.class));
     }
 
+    private MethodEmitter globalCheckObjectCoercible() {
+        return method.invokestatic(GLOBAL_OBJECT, "checkObjectCoercible", methodDescriptor(void.class, Object.class));
+    }
+
     private MethodEmitter globalDirectEval() {
         return method.invokestatic(GLOBAL_OBJECT, "directEval",
                 methodDescriptor(Object.class, Object.class, Object.class, Object.class, Object.class, Object.class));
--- a/nashorn/src/jdk/nashorn/internal/ir/WhileNode.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/ir/WhileNode.java	Fri Oct 11 09:17:18 2013 -0400
@@ -79,13 +79,12 @@
         if (visitor.enterWhileNode(this)) {
             if (isDoWhile()) {
                 return visitor.leaveWhileNode(
-                        setTest(lc, (Expression)test.accept(visitor)).
-                        setBody(lc, (Block)body.accept(visitor)));
+                        setBody(lc, (Block)body.accept(visitor)).
+                        setTest(lc, (Expression)test.accept(visitor)));
             }
             return visitor.leaveWhileNode(
-                    setBody(lc, (Block)body.accept(visitor)).
-                    setTest(lc, (Expression)test.accept(visitor)));
-
+                    setTest(lc, (Expression)test.accept(visitor)).
+                    setBody(lc, (Block)body.accept(visitor)));
         }
         return this;
     }
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Fri Oct 11 09:17:18 2013 -0400
@@ -410,7 +410,8 @@
         comma();
 
         property("id");
-        if (functionNode.isAnonymous()) {
+        final FunctionNode.Kind kind = functionNode.getKind();
+        if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) {
             nullValue();
         } else {
             functionNode.getIdent().accept(this);
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Fri Oct 11 09:17:18 2013 -0400
@@ -33,6 +33,7 @@
 import java.io.PrintWriter;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.ref.ReferenceQueue;
 import java.lang.ref.SoftReference;
 import java.lang.reflect.Field;
 import java.util.Arrays;
@@ -691,17 +692,41 @@
      * Cache for compiled script classes.
      */
     @SuppressWarnings("serial")
-    private static class ClassCache extends LinkedHashMap<Source, SoftReference<Class<?>>> {
+    private static class ClassCache extends LinkedHashMap<Source, ClassReference> {
         private final int size;
+        private final ReferenceQueue<Class<?>> queue;
 
         ClassCache(int size) {
             super(size, 0.75f, true);
             this.size = size;
+            this.queue = new ReferenceQueue<>();
+        }
+
+        void cache(final Source source, final Class<?> clazz) {
+            put(source, new ClassReference(clazz, queue, source));
+        }
+
+        @Override
+        protected boolean removeEldestEntry(final Map.Entry<Source, ClassReference> eldest) {
+            return size() > size;
         }
 
         @Override
-        protected boolean removeEldestEntry(final Map.Entry<Source, SoftReference<Class<?>>> eldest) {
-            return size() >= size;
+        public ClassReference get(Object key) {
+            for (ClassReference ref; (ref = (ClassReference)queue.poll()) != null; ) {
+                remove(ref.source);
+            }
+            return super.get(key);
+        }
+
+    }
+
+    private static class ClassReference extends SoftReference<Class<?>> {
+        private final Source source;
+
+        ClassReference(final Class<?> clazz, final ReferenceQueue<Class<?>> queue, final Source source) {
+            super(clazz, queue);
+            this.source = source;
         }
     }
 
@@ -709,22 +734,14 @@
     @Override
     public Class<?> findCachedClass(final Source source) {
         assert classCache != null : "Class cache used without being initialized";
-        SoftReference<Class<?>> ref = classCache.get(source);
-        if (ref != null) {
-            final Class<?> clazz = ref.get();
-            if (clazz == null) {
-                classCache.remove(source);
-            }
-            return clazz;
-        }
-
-        return null;
+        ClassReference ref = classCache.get(source);
+        return ref != null ? ref.get() : null;
     }
 
     @Override
     public void cacheClass(final Source source, final Class<?> clazz) {
         assert classCache != null : "Class cache used without being initialized";
-        classCache.put(source, new SoftReference<Class<?>>(clazz));
+        classCache.cache(source, clazz);
     }
 
     private static <T> T getLazilyCreatedValue(final Object key, final Callable<T> creator, final Map<Object, T> map) {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Fri Oct 11 09:17:18 2013 -0400
@@ -75,11 +75,11 @@
     private static final int FORMAT_LOCAL_TIME      = 5;
 
     // Constants defined in ECMA 15.9.1.10
-    private static final double hoursPerDay      = 24;
-    private static final double minutesPerHour   = 60;
-    private static final double secondsPerMinute = 60;
-    private static final double msPerSecond   = 1_000;
-    private static final double msPerMinute  = 60_000;
+    private static final int    hoursPerDay      = 24;
+    private static final int    minutesPerHour   = 60;
+    private static final int    secondsPerMinute = 60;
+    private static final int    msPerSecond   = 1_000;
+    private static final int    msPerMinute  = 60_000;
     private static final double msPerHour = 3_600_000;
     private static final double msPerDay = 86_400_000;
 
@@ -926,13 +926,13 @@
                 case FORMAT_DATE :
                 case FORMAT_LOCAL_DATE_TIME:
                     // EEE MMM dd yyyy
-                    sb.append(weekDays[(int) weekDay(t)])
+                    sb.append(weekDays[weekDay(t)])
                             .append(' ')
-                            .append(months[(int) monthFromTime(t)])
+                            .append(months[monthFromTime(t)])
                             .append(' ');
-                    zeroPad(sb, (int) dayFromTime(t), 2);
+                    zeroPad(sb, dayFromTime(t), 2);
                     sb.append(' ');
-                    zeroPad(sb, (int) yearFromTime(t), 4);
+                    zeroPad(sb, yearFromTime(t), 4);
                     if (format == FORMAT_DATE) {
                         break;
                     }
@@ -948,11 +948,11 @@
                     offset = (offset / 60) * 100 + offset % 60;
 
                     // HH:mm:ss GMT+HHmm
-                    zeroPad(sb, (int) hourFromTime(t), 2);
+                    zeroPad(sb, hourFromTime(t), 2);
                     sb.append(':');
-                    zeroPad(sb, (int) minFromTime(t), 2);
+                    zeroPad(sb, minFromTime(t), 2);
                     sb.append(':');
-                    zeroPad(sb, (int) secFromTime(t), 2);
+                    zeroPad(sb, secFromTime(t), 2);
                     sb.append(" GMT")
                             .append(offset < 0 ? '-' : '+');
                     zeroPad(sb, Math.abs(offset), 4);
@@ -963,20 +963,20 @@
 
                 case FORMAT_LOCAL_DATE:
                     // yyyy-MM-dd
-                    zeroPad(sb, (int) yearFromTime(t), 4);
+                    zeroPad(sb, yearFromTime(t), 4);
                     sb.append('-');
-                    zeroPad(sb, (int) monthFromTime(t) + 1, 2);
+                    zeroPad(sb, monthFromTime(t) + 1, 2);
                     sb.append('-');
-                    zeroPad(sb, (int) dayFromTime(t), 2);
+                    zeroPad(sb, dayFromTime(t), 2);
                     break;
 
                 case FORMAT_LOCAL_TIME:
                     // HH:mm:ss
-                    zeroPad(sb, (int) hourFromTime(t), 2);
+                    zeroPad(sb, hourFromTime(t), 2);
                     sb.append(':');
-                    zeroPad(sb, (int) minFromTime(t), 2);
+                    zeroPad(sb, minFromTime(t), 2);
                     sb.append(':');
-                    zeroPad(sb, (int) secFromTime(t), 2);
+                    zeroPad(sb, secFromTime(t), 2);
                     break;
 
                 default:
@@ -996,19 +996,19 @@
             final StringBuilder sb = new StringBuilder(29);
             final double t = nd.getTime();
             // EEE, dd MMM yyyy HH:mm:ss z
-            sb.append(weekDays[(int) weekDay(t)])
+            sb.append(weekDays[weekDay(t)])
                     .append(", ");
-            zeroPad(sb, (int) dayFromTime(t), 2);
+            zeroPad(sb, dayFromTime(t), 2);
             sb.append(' ')
-                    .append(months[(int) monthFromTime(t)])
+                    .append(months[monthFromTime(t)])
                     .append(' ');
-            zeroPad(sb, (int) yearFromTime(t), 4);
+            zeroPad(sb, yearFromTime(t), 4);
             sb.append(' ');
-            zeroPad(sb, (int) hourFromTime(t), 2);
+            zeroPad(sb, hourFromTime(t), 2);
             sb.append(':');
-            zeroPad(sb, (int) minFromTime(t), 2);
+            zeroPad(sb, minFromTime(t), 2);
             sb.append(':');
-            zeroPad(sb, (int) secFromTime(t), 2);
+            zeroPad(sb, secFromTime(t), 2);
             sb.append(" GMT");
             return sb.toString();
         }
@@ -1023,19 +1023,19 @@
             final StringBuilder sb = new StringBuilder(24);
             final double t = nd.getTime();
             // yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
-            zeroPad(sb, (int) yearFromTime(t), 4);
+            zeroPad(sb, yearFromTime(t), 4);
             sb.append('-');
-            zeroPad(sb, (int) monthFromTime(t) + 1, 2);
+            zeroPad(sb, monthFromTime(t) + 1, 2);
             sb.append('-');
-            zeroPad(sb, (int) dayFromTime(t), 2);
+            zeroPad(sb, dayFromTime(t), 2);
             sb.append('T');
-            zeroPad(sb, (int) hourFromTime(t), 2);
+            zeroPad(sb, hourFromTime(t), 2);
             sb.append(':');
-            zeroPad(sb, (int) minFromTime(t), 2);
+            zeroPad(sb, minFromTime(t), 2);
             sb.append(':');
-            zeroPad(sb, (int) secFromTime(t), 2);
+            zeroPad(sb, secFromTime(t), 2);
             sb.append('.');
-            zeroPad(sb, (int) msFromTime(t), 3);
+            zeroPad(sb, msFromTime(t), 3);
             sb.append("Z");
             return sb.toString();
         }
@@ -1072,29 +1072,30 @@
     }
 
     // ECMA 15.9.1.3 Year Number
-    private static double timeFromYear(final double y) {
+    private static double timeFromYear(final int y) {
         return dayFromYear(y) * msPerDay;
     }
 
-    private static double yearFromTime(final double t) {
-        double y = Math.floor(t / (msPerDay * 365.2425)) + 1970;
+    // ECMA 15.9.1.3 Year Number
+    private static int yearFromTime(final double t) {
+        int y = (int) Math.floor(t / (msPerDay * 365.2425)) + 1970;
         final double t2 = timeFromYear(y);
         if (t2 > t) {
             y--;
-        } else if (t2 + msPerDay * daysInYear((int) y) <= t) {
+        } else if (t2 + msPerDay * daysInYear(y) <= t) {
             y++;
         }
         return y;
     }
 
-    private static double dayWithinYear(final double t, final double year) {
-        return day(t) - dayFromYear(year);
+    private static int dayWithinYear(final double t, final int year) {
+        return (int) (day(t) - dayFromYear(year));
     }
 
-    private static double monthFromTime(final double t) {
-        final double year = yearFromTime(t);
-        final double day = dayWithinYear(t, year);
-        final int[] firstDay = firstDayInMonth[isLeapYear((int) year) ? 1 : 0];
+    private static int monthFromTime(final double t) {
+        final int year = yearFromTime(t);
+        final int day = dayWithinYear(t, year);
+        final int[] firstDay = firstDayInMonth[isLeapYear(year) ? 1 : 0];
         int month = 0;
 
         while (month < 11 && firstDay[month + 1] <= day) {
@@ -1103,10 +1104,10 @@
         return month;
     }
 
-    private static double dayFromTime(final double t)  {
-        final double year = yearFromTime(t);
-        final double day = dayWithinYear(t, year);
-        final int[] firstDay = firstDayInMonth[isLeapYear((int) year) ? 1 : 0];
+    private static int dayFromTime(final double t)  {
+        final int year = yearFromTime(t);
+        final int day = dayWithinYear(t, year);
+        final int[] firstDay = firstDayInMonth[isLeapYear(year) ? 1 : 0];
         int month = 0;
 
         while (month < 11 && firstDay[month + 1] <= day) {
@@ -1121,11 +1122,8 @@
         return firstDay[month];
     }
 
-    private static double weekDay(final double time) {
-        if (isNaN(time)) {
-            return NaN;
-        }
-        final double day = (day(time) + 4) % 7;
+    private static int weekDay(final double time) {
+        final int day = (int) (day(time) + 4) % 7;
         return day < 0 ? day + 7 : day;
     }
 
@@ -1140,26 +1138,26 @@
     }
 
     // ECMA 15.9.1.10 Hours, Minutes, Second, and Milliseconds
-    private static double hourFromTime(final double t) {
-        final double h = Math.floor(t / msPerHour) % hoursPerDay;
+    private static int hourFromTime(final double t) {
+        final int h = (int) (Math.floor(t / msPerHour) % hoursPerDay);
         return h < 0 ? h + hoursPerDay: h;
     }
-    private static double minFromTime(final double t) {
-        final double m = Math.floor(t / msPerMinute) % minutesPerHour;
+    private static int minFromTime(final double t) {
+        final int m = (int) (Math.floor(t / msPerMinute) % minutesPerHour);
         return m < 0 ? m + minutesPerHour : m;
     }
 
-    private static double secFromTime(final double t) {
-        final double s = Math.floor(t / msPerSecond) % secondsPerMinute;
+    private static int secFromTime(final double t) {
+        final int s = (int) (Math.floor(t / msPerSecond) % secondsPerMinute);
         return s < 0 ? s + secondsPerMinute : s;
     }
 
-    private static double msFromTime(final double t) {
-        final double m = t % msPerSecond;
+    private static int msFromTime(final double t) {
+        final int m = (int) (t % msPerSecond);
         return m < 0 ? m + msPerSecond : m;
     }
 
-    private static double valueFromTime(final int unit, final double t) {
+    private static int valueFromTime(final int unit, final double t) {
         switch (unit) {
             case YEAR: return yearFromTime(t);
             case MONTH: return monthFromTime(t);
@@ -1180,12 +1178,12 @@
     // ECMA 15.9.1.12 MakeDay (year, month, date)
     private static double makeDay(final double year, final double month, final double date) {
         final double y = year + Math.floor(month / 12);
-        double m = month % 12;
+        int m = (int) (month % 12);
         if (m < 0) {
             m += 12;
         }
-        double d = Math.floor(dayFromYear(y));
-        d += dayFromMonth((int) m, (int) y);
+        double d = dayFromYear(y);
+        d += dayFromMonth(m, (int) y);
 
         return d + date - 1;
     }
@@ -1257,13 +1255,13 @@
                     nullReturn = true;
                 }
 
-                if (! nullReturn) {
+                if (!nullReturn && !isNaN(time)) {
                     d[i - start] = valueFromTime(i, time);
                 }
             }
         }
 
-        return nullReturn? null : d;
+        return nullReturn ? null : d;
     }
 
     // ECMA 15.9.1.14 TimeClip (time)
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Fri Oct 11 09:17:18 2013 -0400
@@ -162,22 +162,27 @@
 
         String gap;
 
-        if (space instanceof Number || space instanceof NativeNumber) {
-            int indent;
-            if (space instanceof NativeNumber) {
-                indent = ((NativeNumber)space).intValue();
-            } else {
-                indent = ((Number)space).intValue();
-            }
+        // modifiable 'space' - parameter is final
+        Object modSpace = space;
+        if (modSpace instanceof NativeNumber) {
+            modSpace = JSType.toNumber(JSType.toPrimitive(modSpace, Number.class));
+        } else if (modSpace instanceof NativeString) {
+            modSpace = JSType.toString(JSType.toPrimitive(modSpace, String.class));
+        }
 
-            final StringBuilder sb = new StringBuilder();
-            for (int i = 0; i < Math.min(10, indent); i++) {
-                sb.append(' ');
+        if (modSpace instanceof Number) {
+            int indent = Math.min(10, JSType.toInteger(modSpace));
+            if (indent < 1) {
+                gap = "";
+            } else {
+                final StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < indent; i++) {
+                    sb.append(' ');
+                }
+                gap = sb.toString();
             }
-            gap = sb.toString();
-
-        } else if (space instanceof String || space instanceof ConsString || space instanceof NativeString) {
-            final String str = (space instanceof String) ? (String)space : space.toString();
+        } else if (modSpace instanceof String || modSpace instanceof ConsString) {
+            final String str = modSpace.toString();
             gap = str.substring(0, Math.min(10, str.length()));
         } else {
             gap = "";
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Fri Oct 11 09:17:18 2013 -0400
@@ -191,23 +191,21 @@
     public static NativeRegExp newRegExp(final Object regexp, final Object flags) {
         String  patternString = "";
         String  flagString    = "";
-        boolean flagsDefined  = false;
-
-        if (flags != UNDEFINED) {
-            flagsDefined = true;
-            flagString = JSType.toString(flags);
-        }
 
         if (regexp != UNDEFINED) {
             if (regexp instanceof NativeRegExp) {
-                if (!flagsDefined) {
-                    return (NativeRegExp)regexp; // 15.10.3.1 - undefined flags and regexp as
+                if (flags != UNDEFINED) {
+                    throw typeError("regex.cant.supply.flags");
                 }
-                throw typeError("regex.cant.supply.flags");
+                return (NativeRegExp)regexp; // 15.10.3.1 - undefined flags and regexp as
             }
             patternString = JSType.toString(regexp);
         }
 
+        if (flags != UNDEFINED) {
+            flagString = JSType.toString(flags);
+        }
+
         return new NativeRegExp(patternString, flagString);
     }
 
@@ -697,8 +695,13 @@
                 appendReplacement(matcher, string, replacement, sb);
             }
 
+            thisIndex = matcher.end();
+            if (thisIndex == string.length() && matcher.start() == matcher.end()) {
+                // Avoid getting empty match at end of string twice
+                break;
+            }
+
             // ECMA 15.5.4.10 String.prototype.match(regexp)
-            thisIndex = matcher.end();
             if (thisIndex == previousLastIndex) {
                 setLastIndex(thisIndex + 1);
                 previousLastIndex = thisIndex + 1;
@@ -883,7 +886,7 @@
      * @return last index property as int
      */
     public int getLastIndex() {
-        return JSType.toInt32(lastIndex);
+        return JSType.toInteger(lastIndex);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/parser/JSONParser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/parser/JSONParser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -349,6 +349,10 @@
 
             case COMMARIGHT:
                 next();
+                // check for trailing comma - not allowed in JSON
+                if (type == RBRACKET) {
+                    throw error(AbstractParser.message("trailing.comma.in.json", type.getNameOrType()));
+                }
                 break;
 
             default:
@@ -388,6 +392,10 @@
 
             case COMMARIGHT:
                 next();
+                // check for trailing comma - not allowed in JSON
+                if (type == RBRACE) {
+                    throw error(AbstractParser.message("trailing.comma.in.json", type.getNameOrType()));
+                }
                 break;
 
             default:
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Fri Oct 11 09:17:18 2013 -0400
@@ -59,6 +59,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import jdk.internal.dynalink.support.NameCodec;
 import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.codegen.Namespace;
 import jdk.nashorn.internal.ir.AccessNode;
@@ -2108,7 +2109,7 @@
                 case "get":
                     final PropertyKey getIdent = propertyName();
                     final String getterName = getIdent.getPropertyName();
-                    final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, "get " + getterName);
+                    final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, "get " + NameCodec.encode(getterName));
                     expect(LPAREN);
                     expect(RPAREN);
                     functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER);
@@ -2117,7 +2118,7 @@
                 case "set":
                     final PropertyKey setIdent = propertyName();
                     final String setterName = setIdent.getPropertyName();
-                    final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, "set " + setterName);
+                    final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, "set " + NameCodec.encode(setterName));
                     expect(LPAREN);
                     final IdentNode argIdent = getIdent();
                     verifyStrictIdent(argIdent, "setter argument");
--- a/nashorn/src/jdk/nashorn/internal/runtime/GlobalFunctions.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/GlobalFunctions.java	Fri Oct 11 09:17:18 2013 -0400
@@ -90,6 +90,7 @@
     public static double parseInt(final Object self, final Object string, final Object rad) {
         final String str    = JSType.trimLeft(JSType.toString(string));
         final int    length = str.length();
+        int          radix  = JSType.toInt32(rad);
 
         // empty string is not valid
         if (length == 0) {
@@ -113,7 +114,6 @@
         }
 
         boolean stripPrefix = true;
-        int     radix = JSType.toInt32(rad);
 
         if (radix != 0) {
             if (radix < 2 || radix > 36) {
@@ -211,7 +211,7 @@
             switch (ch) {
             case '.':
                 // dot allowed only once
-                if (dotSeen) {
+                if (exponentOffset != -1 || dotSeen) {
                     break loop;
                 }
                 dotSeen = true;
--- a/nashorn/src/jdk/nashorn/internal/runtime/Source.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Source.java	Fri Oct 11 09:17:18 2013 -0400
@@ -169,7 +169,7 @@
 
         final Source src = (Source)obj;
         // Only compare content as a last resort measure
-        return length == src.length && Objects.equals(name, src.name) && Arrays.equals(content, src.content);
+        return length == src.length && Objects.equals(url, src.url) && Objects.equals(name, src.name) && Arrays.equals(content, src.content);
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Fri Oct 11 09:17:18 2013 -0400
@@ -57,6 +57,7 @@
 parser.error.regex.unsupported.flag=Unsupported RegExp flag: {0}
 parser.error.regex.repeated.flag=Repeated RegExp flag: {0}
 parser.error.regex.syntax={0}
+parser.error.trailing.comma.in.json=Trailing comma is not allowed in JSON
 
 # strict mode error messages
 parser.error.strict.no.with="with" statement cannot be used in strict mode
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8024972.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8024972: for (LeftHandSideExpression in Expression) crashes the compiler
+ *
+ * @test
+ * @run
+ */
+
+var obj = {};
+
+var arr = [2, 45, -1, 445];
+for (obj.x in arr) {
+    print(obj.x + "->"+ arr[obj.x]);
+}
+
+var abc = { foo: 'bar', hello: 'world' };
+for (obj.x in abc) {
+    print(obj.x + "->" + abc[obj.x]);
+}
+
+for (obj.x in 0) {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8024972.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,6 @@
+0->2
+1->45
+2->-1
+3->445
+foo->bar
+hello->world
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025048-2.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025048: true as case label results in ClassCastException
+ *
+ * @test
+ * @run
+ */
+
+function func(x) {
+    switch(x) { 
+        case 8: break; case false:
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025048.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025048: true as case label results in ClassCastException
+ *
+ * @test
+ * @run
+ */
+
+function func(x) {
+    switch(x) { 
+        case 8: break; case true:
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025080.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025080: Object literal getter, setter function with number format property name results in ClassFormatError
+ *
+ * @test
+ * @run
+ */
+
+var obj = {
+    get 1e81() { print("1e81 getter"); },
+    set 1e81(x) { print("1e81 setter"); },
+    get 3.14e-2() { print("3.14e-2 getter");},
+    set 3.14e-2(x) { print("3.14e-2 setter"); }
+};
+
+obj[1e81];
+obj[1e81] = 23;
+
+obj[3.14e-2];
+obj[3.14e-2] = 42;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025080.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,4 @@
+1e81 getter
+1e81 setter
+3.14e-2 getter
+3.14e-2 setter
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025090.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025090: 'while' statement with 'test' using var before being declared in body results in VerifyError
+ *
+ * @test
+ * @run
+ */
+
+// The following used to result in VerifyError
+function f() {
+   while (x += 2) { var x = 44 }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025111.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025111: undefined or null 'with' expression in empty with block should throw TypeError
+ *
+ * @test
+ * @run
+ */
+
+function check(callback, arg) {
+    try {
+        callback(arg);
+        fail("should have thrown TypeError: " + callback + " on " + arg);
+    } catch (e) {
+        if (! (e instanceof TypeError)) {
+            fail("Expected TypeError, got " + e);
+        }
+    }
+}
+
+function func(obj) {
+    with(obj) {}
+}
+
+check(func);
+check(func, undefined);
+check(func, null);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025147.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025147: Trailing comma is not allowed in JSONArray and JSONObject
+ *
+ * @test
+ * @run
+ */
+
+function check(str) {
+    try {
+        JSON.parse(str);
+        fail("should have thrown SyntaxError for " + str);
+    } catch (e) {
+        print(e);
+    }
+}
+
+check("{ \"a\": 333, }");
+check("[ 4343, ]");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025147.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,6 @@
+SyntaxError: Invalid JSON: <json>:1:12 Trailing comma is not allowed in JSON
+{ "a": 333, }
+            ^
+SyntaxError: Invalid JSON: <json>:1:8 Trailing comma is not allowed in JSON
+[ 4343, ]
+        ^
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025149.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025149: JSON.stringify does not handle 'space' argument as per the spec.
+ *
+ * @test
+ * @run
+ */
+
+print(JSON.stringify({ foo : 23, bar: { x : 22} }, undefined ,new Number(Infinity)));
+
+print(JSON.stringify({ foo : 23, bar: { x : 22} }, undefined ,new Number(-Infinity)));
+
+try {
+    JSON.stringify({},[],
+    (n = new Number(0), n.valueOf = function() { throw ("inside n.valueOf") }, n));
+} catch (e) {
+    print(e);
+}
+
+try {
+    JSON.stringify({},[],
+    (s = new String(""), s.toString = function() { throw ("inside s.toString") }, s));
+} catch (e) {
+    print(e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025149.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,9 @@
+{
+          "foo": 23,
+          "bar": {
+                    "x": 22
+          }
+}
+{"foo":23,"bar":{"x":22}}
+inside n.valueOf
+inside s.toString
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025163.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025163: Date methods should not return -0
+ *
+ * @test
+ * @run
+ */
+
+print(1 / (new Date(0, 0, 1)).getYear());
+print(1 / (new Date(1969, 1, 2)).getDay());
+print(1 / (new Date(1969, 0, 1)).getHours());
+print(1 / (new Date(1969, 0, 1)).getHours());
+print(1 / (new Date(1969, 0, 1)).getMinutes());
+print(1 / (new Date(1969, 0, 1)).getSeconds());
+print(1 / (new Date(1969, 0, 1)).getMilliseconds());
+print(1 / (new Date(1969, 0, 1)).getMilliseconds());
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025163.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,8 @@
+Infinity
+Infinity
+Infinity
+Infinity
+Infinity
+Infinity
+Infinity
+Infinity
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025197.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025197: String replace method fails with regexp /$/gi
+ *
+ * @test
+ * @run
+ */
+
+print('dog'.replace(/$/gi, 's'));
+print('dog'.replace(/(?:g)$/gi, 's'));
+print('dog'.replace(/(?:a)$/gi, 's'));
+print('dog'.replace(/(?!g)$/gi, 's'));
+print('dog'.replace(/(?!a)$/gi, 's'));
+print('dog'.replace(/g?$/gi, 's'));
+print('dog'.replace(/.?$/gi, 's'));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025197.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,7 @@
+dogs
+dos
+dog
+dogs
+dogs
+doss
+doss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025312.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025312: parseInt should convert 'radix' argument to ToInt32 even if empty string is parsed
+ *
+ * @test
+ * @run
+ */
+
+parseInt("", {
+    valueOf: function() {
+        print("inside valueOf of 'radix'");
+    }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025312.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,1 @@
+inside valueOf of 'radix'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025325.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025325: parseFloat does not handle '.' in exponent part
+ *
+ * @test
+ * @run
+ */
+
+print(parseFloat("2e2."));
+print(parseFloat("2e2.3"));
+print(parseFloat("2e2.fdgdf"));
+print(parseFloat("2e2.   gdfgdf"));
+print(parseFloat("2e2.  "));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025325.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,5 @@
+200
+200
+200
+200
+200
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025434.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025434: RegExp lastIndex can exceed int range
+ *
+ * @test
+ * @run
+ */
+
+var r = /a/g;
+
+r.lastIndex = 0x100000000;
+if (r.test("a")) {
+    throw new Error("Expected no match");
+}
+
+r.lastIndex = 0x100000000000000;
+if (r.test("a")) {
+    throw new Error("Expected no match");
+}
+
+r.lastIndex = -0x100000000;
+if (r.test("a")) {
+    throw new Error("Expected match");
+}
+
+r.lastIndex = -0x100000000000000;
+if (r.test("a")) {
+    throw new Error("Expected no match");
+}
+
+r.lastIndex = 1;
+if (r.test("a")) {
+    throw new Error("Expected no match");
+}
+
+r.lastIndex = -1;
+if (r.test("a")) {
+    throw new Error("Expected no match");
+}
+
+r.lastIndex = 0;
+if (!r.test("a")) {
+    throw new Error("Expected match");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025486.js	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8025486: RegExp constructor arguments are not evaluated in right order
+ *
+ * @test
+ * @run
+ */
+
+new RegExp({
+    toString: function() {
+        print("source");
+        return "a";
+    }
+}, {
+    toString: function() {
+        print("flags");
+        return "g";
+    }
+});
+
+try {
+    new RegExp(/asdf/, {
+        toString: function() {
+            fail("toString should not be called");
+        }
+    });
+    fail("expected TypeError");
+} catch (e) {
+    if (!(e instanceof TypeError)) {
+        fail("expected TypeError");
+    }
+    print(e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8025486.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -0,0 +1,3 @@
+source
+flags
+TypeError: Cannot supply flags when constructing one RegExp from another
--- a/nashorn/test/script/basic/parser/objectLitExpr.js.EXPECTED	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/test/script/basic/parser/objectLitExpr.js.EXPECTED	Fri Oct 11 09:17:18 2013 -0400
@@ -126,10 +126,7 @@
                             },
                             "value": {
                                 "type": "FunctionExpression",
-                                "id": {
-                                    "type": "Identifier",
-                                    "name": "get x"
-                                },
+                                "id": null,
                                 "params": [],
                                 "defaults": [],
                                 "rest": null,
@@ -157,10 +154,7 @@
                             },
                             "value": {
                                 "type": "FunctionExpression",
-                                "id": {
-                                    "type": "Identifier",
-                                    "name": "get y"
-                                },
+                                "id": null,
                                 "params": [],
                                 "defaults": [],
                                 "rest": null,
--- a/nashorn/test/script/trusted/JDK-8008305.js	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/test/script/trusted/JDK-8008305.js	Fri Oct 11 09:17:18 2013 -0400
@@ -54,6 +54,6 @@
     fail("Expected SecurityException from script!");
 } catch (e) {
     if (! (e instanceof SecurityException)) {
-        faile("Expected SecurityException, but got " + e);
+        fail("Expected SecurityException, but got " + e);
     }
 }
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Fri Oct 11 08:43:07 2013 -0400
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Fri Oct 11 09:17:18 2013 -0400
@@ -37,10 +37,12 @@
 import java.util.concurrent.Callable;
 import javax.script.Compilable;
 import javax.script.CompiledScript;
+import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineFactory;
 import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
+import javax.script.SimpleScriptContext;
 import org.testng.annotations.Test;
 
 /**
@@ -231,6 +233,17 @@
     }
 
     @Test
+    public void compileAndEvalInDiffContextTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine = m.getEngineByName("js");
+        final Compilable compilable = (Compilable) engine;
+        final CompiledScript compiledScript = compilable.compile("foo");
+        final ScriptContext ctxt = new SimpleScriptContext();
+        ctxt.setAttribute("foo", "hello", ScriptContext.ENGINE_SCOPE);
+        assertEquals(compiledScript.eval(ctxt), "hello");
+    }
+
+    @Test
     public void accessGlobalTest() {
         final ScriptEngineManager m = new ScriptEngineManager();
         final ScriptEngine e = m.getEngineByName("nashorn");